Date: Wed, 1 Dec 1999 16:21:18 +0300 (MSK) From: vak@cronyx.ru To: FreeBSD-gnats-submit@freebsd.org Subject: kern/15206: patch to add bridging to if_vr.c Message-ID: <199912011321.QAA00490@hanoi.cronyx.ru>
next in thread | raw e-mail | index | archive | help
>Number: 15206 >Category: kern >Synopsis: Ethernet driver if_vr.c (VIA Technologies) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Dec 1 05:40:03 PST 1999 >Closed-Date: >Last-Modified: >Originator: Serge V.Vakulenko >Release: FreeBSD 3.3-RELEASE i386 >Organization: Cronyx Engineering Ltd. >Environment: FreeBSD router with two D-Link DFE-530 Ethernet adapters installed. >Description: Bridging does not work properly. The bridge functionality is missing in the driver. >How-To-Repeat: Enable BRIDGE option in the kernel and enable sysctl -w net.link.ether.bridge=1 in /etc/rc.local. Try ping across the bridge. >Fix: --- if_vr33.c Wed Dec 1 16:08:38 1999 +++ if_vr.c Wed Dec 1 16:00:23 1999 @@ -79,6 +79,11 @@ #include <net/bpf.h> #endif +#include "opt_bdg.h" +#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 */ @@ -1318,22 +1323,43 @@ m->m_pkthdr.len = m->m_len = total_len; #if NBPFILTER > 0 /* - * Handle BPF listeners. Let the BPF user see the packet, but - * don't pass it up to the ether_input() layer unless it's - * a broadcast packet, multicast packet, matches our ethernet - * address or the interface is in promiscuous mode. + * Handle BPF listeners. Let the BPF user see the packet. */ - if (ifp->if_bpf) { + if (ifp->if_bpf) bpf_mtap(ifp, m); - if (ifp->if_flags & IFF_PROMISC && - (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, - ETHER_ADDR_LEN) && - (eh->ether_dhost[0] & 1) == 0)) { +#endif +#ifdef BRIDGE /* see code in if_ed.c */ + if (do_bridge) { + struct ifnet *bdg_ifp ; + bdg_ifp = bridge_in(m); + if (bdg_ifp == BDG_DROP) { m_freem(m); continue; } + if (bdg_ifp != BDG_LOCAL) + bdg_forward(&m, bdg_ifp); + if (bdg_ifp != BDG_LOCAL && bdg_ifp != BDG_BCAST && + bdg_ifp != BDG_MCAST) { + /* not local and not multicast, just drop it */ + if (m) + m_freem(m); + continue; + } + /* all others accepted locally */ } #endif + /* + * Don't pass it up to the ether_input() layer unless it's + * a broadcast packet, multicast packet, matches our ethernet + * address or the interface is in promiscuous mode. + */ + if (ifp->if_flags & IFF_PROMISC && + (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, + ETHER_ADDR_LEN) && + (eh->ether_dhost[0] & 1) == 0)) { + m_freem(m); + continue; + } /* Remove header from mbuf and pass it on. */ m_adj(m, sizeof(struct ether_header)); ether_input(ifp, eh, m); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912011321.QAA00490>