From a8d45119250f0a95b20589d3423fbe437b28ccbe Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Sun, 25 Jun 2006 11:02:40 +0000 Subject: [PATCH] Remove OLDBRIDGE --- etc/mtree/BSD.include.dist | 4 +- include/Makefile | 4 +- sbin/ipfw/ipfw.8 | 29 +- sbin/ipfw/ipfw.c | 7 +- sbin/ipfw/ipfw2.c | 3 +- share/man/man4/Makefile | 3 +- share/man/man4/oldbridge.4 | 199 ------ sys/conf/files | 3 +- sys/conf/options | 3 +- sys/config/LINT | 6 +- sys/dev/agp/Makefile | 4 +- sys/dev/crypto/hifn/Makefile | 4 +- sys/dev/crypto/ubsec/Makefile | 4 +- sys/dev/disk/ncv/Makefile | 4 +- sys/dev/disk/nsp/Makefile | 4 +- sys/dev/disk/stg/Makefile | 4 +- sys/dev/netif/aue/Makefile | 4 +- sys/dev/netif/axe/Makefile | 4 +- sys/dev/netif/bfe/Makefile | 4 +- sys/dev/netif/bge/Makefile | 3 +- sys/dev/netif/cue/Makefile | 4 +- sys/dev/netif/dc/Makefile | 4 +- sys/dev/netif/ed/Makefile | 4 +- sys/dev/netif/ed/if_ed.c | 25 +- sys/dev/netif/em/Makefile | 4 +- sys/dev/netif/em/if_em.h | 3 +- sys/dev/netif/fxp/Makefile | 4 +- sys/dev/netif/gx/Makefile | 4 +- sys/dev/netif/ie/Makefile | 4 +- sys/dev/netif/kue/Makefile | 4 +- sys/dev/netif/lge/Makefile | 4 +- sys/dev/netif/nge/Makefile | 4 +- sys/dev/netif/pcn/Makefile | 4 +- sys/dev/netif/rl/Makefile | 4 +- sys/dev/netif/sf/Makefile | 4 +- sys/dev/netif/sis/Makefile | 4 +- sys/dev/netif/sk/Makefile | 4 +- sys/dev/netif/ste/Makefile | 4 +- sys/dev/netif/ti/Makefile | 4 +- sys/dev/netif/tl/Makefile | 4 +- sys/dev/netif/tx/Makefile | 4 +- sys/dev/netif/txp/Makefile | 4 +- sys/dev/netif/vr/Makefile | 4 +- sys/dev/netif/wb/Makefile | 4 +- sys/dev/netif/wb/if_wb.c | 4 +- sys/dev/netif/xe/Makefile | 4 +- sys/dev/netif/xl/Makefile | 4 +- sys/emulation/ndis/Makefile | 4 +- sys/i386/conf/LINT | 6 +- sys/net/Makefile | 4 +- sys/net/dummynet/Makefile | 4 +- sys/net/dummynet/ip_dummynet.c | 31 +- sys/net/dummynet/ip_dummynet.h | 5 +- sys/net/if_ethersubr.c | 78 +-- sys/net/ipfw/ip_fw.c | 32 +- sys/net/ipfw/ip_fw.h | 4 +- sys/net/ipfw/ip_fw2.c | 4 +- sys/net/oldbridge/Makefile | 9 - sys/net/oldbridge/bridge.c | 1154 -------------------------------- sys/net/oldbridge/bridge.h | 115 ---- sys/netinet/if_ether.c | 46 +- usr.bin/netstat/if.c | 47 +- usr.bin/netstat/main.c | 6 +- usr.bin/netstat/netstat.1 | 6 +- usr.bin/netstat/netstat.h | 4 +- 65 files changed, 124 insertions(+), 1863 deletions(-) delete mode 100644 share/man/man4/oldbridge.4 delete mode 100644 sys/net/oldbridge/Makefile delete mode 100644 sys/net/oldbridge/bridge.c delete mode 100644 sys/net/oldbridge/bridge.h diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 87f9ab348e..5b1a925ba4 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -1,5 +1,5 @@ # $FreeBSD: src/etc/mtree/BSD.include.dist,v 1.32.2.14 2003/01/24 09:47:07 roam Exp $ -# $DragonFly: src/etc/mtree/BSD.include.dist,v 1.19 2005/12/21 11:18:30 corecode Exp $ +# $DragonFly: src/etc/mtree/BSD.include.dist,v 1.20 2006/06/25 11:02:37 corecode Exp $ # # Please see the file src/etc/mtree/README before making changes to this file. # @@ -159,8 +159,6 @@ .. bridge .. - oldbridge - .. tun .. i4b diff --git a/include/Makefile b/include/Makefile index 71b478db90..d801bdb35a 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,6 +1,6 @@ # @(#)Makefile 8.2 (Berkeley) 1/4/94 # $FreeBSD: src/include/Makefile,v 1.109.2.27 2003/01/24 05:12:29 sam Exp $ -# $DragonFly: src/include/Makefile,v 1.28 2005/12/21 16:33:20 corecode Exp $ +# $DragonFly: src/include/Makefile,v 1.29 2006/06/25 11:02:37 corecode Exp $ # # Doing a make install builds /usr/include # @@ -53,7 +53,7 @@ LSUBDIRS= bus/cam bus/cam/scsi \ vfs/msdosfs vfs/nfs vfs/ntfs vfs/nwfs \ vfs/smbfs vfs/udf vfs/ufs \ net/vlan net/ipfw net/ip6fw net/dummynet net/sppp net/ip_mroute \ - net/bridge net/oldbridge net/tun net/ppp net/ppp_layer net/sl \ + net/bridge net/tun net/ppp net/ppp_layer net/sl \ net/pf net/altq \ netgraph/UI netgraph/async netgraph/bpf netgraph/bridge \ netgraph/cisco netgraph/echo netgraph/eiface netgraph/etf \ diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index afbe5a90fb..d147a96a6c 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,6 +1,6 @@ .\" .\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.63.2.33 2003/02/04 01:36:02 brueffer Exp $ -.\" $DragonFly: src/sbin/ipfw/ipfw.8,v 1.7 2006/03/26 22:56:57 swildner Exp $ +.\" $DragonFly: src/sbin/ipfw/ipfw.8,v 1.8 2006/06/25 11:02:37 corecode Exp $ .\" .Dd August 13, 2002 .Dt IPFW 8 @@ -337,8 +337,6 @@ have this picture in mind in order to design a correct ruleset. | | ^ V [ether_demux] [ether_output_frame] net.link.ether.ipfw=1 - | | - +-->--[bdg_forward]-->--+ net.link.ether.bridge_ipfw=1 ^ V | to devices | .Ed @@ -378,7 +376,7 @@ differentiate among the possible places. .Cm skipto rules can be useful here, as an example: .Bd -literal -offset indent -# packets from ether_demux or bdg_forward +# packets from ether_demux ipfw add 10 skipto 1000 all from any to any layer2 in # packets from ip_input ipfw add 10 skipto 2000 all from any to any not layer2 in @@ -387,9 +385,6 @@ ipfw add 10 skipto 3000 all from any to any not layer2 out # packets from ether_output_frame ipfw add 10 skipto 4000 all from any to any layer2 out .Ed -.Pp -(yes, at the moment there is no way to differentiate between -ether_demux and bdg_forward). .Sh RULE FORMAT The format of .Nm @@ -566,7 +561,7 @@ the local routing table for that IP. A .Ar fwd rule will not match layer-2 packets (those received -on ether_input, ether_output, or bridged). +on ether_input or ether_output). .br The .Cm fwd @@ -823,8 +818,6 @@ operand, and possibly grouped into .Pp The following match patterns can be used (listed in alphabetical order): .Bl -tag -width indent -.It Cm bridged -Matches only bridged packets. .It Cm dst-ip Ar ip address Matches IP packets whose destination IP is one of the address(es) specified as argument. @@ -1535,8 +1528,7 @@ A set of .Xr sysctl 8 variables controls the behaviour of the firewall and associated modules ( -.Nm dummynet , -.Nm bridge +.Nm dummynet ). These are shown below together with their default value (but always check with the @@ -1621,7 +1613,7 @@ pipe is not passed though the firewall again. Otherwise, after a pipe action, the packet is reinjected into the firewall at the next rule. .Pp -Note: bridged and layer 2 packets coming out of a pipe +Note: layer 2 packets coming out of a pipe are never reinjected in the firewall irrespective of the value of this variable. .It Em net.inet.ip.fw.verbose : No 1 @@ -1632,10 +1624,6 @@ Limits the number of messages produced by a verbose firewall. Controls whether layer-2 packets are passed to .Nm . Default is no. -.It Em net.link.ether.bridge_ipfw : No 0 -Controls whether bridged packets are passed to -.Nm . -Default is no. .El .Sh USING IPFW2 IN FreeBSD-STABLE .Nm ipfw2 @@ -1670,11 +1658,7 @@ write your rulesets in a more efficient way. .Bl -tag -width indent .It Handling of non-IPv4 packets .Nm ipfw1 -will silently accept all non-IPv4 packets (which -.Nm ipfw1 -will only see when -.Em net.link.ether.bridge_ipfw=1 Ns -). +will silently accept all non-IPv4 packets. .Nm ipfw2 will filter all packets (including non-IPv4 ones) according to the ruleset. To achieve the same behaviour as @@ -1993,7 +1977,6 @@ the sleep terminates thus restoring the previous situation. .Sh SEE ALSO .Xr cpp 1 , .Xr m4 1 , -.Xr bridge 4 , .Xr divert 4 , .Xr dummynet 4 , .Xr ip 4 , diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index 1d59d928db..19eba869ee 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -17,7 +17,7 @@ * NEW command line interface for IP firewall facility * * $FreeBSD: src/sbin/ipfw/ipfw.c,v 1.80.2.26 2003/01/14 19:15:58 dillon Exp $ - * $DragonFly: src/sbin/ipfw/Attic/ipfw.c,v 1.7 2004/12/18 21:43:38 swildner Exp $ + * $DragonFly: src/sbin/ipfw/Attic/ipfw.c,v 1.8 2006/06/25 11:02:37 corecode Exp $ */ #include @@ -401,8 +401,6 @@ show_ipfw(struct ip_fw *chain, int pcwidth, int bcwidth) } } /* Direction */ - if (chain->fw_flg & IP_FW_BRIDGED) - printf(" bridged"); if ((chain->fw_flg & IP_FW_F_IN) && !(chain->fw_flg & IP_FW_F_OUT)) printf(" in"); if (!(chain->fw_flg & IP_FW_F_IN) && (chain->fw_flg & IP_FW_F_OUT)) @@ -1995,9 +1993,6 @@ add(int ac, char *av[]) rule.dyn_type = type; av++; ac--; } - } else if (!strncmp(*av, "bridged", strlen(*av))) { - rule.fw_flg |= IP_FW_BRIDGED; - av++; ac--; } else if (!strncmp(*av, "out", strlen(*av))) { rule.fw_flg |= IP_FW_F_OUT; av++; ac--; diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 8362b7b937..5abf3c4757 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -18,7 +18,7 @@ * NEW command line interface for IP firewall facility * * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.4.2.13 2003/05/27 22:21:11 gshapiro Exp $ - * $DragonFly: src/sbin/ipfw/ipfw2.c,v 1.7 2005/11/06 12:29:11 swildner Exp $ + * $DragonFly: src/sbin/ipfw/ipfw2.c,v 1.8 2006/06/25 11:02:37 corecode Exp $ */ #include @@ -296,7 +296,6 @@ struct _s_x rule_options[] = { { "in", TOK_IN }, { "limit", TOK_LIMIT }, { "keep-state", TOK_KEEPSTATE }, - { "bridged", TOK_LAYER2 }, { "layer2", TOK_LAYER2 }, { "out", TOK_OUT }, { "xmit", TOK_XMIT }, diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index f77e462bda..7c421bdeb6 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,6 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 # $FreeBSD: src/share/man/man4/Makefile,v 1.83.2.66 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/share/man/man4/Makefile,v 1.38 2006/05/20 09:13:09 sephe Exp $ +# $DragonFly: src/share/man/man4/Makefile,v 1.39 2006/06/25 11:02:37 corecode Exp $ MAN= aac.4 \ acpi.4 \ @@ -150,7 +150,6 @@ MAN= aac.4 \ nv.4 \ null.4 \ ohci.4 \ - oldbridge.4 \ orm.4 \ pass.4 \ pccard.4 \ diff --git a/share/man/man4/oldbridge.4 b/share/man/man4/oldbridge.4 deleted file mode 100644 index 221aa1b6f4..0000000000 --- a/share/man/man4/oldbridge.4 +++ /dev/null @@ -1,199 +0,0 @@ -.\" -.\" $FreeBSD: src/share/man/man4/bridge.4,v 1.6.2.11 2002/02/18 02:00:21 luigi Exp $ -.\" $DragonFly: src/share/man/man4/Attic/oldbridge.4,v 1.3 2006/03/26 22:56:57 swildner Exp $ -.\" -.Dd February 15, 2002 -.Dt OLDBRIDGE 4 -.Os -.Sh NAME -.Nm bridge -.Nd bridging support -.Sh SYNOPSIS -.Cd "options BRIDGE" -.Cd kldload /modules/bridge.ko -.Sh DESCRIPTION -.Dx -supports bridging on Ethernet-type interfaces, including VLANs. -Bridging support can be either compiled into the kernel, or loaded -at runtime as a kernel module. -.Pp -A single -.Dx -host can do bridging on independent sets of interfaces, -which are called -.Ar clusters . -Each cluster connects a set of interfaces, and is -identified by a "cluster-id" which is a number in the range 1..65535. -A cluster in fact is very similar to what commercial switches call -a "VLAN". Note however that there is no relation whatsoever -between the cluster-id and the IEEE 802.1q VLAN-id which appears -in the header of packets transmitted on the wire. -In fact, in most cases there is no relation between the -so-called "VLAN identifier" used in most commercial switches, and -the IEEE 802.1q VLAN-id. -.Pp -By putting both physical and logical (vlanX) interfaces -in the same cluster, a -.Dx -box can also implement what in -commercial terms is called a "trunk" interface. This means packets -coming from one of the interfaces in the cluster, -will appear -on the wire on the "parent" interfaces of any vlan -interface belonging to the cluster, with the -proper VLAN tag. Similarly, packets coming from a -parent interface, will have the VLAN tag stripped and -will be forwarded to other interfaces on the same cluster. -See the -.Sx EXAMPLES -section for more details. -.Pp -Runtime operation of the -.Nm -is controlled by several -.Xr sysctl 8 -variables, as follows. -.Pp -.Bl -tag -width indent -.It Va net.link.ether.bridge -set to -.Li 1 -to enable bridging, set to -.Li 0 -to disable it. -.Pp -.It Va net.link.ether.bridge_ipfw -set to -.Li 1 -to enable -.Xr ipfw 8 -filtering on bridged packets. -Note that -.Xr ipfw 8 -rules only apply -to IP packets. -Non-IP packets are accepted by default. -See the -.Sx BUGS -section and the -.Xr ipfw 8 -manpage for more details on the interaction of bridging -and the firewall. -.Pp -.It Va net.link.ether.bridge_cfg -contains a list of interfaces on which bridging is to be performed. -Interfaces are separated by spaces, commas or tabs. Each interface -can be optionally followed by a colon and an integer indicating the -cluster it belongs to (defaults to 1 if the cluster-id is missing), e.g. -.Pp -.Ar dc0:1,dc1,vlan0:3 dc2:3 -.Pp -will put dc0 and dc1 in cluster number 1, and vlan0 and dc2 in cluster -number 3. -See the -.Sx EXAMPLES -section for more examples. -.Pp -The list of interfaces is rescanned every time the list is -modified, bridging is enabled, or new interfaces are created or -destroyed. Interfaces that are in the list but cannot be used -for bridging (because they are non-existing, or not Ethernet or VLAN) -are not used and a warning message is generated. -.El -.Pp -Bridging requires interfaces to be put in promiscuous mode, -and transmit packets with Ethernet source addresses. -Some interfaces (e.g. -.Xr wi 4 ) -do not support this functionality. -Also, bridging is not compatible with interfaces which -use hardware loopback, because there is no way to tell locally -generated packets from externally generated ones. -.Sh EXAMPLES -A simple bridge configuration with three interfaces in the same -cluster can be set as follows. No cluster-id is specified here, which -will cause the interfaces to appear as part of cluster #1. -.Pp -.Dl sysctl net.link.ether.bridge_cfg=dc0,dc1,fxp1 -.Pp -If you do not know what actual interfaces will be present on -your system, you can just put all existing interfaces in the -configuration, as follows: -.Pp -.Dl sysctl net.link.ether.bridge_cfg="`ifconfig -l`" -.Pp -This will result in a space-separated list of interfaces. -Out of the list, only Ethernet or VLAN interfaces will be -used for bridging, whereas for others the kernel will produce -a warning message. -.Pp -More complex configurations can be used to create multiple -clusters, e.g. -.Pp -.Dl sysctl net.link.ether.bridge_cfg=dc0:3,dc1:3,fxp0:4,fxp1:4 -.Pp -will create two completely independent clusters. -.Pp -Finally, interesting configurations involve vlans and parent interfaces. -As an example, the following configuration will use interface dc0 -as a "trunk" interface, and pass packets -for 802.1q vlans 10 and 20 to physical interfaces dc1 and dc2: -.Pp -.Dl sysctl net.link.ether.bridge_cfg=vlan0:34,dc1:34,vlan1:56,dc2:56 -.Dl ifconfig vlan0 vlan 10 vlandev dc0 -.Dl ifconfig vlan1 vlan 20 vlandev dc0 -.Pp -Note how there is no relation between the 802.1q vlan identifiers -(10 and 20) and the cluster-id's (34 and 56) used in -the bridge_cfg variable. -.Pp -Note also that the trunk interface -does not even appear in the bridge_cfg, as vlan tag insertion/removal -is performed by the -.Xr vlan 4 -devices. -When using vlan devices, care must be taken by not creating loops -between these devices and their parent interfaces. -.Sh SEE ALSO -.Xr ip 4 , -.Xr ng_bridge 4 , -.Xr vlan 4 , -.Xr ipfw 8 , -.Xr sysctl 8 -.Sh HISTORY -Bridging was introduced in -.Fx 2.2.8 -by -.An Luigi Rizzo Aq luigi@iet.unipi.it . -.Sh BUGS -Care must be taken not to construct loops in the -.Nm -topology. -The kernel supports only a primitive form of loop detection, by disabling -some interfaces when a loop is detected. -No support for a daemon running the -spanning tree algorithm is currently provided. -.Pp -With bridging active, interfaces are in promiscuous mode, -thus causing some load on the system to receive and filter -out undesired traffic. -.Pp -When passing bridged packets to -.Xr ipfw 8 , -remember that only IP packets are passed to the firewall, while -other packets are silently accepted. -Also remember that bridged packets are accepted after the -first pass through the firewall irrespective of the setting -of the sysctl variable -.Nm net.inet.ip.fw.one_pass , -and that some -.Nm ipfw -actions such as -.Nm divert -do not apply to bridged packets. -It might be useful to have a rule of the form -.Pp -.Dl skipto 20000 ip from any to any bridged -.Pp -near the beginning of your ruleset to implement specific rulesets -for bridged packets. diff --git a/sys/conf/files b/sys/conf/files index ab29acd5b0..00f4571ef3 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/files,v 1.340.2.137 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/sys/conf/files,v 1.129 2006/06/18 01:33:29 dillon Exp $ +# $DragonFly: src/sys/conf/files,v 1.130 2006/06/25 11:02:37 corecode Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -660,7 +660,6 @@ net/altq/altq_rmclass.c optional altq net/altq/altq_subr.c optional altq net/bpf.c standard net/bpf_filter.c optional bpf -net/oldbridge/bridge.c optional bridge net/bridge/if_bridge.c optional bridge net/bridge/bridgestp.c optional bridge net/bsd_comp.c optional ppp_bsdcomp diff --git a/sys/conf/options b/sys/conf/options index b1472d8727..6f1c4c68d7 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/options,v 1.191.2.53 2003/06/04 17:56:58 sam Exp $ -# $DragonFly: src/sys/conf/options,v 1.49 2006/06/08 18:25:45 dillon Exp $ +# $DragonFly: src/sys/conf/options,v 1.50 2006/06/25 11:02:37 corecode Exp $ # # On the handling of kernel options # @@ -264,7 +264,6 @@ BOOTP_COMPAT opt_bootp.h BOOTP_NFSROOT opt_bootp.h BOOTP_NFSV3 opt_bootp.h BOOTP_WIRED_TO opt_bootp.h -BRIDGE opt_bdg.h ETHER_II opt_ef.h ETHER_8023 opt_ef.h ETHER_8022 opt_ef.h diff --git a/sys/config/LINT b/sys/config/LINT index 18b4ce2978..0840ceb8ba 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -3,7 +3,7 @@ # as much of the source tree as it can. # # $FreeBSD: src/sys/i386/conf/LINT,v 1.749.2.144 2003/06/04 17:56:59 sam Exp $ -# $DragonFly: src/sys/config/LINT,v 1.83 2006/06/23 17:26:12 eirikn Exp $ +# $DragonFly: src/sys/config/LINT,v 1.84 2006/06/25 11:02:39 corecode Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -661,11 +661,7 @@ options ICMP_BANDLIM # When you run DUMMYNET it is advisable to also have "options HZ=1000" # to achieve a smoother scheduling of the traffic. # -# BRIDGE enables bridging between ethernet cards -- see bridge(4). -# You can use IPFIREWALL and DUMMYNET together with bridging. -# options DUMMYNET -options BRIDGE # # ATM (HARP version) options diff --git a/sys/dev/agp/Makefile b/sys/dev/agp/Makefile index 1551068e4c..672bf8d097 100644 --- a/sys/dev/agp/Makefile +++ b/sys/dev/agp/Makefile @@ -1,12 +1,12 @@ # $FreeBSD: src/sys/modules/agp/Makefile,v 1.2.2.4 2000/09/30 02:49:36 ps Exp $ -# $DragonFly: src/sys/dev/agp/Makefile,v 1.4 2004/03/24 20:40:33 dillon Exp $ +# $DragonFly: src/sys/dev/agp/Makefile,v 1.5 2006/06/25 11:02:38 corecode Exp $ KMOD = agp SRCS = agp.c SRCS += agp_i810.c agp_ali.c agp_amd.c agp_nvidia.c agp_intel.c SRCS += agp_sis.c agp_via.c SRCS += agp_if.c device_if.h bus_if.h agp_if.h pci_if.h -SRCS += opt_bdg.h opt_bus.h opt_pci.h +SRCS += opt_bus.h opt_pci.h MFILES = kern/device_if.m kern/bus_if.m dev/agp/agp_if.m bus/pci/pci_if.m .include diff --git a/sys/dev/crypto/hifn/Makefile b/sys/dev/crypto/hifn/Makefile index 170cc6fbf5..494add0906 100644 --- a/sys/dev/crypto/hifn/Makefile +++ b/sys/dev/crypto/hifn/Makefile @@ -1,11 +1,11 @@ # $FreeBSD: src/sys/modules/hifn/Makefile,v 1.2.2.2 2003/06/05 04:13:47 sam Exp $ -# $DragonFly: src/sys/dev/crypto/hifn/Makefile,v 1.3 2005/02/18 11:41:41 corecode Exp $ +# $DragonFly: src/sys/dev/crypto/hifn/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ .PATH: ${.CURDIR}/../../dev/hifn KMOD = hifn SRCS = hifn7751.c opt_hifn.h SRCS += device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_bus.h crypto_if.h +SRCS += opt_bus.h crypto_if.h .if !defined(BUILDING_WITH_KERNEL) opt_hifn.h: diff --git a/sys/dev/crypto/ubsec/Makefile b/sys/dev/crypto/ubsec/Makefile index 559faf9e29..92cd98744e 100644 --- a/sys/dev/crypto/ubsec/Makefile +++ b/sys/dev/crypto/ubsec/Makefile @@ -1,11 +1,11 @@ # $FreeBSD: src/sys/modules/ubsec/Makefile,v 1.2.2.2 2003/06/05 04:13:48 sam Exp $ -# $DragonFly: src/sys/dev/crypto/ubsec/Makefile,v 1.3 2005/02/18 11:41:42 corecode Exp $ +# $DragonFly: src/sys/dev/crypto/ubsec/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ .PATH: ${.CURDIR}/../../dev/ubsec KMOD = ubsec SRCS = ubsec.c opt_ubsec.h SRCS += device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_bus.h crypto_if.h +SRCS += opt_bus.h crypto_if.h .if !defined(BUILDING_WITH_KERNEL) opt_ubsec.h: diff --git a/sys/dev/disk/ncv/Makefile b/sys/dev/disk/ncv/Makefile index 559151af6e..48100d597c 100644 --- a/sys/dev/disk/ncv/Makefile +++ b/sys/dev/disk/ncv/Makefile @@ -1,11 +1,11 @@ # $FreeBSD: src/sys/modules/ncv/Makefile,v 1.1.2.2 2002/01/02 07:59:12 non Exp $ -# $DragonFly: src/sys/dev/disk/ncv/Makefile,v 1.2 2003/06/17 04:28:45 dillon Exp $ +# $DragonFly: src/sys/dev/disk/ncv/Makefile,v 1.3 2006/06/25 11:02:38 corecode Exp $ .PATH: ${.CURDIR}/../../dev/ncv KMOD= ncv SRCS= ncr53c500_pccard.c ncr53c500.c -SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h +SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h SRCS+= opt_cam.h opt_scsi.h opt_ddb.h KMODDEPS= scsi_low diff --git a/sys/dev/disk/nsp/Makefile b/sys/dev/disk/nsp/Makefile index 71f843dd25..110ffff8f7 100644 --- a/sys/dev/disk/nsp/Makefile +++ b/sys/dev/disk/nsp/Makefile @@ -1,11 +1,11 @@ # $FreeBSD: src/sys/modules/nsp/Makefile,v 1.1.2.2 2002/01/02 07:59:12 non Exp $ -# $DragonFly: src/sys/dev/disk/nsp/Makefile,v 1.2 2003/06/17 04:28:46 dillon Exp $ +# $DragonFly: src/sys/dev/disk/nsp/Makefile,v 1.3 2006/06/25 11:02:38 corecode Exp $ .PATH: ${.CURDIR}/../../dev/nsp KMOD= nsp SRCS= nsp.c nsp_pccard.c -SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h +SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h SRCS+= opt_cam.h opt_scsi.h opt_ddb.h KMODDEPS= scsi_low diff --git a/sys/dev/disk/stg/Makefile b/sys/dev/disk/stg/Makefile index 4c2801055b..1779d32ff5 100644 --- a/sys/dev/disk/stg/Makefile +++ b/sys/dev/disk/stg/Makefile @@ -1,11 +1,11 @@ # $FreeBSD: src/sys/modules/stg/Makefile,v 1.1.2.2 2002/01/02 07:59:12 non Exp $ -# $DragonFly: src/sys/dev/disk/stg/Makefile,v 1.2 2003/06/17 04:28:47 dillon Exp $ +# $DragonFly: src/sys/dev/disk/stg/Makefile,v 1.3 2006/06/25 11:02:38 corecode Exp $ .PATH: ${.CURDIR}/../../dev/stg KMOD= stg SRCS= tmc18c30.c tmc18c30_isa.c tmc18c30_pccard.c -SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h +SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h SRCS+= opt_cam.h opt_scsi.h opt_ddb.h KMODDEPS= scsi_low diff --git a/sys/dev/netif/aue/Makefile b/sys/dev/netif/aue/Makefile index d7ebbd9b04..63a66e6339 100644 --- a/sys/dev/netif/aue/Makefile +++ b/sys/dev/netif/aue/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/aue/Makefile,v 1.2 2000/01/28 11:26:27 bde Exp $ -# $DragonFly: src/sys/dev/netif/aue/Makefile,v 1.3 2005/05/24 07:36:29 joerg Exp $ +# $DragonFly: src/sys/dev/netif/aue/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ KMOD = if_aue -SRCS = if_aue.c opt_bdg.h opt_usb.h device_if.h bus_if.h +SRCS = if_aue.c opt_usb.h device_if.h bus_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/axe/Makefile b/sys/dev/netif/axe/Makefile index afaabea306..b09dc73db4 100644 --- a/sys/dev/netif/axe/Makefile +++ b/sys/dev/netif/axe/Makefile @@ -1,7 +1,7 @@ -# $DragonFly: src/sys/dev/netif/axe/Makefile,v 1.2 2005/05/25 11:38:58 joerg Exp $ +# $DragonFly: src/sys/dev/netif/axe/Makefile,v 1.3 2006/06/25 11:02:38 corecode Exp $ KMOD = if_axe -SRCS = if_axe.c opt_bdg.h opt_usb.h device_if.h bus_if.h +SRCS = if_axe.c opt_usb.h device_if.h bus_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/bfe/Makefile b/sys/dev/netif/bfe/Makefile index 5bc0a9d831..1bdb4c726d 100644 --- a/sys/dev/netif/bfe/Makefile +++ b/sys/dev/netif/bfe/Makefile @@ -1,7 +1,7 @@ -# $DragonFly: src/sys/dev/netif/bfe/Makefile,v 1.1 2004/02/27 11:56:12 joerg Exp $ +# $DragonFly: src/sys/dev/netif/bfe/Makefile,v 1.2 2006/06/25 11:02:38 corecode Exp $ KMOD= if_bfe -SRCS= if_bfe.c miibus_if.h opt_bdg.h device_if.h \ +SRCS= if_bfe.c miibus_if.h device_if.h \ bus_if.h pci_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/bge/Makefile b/sys/dev/netif/bge/Makefile index ec33d3e60b..cebbf6f496 100644 --- a/sys/dev/netif/bge/Makefile +++ b/sys/dev/netif/bge/Makefile @@ -1,9 +1,8 @@ # $FreeBSD: src/sys/modules/bge/Makefile,v 1.1.2.2 2001/12/04 20:01:53 brooks Exp $ -# $DragonFly: src/sys/dev/netif/bge/Makefile,v 1.5 2006/03/23 13:45:12 sephe Exp $ +# $DragonFly: src/sys/dev/netif/bge/Makefile,v 1.6 2006/06/25 11:02:38 corecode Exp $ KMOD= if_bge SRCS= if_bge.c -SRCS+= opt_bdg.h SRCS+= miibus_if.h device_if.h bus_if.h pci_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/cue/Makefile b/sys/dev/netif/cue/Makefile index b4e2109142..70a94661bc 100644 --- a/sys/dev/netif/cue/Makefile +++ b/sys/dev/netif/cue/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/cue/Makefile,v 1.2 2000/01/28 11:26:27 bde Exp $ -# $DragonFly: src/sys/dev/netif/cue/Makefile,v 1.3 2005/05/25 11:46:10 joerg Exp $ +# $DragonFly: src/sys/dev/netif/cue/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ KMOD = if_cue -SRCS = if_cue.c opt_bdg.h opt_usb.h device_if.h bus_if.h +SRCS = if_cue.c opt_usb.h device_if.h bus_if.h SRCS += miibus_if.h .include diff --git a/sys/dev/netif/dc/Makefile b/sys/dev/netif/dc/Makefile index c7d75e4fae..634c94562e 100644 --- a/sys/dev/netif/dc/Makefile +++ b/sys/dev/netif/dc/Makefile @@ -1,10 +1,10 @@ # $FreeBSD: src/sys/modules/dc/Makefile,v 1.2 2000/01/28 11:26:28 bde Exp $ -# $DragonFly: src/sys/dev/netif/dc/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/dc/Makefile,v 1.5 2006/06/25 11:02:38 corecode Exp $ KMOD = if_dc SRCS = if_dc.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h KMODDEPS = miibus .ifndef BUILDING_WITH_KERNEL diff --git a/sys/dev/netif/ed/Makefile b/sys/dev/netif/ed/Makefile index 6a9bdeecb6..8b40f3adf8 100644 --- a/sys/dev/netif/ed/Makefile +++ b/sys/dev/netif/ed/Makefile @@ -1,10 +1,10 @@ -# $DragonFly: src/sys/dev/netif/ed/Makefile,v 1.2 2005/07/28 00:06:09 joerg Exp $ +# $DragonFly: src/sys/dev/netif/ed/Makefile,v 1.3 2006/06/25 11:02:38 corecode Exp $ KMOD = if_ed SRCS = if_ed.c if_ed_isa.c if_ed_pccard.c if_ed_pci.c \ card_if.h device_if.h bus_if.h pci_if.h isa_if.h \ miibus_if.h \ - opt_ed.h opt_bdg.h + opt_ed.h KMODDEPS = miibus .include diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 217a35de49..c1611bfcd3 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.224 2003/12/08 07:54:12 obrien Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.29 2005/12/19 00:07:02 corecode Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.30 2006/06/25 11:02:38 corecode Exp $ */ /* @@ -70,8 +70,6 @@ #endif #include -#include "opt_bdg.h" -#include #include @@ -2764,26 +2762,9 @@ ed_get_packet(struct ed_softc *sc, char *buf, u_short len) eh = mtod(m, struct ether_header *); /* - * Don't read in the entire packet if we know we're going to drop it - * and no bpf is active. + * Get packet, including link layer address, from interface. */ - if (!ifp->if_bpf && BDG_ACTIVE( (ifp) ) ) { - struct ifnet *bif; - - ed_ring_copy(sc, buf, (char *)eh, ETHER_HDR_LEN); - bif = bridge_in_ptr(ifp, eh) ; - if (bif == BDG_DROP) { - m_freem(m); - return; - } - if (len > ETHER_HDR_LEN) - ed_ring_copy(sc, buf + ETHER_HDR_LEN, - (char *)(eh + 1), len - ETHER_HDR_LEN); - } else - /* - * Get packet, including link layer address, from interface. - */ - ed_ring_copy(sc, buf, (char *)eh, len); + ed_ring_copy(sc, buf, (char *)eh, len); m->m_pkthdr.len = m->m_len = len; diff --git a/sys/dev/netif/em/Makefile b/sys/dev/netif/em/Makefile index 0f159ff2a5..1b17d34635 100644 --- a/sys/dev/netif/em/Makefile +++ b/sys/dev/netif/em/Makefile @@ -1,9 +1,9 @@ #$FreeBSD: src/sys/modules/em/Makefile,v 1.1.2.3 2002/06/18 21:00:56 pdeuskar Exp $ -#$DragonFly: src/sys/dev/netif/em/Makefile,v 1.5 2005/12/10 18:28:18 dillon Exp $ +#$DragonFly: src/sys/dev/netif/em/Makefile,v 1.6 2006/06/25 11:02:38 corecode Exp $ KMOD= if_em SRCS= if_em.c if_em_hw.c -SRCS+= device_if.h bus_if.h pci_if.h opt_bdg.h opt_polling.h opt_ktr.h +SRCS+= device_if.h bus_if.h pci_if.h opt_polling.h opt_ktr.h .ifndef BUILDING_WITH_KERNEL opt_polling.h: diff --git a/sys/dev/netif/em/if_em.h b/sys/dev/netif/em/if_em.h index 72b8cbe9d5..0681f4c61c 100644 --- a/sys/dev/netif/em/if_em.h +++ b/sys/dev/netif/em/if_em.h @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /*$FreeBSD: src/sys/dev/em/if_em.h,v 1.1.2.13 2003/06/09 21:43:41 pdeuskar Exp $*/ -/*$DragonFly: src/sys/dev/netif/em/if_em.h,v 1.14 2005/12/10 18:28:18 dillon Exp $*/ +/*$DragonFly: src/sys/dev/netif/em/if_em.h,v 1.15 2006/06/25 11:02:38 corecode Exp $*/ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -78,7 +78,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "opt_bdg.h" #include diff --git a/sys/dev/netif/fxp/Makefile b/sys/dev/netif/fxp/Makefile index d489c6b6c5..703e4623d7 100644 --- a/sys/dev/netif/fxp/Makefile +++ b/sys/dev/netif/fxp/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/fxp/Makefile,v 1.9.2.3 2001/12/04 20:01:53 brooks Exp $ -# $DragonFly: src/sys/dev/netif/fxp/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/fxp/Makefile,v 1.5 2006/06/25 11:02:38 corecode Exp $ KMOD = if_fxp SRCS = if_fxp.c device_if.h bus_if.h pci_if.h miibus_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h KMODDEPS = miibus .ifndef BUILDING_WITH_KERNEL diff --git a/sys/dev/netif/gx/Makefile b/sys/dev/netif/gx/Makefile index 5644b5d066..eaa38a34dd 100644 --- a/sys/dev/netif/gx/Makefile +++ b/sys/dev/netif/gx/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/gx/Makefile,v 1.1.2.2 2001/12/04 20:01:53 brooks Exp $ -# $DragonFly: src/sys/dev/netif/gx/Attic/Makefile,v 1.3 2005/07/28 00:06:09 joerg Exp $ +# $DragonFly: src/sys/dev/netif/gx/Attic/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ KMOD = if_gx -SRCS = if_gx.c opt_bdg.h device_if.h bus_if.h pci_if.h miibus_if.h +SRCS = if_gx.c device_if.h bus_if.h pci_if.h miibus_if.h KMODDEPS = miibus .include diff --git a/sys/dev/netif/ie/Makefile b/sys/dev/netif/ie/Makefile index dd15cbf21b..2ca6a0c3f3 100644 --- a/sys/dev/netif/ie/Makefile +++ b/sys/dev/netif/ie/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/rl/Makefile,v 1.6 2000/01/28 11:26:34 bde Exp $ -# $DragonFly: src/sys/dev/netif/ie/Makefile,v 1.3 2005/07/28 00:06:09 joerg Exp $ +# $DragonFly: src/sys/dev/netif/ie/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ KMOD= if_ie -SRCS= if_ie.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS= if_ie.c device_if.h bus_if.h pci_if.h SRCS+= use_ie.h opt_inet.h opt_ipx.h use_ie.h: diff --git a/sys/dev/netif/kue/Makefile b/sys/dev/netif/kue/Makefile index 23f7e118cc..985cd18b17 100644 --- a/sys/dev/netif/kue/Makefile +++ b/sys/dev/netif/kue/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/kue/Makefile,v 1.2 2000/01/28 11:26:30 bde Exp $ -# $DragonFly: src/sys/dev/netif/kue/Makefile,v 1.3 2005/07/28 00:06:09 joerg Exp $ +# $DragonFly: src/sys/dev/netif/kue/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ S = ${.CURDIR}/../.. KMOD = if_kue -SRCS = if_kue.c opt_bdg.h opt_usb.h device_if.h bus_if.h +SRCS = if_kue.c opt_usb.h device_if.h bus_if.h SRCS += miibus_if.h .include diff --git a/sys/dev/netif/lge/Makefile b/sys/dev/netif/lge/Makefile index d82aa081d3..b8e74069a8 100644 --- a/sys/dev/netif/lge/Makefile +++ b/sys/dev/netif/lge/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/lge/Makefile,v 1.1.2.1 2001/06/19 19:42:41 wpaul Exp $ -# $DragonFly: src/sys/dev/netif/lge/Makefile,v 1.3 2005/07/28 00:06:09 joerg Exp $ +# $DragonFly: src/sys/dev/netif/lge/Makefile,v 1.4 2006/06/25 11:02:38 corecode Exp $ KMOD= if_lge -SRCS= if_lge.c miibus_if.h opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS= if_lge.c miibus_if.h device_if.h bus_if.h pci_if.h KMODDEPS = miibus .include diff --git a/sys/dev/netif/nge/Makefile b/sys/dev/netif/nge/Makefile index d46e90b8f4..e7eeb7c693 100644 --- a/sys/dev/netif/nge/Makefile +++ b/sys/dev/netif/nge/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/nge/Makefile,v 1.2.2.2 2001/12/04 20:01:53 brooks Exp $ -# $DragonFly: src/sys/dev/netif/nge/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/nge/Makefile,v 1.5 2006/06/25 11:02:38 corecode Exp $ KMOD= if_nge SRCS= if_nge.c miibus_if.h device_if.h bus_if.h pci_if.h -SRCS+= opt_bdg.h opt_polling.h +SRCS+= opt_polling.h KMODDEPS = miibus .ifndef BUILDING_WITH_KERNEL diff --git a/sys/dev/netif/pcn/Makefile b/sys/dev/netif/pcn/Makefile index 55d854ccab..472340dae3 100644 --- a/sys/dev/netif/pcn/Makefile +++ b/sys/dev/netif/pcn/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/pcn/Makefile,v 1.1.2.1 2000/10/03 18:46:56 wpaul Exp $ -# $DragonFly: src/sys/dev/netif/pcn/Makefile,v 1.3 2005/07/28 00:06:10 joerg Exp $ +# $DragonFly: src/sys/dev/netif/pcn/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_pcn -SRCS = if_pcn.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_pcn.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/rl/Makefile b/sys/dev/netif/rl/Makefile index 28469de438..5313900a70 100644 --- a/sys/dev/netif/rl/Makefile +++ b/sys/dev/netif/rl/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/rl/Makefile,v 1.6 2000/01/28 11:26:34 bde Exp $ -# $DragonFly: src/sys/dev/netif/rl/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/rl/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ KMOD = if_rl SRCS = if_rl.c device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/sf/Makefile b/sys/dev/netif/sf/Makefile index bebe10096b..44ec17f1bf 100644 --- a/sys/dev/netif/sf/Makefile +++ b/sys/dev/netif/sf/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/sf/Makefile,v 1.9 2000/01/28 11:26:35 bde Exp $ -# $DragonFly: src/sys/dev/netif/sf/Makefile,v 1.3 2005/07/28 00:06:10 joerg Exp $ +# $DragonFly: src/sys/dev/netif/sf/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_sf -SRCS = if_sf.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_sf.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/sis/Makefile b/sys/dev/netif/sis/Makefile index 82bfeb85c9..0dd72bb5f6 100644 --- a/sys/dev/netif/sis/Makefile +++ b/sys/dev/netif/sis/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/sis/Makefile,v 1.6 2000/01/28 11:26:35 bde Exp $ -# $DragonFly: src/sys/dev/netif/sis/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/sis/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ KMOD = if_sis SRCS = if_sis.c device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/sk/Makefile b/sys/dev/netif/sk/Makefile index c32fd13459..c166350874 100644 --- a/sys/dev/netif/sk/Makefile +++ b/sys/dev/netif/sk/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/sk/Makefile,v 1.8.2.1 2000/04/27 20:18:34 wpaul Exp $ -# $DragonFly: src/sys/dev/netif/sk/Makefile,v 1.3 2005/07/28 00:06:10 joerg Exp $ +# $DragonFly: src/sys/dev/netif/sk/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_sk -SRCS = if_sk.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_sk.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h .include diff --git a/sys/dev/netif/ste/Makefile b/sys/dev/netif/ste/Makefile index d3305c0e99..564d17f1d3 100644 --- a/sys/dev/netif/ste/Makefile +++ b/sys/dev/netif/ste/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/ste/Makefile,v 1.7 2000/01/28 11:26:37 bde Exp $ -# $DragonFly: src/sys/dev/netif/ste/Makefile,v 1.3 2005/06/09 19:05:16 joerg Exp $ +# $DragonFly: src/sys/dev/netif/ste/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_ste -SRCS = if_ste.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_ste.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/ti/Makefile b/sys/dev/netif/ti/Makefile index 1fe611eba6..78ab1e373d 100644 --- a/sys/dev/netif/ti/Makefile +++ b/sys/dev/netif/ti/Makefile @@ -1,7 +1,7 @@ # $FreeBSD: src/sys/modules/ti/Makefile,v 1.8.2.1 2001/12/04 20:01:53 brooks Exp $ -# $DragonFly: src/sys/dev/netif/ti/Makefile,v 1.3 2005/06/14 13:34:52 joerg Exp $ +# $DragonFly: src/sys/dev/netif/ti/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_ti -SRCS = if_ti.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_ti.c device_if.h bus_if.h pci_if.h .include diff --git a/sys/dev/netif/tl/Makefile b/sys/dev/netif/tl/Makefile index 7fa6cfd87a..085fd0ef5f 100644 --- a/sys/dev/netif/tl/Makefile +++ b/sys/dev/netif/tl/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/tl/Makefile,v 1.11 2000/01/28 11:26:39 bde Exp $ -# $DragonFly: src/sys/dev/netif/tl/Makefile,v 1.3 2005/06/14 12:38:04 joerg Exp $ +# $DragonFly: src/sys/dev/netif/tl/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_tl -SRCS = if_tl.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_tl.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/tx/Makefile b/sys/dev/netif/tx/Makefile index 3754a9c99c..751741c6db 100644 --- a/sys/dev/netif/tx/Makefile +++ b/sys/dev/netif/tx/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/tx/Makefile,v 1.4.2.4 2002/10/29 01:43:50 semenu Exp $ -# $DragonFly: src/sys/dev/netif/tx/Makefile,v 1.3 2005/06/14 12:25:32 joerg Exp $ +# $DragonFly: src/sys/dev/netif/tx/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_tx -SRCS = if_tx.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS = if_tx.c device_if.h bus_if.h pci_if.h SRCS += miibus_if.h .include diff --git a/sys/dev/netif/txp/Makefile b/sys/dev/netif/txp/Makefile index 0303f51a4d..a0cc98fb44 100644 --- a/sys/dev/netif/txp/Makefile +++ b/sys/dev/netif/txp/Makefile @@ -1,7 +1,7 @@ # $FreeBSD: src/sys/modules/txp/Makefile,v 1.2.2.2 2001/12/04 20:01:54 brooks Exp $ -# $DragonFly: src/sys/dev/netif/txp/Makefile,v 1.3 2005/06/20 13:24:14 joerg Exp $ +# $DragonFly: src/sys/dev/netif/txp/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD= if_txp -SRCS= if_txp.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS= if_txp.c device_if.h bus_if.h pci_if.h .include diff --git a/sys/dev/netif/vr/Makefile b/sys/dev/netif/vr/Makefile index 376a581ffa..9e9818072a 100644 --- a/sys/dev/netif/vr/Makefile +++ b/sys/dev/netif/vr/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/vr/Makefile,v 1.8 2000/01/28 11:26:42 bde Exp $ -# $DragonFly: src/sys/dev/netif/vr/Makefile,v 1.4 2005/10/24 08:06:15 sephe Exp $ +# $DragonFly: src/sys/dev/netif/vr/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ KMOD = if_vr SRCS = if_vr.c device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/wb/Makefile b/sys/dev/netif/wb/Makefile index 94e7f4e8be..a66ac3e777 100644 --- a/sys/dev/netif/wb/Makefile +++ b/sys/dev/netif/wb/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/sys/modules/wb/Makefile,v 1.8 2000/01/28 11:26:43 bde Exp $ -# $DragonFly: src/sys/dev/netif/wb/Makefile,v 1.3 2005/06/10 16:02:47 joerg Exp $ +# $DragonFly: src/sys/dev/netif/wb/Makefile,v 1.4 2006/06/25 11:02:39 corecode Exp $ KMOD = if_wb -SRCS = if_wb.c opt_bdg.h device_if.h +SRCS = if_wb.c device_if.h SRCS += bus_if.h miibus_if.h pci_if.h KMODDEPS = miibus diff --git a/sys/dev/netif/wb/if_wb.c b/sys/dev/netif/wb/if_wb.c index be09099a5f..f6385a1e1b 100644 --- a/sys/dev/netif/wb/if_wb.c +++ b/sys/dev/netif/wb/if_wb.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_wb.c,v 1.26.2.6 2003/03/05 18:42:34 njl Exp $ - * $DragonFly: src/sys/dev/netif/wb/if_wb.c,v 1.34 2005/12/31 14:08:00 sephe Exp $ + * $DragonFly: src/sys/dev/netif/wb/if_wb.c,v 1.35 2006/06/25 11:02:39 corecode Exp $ */ /* @@ -84,8 +84,6 @@ * three of my test boards seems fine. */ -#include "opt_bdg.h" - #include #include #include diff --git a/sys/dev/netif/xe/Makefile b/sys/dev/netif/xe/Makefile index bc897ef949..ab7a9ef29d 100644 --- a/sys/dev/netif/xe/Makefile +++ b/sys/dev/netif/xe/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/xe/Makefile,v 1.1.2.1 2002/04/08 18:04:18 asmodai Exp $ -# $DragonFly: src/sys/dev/netif/xe/Makefile,v 1.4 2005/07/13 17:31:05 joerg Exp $ +# $DragonFly: src/sys/dev/netif/xe/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ KMOD = if_xe SRCS = if_xe.c if_xe_pccard.c \ - opt_bdg.h device_if.h card_if.h bus_if.h pci_if.h + device_if.h card_if.h bus_if.h pci_if.h SRCS += if_xevar.h if_xereg.h .include diff --git a/sys/dev/netif/xl/Makefile b/sys/dev/netif/xl/Makefile index 022a652633..a47b765f57 100644 --- a/sys/dev/netif/xl/Makefile +++ b/sys/dev/netif/xl/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/xl/Makefile,v 1.9 2000/01/28 11:26:45 bde Exp $ -# $DragonFly: src/sys/dev/netif/xl/Makefile,v 1.4 2005/10/24 08:06:16 sephe Exp $ +# $DragonFly: src/sys/dev/netif/xl/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ KMOD = if_xl SRCS = if_xl.c device_if.h bus_if.h pci_if.h -SRCS += opt_bdg.h opt_polling.h +SRCS += opt_polling.h SRCS += miibus_if.h KMODDEPS = miibus diff --git a/sys/emulation/ndis/Makefile b/sys/emulation/ndis/Makefile index dcebb4d1c6..e0497bb66d 100644 --- a/sys/emulation/ndis/Makefile +++ b/sys/emulation/ndis/Makefile @@ -1,9 +1,9 @@ -# $DragonFly: src/sys/emulation/ndis/Makefile,v 1.2 2004/08/13 17:51:08 dillon Exp $ +# $DragonFly: src/sys/emulation/ndis/Makefile,v 1.3 2006/06/25 11:02:39 corecode Exp $ # KMOD= ndis SRCS= subr_pe.c subr_ndis.c subr_hal.c subr_ntoskrnl.c kern_ndis.c -SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS+= device_if.h bus_if.h pci_if.h .include diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 777c889669..fda3d97cd0 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -3,7 +3,7 @@ # as much of the source tree as it can. # # $FreeBSD: src/sys/i386/conf/LINT,v 1.749.2.144 2003/06/04 17:56:59 sam Exp $ -# $DragonFly: src/sys/i386/conf/Attic/LINT,v 1.83 2006/06/23 17:26:12 eirikn Exp $ +# $DragonFly: src/sys/i386/conf/Attic/LINT,v 1.84 2006/06/25 11:02:39 corecode Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -661,11 +661,7 @@ options ICMP_BANDLIM # When you run DUMMYNET it is advisable to also have "options HZ=1000" # to achieve a smoother scheduling of the traffic. # -# BRIDGE enables bridging between ethernet cards -- see bridge(4). -# You can use IPFIREWALL and DUMMYNET together with bridging. -# options DUMMYNET -options BRIDGE # # ATM (HARP version) options diff --git a/sys/net/Makefile b/sys/net/Makefile index f0dc31264b..b74ba14bf8 100644 --- a/sys/net/Makefile +++ b/sys/net/Makefile @@ -1,8 +1,8 @@ -# $DragonFly: src/sys/net/Makefile,v 1.4 2005/12/21 16:37:15 corecode Exp $ +# $DragonFly: src/sys/net/Makefile,v 1.5 2006/06/25 11:02:39 corecode Exp $ # SUBDIR=accf_data accf_http disc ef faith gif gre sl stf tap tun \ - vlan bridge oldbridge dummynet ipfilter ipfw ip6fw ip_mroute \ + vlan bridge dummynet ipfilter ipfw ip6fw ip_mroute \ sppp ppp_layer pf .include diff --git a/sys/net/dummynet/Makefile b/sys/net/dummynet/Makefile index b3b5677dff..ac411ecbb9 100644 --- a/sys/net/dummynet/Makefile +++ b/sys/net/dummynet/Makefile @@ -1,9 +1,9 @@ # $FreeBSD: src/sys/modules/dummynet/Makefile,v 1.1.2.2 2003/04/08 10:18:00 maxim Exp $ -# $DragonFly: src/sys/net/dummynet/Makefile,v 1.2 2003/06/17 04:28:43 dillon Exp $ +# $DragonFly: src/sys/net/dummynet/Makefile,v 1.3 2006/06/25 11:02:39 corecode Exp $ .PATH: ${.CURDIR}/../../netinet KMOD= dummynet -SRCS= ip_dummynet.c opt_bdg.h +SRCS= ip_dummynet.c NOMAN= .if defined(IPFW2) CFLAGS+= -DIPFW2 diff --git a/sys/net/dummynet/ip_dummynet.c b/sys/net/dummynet/ip_dummynet.c index 2e32cf5e9f..8fbe9714bd 100644 --- a/sys/net/dummynet/ip_dummynet.c +++ b/sys/net/dummynet/ip_dummynet.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.24.2.22 2003/05/13 09:31:06 maxim Exp $ - * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.17 2006/01/14 11:05:17 swildner Exp $ + * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.18 2006/06/25 11:02:39 corecode Exp $ */ #if !defined(KLD_MODULE) @@ -85,7 +85,6 @@ #include #include /* for struct arpcom */ -#include /* * We keep a private variable for the simulation time, but we could @@ -432,13 +431,6 @@ transmit_event(struct dn_pipe *pipe) ip_input((struct mbuf *)pkt) ; break ; - case DN_TO_BDG_FWD : - if (!BDG_LOADED) { - /* somebody unloaded the bridge module. Drop pkt */ - printf("-- dropping bridged packet trapped in pipe--\n"); - m_freem(pkt->dn_m); - break; - } /* fallthrough */ case DN_TO_ETH_DEMUX: { struct mbuf *m = (struct mbuf *)pkt ; @@ -446,7 +438,7 @@ transmit_event(struct dn_pipe *pipe) if (pkt->dn_m->m_len < ETHER_HDR_LEN && (pkt->dn_m = m_pullup(pkt->dn_m, ETHER_HDR_LEN)) == NULL) { - printf("dummynet/bridge: pullup fail, dropping pkt\n"); + printf("dummynet: pullup fail, dropping pkt\n"); break; } /* @@ -454,20 +446,8 @@ transmit_event(struct dn_pipe *pipe) */ eh = mtod(pkt->dn_m, struct ether_header *); m_adj(pkt->dn_m, ETHER_HDR_LEN); - /* - * bdg_forward() wants a pointer to the pseudo-mbuf-header, but - * on return it will supply the pointer to the actual packet - * (originally pkt->dn_m, but could be something else now) if - * it has not consumed it. - */ - if (pkt->dn_dir == DN_TO_BDG_FWD) { - m = bdg_forward_ptr(m, eh, pkt->ifp); - if (m) - m_freem(m); - } else { - /* which consumes the mbuf */ - ether_demux(NULL, eh, m); - } + /* which consumes the mbuf */ + ether_demux(NULL, eh, m); } break ; case DN_TO_ETH_OUT: @@ -1064,8 +1044,7 @@ locate_flowset(int pipe_nr, struct ip_fw *rule) * dir where shall we send the packet after dummynet. * m the mbuf with the packet * ifp the 'ifp' parameter from the caller. - * NULL in ip_input, destination interface in ip_output, - * real_dst in bdg_forward + * NULL in ip_input, destination interface in ip_output * ro route parameter (only used in ip_output, NULL otherwise) * dst destination address, only used by ip_output * rule matching rule, in case of multiple passes diff --git a/sys/net/dummynet/ip_dummynet.h b/sys/net/dummynet/ip_dummynet.h index 8d935de980..5d28e9b00c 100644 --- a/sys/net/dummynet/ip_dummynet.h +++ b/sys/net/dummynet/ip_dummynet.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_dummynet.h,v 1.10.2.9 2003/05/13 09:31:06 maxim Exp $ - * $DragonFly: src/sys/net/dummynet/ip_dummynet.h,v 1.4 2006/05/21 03:43:46 dillon Exp $ + * $DragonFly: src/sys/net/dummynet/ip_dummynet.h,v 1.5 2006/06/25 11:02:39 corecode Exp $ */ #ifndef _IP_DUMMYNET_H @@ -115,7 +115,7 @@ struct dn_heap { /* * struct dn_pkt identifies a packet in the dummynet queue, but * is also used to tag packets passed back to the various destinations - * (ip_input(), ip_output(), bdg_forward() and so on). + * (ip_input(), ip_output() and so on). * As such the first part of the structure must be a struct m_hdr, * followed by dummynet-specific parameters. The m_hdr must be * initialized with @@ -136,7 +136,6 @@ struct dn_pkt { int dn_dir; /* action when packet comes out. */ #define DN_TO_IP_OUT 1 #define DN_TO_IP_IN 2 -#define DN_TO_BDG_FWD 3 #define DN_TO_ETH_DEMUX 4 #define DN_TO_ETH_OUT 5 diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7839bacae3..66a6fce604 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -32,14 +32,13 @@ * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.33 2003/04/28 15:45:53 archie Exp $ - * $DragonFly: src/sys/net/if_ethersubr.c,v 1.35 2005/12/21 16:37:15 corecode Exp $ + * $DragonFly: src/sys/net/if_ethersubr.c,v 1.36 2006/06/25 11:02:39 corecode Exp $ */ #include "opt_atalk.h" #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipx.h" -#include "opt_bdg.h" #include "opt_netgraph.h" #include @@ -60,7 +59,6 @@ #include #include #include -#include #if defined(INET) || defined(INET6) #include @@ -117,14 +115,8 @@ static int ether_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); /* - * bridge support + * if_bridge support */ -int do_bridge; -bridge_in_t *bridge_in_ptr; -bdg_forward_t *bdg_forward_ptr; -bdgtakeifaces_t *bdgtakeifaces_ptr; -struct bdg_softc *ifp2sc; - struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *); int (*bridge_output_p)(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); @@ -372,7 +364,7 @@ bad: * Ethernet link layer output routine to send a raw frame to the device. * * This assumes that the 14 byte Ethernet header is present and contiguous - * in the first mbuf (if BRIDGE'ing). + * in the first mbuf. */ int ether_output_frame(struct ifnet *ifp, struct mbuf *m) @@ -391,23 +383,7 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m) } m = m->m_next; } - if (rule != NULL) /* packet was already bridged */ - goto no_bridge; - - if (BDG_ACTIVE(ifp)) { - struct ether_header *eh; /* a pointer suffices */ - - m->m_pkthdr.rcvif = NULL; - eh = mtod(m, struct ether_header *); - m_adj(m, ETHER_HDR_LEN); - lwkt_serialize_exit(ifp->if_serializer); - m = bdg_forward_ptr(m, eh, ifp); - lwkt_serialize_enter(ifp->if_serializer); - m_freem(m); - return (0); - } -no_bridge: if (ifq_is_enabled(&ifp->if_snd)) altq_etherclassify(&ifp->if_snd, m, &pktattr); crit_enter(); @@ -454,9 +430,7 @@ no_bridge: /* * ipfw processing for ethernet packets (in and out). * The second parameter is NULL from ether_demux(), and ifp from - * ether_output_frame(). This section of code could be used from - * bridge.c as well as long as we use some extra info - * to distinguish that case from ether_output_frame(). + * ether_output_frame(). */ static boolean_t ether_ipfw_chk( @@ -643,41 +617,6 @@ ether_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) return; } - /* Check for bridging mode */ - if (BDG_ACTIVE(ifp)) { - struct ifnet *bif; - - /* Check with bridging code */ - if ((bif = bridge_in_ptr(ifp, eh)) == BDG_DROP) { - m_freem(m); - return; - } - if (bif != BDG_LOCAL) { - save_eh = *eh ; /* because it might change */ - lwkt_serialize_exit(ifp->if_serializer); - m = bdg_forward_ptr(m, eh, bif); /* needs forwarding */ - lwkt_serialize_enter(ifp->if_serializer); - /* - * Do not continue if bdg_forward_ptr() processed our - * packet (and cleared the mbuf pointer m) or if - * it dropped (m_free'd) the packet itself. - */ - if (m == NULL) { - if (bif == BDG_BCAST || bif == BDG_MCAST) - printf("bdg_forward drop MULTICAST PKT\n"); - return; - } - eh = &save_eh ; - } - if (bif == BDG_LOCAL || bif == BDG_BCAST || bif == BDG_MCAST) - goto recvLocal; /* receive locally */ - - /* If not local and not multicast, just drop it */ - m_freem(m); - return; - } - -recvLocal: /* Continue with upper layer processing */ ether_demux(ifp, eh, m); } @@ -704,7 +643,7 @@ ether_demux(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) } m = m->m_next; } - if (rule) /* packet was already bridged */ + if (rule) /* packet is passing the second time */ goto post_stats; /* @@ -713,8 +652,7 @@ ether_demux(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) * driver is working properly, then this situation can only * happen when the interface is in promiscuous mode. */ - if (!BDG_ACTIVE(ifp) && - ((ifp->if_flags & (IFF_PROMISC | IFF_PPROMISC)) == IFF_PROMISC) && + if (((ifp->if_flags & (IFF_PROMISC | IFF_PPROMISC)) == IFF_PROMISC) && (eh->ether_dhost[0] & 1) == 0 && bcmp(eh->ether_dhost, IFP2AC(ifp)->ac_enaddr, ETHER_ADDR_LEN)) { m_freem(m); @@ -895,8 +833,6 @@ ether_ifattach_bpf(struct ifnet *ifp, uint8_t *lla, u_int dlt, u_int hdrlen, bpfattach(ifp, dlt, hdrlen); if (ng_ether_attach_p != NULL) (*ng_ether_attach_p)(ifp); - if (BDG_LOADED) - bdgtakeifaces_ptr(); if_printf(ifp, "MAC address: %6D\n", lla, ":"); } @@ -913,8 +849,6 @@ ether_ifdetach(struct ifnet *ifp) (*ng_ether_detach_p)(ifp); bpfdetach(ifp); if_detach(ifp); - if (BDG_LOADED) - bdgtakeifaces_ptr(); } int diff --git a/sys/net/ipfw/ip_fw.c b/sys/net/ipfw/ip_fw.c index 0f123868cd..e0fa90710d 100644 --- a/sys/net/ipfw/ip_fw.c +++ b/sys/net/ipfw/ip_fw.c @@ -14,7 +14,7 @@ * This software is provided ``AS IS'' without any warranties of any kind. * * $FreeBSD: src/sys/netinet/ip_fw.c,v 1.131.2.39 2003/01/20 02:23:07 iedowse Exp $ - * $DragonFly: src/sys/net/ipfw/Attic/ip_fw.c,v 1.15 2005/12/11 13:00:16 swildner Exp $ + * $DragonFly: src/sys/net/ipfw/Attic/ip_fw.c,v 1.16 2006/06/25 11:02:39 corecode Exp $ */ #define DEB(x) @@ -1100,16 +1100,7 @@ ip_fw_chk(struct ip_fw_args *args) int direction = MATCH_FORWARD ; /* dirty trick... */ struct ipfw_dyn_rule *q = NULL ; - /* Special hack for bridging (as usual) */ -#define BRIDGED (args->eh != NULL) - if (BRIDGED) { /* this is a bridged packet */ - if ( (*m)->m_pkthdr.len >= sizeof(struct ip) && - ntohs(args->eh->ether_type) == ETHERTYPE_IP) - hlen = ip->ip_hl << 2; - else - return 0; /* XXX ipfw1 always accepts non-ip pkts */ - } else - hlen = ip->ip_hl << 2; + hlen = ip->ip_hl << 2; /* Grab and reset cookie */ if ((mtag = m_tag_find(*m, PACKET_TAG_IPFW_DIVERT, NULL)) != NULL) { @@ -1135,13 +1126,8 @@ ip_fw_chk(struct ip_fw_args *args) proto = ip->ip_p; src_ip = ip->ip_src; dst_ip = ip->ip_dst; - if (BRIDGED) { /* bridged packets are as on the wire */ - ip_off = ntohs(ip->ip_off); - ip_len = ntohs(ip->ip_len); - } else { - ip_off = ip->ip_off; - ip_len = ip->ip_len; - } + ip_off = ip->ip_off; + ip_len = ip->ip_len; offset = ip_off & IP_OFFMASK; if (offset == 0) { switch (proto) { @@ -1242,10 +1228,6 @@ again: continue ; } - /* Check if rule only valid for bridged packets */ - if ((f->fw_flg & IP_FW_BRIDGED) != 0 && !(BRIDGED)) - continue; - if (oif) { /* Check direction outbound */ if (!(f->fw_flg & IP_FW_F_OUT)) @@ -1561,11 +1543,6 @@ got_match: && (proto != IPPROTO_ICMP || is_icmp_query(ip)) && !((*m)->m_flags & (M_BCAST|M_MCAST)) && !IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { - /* Must convert to host order for icmp_error() etc. */ - if (BRIDGED) { - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); - } switch (f->fw_reject_code) { case IP_FW_REJECT_RST: { @@ -1608,7 +1585,6 @@ dropit: * Finally, drop the packet. */ return(IP_FW_PORT_DENY_FLAG); -#undef BRIDGED } /* diff --git a/sys/net/ipfw/ip_fw.h b/sys/net/ipfw/ip_fw.h index c7b9fc659e..8829e292c4 100644 --- a/sys/net/ipfw/ip_fw.h +++ b/sys/net/ipfw/ip_fw.h @@ -12,7 +12,7 @@ * This software is provided ``AS IS'' without any warranties of any kind. * * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.47.2.11 2002/07/09 09:11:42 luigi Exp $ - * $DragonFly: src/sys/net/ipfw/ip_fw.h,v 1.6 2005/04/18 14:26:57 joerg Exp $ + * $DragonFly: src/sys/net/ipfw/ip_fw.h,v 1.7 2006/06/25 11:02:39 corecode Exp $ */ #ifndef _IP_FW_H @@ -250,7 +250,7 @@ struct ipfw_dyn_rule { #define IP_FW_F_RND_MATCH 0x00800000 /* probabilistic rule match */ #define IP_FW_F_SMSK 0x01000000 /* src-port + mask */ #define IP_FW_F_DMSK 0x02000000 /* dst-port + mask */ -#define IP_FW_BRIDGED 0x04000000 /* only match bridged packets */ +#define IP_FW_UNUSED0 0x04000000 #define IP_FW_F_KEEP_S 0x08000000 /* keep state */ #define IP_FW_F_CHECK_S 0x10000000 /* check state */ #define IP_FW_F_SME 0x20000000 /* source = me */ diff --git a/sys/net/ipfw/ip_fw2.c b/sys/net/ipfw/ip_fw2.c index 083d770053..8f8b155b1f 100644 --- a/sys/net/ipfw/ip_fw2.c +++ b/sys/net/ipfw/ip_fw2.c @@ -23,7 +23,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.6.2.12 2003/04/08 10:42:32 maxim Exp $ - * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.18 2006/06/14 04:39:05 y0netan1 Exp $ + * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.19 2006/06/25 11:02:39 corecode Exp $ */ #define DEB(x) @@ -1243,7 +1243,7 @@ ipfw_chk(struct ip_fw_args *args) /* * oif | args->oif If NULL, ipfw_chk has been called on the - * inbound path (ether_input, bdg_forward, ip_input). + * inbound path (ether_input, ip_input). * If non-NULL, ipfw_chk has been called on the outbound path * (ether_output, ip_output). */ diff --git a/sys/net/oldbridge/Makefile b/sys/net/oldbridge/Makefile deleted file mode 100644 index 4aa266a3bd..0000000000 --- a/sys/net/oldbridge/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: src/sys/modules/bridge/Makefile,v 1.1.2.1 2001/11/03 00:42:01 luigi Exp $ -# $DragonFly: src/sys/net/oldbridge/Attic/Makefile,v 1.3 2005/12/19 00:07:02 corecode Exp $ - -.PATH: ${.CURDIR}/../../net -KMOD= bridge -SRCS= bridge.c -NOMAN= - -.include diff --git a/sys/net/oldbridge/bridge.c b/sys/net/oldbridge/bridge.c deleted file mode 100644 index e38bdc5d0e..0000000000 --- a/sys/net/oldbridge/bridge.c +++ /dev/null @@ -1,1154 +0,0 @@ -/* - * Copyright (c) 1998-2002 Luigi Rizzo - * - * Work partly supported by: Cisco Systems, Inc. - NSITE lab, RTP, NC - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/net/bridge.c,v 1.16.2.25 2003/01/23 21:06:44 sam Exp $ - * $DragonFly: src/sys/net/oldbridge/Attic/bridge.c,v 1.21 2005/12/19 00:07:02 corecode Exp $ - */ - -/* - * This code implements bridging in FreeBSD. It only acts on ethernet - * interfaces, including VLANs (others are still usable for routing). - * A FreeBSD host can implement multiple logical bridges, called - * "clusters". Each cluster is made of a set of interfaces, and - * identified by a "cluster-id" which is a number in the range 1..2^16-1. - * - * Bridging is enabled by the sysctl variable - * net.link.ether.bridge - * the grouping of interfaces into clusters is done with - * net.link.ether.bridge_cfg - * containing a list of interfaces each optionally followed by - * a colon and the cluster it belongs to (1 is the default). - * Separators can be * spaces, commas or tabs, e.g. - * net.link.ether.bridge_cfg="fxp0:2 fxp1:2 dc0 dc1:1" - * Optionally bridged packets can be passed through the firewall, - * this is controlled by the variable - * net.link.ether.bridge_ipfw - * - * For each cluster there is a descriptor (cluster_softc) storing - * the following data structures: - * - a hash table with the MAC address and destination interface for each - * known node. The table is indexed using a hash of the source address. - * - an array with the MAC addresses of the interfaces used in the cluster. - * - * Input packets are tapped near the beginning of ether_input(), and - * analysed by bridge_in(). Depending on the result, the packet - * can be forwarded to one or more output interfaces using bdg_forward(), - * and/or sent to the upper layer (e.g. in case of multicast). - * - * Output packets are intercepted near the end of ether_output(). - * The correct destination is selected by bridge_dst_lookup(), - * and then forwarding is done by bdg_forward(). - * - * The arp code is also modified to let a machine answer to requests - * irrespective of the port the request came from. - * - * In case of loops in the bridging topology, the bridge detects this - * event and temporarily mutes output bridging on one of the ports. - * Periodically, interfaces are unmuted by bdg_timeout(). - * Muting is only implemented as a safety measure, and also as - * a mechanism to support a user-space implementation of the spanning - * tree algorithm. - * - * To build a bridging kernel, use the following option - * option BRIDGE - * and then at runtime set the sysctl variable to enable bridging. - * - * Only one interface per cluster is supposed to have addresses set (but - * there are no substantial problems if you set addresses for none or - * for more than one interface). - * Bridging will act before routing, but nothing prevents a machine - * from doing both (modulo bugs in the implementation...). - * - * THINGS TO REMEMBER - * - bridging is incompatible with multicast routing on the same - * machine. There is not an easy fix to this. - * - be very careful when bridging VLANs - * - loop detection is still not very robust. - */ - -#include -#include -#include -#include -#include /* for net/if.h */ -#include /* string functions */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include /* for struct arpcom */ -#include -#include -#include -#include -#include /* for struct arpcom */ - -#include -#include -#include -#include "bridge.h" - -/*--------------------*/ - -/* - * For each cluster, source MAC addresses are stored into a hash - * table which locates the port they reside on. - */ -#define HASH_SIZE 8192 /* Table size, must be a power of 2 */ - -typedef struct hash_table { /* each entry. */ - struct ifnet * name; - u_char etheraddr[6]; - u_int16_t used; /* also, padding */ -} bdg_hash_table ; - -/* - * The hash function applied to MAC addresses. Out of the 6 bytes, - * the last ones tend to vary more. Since we are on a little endian machine, - * we have to do some gimmick... - */ -#define HASH_FN(addr) ( \ - ntohs( ((u_int16_t *)addr)[1] ^ ((u_int16_t *)addr)[2] ) & (HASH_SIZE -1)) - -/* - * This is the data structure where local addresses are stored. - */ -struct bdg_addr { - u_char etheraddr[6] ; - u_int16_t _padding ; -}; - -/* - * The configuration of each cluster includes the cluster id, a pointer to - * the hash table, and an array of local MAC addresses (of size "ports"). - */ -struct cluster_softc { - u_int16_t cluster_id; - u_int16_t ports; - bdg_hash_table *ht; - struct bdg_addr *my_macs; /* local MAC addresses */ -}; - - -extern struct protosw inetsw[]; /* from netinet/ip_input.c */ - -static int n_clusters; /* number of clusters */ -static struct cluster_softc *clusters; - -#define BDG_MUTED(ifp) (ifp2sc[ifp->if_index].flags & IFF_MUTE) -#define BDG_MUTE(ifp) ifp2sc[ifp->if_index].flags |= IFF_MUTE -#define BDG_CLUSTER(ifp) (ifp2sc[ifp->if_index].cluster) - -#define BDG_SAMECLUSTER(ifp,src) \ - (src == NULL || BDG_CLUSTER(ifp) == BDG_CLUSTER(src) ) - -#ifdef __i386__ -#define BDG_MATCH(a,b) ( \ - ((u_int16_t *)(a))[2] == ((u_int16_t *)(b))[2] && \ - *((u_int32_t *)(a)) == *((u_int32_t *)(b)) ) -#define IS_ETHER_BROADCAST(a) ( \ - *((u_int32_t *)(a)) == 0xffffffff && \ - ((u_int16_t *)(a))[2] == 0xffff ) -#else -/* for machines that do not support unaligned access */ -#define BDG_MATCH(a,b) (!bcmp(a, b, ETHER_ADDR_LEN) ) -#define IS_ETHER_BROADCAST(a) (!bcmp(a, "\377\377\377\377\377\377", 6)) -#endif - - -/* - * For timing-related debugging, you can use the following macros. - * remember, rdtsc() only works on Pentium-class machines - - quad_t ticks; - DDB(ticks = rdtsc();) - ... interesting code ... - DDB(bdg_fw_ticks += (u_long)(rdtsc() - ticks) ; bdg_fw_count++ ;) - - * - */ - -#define DDB(x) x -#define DEB(x) - -static int bdginit(void); -static void parse_bdg_cfg(void); - -static int bdg_pfil; /* PFIL hooks enabled in bridge */ -static int bdg_ipfw; - -#if 0 /* debugging only */ -static char *bdg_dst_names[] = { - "BDG_NULL ", - "BDG_BCAST ", - "BDG_MCAST ", - "BDG_LOCAL ", - "BDG_DROP ", - "BDG_UNKNOWN ", - "BDG_IN ", - "BDG_OUT ", - "BDG_FORWARD " }; -#endif -/* - * System initialization - */ - -static struct bdg_stats bdg_stats ; -static struct callout bdg_timeout_h ; - -/* - * Add an interface to a cluster, possibly creating a new entry in - * the cluster table. This requires reallocation of the table and - * updating pointers in ifp2sc. - */ -static struct cluster_softc * -add_cluster(u_int16_t cluster_id, struct arpcom *ac) -{ - struct cluster_softc *c = NULL; - int i; - - for (i = 0; i < n_clusters ; i++) - if (clusters[i].cluster_id == cluster_id) - goto found; - - /* Not found, need to reallocate */ - c = malloc((1+n_clusters) * sizeof (*c), M_IFADDR, M_WAITOK | M_ZERO); - c[n_clusters].ht = malloc(HASH_SIZE * sizeof(struct hash_table), - M_IFADDR, M_WAITOK | M_ZERO); - c[n_clusters].my_macs = malloc(BDG_MAX_PORTS * sizeof(struct bdg_addr), - M_IFADDR, M_WAITOK | M_ZERO); - - c[n_clusters].cluster_id = cluster_id; - c[n_clusters].ports = 0; - /* - * now copy old descriptors here - */ - if (n_clusters > 0) { - for (i=0; i < n_clusters; i++) - c[i] = clusters[i]; - /* - * and finally update pointers in ifp2sc - */ - for (i = 0 ; i < if_index && i < BDG_MAX_PORTS; i++) - if (ifp2sc[i].cluster != NULL) - ifp2sc[i].cluster = c + (ifp2sc[i].cluster - clusters); - free(clusters, M_IFADDR); - } - clusters = c; - i = n_clusters; /* index of cluster entry */ - n_clusters++; -found: - c = clusters + i; /* the right cluster ... */ - bcopy(ac->ac_enaddr, &(c->my_macs[c->ports]), 6); - c->ports++; - return c; -} - - -/* - * Turn off bridging, by clearing promisc mode on the interface, - * marking the interface as unused, and clearing the name in the - * stats entry. - * Also dispose the hash tables associated with the clusters. - */ -static void -bridge_off(void) -{ - struct ifnet *ifp ; - int i; - - DEB(printf("bridge_off: n_clusters %d\n", n_clusters);) - TAILQ_FOREACH(ifp, &ifnet, if_link) { - struct bdg_softc *b; - - if (ifp->if_index >= BDG_MAX_PORTS) - continue; /* make sure we do not go beyond the end */ - b = &(ifp2sc[ifp->if_index]); - - if ( b->flags & IFF_BDG_PROMISC ) { - crit_enter(); - ifpromisc(ifp, 0); - crit_exit(); - b->flags &= ~(IFF_BDG_PROMISC|IFF_MUTE) ; - DEB(printf(">> now %s promisc OFF if_flags 0x%x bdg_flags 0x%x\n", - ifp->if_xname, - ifp->if_flags, b->flags);) - } - b->flags &= ~(IFF_USED) ; - b->cluster = NULL; - bdg_stats.s[ifp->if_index].name[0] = '\0'; - } - /* flush_tables */ - - crit_enter(); - for (i=0; i < n_clusters; i++) { - free(clusters[i].ht, M_IFADDR); - free(clusters[i].my_macs, M_IFADDR); - } - if (clusters != NULL) - free(clusters, M_IFADDR); - clusters = NULL; - n_clusters =0; - crit_exit(); -} - -/* - * set promisc mode on the interfaces we use. - */ -static void -bridge_on(void) -{ - struct ifnet *ifp ; - - TAILQ_FOREACH(ifp, &ifnet, if_link) { - struct bdg_softc *b = &ifp2sc[ifp->if_index]; - - if ( !(b->flags & IFF_USED) ) - continue ; - if ( !( ifp->if_flags & IFF_UP) ) { - crit_enter(); - if_up(ifp); - crit_exit(); - } - if ( !(b->flags & IFF_BDG_PROMISC) ) { - int ret ; - crit_enter(); - ret = ifpromisc(ifp, 1); - crit_exit(); - b->flags |= IFF_BDG_PROMISC ; - DEB(printf(">> now %s promisc ON if_flags 0x%x bdg_flags 0x%x\n", - ifp->if_xname, - ifp->if_flags, b->flags);) - } - if (b->flags & IFF_MUTE) { - DEB(printf(">> unmuting %s\n", ifp->if_xname);) - b->flags &= ~IFF_MUTE; - } - } -} - -/** - * reconfigure bridge. - * This is also done every time we attach or detach an interface. - * Main use is to make sure that we do not bridge on some old - * (ejected) device. So, it would be really useful to have a - * pointer to the modified device as an argument. Without it, we - * have to scan all interfaces. - */ -static void -reconfigure_bridge(void) -{ - bridge_off(); - if (do_bridge) { - if (if_index >= BDG_MAX_PORTS) { - printf("-- sorry too many interfaces (%d, max is %d)," - " disabling bridging\n", if_index, BDG_MAX_PORTS); - do_bridge=0; - return; - } - parse_bdg_cfg(); - bridge_on(); - } -} - -static char bridge_cfg[1024]; /* in BSS so initialized to all NULs */ - -/* - * parse the config string, set IFF_USED, name and cluster_id - * for all interfaces found. - * The config string is a list of "if[:cluster]" with - * a number of possible separators (see "sep"). In particular the - * use of the space lets you set bridge_cfg with the output from - * "ifconfig -l" - */ -static void -parse_bdg_cfg(void) -{ - char *p, *beg ; - int l, cluster; - static char *sep = ", \t"; - - for (p = bridge_cfg; *p ; p++) { - struct ifnet *ifp; - int found = 0; - char c; - - if (index(sep, *p)) /* skip separators */ - continue ; - /* names are lowercase and digits */ - for ( beg = p ; islower(*p) || isdigit(*p) ; p++ ) - ; - l = p - beg ; /* length of name string */ - if (l == 0) /* invalid name */ - break ; - if ( *p != ':' ) /* no ':', assume default cluster 1 */ - cluster = 1 ; - else /* fetch cluster */ - cluster = strtoul( p+1, &p, 10); - c = *p; - *p = '\0'; - /* - * now search in interface list for a matching name - */ - TAILQ_FOREACH(ifp, &ifnet, if_link) { - char buf[IFNAMSIZ]; - - snprintf(buf, sizeof(buf), "%s", ifp->if_xname); - if (!strncmp(beg, buf, max(l, strlen(buf)))) { - struct bdg_softc *b = &ifp2sc[ifp->if_index]; - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) { - printf("%s is not an ethernet, continue\n", buf); - continue; - } - if (b->flags & IFF_USED) { - printf("%s already used, skipping\n", buf); - break; - } - b->cluster = add_cluster(htons(cluster), (struct arpcom *)ifp); - b->flags |= IFF_USED ; - sprintf(bdg_stats.s[ifp->if_index].name, - "%s:%d", ifp->if_xname, cluster); - - DEB(printf("--++ found %s next c %d\n", - bdg_stats.s[ifp->if_index].name, c);) - found = 1; - break ; - } - } - if (!found) - printf("interface %s Not found in bridge\n", beg); - *p = c; - if (c == '\0') - break; /* no more */ - } -} - - -/* - * handler for net.link.ether.bridge - */ -static int -sysctl_bdg(SYSCTL_HANDLER_ARGS) -{ - int error, oldval = do_bridge ; - - error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); - DEB( printf("called sysctl for bridge name %s arg2 %d val %d->%d\n", - oidp->oid_name, oidp->oid_arg2, - oldval, do_bridge); ) - - if (oldval != do_bridge) - reconfigure_bridge(); - return error ; -} - -/* - * handler for net.link.ether.bridge_cfg - */ -static int -sysctl_bdg_cfg(SYSCTL_HANDLER_ARGS) -{ - int error = 0 ; - char old_cfg[1024] ; - - strcpy(old_cfg, bridge_cfg) ; - - error = sysctl_handle_string(oidp, bridge_cfg, oidp->oid_arg2, req); - DEB( - printf("called sysctl for bridge name %s arg2 %d err %d val %s->%s\n", - oidp->oid_name, oidp->oid_arg2, - error, - old_cfg, bridge_cfg); - ) - if (strcmp(old_cfg, bridge_cfg)) - reconfigure_bridge(); - return error ; -} - -static int -sysctl_refresh(SYSCTL_HANDLER_ARGS) -{ - if (req->newptr) - reconfigure_bridge(); - - return 0; -} - - -SYSCTL_DECL(_net_link_ether); -SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge_cfg, CTLTYPE_STRING|CTLFLAG_RW, - &bridge_cfg, sizeof(bridge_cfg), &sysctl_bdg_cfg, "A", - "Bridge configuration"); - -SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge, CTLTYPE_INT|CTLFLAG_RW, - &do_bridge, 0, &sysctl_bdg, "I", "Bridging"); - -SYSCTL_INT(_net_link_ether, OID_AUTO, bridge_ipfw, CTLFLAG_RW, - &bdg_ipfw,0,"Pass bridged pkts through IPFW"); - -SYSCTL_INT(_net_link_ether, OID_AUTO, bridge_pfil, CTLFLAG_RW, - &bdg_pfil, 0,"Pass bridged pkts through PFIL hooks"); - -/* - * The follow macro declares a variable, and maps it to - * a SYSCTL_INT entry with the same name. - */ -#define SY(parent, var, comment) \ - static int var ; \ - SYSCTL_INT(parent, OID_AUTO, var, CTLFLAG_RW, &(var), 0, comment); - -int bdg_ipfw_drops; -SYSCTL_INT(_net_link_ether, OID_AUTO, bridge_ipfw_drop, - CTLFLAG_RW, &bdg_ipfw_drops,0,""); - -int bdg_ipfw_colls; -SYSCTL_INT(_net_link_ether, OID_AUTO, bridge_ipfw_collisions, - CTLFLAG_RW, &bdg_ipfw_colls,0,""); - -SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge_refresh, CTLTYPE_INT|CTLFLAG_WR, - NULL, 0, &sysctl_refresh, "I", "iface refresh"); - -#if 1 /* diagnostic vars */ - -SY(_net_link_ether, verbose, "Be verbose"); -SY(_net_link_ether, bdg_split_pkts, "Packets split in bdg_forward"); - -SY(_net_link_ether, bdg_thru, "Packets through bridge"); - -SY(_net_link_ether, bdg_copied, "Packets copied in bdg_forward"); - -SY(_net_link_ether, bdg_copy, "Force copy in bdg_forward"); -SY(_net_link_ether, bdg_predict, "Correctly predicted header location"); - -SY(_net_link_ether, bdg_fw_avg, "Cycle counter avg"); -SY(_net_link_ether, bdg_fw_ticks, "Cycle counter item"); -SY(_net_link_ether, bdg_fw_count, "Cycle counter count"); -#endif - -SYSCTL_STRUCT(_net_link_ether, PF_BDG, bdgstats, - CTLFLAG_RD, &bdg_stats , bdg_stats, "bridge statistics"); - -static int bdg_loops ; - -/* - * called periodically to flush entries etc. - */ -static void -bdg_timeout(void *dummy) -{ - static int slowtimer; /* in BSS so initialized to 0 */ - - if (do_bridge) { - static int age_index = 0 ; /* index of table position to age */ - int l = age_index + HASH_SIZE/4 ; - int i; - /* - * age entries in the forwarding table. - */ - if (l > HASH_SIZE) - l = HASH_SIZE ; - - for (i=0; i= HASH_SIZE) - age_index = 0 ; - - if (--slowtimer <= 0 ) { - slowtimer = 5 ; - - bridge_on() ; /* we just need unmute, really */ - bdg_loops = 0 ; - } - } - callout_reset(&bdg_timeout_h, 2*hz, bdg_timeout, NULL); -} - -/* - * Find the right pkt destination: - * BDG_BCAST is a broadcast - * BDG_MCAST is a multicast - * BDG_LOCAL is for a local address - * BDG_DROP must be dropped - * other ifp of the dest. interface (incl.self) - * - * We assume this is only called for interfaces for which bridging - * is enabled, i.e. BDG_USED(ifp) is true. - */ -static __inline -struct ifnet * -bridge_dst_lookup(struct ether_header *eh, struct cluster_softc *c) -{ - struct ifnet *dst ; - int index ; - struct bdg_addr *p ; - bdg_hash_table *bt; /* pointer to entry in hash table */ - - if (IS_ETHER_BROADCAST(eh->ether_dhost)) - return BDG_BCAST ; - if (eh->ether_dhost[0] & 1) - return BDG_MCAST ; - /* - * Lookup local addresses in case one matches. - */ - for (index = c->ports, p = c->my_macs; index ; index--, p++ ) - if (BDG_MATCH(p->etheraddr, eh->ether_dhost) ) - return BDG_LOCAL ; - /* - * Look for a possible destination in table - */ - index= HASH_FN( eh->ether_dhost ); - bt = &(c->ht[index]); - dst = bt->name; - if ( dst && BDG_MATCH( bt->etheraddr, eh->ether_dhost) ) - return dst ; - else - return BDG_UNKNOWN ; -} - -/** - * bridge_in() is invoked to perform bridging decision on input packets. - * - * On Input: - * eh Ethernet header of the incoming packet. - * ifp interface the packet is coming from. - * - * On Return: destination of packet, one of - * BDG_BCAST broadcast - * BDG_MCAST multicast - * BDG_LOCAL is only for a local address (do not forward) - * BDG_DROP drop the packet - * ifp ifp of the destination interface. - * - * Forwarding is not done directly to give a chance to some drivers - * to fetch more of the packet, or simply drop it completely. - */ - -static struct ifnet * -bridge_in(struct ifnet *ifp, struct ether_header *eh) -{ - int index; - struct ifnet *dst , *old ; - bdg_hash_table *bt; /* location in hash table */ - int dropit = BDG_MUTED(ifp) ; - - /* - * hash the source address - */ - index= HASH_FN(eh->ether_shost); - bt = &(ifp2sc[ifp->if_index].cluster->ht[index]); - bt->used = 1 ; - old = bt->name ; - if ( old ) { /* the entry is valid. */ - if (!BDG_MATCH( eh->ether_shost, bt->etheraddr) ) { - bdg_ipfw_colls++ ; - bt->name = NULL ; - } else if (old != ifp) { - /* - * Found a loop. Either a machine has moved, or there - * is a misconfiguration/reconfiguration of the network. - * First, do not forward this packet! - * Record the relocation anyways; then, if loops persist, - * suspect a reconfiguration and disable forwarding - * from the old interface. - */ - bt->name = ifp ; /* relocate address */ - printf("-- loop (%d) %6D to %s from %s (%s)\n", - bdg_loops, eh->ether_shost, ".", - ifp->if_xname, old->if_xname, - BDG_MUTED(old) ? "muted":"active"); - dropit = 1 ; - if ( !BDG_MUTED(old) ) { - if (++bdg_loops > 10) - BDG_MUTE(old) ; - } - } - } - - /* - * now write the source address into the table - */ - if (bt->name == NULL) { - DEB(printf("new addr %6D at %d for %s\n", - eh->ether_shost, ".", index, ifp->if_xname);) - bcopy(eh->ether_shost, bt->etheraddr, 6); - bt->name = ifp ; - } - dst = bridge_dst_lookup(eh, ifp2sc[ifp->if_index].cluster); - /* - * bridge_dst_lookup can return the following values: - * BDG_BCAST, BDG_MCAST, BDG_LOCAL, BDG_UNKNOWN, BDG_DROP, ifp. - * For muted interfaces, or when we detect a loop, the first 3 are - * changed in BDG_LOCAL (we still listen to incoming traffic), - * and others to BDG_DROP (no use for the local host). - * Also, for incoming packets, ifp is changed to BDG_DROP if ifp == src. - * These changes are not necessary for outgoing packets from ether_output(). - */ - BDG_STAT(ifp, BDG_IN); - switch ((uintptr_t)dst) { - case (uintptr_t)BDG_BCAST: - case (uintptr_t)BDG_MCAST: - case (uintptr_t)BDG_LOCAL: - case (uintptr_t)BDG_UNKNOWN: - case (uintptr_t)BDG_DROP: - BDG_STAT(ifp, dst); - break ; - default : - if (dst == ifp || dropit) - BDG_STAT(ifp, BDG_DROP); - else - BDG_STAT(ifp, BDG_FORWARD); - break ; - } - - if ( dropit ) { - if (dst == BDG_BCAST || dst == BDG_MCAST || dst == BDG_LOCAL) - dst = BDG_LOCAL ; - else - dst = BDG_DROP ; - } else { - if (dst == ifp) - dst = BDG_DROP; - } - DEB(printf("bridge_in %6D ->%6D ty 0x%04x dst %s\n", - eh->ether_shost, ".", - eh->ether_dhost, ".", - ntohs(eh->ether_type), - (dst <= BDG_FORWARD) ? bdg_dst_names[(int)dst]"0" : - dst->if_xname); ) - - return dst ; -} - -/* - * Forward a packet to dst -- which can be a single interface or - * an entire cluster. The src port and muted interfaces are excluded. - * - * If src == NULL, the pkt comes from ether_output, and dst is the real - * interface the packet is originally sent to. In this case, we must forward - * it to the whole cluster. - * We never call bdg_forward from ether_output on interfaces which are - * not part of a cluster. - * - * If possible (i.e. we can determine that the caller does not need - * a copy), the packet is consumed here, and bdg_forward returns NULL. - * Otherwise, a pointer to a copy of the packet is returned. - * - * XXX be careful with eh, it can be a pointer into *m - */ -static struct mbuf * -bdg_forward(struct mbuf *m0, struct ether_header *const eh, struct ifnet *dst) -{ - struct ifnet *src; - struct ifnet *ifp, *last; - int shared = bdg_copy ; /* someone else is using the mbuf */ - int error, once = 0; /* loop only once */ - struct ifnet *real_dst = dst ; /* real dst from ether_output */ - struct ip_fw_args args; - struct m_tag *mtag; - - /* - * XXX eh is usually a pointer within the mbuf (some ethernet drivers - * do that), so we better copy it before doing anything with the mbuf, - * or we might corrupt the header. - */ - struct ether_header save_eh = *eh ; - - DEB(quad_t ticks; ticks = rdtsc();) - - args.rule = NULL; /* did we match a firewall rule ? */ - /* Fetch state from dummynet tag, ignore others */ - for (;m0->m_type == MT_TAG; m0 = m0->m_next) - if (m0->_m_tag_id == PACKET_TAG_DUMMYNET) { - args.rule = ((struct dn_pkt *)m0)->rule; - shared = 0; /* For sure this is our own mbuf. */ - } - if (args.rule == NULL) - bdg_thru++; /* first time through bdg_forward, count packet */ - - src = m0->m_pkthdr.rcvif; - if (src == NULL) /* packet from ether_output */ - dst = bridge_dst_lookup(eh, ifp2sc[real_dst->if_index].cluster); - - if (dst == BDG_DROP) { /* this should not happen */ - printf("xx bdg_forward for BDG_DROP\n"); - m_freem(m0); - return NULL; - } - if (dst == BDG_LOCAL) { /* this should not happen as well */ - printf("xx ouch, bdg_forward for local pkt\n"); - return m0; - } - if (dst == BDG_BCAST || dst == BDG_MCAST || dst == BDG_UNKNOWN) { - ifp = TAILQ_FIRST(&ifnet) ; /* scan all ports */ - once = 0 ; - if (dst != BDG_UNKNOWN) /* need a copy for the local stack */ - shared = 1 ; - } else { - ifp = dst ; - once = 1 ; - } - if ( (uintptr_t)(ifp) <= (u_int)BDG_FORWARD ) - panic("bdg_forward: bad dst"); - - /* - * Do filtering in a very similar way to what is done in ip_output. - * Only if firewall is loaded, enabled, and the packet is not - * from ether_output() (src==NULL, or we would filter it twice). - * Additional restrictions may apply e.g. non-IP, short packets, - * and pkts already gone through a pipe. - */ - if (src != NULL && ( - (bdg_pfil && pfil_has_hooks(&inet_pfil_hook)) || - (IPFW_LOADED && bdg_ipfw != 0))) { - - int i; - - if (args.rule != NULL && fw_one_pass) - goto forward; /* packet already partially processed */ - /* - * i need some amt of data to be contiguous, and in case others need - * the packet (shared==1) also better be in the first mbuf. - */ - i = min(m0->m_pkthdr.len, max_protohdr) ; - if ( shared || m0->m_len < i) { - m0 = m_pullup(m0, i) ; - if (m0 == NULL) { - printf("-- bdg: pullup failed.\n") ; - return NULL ; - } - } - - /* - * PFIL hooks processing - */ - if (bdg_pfil && pfil_has_hooks(&inet_pfil_hook) && - m0->m_pkthdr.len >= sizeof(struct ip) && - ntohs(save_eh.ether_type) == ETHERTYPE_IP) { - /* - * before calling the firewall, swap fields the same as IP does. - * here we assume the pkt is an IP one and the header is contiguous - */ - struct ip *ip = mtod(m0, struct ip *); - int error; - - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); - - /* - * XXX I think this needs to be reworked to enable stateful - * filtering. Think about this. For now, declare the packet as incoming. - */ - error = pfil_run_hooks(&inet_pfil_hook, &m0, src, PFIL_IN); - if (error != 0 || m0 == NULL) - return m0; - - /* - * If we get here, the firewall has passed the pkt, but the mbuf - * pointer might have changed. Restore ip and the fields ntohs()'d. - */ - ip = mtod(m0, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - } - - /* - * Prepare arguments and call the firewall. - */ - if (!IPFW_LOADED || bdg_ipfw == 0) - goto forward; /* not using ipfw, accept the packet */ - - /* - * XXX The following code is very similar to the one in - * if_ethersubr.c:ether_ipfw_chk() - */ - - args.m = m0; /* the packet we are looking at */ - args.oif = NULL; /* this is an input packet */ - - /* no divert support */ - if ((mtag = m_tag_find(m0, PACKET_TAG_IPFW_DIVERT, NULL)) != NULL) - m_tag_delete(m0, mtag); - - args.next_hop = NULL; /* we do not support forward yet */ - args.eh = &save_eh; /* MAC header for bridged/MAC packets */ - i = ip_fw_chk_ptr(&args); - m0 = args.m; /* in case the firewall used the mbuf */ - - if ( (i & IP_FW_PORT_DENY_FLAG) || m0 == NULL) /* drop */ - return m0 ; - - if (i == 0) /* a PASS rule. */ - goto forward ; - if (DUMMYNET_LOADED && (i & IP_FW_PORT_DYNT_FLAG)) { - /* - * Pass the pkt to dummynet, which consumes it. - * If shared, make a copy and keep the original. - */ - struct mbuf *m ; - - if (shared) { - m = m_copypacket(m0, MB_DONTWAIT); - if (m == NULL) /* copy failed, give up */ - return m0; - } else { - m = m0 ; /* pass the original to dummynet */ - m0 = NULL ; /* and nothing back to the caller */ - } - /* - * Prepend the header, optimize for the common case of - * eh pointing into the mbuf. - */ - if ( (void *)(eh + 1) == (void *)m->m_data) { - m->m_data -= ETHER_HDR_LEN ; - m->m_len += ETHER_HDR_LEN ; - m->m_pkthdr.len += ETHER_HDR_LEN ; - bdg_predict++; - } else { - M_PREPEND(m, ETHER_HDR_LEN, MB_DONTWAIT); - if (m == NULL) /* nope... */ - return m0 ; - bcopy(&save_eh, mtod(m, struct ether_header *), ETHER_HDR_LEN); - } - - args.oif = real_dst; - ip_dn_io_ptr(m, (i & 0xffff),DN_TO_BDG_FWD, &args); - return m0 ; - } - /* - * XXX at some point, add support for divert/forward actions. - * If none of the above matches, we have to drop the packet. - */ - bdg_ipfw_drops++ ; - return m0 ; - } -forward: - /* - * Again, bring up the headers in case of shared bufs to avoid - * corruptions in the future. - */ - if ( shared ) { - int i = min(m0->m_pkthdr.len, max_protohdr) ; - - m0 = m_pullup(m0, i) ; - if (m0 == NULL) - return NULL ; - } - /* - * now real_dst is used to determine the cluster where to forward. - * For packets coming from ether_input, this is the one of the 'src' - * interface, whereas for locally generated packets (src==NULL) it - * is the cluster of the original destination interface, which - * was already saved into real_dst. - */ - if (src != NULL) - real_dst = src ; - - last = NULL; - for (;;) { - if (last) { /* need to forward packet leftover from previous loop */ - struct mbuf *m ; - struct altq_pktattr pktattr; - - if (shared == 0 && once ) { /* no need to copy */ - m = m0 ; - m0 = NULL ; /* original is gone */ - } else { - m = m_copypacket(m0, MB_DONTWAIT); - if (m == NULL) { - printf("bdg_forward: sorry, m_copypacket failed!\n"); - return m0 ; /* the original is still there... */ - } - } - if (ifq_is_enabled(&last->if_snd)) { - uint16_t ether_type; - int af; - - /* - * If the queueing discipline needs packet classification, - * do it before prepending link headers. - */ - ether_type = ntohs(eh->ether_type); - if (ether_type == ETHERTYPE_IP) - af = AF_INET; -#ifdef INET6 - else if (ether_type == ETHERTYPE_IPV6) - af = AF_INET6; -#endif - else - af = AF_UNSPEC; - ifq_classify(&last->if_snd, m, af, &pktattr); - } - - /* - * Add header (optimized for the common case of eh pointing - * already into the mbuf) and execute last part of ether_output: - * queue pkt and start output if interface not yet active. - */ - if ( (void *)(eh + 1) == (void *)m->m_data) { - m->m_data -= ETHER_HDR_LEN ; - m->m_len += ETHER_HDR_LEN ; - m->m_pkthdr.len += ETHER_HDR_LEN ; - bdg_predict++; - } else { - M_PREPEND(m, ETHER_HDR_LEN, MB_DONTWAIT); - if (!m && verbose) - printf("M_PREPEND failed\n"); - if (m == NULL) - return m0; - bcopy(&save_eh, mtod(m, struct ether_header *), ETHER_HDR_LEN); - } - lwkt_serialize_enter(last->if_serializer); - error = ifq_handoff(last, m, &pktattr); - lwkt_serialize_exit(last->if_serializer); - if (error != 0) { -#if 0 - BDG_MUTE(last); /* should I also mute ? */ -#endif - } - BDG_STAT(last, BDG_OUT); - last = NULL ; - if (once) - break ; - } - if (ifp == NULL) - break ; - /* - * If the interface is used for bridging, not muted, not full, - * up and running, is not the source interface, and belongs to - * the same cluster as the 'real_dst', then send here. - */ - if ( BDG_USED(ifp) && !BDG_MUTED(ifp) && -#ifndef ALTQ - !IF_QFULL(&ifp->if_snd) && -#endif - (ifp->if_flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING) && - ifp != src && BDG_SAMECLUSTER(ifp, real_dst) ) - last = ifp ; - ifp = TAILQ_NEXT(ifp, if_link) ; - if (ifp == NULL) - once = 1 ; - } - DEB(bdg_fw_ticks += (u_long)(rdtsc() - ticks) ; bdg_fw_count++ ; - if (bdg_fw_count != 0) bdg_fw_avg = bdg_fw_ticks/bdg_fw_count; ) - return m0 ; -} - -/* - * initialization of bridge code. - */ -static int -bdginit(void) -{ - printf("BRIDGE 020214 loaded\n"); - - ifp2sc = malloc(BDG_MAX_PORTS * sizeof(struct bdg_softc), - M_IFADDR, M_WAITOK | M_ZERO ); - if (ifp2sc == NULL) - return ENOMEM ; - - callout_init(&bdg_timeout_h); - - bridge_in_ptr = bridge_in; - bdg_forward_ptr = bdg_forward; - bdgtakeifaces_ptr = reconfigure_bridge; - - n_clusters = 0; - clusters = NULL; - do_bridge=0; - - bzero(&bdg_stats, sizeof(bdg_stats) ); - bdgtakeifaces_ptr(); - bdg_timeout(0); - return 0 ; -} - -/* - * initialization code, both for static and dynamic loading. - */ -static int -bridge_modevent(module_t mod, int type, void *unused) -{ - int err = 0 ; - - switch (type) { - case MOD_LOAD: - if (BDG_LOADED) { - err = EEXIST; - break ; - } - crit_enter(); - err = bdginit(); - crit_exit(); - break; - case MOD_UNLOAD: -#if !defined(KLD_MODULE) - printf("bridge statically compiled, cannot unload\n"); - err = EINVAL ; -#else - crit_enter(); - do_bridge = 0; - bridge_in_ptr = NULL; - bdg_forward_ptr = NULL; - bdgtakeifaces_ptr = NULL; - callout_stop(&bdg_timeout_h); - bridge_off(); - if (clusters) - free(clusters, M_IFADDR); - free(ifp2sc, M_IFADDR); - ifp2sc = NULL ; - crit_exit(); -#endif - break; - default: - err = EINVAL ; - break; - } - return err; -} - -static moduledata_t bridge_mod = { - "bridge", - bridge_modevent, - 0 -}; - -DECLARE_MODULE(bridge, bridge_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); -MODULE_VERSION(bridge, 1); diff --git a/sys/net/oldbridge/bridge.h b/sys/net/oldbridge/bridge.h deleted file mode 100644 index 7fbba2001e..0000000000 --- a/sys/net/oldbridge/bridge.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 1998-2002 Luigi Rizzo - * - * Work partly supported by: Cisco Systems, Inc. - NSITE lab, RTP, NC - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/net/bridge.h,v 1.4.2.5 2002/02/15 05:13:58 luigi Exp $ - * $DragonFly: src/sys/net/oldbridge/Attic/bridge.h,v 1.3 2005/12/19 00:07:02 corecode Exp $ - */ - -extern int do_bridge; - -/* - * We need additional per-interface info for the bridge, which is - * stored in a struct bdg_softc. The ifp2sc[] array provides a pointer - * to this struct using the if_index as a mapping key. - * bdg_softc has a backpointer to the struct ifnet, the bridge - * flags, and a cluster (bridging occurs only between port of the - * same cluster). - */ - -struct cluster_softc; /* opaque here, defined in bridge.c */ - -struct bdg_softc { - struct ifnet *ifp ; - /* also ((struct arpcom *)ifp)->ac_enaddr is the eth. addr */ - int flags ; -#define IFF_BDG_PROMISC 0x0001 /* set promisc mode on this if. */ -#define IFF_MUTE 0x0002 /* mute this if for bridging. */ -#define IFF_USED 0x0004 /* use this if for bridging. */ - struct cluster_softc *cluster; -} ; - -extern struct bdg_softc *ifp2sc; - -#define BDG_USED(ifp) (ifp2sc[ifp->if_index].flags & IFF_USED) -/* - * BDG_ACTIVE(ifp) does all checks to see if bridging is enabled, loaded, - * and used on a given interface. - */ -#define BDG_ACTIVE(ifp) (do_bridge && BDG_LOADED && BDG_USED(ifp)) - -/* - * The following constants are not legal ifnet pointers, and are used - * as return values from the classifier, bridge_dst_lookup(). - * The same values are used as index in the statistics arrays, - * with BDG_FORWARD replacing specifically forwarded packets. - * - * These constants are here because they are used in 'netstat' - * to show bridge statistics. - */ -#define BDG_BCAST ( (struct ifnet *)1 ) -#define BDG_MCAST ( (struct ifnet *)2 ) -#define BDG_LOCAL ( (struct ifnet *)3 ) -#define BDG_DROP ( (struct ifnet *)4 ) -#define BDG_UNKNOWN ( (struct ifnet *)5 ) -#define BDG_IN ( (struct ifnet *)7 ) -#define BDG_OUT ( (struct ifnet *)8 ) -#define BDG_FORWARD ( (struct ifnet *)9 ) - -/* - * Statistics are passed up with the sysctl interface, "netstat -p bdg" - * reads them. PF_BDG defines the 'bridge' protocol family. - */ - -#define PF_BDG 3 /* XXX superhack */ - -#define STAT_MAX (int)BDG_FORWARD -struct bdg_port_stat { - char name[16]; - u_long collisions; - u_long p_in[STAT_MAX+1]; -} ; - -/* XXX this should be made dynamic */ -#define BDG_MAX_PORTS 128 -struct bdg_stats { - struct bdg_port_stat s[BDG_MAX_PORTS]; -} ; - - -#define BDG_STAT(ifp, type) bdg_stats.s[ifp->if_index].p_in[(uintptr_t)type]++ - -#ifdef _KERNEL -typedef struct ifnet *bridge_in_t(struct ifnet *, struct ether_header *); -/* bdg_forward frees the mbuf if necessary, returning null */ -typedef struct mbuf *bdg_forward_t(struct mbuf *, struct ether_header *const, - struct ifnet *); -typedef void bdgtakeifaces_t(void); -extern bridge_in_t *bridge_in_ptr; -extern bdg_forward_t *bdg_forward_ptr; -extern bdgtakeifaces_t *bdgtakeifaces_ptr; - -#define BDG_LOADED (bdgtakeifaces_ptr != NULL) -#endif /* KERNEL */ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 8e5aae9de1..9dbfc753f1 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -82,7 +82,7 @@ * * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netinet/if_ether.c,v 1.64.2.23 2003/04/11 07:23:15 fjoe Exp $ - * $DragonFly: src/sys/netinet/if_ether.c,v 1.32 2006/05/20 06:32:40 dillon Exp $ + * $DragonFly: src/sys/netinet/if_ether.c,v 1.33 2006/06/25 11:02:40 corecode Exp $ */ /* @@ -92,7 +92,6 @@ */ #include "opt_inet.h" -#include "opt_bdg.h" #include #include @@ -113,10 +112,6 @@ #include #include #include -#ifdef BRIDGE -#include -#include -#endif #include #include @@ -599,12 +594,6 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW, &log_arp_wrong_iface, 0, "log arp packets arriving on the wrong interface"); -#ifdef BRIDGE -#define BRIDGE_TEST (do_bridge) -#else -#define BRIDGE_TEST (0) /* cc will optimise the test away */ -#endif - static void arp_update_oncpu(struct mbuf *m, in_addr_t saddr, boolean_t create, boolean_t dologging) @@ -621,7 +610,7 @@ arp_update_oncpu(struct mbuf *m, in_addr_t saddr, boolean_t create, struct in_addr isaddr = { saddr }; /* the following is not an error when doing bridging */ - if (!BRIDGE_TEST && rt->rt_ifp != ifp) { + if (rt->rt_ifp != ifp) { if (dologging && log_arp_wrong_iface && cpu == 0) { log(LOG_ERR, "arp: %s is on %s " @@ -784,17 +773,6 @@ in_arpinput(struct mbuf *m) * when we have clusters of interfaces). */ LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { - /* - * Old style bridging OBSOLETE - */ - if ((BRIDGE_TEST || (ia->ia_ifp == ifp)) && - itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { - goto match; - } - - /* - * New style bridging - */ if (ifp->if_bridge && ia->ia_ifp && ifp->if_bridge == ia->ia_ifp->if_bridge && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { @@ -802,17 +780,6 @@ in_arpinput(struct mbuf *m) } } LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) { - /* - * Old style bridging OBSOLETE - */ - if ((BRIDGE_TEST || (ia->ia_ifp == ifp)) && - isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { - goto match; - } - - /* - * New style bridging - */ if (ifp->if_bridge && ia->ia_ifp && ifp->if_bridge == ia->ia_ifp->if_bridge && isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { @@ -828,14 +795,7 @@ in_arpinput(struct mbuf *m) ia = ifatoia(ifa); goto match; } - /* - * If bridging, fall back to using any inet address. - * This is probably incorrect, the right way being try to match - * addresses for interfaces in the same cluster, so if we - * get here we should always drop the packet. - */ - if (!BRIDGE_TEST || - (ia = TAILQ_FIRST(&in_ifaddrhead)) == NULL) { + if ((ia = TAILQ_FIRST(&in_ifaddrhead)) == NULL) { m_freem(m); return; } diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index e47ad7adf8..9efb849aa9 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -32,7 +32,7 @@ * * @(#)if.c 8.3 (Berkeley) 4/28/95 * $FreeBSD: src/usr.bin/netstat/if.c,v 1.32.2.9 2001/09/17 14:35:46 ru Exp $ - * $DragonFly: src/usr.bin/netstat/if.c,v 1.9 2005/12/19 00:07:02 corecode Exp $ + * $DragonFly: src/usr.bin/netstat/if.c,v 1.10 2006/06/25 11:02:40 corecode Exp $ */ #include @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -78,52 +77,8 @@ static void catchalarm (int); #ifdef INET6 char *netname6 (struct sockaddr_in6 *, struct in6_addr *); static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */ -static int bdg_done; #endif -/* print bridge statistics */ -void -bdg_stats(u_long dummy __unused, char *name, int af __unused) -{ - int i; - size_t slen ; - struct bdg_stats s ; - int mib[4] ; - - slen = sizeof(s); - - mib[0] = CTL_NET ; - mib[1] = PF_LINK ; - mib[2] = IFT_ETHER ; - mib[3] = PF_BDG ; - if (sysctl(mib,4, &s,&slen,NULL,0)==-1) - return ; /* no bridging */ -#ifdef INET6 - if (bdg_done != 0) - return; - else - bdg_done = 1; -#endif - printf("-- Bridging statistics (%s) --\n", name) ; - printf( -"Name In Out Forward Drop Bcast Mcast Local Unknown\n"); - for (i = 0 ; i < 16 ; i++) { - if (s.s[i].name[0]) - printf("%-6s %9ld%9ld%9ld%9ld%9ld%9ld%9ld%9ld\n", - s.s[i].name, - s.s[i].p_in[(int)BDG_IN], - s.s[i].p_in[(int)BDG_OUT], - s.s[i].p_in[(int)BDG_FORWARD], - s.s[i].p_in[(int)BDG_DROP], - s.s[i].p_in[(int)BDG_BCAST], - s.s[i].p_in[(int)BDG_MCAST], - s.s[i].p_in[(int)BDG_LOCAL], - s.s[i].p_in[(int)BDG_UNKNOWN] ); - } -} - - - /* * Display a formatted value, or a '-' in the same space. diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 53eb42e6d3..b48781175a 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1983, 1988, 1993 Regents of the University of California. All rights reserved. * @(#)main.c 8.4 (Berkeley) 3/1/94 * $FreeBSD: src/usr.bin/netstat/main.c,v 1.34.2.12 2001/09/17 15:17:46 ru Exp $ - * $DragonFly: src/usr.bin/netstat/main.c,v 1.11 2006/01/19 22:19:25 dillon Exp $ + * $DragonFly: src/usr.bin/netstat/main.c,v 1.12 2006/06/25 11:02:40 corecode Exp $ */ #include @@ -179,8 +179,6 @@ struct protox { { -1, N_IPSECSTAT, 1, 0, ipsec_stats, NULL, "ipsec", 0}, #endif - { -1, -1, 1, 0, - bdg_stats, NULL, "bdg", 1 /* bridging... */ }, { -1, -1, 0, 0, 0, NULL, 0 } }; @@ -205,8 +203,6 @@ struct protox ip6protox[] = { #endif { -1, -1, 1, 0, rip6_stats, NULL, "rip6", 0 }, - { -1, -1, 1, 0, - bdg_stats, NULL, "bdg", 1 /* bridging... */ }, { -1, -1, 1, protopr, pim_stats, NULL, "pim", IPPROTO_PIM }, { -1, -1, 0, 0, diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index c4b62cec88..120c7ffcc0 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -31,7 +31,7 @@ .\" .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD: src/usr.bin/netstat/netstat.1,v 1.22.2.13 2003/05/03 22:10:02 keramida Exp $ -.\" $DragonFly: src/usr.bin/netstat/netstat.1,v 1.6 2006/01/19 22:19:25 dillon Exp $ +.\" $DragonFly: src/usr.bin/netstat/netstat.1,v 1.7 2006/06/25 11:02:40 corecode Exp $ .\" .Dd September 7, 2001 .Dt NETSTAT 1 @@ -283,9 +283,9 @@ The following address families and protocols are recognized: .It Em Family .Em Protocols .It Cm inet Pq Dv AF_INET -.Cm bdg , divert , icmp , igmp , ip , ipsec , pim , tcp , udp +.Cm divert , icmp , igmp , ip , ipsec , pim , tcp , udp .It Cm inet6 Pq Dv AF_INET6 -.Cm bdg , icmp6 , ip6 , ipsec6 , rip6 , tcp , udp +.Cm icmp6 , ip6 , ipsec6 , rip6 , tcp , udp .It Cm pfkey Pq Dv PF_KEY .Cm pfkey .It Cm atalk Pq Dv AF_APPLETALK diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 974abae5cf..f0329cd207 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -32,7 +32,7 @@ * * @(#)netstat.h 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/usr.bin/netstat/netstat.h,v 1.16.2.7 2001/09/17 15:17:46 ru Exp $ - * $DragonFly: src/usr.bin/netstat/netstat.h,v 1.8 2006/01/19 22:19:25 dillon Exp $ + * $DragonFly: src/usr.bin/netstat/netstat.h,v 1.9 2006/06/25 11:02:40 corecode Exp $ */ #include @@ -97,8 +97,6 @@ char *netname6 (struct sockaddr_in6 *, struct in6_addr *); void pfkey_stats (u_long, char *, int); #endif -void bdg_stats (u_long, char *, int); - void mbpr (u_long, u_long, u_long, u_long); void hostpr (u_long, u_long); -- 2.41.0