if_ethersubr.c (125952) | if_ethersubr.c (126239) |
---|---|
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 125952 2004-02-18 00:04:52Z mlaier $ | 34 * $FreeBSD: head/sys/net/if_ethersubr.c 126239 2004-02-25 19:55:29Z mlaier $ |
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_mac.h" --- 274 unchanged lines hidden (view full) --- 317 * Ethernet link layer output routine to send a raw frame to the device. 318 * 319 * This assumes that the 14 byte Ethernet header is present and contiguous 320 * in the first mbuf (if BRIDGE'ing). 321 */ 322int 323ether_output_frame(struct ifnet *ifp, struct mbuf *m) 324{ | 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_mac.h" --- 274 unchanged lines hidden (view full) --- 317 * Ethernet link layer output routine to send a raw frame to the device. 318 * 319 * This assumes that the 14 byte Ethernet header is present and contiguous 320 * in the first mbuf (if BRIDGE'ing). 321 */ 322int 323ether_output_frame(struct ifnet *ifp, struct mbuf *m) 324{ |
325 struct ip_fw *rule = NULL; | 325 struct ip_fw *rule = ip_dn_claim_rule(m); |
326 | 326 |
327 /* Extract info from dummynet tag, ignore others */ 328 for (; m->m_type == MT_TAG; m = m->m_next) 329 if (m->m_flags == PACKET_TAG_DUMMYNET) 330 rule = ((struct dn_pkt *)m)->rule; 331 | |
332 if (rule == NULL && BDG_ACTIVE(ifp)) { 333 /* 334 * Beware, the bridge code notices the null rcvif and 335 * uses that identify that it's being called from 336 * ether_output as opposd to ether_input. Yech. 337 */ 338 m->m_pkthdr.rcvif = NULL; 339 m = bdg_forward_ptr(m, ifp); --- 52 unchanged lines hidden (view full) --- 392 } 393 } 394 eh = mtod(m, struct ether_header *); 395 save_eh = *eh; /* save copy for restore below */ 396 m_adj(m, ETHER_HDR_LEN); /* strip ethernet header */ 397 398 args.m = m; /* the packet we are looking at */ 399 args.oif = dst; /* destination, if any */ | 327 if (rule == NULL && BDG_ACTIVE(ifp)) { 328 /* 329 * Beware, the bridge code notices the null rcvif and 330 * uses that identify that it's being called from 331 * ether_output as opposd to ether_input. Yech. 332 */ 333 m->m_pkthdr.rcvif = NULL; 334 m = bdg_forward_ptr(m, ifp); --- 52 unchanged lines hidden (view full) --- 387 } 388 } 389 eh = mtod(m, struct ether_header *); 390 save_eh = *eh; /* save copy for restore below */ 391 m_adj(m, ETHER_HDR_LEN); /* strip ethernet header */ 392 393 args.m = m; /* the packet we are looking at */ 394 args.oif = dst; /* destination, if any */ |
400 args.divert_rule = 0; /* we do not support divert yet */ | |
401 args.rule = *rule; /* matching rule to restart */ 402 args.next_hop = NULL; /* we do not support forward yet */ 403 args.eh = &save_eh; /* MAC header for bridged/MAC packets */ 404 i = ip_fw_chk_ptr(&args); 405 m = args.m; 406 if (m != NULL) { 407 /* 408 * Restore Ethernet header, as needed, in case the --- 197 unchanged lines hidden (view full) --- 606ether_demux(struct ifnet *ifp, struct mbuf *m) 607{ 608 struct ether_header *eh; 609 int isr; 610 u_short ether_type; 611#if defined(NETATALK) 612 struct llc *l; 613#endif | 395 args.rule = *rule; /* matching rule to restart */ 396 args.next_hop = NULL; /* we do not support forward yet */ 397 args.eh = &save_eh; /* MAC header for bridged/MAC packets */ 398 i = ip_fw_chk_ptr(&args); 399 m = args.m; 400 if (m != NULL) { 401 /* 402 * Restore Ethernet header, as needed, in case the --- 197 unchanged lines hidden (view full) --- 600ether_demux(struct ifnet *ifp, struct mbuf *m) 601{ 602 struct ether_header *eh; 603 int isr; 604 u_short ether_type; 605#if defined(NETATALK) 606 struct llc *l; 607#endif |
614 struct ip_fw *rule = NULL; | 608 struct ip_fw *rule = ip_dn_claim_rule(m); |
615 | 609 |
616 /* Extract info from dummynet tag, ignore others */ 617 for (;m->m_type == MT_TAG; m = m->m_next) 618 if (m->m_flags == PACKET_TAG_DUMMYNET) { 619 rule = ((struct dn_pkt *)m)->rule; 620 ifp = m->m_next->m_pkthdr.rcvif; 621 } | 610 if (rule != NULL) 611 ifp = m->m_pkthdr.rcvif; |
622 623 KASSERT(ifp != NULL, ("ether_demux: NULL interface pointer")); 624 625 eh = mtod(m, struct ether_header *); 626 627 if (rule) /* packet was already bridged */ 628 goto post_stats; 629 --- 410 unchanged lines hidden --- | 612 613 KASSERT(ifp != NULL, ("ether_demux: NULL interface pointer")); 614 615 eh = mtod(m, struct ether_header *); 616 617 if (rule) /* packet was already bridged */ 618 goto post_stats; 619 --- 410 unchanged lines hidden --- |