if_ethersubr.c (193983) | if_ethersubr.c (194819) |
---|---|
1/*- 2 * Copyright (c) 1982, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 | 1/*- 2 * Copyright (c) 1982, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 |
30 * $FreeBSD: head/sys/net/if_ethersubr.c 193983 2009-06-11 10:26:38Z bz $ | 30 * $FreeBSD: head/sys/net/if_ethersubr.c 194819 2009-06-24 10:32:44Z rwatson $ |
31 */ 32 33#include "opt_atalk.h" 34#include "opt_inet.h" 35#include "opt_inet6.h" 36#include "opt_ipx.h" 37#include "opt_netgraph.h" 38#include "opt_carp.h" --- 217 unchanged lines hidden (view full) --- 256#endif 257#ifdef NETATALK 258 case AF_APPLETALK: 259 { 260 struct at_ifaddr *aa; 261 262 if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) 263 senderr(EHOSTUNREACH); /* XXX */ | 31 */ 32 33#include "opt_atalk.h" 34#include "opt_inet.h" 35#include "opt_inet6.h" 36#include "opt_ipx.h" 37#include "opt_netgraph.h" 38#include "opt_carp.h" --- 217 unchanged lines hidden (view full) --- 256#endif 257#ifdef NETATALK 258 case AF_APPLETALK: 259 { 260 struct at_ifaddr *aa; 261 262 if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) 263 senderr(EHOSTUNREACH); /* XXX */ |
264 if (!aarpresolve(ifp, m, (struct sockaddr_at *)dst, edst)) | 264 if (!aarpresolve(ifp, m, (struct sockaddr_at *)dst, edst)) { 265 ifa_free(&aa->aa_ifa); |
265 return (0); | 266 return (0); |
267 } |
|
266 /* 267 * In the phase 2 case, need to prepend an mbuf for the llc header. 268 */ 269 if ( aa->aa_flags & AFA_PHASE2 ) { 270 struct llc llc; 271 | 268 /* 269 * In the phase 2 case, need to prepend an mbuf for the llc header. 270 */ 271 if ( aa->aa_flags & AFA_PHASE2 ) { 272 struct llc llc; 273 |
274 ifa_free(&aa->aa_ifa); |
|
272 M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT); 273 if (m == NULL) 274 senderr(ENOBUFS); 275 llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; 276 llc.llc_control = LLC_UI; 277 bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code)); 278 llc.llc_snap_ether_type = htons( ETHERTYPE_AT ); 279 bcopy(&llc, mtod(m, caddr_t), LLC_SNAPFRAMELEN); 280 type = htons(m->m_pkthdr.len); 281 hlen = LLC_SNAPFRAMELEN + ETHER_HDR_LEN; 282 } else { | 275 M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT); 276 if (m == NULL) 277 senderr(ENOBUFS); 278 llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; 279 llc.llc_control = LLC_UI; 280 bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code)); 281 llc.llc_snap_ether_type = htons( ETHERTYPE_AT ); 282 bcopy(&llc, mtod(m, caddr_t), LLC_SNAPFRAMELEN); 283 type = htons(m->m_pkthdr.len); 284 hlen = LLC_SNAPFRAMELEN + ETHER_HDR_LEN; 285 } else { |
286 ifa_free(&aa->aa_ifa); |
|
283 type = htons(ETHERTYPE_AT); 284 } 285 break; 286 } 287#endif /* NETATALK */ 288 289 case pseudo_AF_HDRCMPLT: 290 hdrcmplt = 1; --- 1051 unchanged lines hidden --- | 287 type = htons(ETHERTYPE_AT); 288 } 289 break; 290 } 291#endif /* NETATALK */ 292 293 case pseudo_AF_HDRCMPLT: 294 hdrcmplt = 1; --- 1051 unchanged lines hidden --- |