if_ethersubr.c (e790940191bd358e83b225dcc2ef6bd790e02254) | if_ethersubr.c (36e8826ffbfb16b1970dec46e3dd8487c014788a) |
---|---|
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 --- 308 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{ | 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 --- 308 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 = ip_dn_find_rule(m); | 325 struct ip_fw *rule = NULL; |
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 |
|
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 */ | 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 */ |
400 args.divert_rule = 0; /* we do not support divert yet */ |
|
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 | 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 |
608 struct ip_fw *rule = ip_dn_find_rule(m); | 614 struct ip_fw *rule = NULL; |
609 | 615 |
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 } 622 |
|
610 KASSERT(ifp != NULL, ("ether_demux: NULL interface pointer")); 611 612 eh = mtod(m, struct ether_header *); 613 614 if (rule) /* packet was already bridged */ 615 goto post_stats; 616 617 if (!(BDG_ACTIVE(ifp))) { --- 409 unchanged lines hidden --- | 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 630 if (!(BDG_ACTIVE(ifp))) { --- 409 unchanged lines hidden --- |