if_ethersubr.c (66479) | if_ethersubr.c (69152) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/net/if_ethersubr.c 66479 2000-09-30 14:33:53Z bp $ | 34 * $FreeBSD: head/sys/net/if_ethersubr.c 69152 2000-11-25 07:35:38Z jlemon $ |
35 */ 36 37#include "opt_atalk.h" 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_ipx.h" 41#include "opt_bdg.h" 42#include "opt_netgraph.h" --- 216 unchanged lines hidden (view full) --- 259 /* 260 * XXX if ns_thishost is the same as the node's ethernet 261 * address then just the default code will catch this anyhow. 262 * So I'm not sure if this next clause should be here at all? 263 * [JRE] 264 */ 265 if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst))){ 266 m->m_pkthdr.rcvif = ifp; | 35 */ 36 37#include "opt_atalk.h" 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_ipx.h" 41#include "opt_bdg.h" 42#include "opt_netgraph.h" --- 216 unchanged lines hidden (view full) --- 259 /* 260 * XXX if ns_thishost is the same as the node's ethernet 261 * address then just the default code will catch this anyhow. 262 * So I'm not sure if this next clause should be here at all? 263 * [JRE] 264 */ 265 if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst))){ 266 m->m_pkthdr.rcvif = ifp; |
267 schednetisr(NETISR_NS); | |
268 inq = &nsintrq; | 267 inq = &nsintrq; |
269 s = splimp(); 270 if (IF_QFULL(inq)) { 271 IF_DROP(inq); 272 m_freem(m); 273 } else 274 IF_ENQUEUE(inq, m); 275 splx(s); | 268 if (IF_HANDOFF(inq, m, NULL)) 269 schednetisr(NETISR_NS); |
276 return (error); 277 } 278 if (!bcmp((caddr_t)edst, (caddr_t)&ns_broadhost, sizeof(edst))){ 279 m->m_flags |= M_BCAST; 280 } 281 break; 282#endif /* NS */ 283 --- 76 unchanged lines hidden (view full) --- 360 * This assumes that the 14 byte Ethernet header is present and contiguous 361 * in the first mbuf (if BRIDGE'ing). 362 */ 363int 364ether_output_frame(ifp, m) 365 struct ifnet *ifp; 366 struct mbuf *m; 367{ | 270 return (error); 271 } 272 if (!bcmp((caddr_t)edst, (caddr_t)&ns_broadhost, sizeof(edst))){ 273 m->m_flags |= M_BCAST; 274 } 275 break; 276#endif /* NS */ 277 --- 76 unchanged lines hidden (view full) --- 354 * This assumes that the 14 byte Ethernet header is present and contiguous 355 * in the first mbuf (if BRIDGE'ing). 356 */ 357int 358ether_output_frame(ifp, m) 359 struct ifnet *ifp; 360 struct mbuf *m; 361{ |
368 int s, error = 0; | 362 int error = 0; |
369 370#ifdef BRIDGE 371 if (do_bridge) { 372 struct ether_header hdr; 373 374 m->m_pkthdr.rcvif = NULL; 375 bcopy(mtod(m, struct ether_header *), &hdr, ETHER_HDR_LEN); 376 m_adj(m, ETHER_HDR_LEN); 377 ifp = bridge_dst_lookup(&hdr); 378 bdg_forward(&m, &hdr, ifp); 379 if (m != NULL) 380 m_freem(m); 381 return (0); 382 } 383#endif 384 | 363 364#ifdef BRIDGE 365 if (do_bridge) { 366 struct ether_header hdr; 367 368 m->m_pkthdr.rcvif = NULL; 369 bcopy(mtod(m, struct ether_header *), &hdr, ETHER_HDR_LEN); 370 m_adj(m, ETHER_HDR_LEN); 371 ifp = bridge_dst_lookup(&hdr); 372 bdg_forward(&m, &hdr, ifp); 373 if (m != NULL) 374 m_freem(m); 375 return (0); 376 } 377#endif 378 |
385 s = splimp(); | |
386 /* | 379 /* |
387 * Queue message on interface, and start output if interface 388 * not yet active. | 380 * Queue message on interface, update output statistics if 381 * successful, and start output if interface not yet active. |
389 */ | 382 */ |
390 if (IF_QFULL(&ifp->if_snd)) { 391 IF_DROP(&ifp->if_snd); 392 splx(s); 393 m_freem(m); | 383 if (! IF_HANDOFF(&ifp->if_snd, m, ifp)) |
394 return (ENOBUFS); | 384 return (ENOBUFS); |
395 } 396 ifp->if_obytes += m->m_pkthdr.len; 397 if (m->m_flags & M_MCAST) 398 ifp->if_omcasts++; 399 IF_ENQUEUE(&ifp->if_snd, m); 400 if ((ifp->if_flags & IFF_OACTIVE) == 0) 401 (*ifp->if_start)(ifp); 402 splx(s); | |
403 return (error); 404} 405 406/* 407 * Process a received Ethernet packet; 408 * the packet is in the mbuf chain m without 409 * the ether header, which is provided separately. 410 * --- 225 unchanged lines hidden (view full) --- 636 if (ng_ether_input_orphan_p != NULL) 637 (*ng_ether_input_orphan_p)(ifp, m, eh); 638 else 639 m_freem(m); 640 return; 641#endif /* NETATALK */ 642 } 643 | 385 return (error); 386} 387 388/* 389 * Process a received Ethernet packet; 390 * the packet is in the mbuf chain m without 391 * the ether header, which is provided separately. 392 * --- 225 unchanged lines hidden (view full) --- 618 if (ng_ether_input_orphan_p != NULL) 619 (*ng_ether_input_orphan_p)(ifp, m, eh); 620 else 621 m_freem(m); 622 return; 623#endif /* NETATALK */ 624 } 625 |
644 s = splimp(); 645 if (IF_QFULL(inq)) { 646 IF_DROP(inq); 647 m_freem(m); 648 } else 649 IF_ENQUEUE(inq, m); 650 splx(s); | 626 (void) IF_HANDOFF(inq, m, NULL); |
651} 652 653/* 654 * Perform common duties while attaching to interface list 655 */ 656void 657ether_ifattach(ifp, bpf) 658 register struct ifnet *ifp; --- 234 unchanged lines hidden --- | 627} 628 629/* 630 * Perform common duties while attaching to interface list 631 */ 632void 633ether_ifattach(ifp, bpf) 634 register struct ifnet *ifp; --- 234 unchanged lines hidden --- |