Date: Thu, 14 Jan 1999 08:12:03 +0100 (MET) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: wpaul@FreeBSD.ORG, net@FreeBSD.ORG Subject: rl.c patches for bridging Message-ID: <199901140712.IAA28966@labinfo.iet.unipi.it>
next in thread | raw e-mail | index | archive | help
Here are patches for the "rl" driver for bridging. I have tried them on
a 2.2.x version of the driver and they seem to work (the first set of
#include's may be a 2.2.x'ism because of the mislocation of things like
ETHERMTU etc, i am going to try this on 3.x to see how it works.
cheers
luigi
--- src/sys/pci/if_rl.c Thu Dec 24 19:39:48 1998
+++ /sys/pci/if_rl.c Thu Jan 14 07:43:58 1999
@@ -99,16 +99,23 @@
#include <net/if_dl.h>
#include <net/if_media.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/ip.h>
+#include <netinet/if_ether.h>
+
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
+#ifdef BRIDGE
+#include <net/bridge.h>
+#endif
+
#include <vm/vm.h> /* for vtophys */
#include <vm/pmap.h> /* for vtophys */
#include <machine/clock.h> /* for DELAY */
@@ -1392,17 +1438,37 @@
* a broadcast packet, multicast packet, matches our ethernet
* address or the interface is in promiscuous mode.
*/
- if (ifp->if_bpf) {
+ if (ifp->if_bpf)
bpf_mtap(ifp, m);
+#endif
+#ifdef BRIDGE
+ if (do_bridge) {
+ struct ifnet *bdg_ifp ;
+ bdg_ifp = bridge_in(m);
+ if (bdg_ifp == BDG_DROP)
+ goto dropit;
+ else {
+ if (bdg_ifp != BDG_LOCAL)
+ bdg_forward(&m, bdg_ifp);
+ if (!m)
+ goto dropit ;
+ if (bdg_ifp == BDG_LOCAL || bdg_ifp == BDG_BCAST ||
+ bdg_ifp == BDG_MCAST)
+ goto getit ;
+ else if (m)
+ goto dropit ;
+ }
+ } else
+#endif
if (ifp->if_flags & IFF_PROMISC &&
(bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
ETHER_ADDR_LEN) &&
(eh->ether_dhost[0] & 1) == 0)) {
+dropit:
m_freem(m);
continue;
}
- }
-#endif
+getit:
/* Remove header from mbuf and pass it on. */
m_adj(m, sizeof(struct ether_header));
ether_input(ifp, eh, m);
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901140712.IAA28966>
