Remove bridge(4) from the tree. if_bridge(4) is a full functional
replacement and has additional features which make it superior. Discussed on: -arch Reviewed by: thompsa X-MFC-after: never (RELENG_6 as transition period)
This commit is contained in:
parent
50ddc43475
commit
54313cbc31
4
UPDATING
4
UPDATING
@ -21,6 +21,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 7.x IS SLOW:
|
||||
developers choose to disable these features on build machines
|
||||
to maximize performance.
|
||||
|
||||
20050927:
|
||||
The old bridge(4) implementation was retired. The new
|
||||
if_bridge(4) serves as a full functional replacement.
|
||||
|
||||
20050722:
|
||||
The ai_addrlen of a struct addrinfo was changed to a socklen_t
|
||||
to conform to POSIX-2001. This change broke an ABI
|
||||
|
@ -39,7 +39,7 @@ options IPDIVERT # divert (for natd)
|
||||
|
||||
# Support for bridging and bandwidth limiting
|
||||
options DUMMYNET
|
||||
options BRIDGE
|
||||
device if_bridge
|
||||
options HZ=1000
|
||||
#options NMBCLUSTERS=4096
|
||||
|
||||
|
@ -52,12 +52,6 @@
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#ifdef BRIDGING
|
||||
#include <net/if_types.h> /* IFT_ETHER */
|
||||
#include <net/ethernet.h>
|
||||
#include <net/bridge.h>
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <osreldate.h>
|
||||
@ -80,11 +74,7 @@ void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "\n%s [-nrsil] [-p proto] [-w wait]\n", progname);
|
||||
#ifdef BRIDGING
|
||||
fprintf(stderr, " proto: {ip|tcp|udp|icmp|bdg}\n\n");
|
||||
#else
|
||||
fprintf(stderr, " proto: {ip|tcp|udp|icmp}\n\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -720,19 +710,12 @@ stats(char *proto)
|
||||
print_udp_stats();
|
||||
if (strcmp(proto, "tcp") == 0)
|
||||
print_tcp_stats();
|
||||
#ifdef BRIDGING
|
||||
if (strcmp(proto, "bdg") == 0)
|
||||
print_bdg_stats();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
print_ip_stats();
|
||||
print_icmp_stats();
|
||||
print_udp_stats();
|
||||
print_tcp_stats();
|
||||
#ifdef BRIDGING
|
||||
print_bdg_stats();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -844,42 +827,3 @@ print_load_stats(void)
|
||||
X(0), X(1), X(2), X(3), X(4) );
|
||||
bcopy(new_cp_time, cp_time, sizeof(cp_time));
|
||||
}
|
||||
|
||||
#ifdef BRIDGING
|
||||
/* print bridge statistics */
|
||||
int
|
||||
print_bdg_stats()
|
||||
{
|
||||
int i;
|
||||
int mib[4];
|
||||
int slen;
|
||||
struct bdg_stats s;
|
||||
|
||||
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 0; /* no bridging */
|
||||
}
|
||||
printf("-- Bridging statistics --\n");
|
||||
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 %9d%9d%9d%9d%9d%9d%9d%9d\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]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -34,7 +34,6 @@ MAN= aac.4 \
|
||||
bktr.4 \
|
||||
blackhole.4 \
|
||||
bpf.4 \
|
||||
bridge.4 \
|
||||
bt.4 \
|
||||
cardbus.4 \
|
||||
carp.4 \
|
||||
|
@ -1,252 +0,0 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 20, 2003
|
||||
.Dt BRIDGE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm bridge
|
||||
.Nd bridging support
|
||||
.Sh SYNOPSIS
|
||||
.Cd "options BRIDGE"
|
||||
.Sh DESCRIPTION
|
||||
.Fx
|
||||
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
|
||||
.Fx
|
||||
host can do bridging on independent sets of interfaces,
|
||||
which are called
|
||||
.Dq clusters .
|
||||
Each cluster connects a set of interfaces, and is
|
||||
identified by a
|
||||
.Dq cluster-ID
|
||||
which is a number in the range 1..65535.
|
||||
A cluster in fact is very similar to what commercial switches call
|
||||
a
|
||||
.Dq 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
|
||||
.Dq "VLAN identifier"
|
||||
used in most commercial switches, and
|
||||
the IEEE 802.1q VLAN-ID.
|
||||
.Pp
|
||||
By putting both physical and logical
|
||||
.Pq Xr vlan 4
|
||||
interfaces in the same cluster, a
|
||||
.Fx
|
||||
box can also implement what in commercial terms is called a
|
||||
.Dq trunk
|
||||
interface.
|
||||
This means that packets
|
||||
coming from one of the interfaces in a cluster
|
||||
will appear on the wire of the
|
||||
.Dq parent
|
||||
interface of any VLAN interface in a cluster,
|
||||
with the proper VLAN tag.
|
||||
Similarly, packets
|
||||
coming from a parent interface of any VLAN interface in a cluster
|
||||
will have the VLAN tag stripped,
|
||||
and will be forwarded to other interfaces in a 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.
|
||||
.Bl -tag -width indent
|
||||
.It Va net.link.ether.bridge.enable
|
||||
Set to
|
||||
.Li 1
|
||||
to enable bridging, set to
|
||||
.Li 0
|
||||
to disable it.
|
||||
.It Va net.link.ether.bridge.ipfw
|
||||
Set to
|
||||
.Li 1
|
||||
to enable
|
||||
.Xr ipfw 8
|
||||
processing of 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.
|
||||
.It Va net.link.ether.bridge.ipf
|
||||
Set to
|
||||
.Li 1
|
||||
to enable
|
||||
.Xr ipf 8
|
||||
processing of bridged packets.
|
||||
Note that
|
||||
.Xr ipf 8
|
||||
rules only apply
|
||||
to IP packets.
|
||||
Non-IP packets are accepted by default.
|
||||
.It Va net.link.ether.bridge.config
|
||||
Set to the list of interfaces to bridge.
|
||||
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.\&
|
||||
.Dq Li "dc0:1,dc1,vlan0:3 dc2:3"
|
||||
will put
|
||||
.Li dc0
|
||||
and
|
||||
.Li dc1
|
||||
in cluster number 1, and
|
||||
.Li vlan0
|
||||
and
|
||||
.Li 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.
|
||||
An explicit request to refresh the
|
||||
.Nm
|
||||
configuration can also
|
||||
be done by writing any value to
|
||||
.Va net.link.ether.bridge.refresh .
|
||||
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 different
|
||||
than their own.
|
||||
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 FILES
|
||||
.Bl -tag -width ".Pa /boot/kernel/bridge.ko" -compact
|
||||
.It Pa /boot/kernel/bridge.ko
|
||||
.Nm
|
||||
loadable module.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
A simple
|
||||
.Nm
|
||||
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.config=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.config="`ifconfig -l`"
|
||||
.Pp
|
||||
This will result in a space-separated list of interfaces.
|
||||
Out of the list, only Ethernet and 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.config=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
|
||||
.Li dc0
|
||||
as a
|
||||
.Dq trunk
|
||||
interface, and pass packets
|
||||
for 802.1q VLANs 10 and 20 to physical interfaces
|
||||
.Li dc1
|
||||
and
|
||||
.Li dc2 ,
|
||||
respectively:
|
||||
.Bd -literal -offset indent
|
||||
sysctl net.link.ether.bridge.config=vlan0:34,dc1:34,vlan1:56,dc2:56
|
||||
ifconfig vlan0 vlan 10 vlandev dc0
|
||||
ifconfig vlan1 vlan 20 vlandev dc0
|
||||
.Ed
|
||||
.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
|
||||
.Va bridge.config
|
||||
variable.
|
||||
.Pp
|
||||
Note also that the trunk interface
|
||||
does not even appear in the
|
||||
.Va bridge.config ,
|
||||
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 ipf 8 ,
|
||||
.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
|
||||
.Va net.inet.ip.fw.one_pass ,
|
||||
and that some
|
||||
.Xr ipfw 8
|
||||
actions such as
|
||||
.Cm 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.
|
@ -60,7 +60,6 @@ sum of the bandwidth-delay products and queue sizes of all configured
|
||||
pipes.
|
||||
.Sh SEE ALSO
|
||||
.Xr setsockopt 2 ,
|
||||
.Xr bridge 4 ,
|
||||
.Xr if_bridge 4 ,
|
||||
.Xr ip 4 ,
|
||||
.Xr ipfw 8 ,
|
||||
|
@ -192,7 +192,7 @@ control message, or when all hooks have been disconnected.
|
||||
Example script showing how to set up a bridging network
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr bridge 4 ,
|
||||
.Xr if_bridge 4 ,
|
||||
.Xr netgraph 4 ,
|
||||
.Xr ng_ether 4 ,
|
||||
.Xr ng_hub 4 ,
|
||||
|
@ -78,10 +78,6 @@ checksum offloading,
|
||||
segmentation, nor
|
||||
.Xr ipsec 4
|
||||
acceleration.
|
||||
Note that hardware checksumming is only used when the interface is not
|
||||
in
|
||||
.Xr bridge 4
|
||||
mode.
|
||||
.Pp
|
||||
Each of the host's network addresses
|
||||
is specified at boot time with an
|
||||
|
@ -145,7 +145,7 @@ function
|
||||
might sleep!
|
||||
.Sh SEE ALSO
|
||||
.Xr bpf 4 ,
|
||||
.Xr bridge 4
|
||||
.Xr if_bridge 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
@ -196,10 +196,12 @@ Packets diverted through these hooks have data in
|
||||
host byte order contrary to the above statements.
|
||||
.Pp
|
||||
The
|
||||
.Xr bridge 4
|
||||
diverts inbound
|
||||
.Xr if_bridge 4
|
||||
diverts
|
||||
.Dv AF_INET
|
||||
traffic, but contrary to the above
|
||||
and
|
||||
.DV AF_INET6
|
||||
traffic according to it's sysctl settings, but contrary to the above
|
||||
statements, the data is provided in host byte order.
|
||||
.Pp
|
||||
When a
|
||||
|
@ -765,12 +765,7 @@ options TCP_DROP_SYNFIN #drop TCP packets with SYN+FIN
|
||||
# as well. See dummynet(4) and ipfw(8) for more info. 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
|
||||
|
||||
# Zero copy sockets support. This enables "zero copy" for sending and
|
||||
# receiving data via a socket. The send side works for any type of NIC,
|
||||
|
@ -1418,7 +1418,6 @@ libkern/strvalid.c standard
|
||||
net/bpf.c standard
|
||||
net/bpf_filter.c optional bpf
|
||||
net/bpf_filter.c optional netgraph_bpf
|
||||
net/bridge.c optional bridge
|
||||
net/bridgestp.c optional if_bridge
|
||||
net/bsd_comp.c optional ppp_bsdcomp
|
||||
net/if.c standard
|
||||
|
@ -327,7 +327,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
|
||||
DEV_PF opt_pf.h
|
||||
DEV_PFLOG opt_pf.h
|
||||
DEV_PFSYNC opt_pf.h
|
||||
|
@ -75,7 +75,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/proc.h>
|
||||
#include "opt_bdg.h"
|
||||
|
||||
#include <dev/em/if_em_hw.h>
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_bdg.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/sockio.h>
|
||||
|
@ -78,7 +78,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/endian.h>
|
||||
#include "opt_bdg.h"
|
||||
|
||||
#include <dev/ixgb/ixgb_hw.h>
|
||||
#include <dev/ixgb/ixgb_ee.h>
|
||||
|
@ -38,7 +38,6 @@ SUBDIR= ${_3dfx} \
|
||||
bge \
|
||||
${_bios} \
|
||||
${_bktr} \
|
||||
bridge \
|
||||
cam \
|
||||
${_canbepm} \
|
||||
${_canbus} \
|
||||
|
@ -18,7 +18,7 @@ SRCS+= agp_amd.c
|
||||
SRCS+= agp_amd64.c
|
||||
.endif
|
||||
SRCS+= device_if.h bus_if.h agp_if.h pci_if.h
|
||||
SRCS+= opt_bdg.h opt_bus.h
|
||||
SRCS+= opt_bus.h
|
||||
MFILES= kern/device_if.m kern/bus_if.m pci/agp_if.m dev/pci/pci_if.m
|
||||
WERROR=
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
KMOD= if_ath
|
||||
SRCS= if_ath.c if_ath_pci.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
|
||||
HAL= ${.CURDIR}/../../contrib/dev/ath
|
||||
CFLAGS+= -I. -I${HAL}/freebsd -I${HAL}
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
KMOD= ath_rate
|
||||
SRCS= amrr.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
|
||||
HAL= ${.CURDIR}/../../contrib/dev/ath
|
||||
CFLAGS+= -I. -I${HAL}/freebsd -I${HAL}
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
KMOD= ath_rate
|
||||
SRCS= onoe.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
|
||||
HAL= ${.CURDIR}/../../contrib/dev/ath
|
||||
CFLAGS+= -I. -I${HAL}/freebsd -I${HAL}
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
KMOD= ath_rate
|
||||
SRCS= sample.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h
|
||||
|
||||
HAL= ${.CURDIR}/../../contrib/dev/ath
|
||||
CFLAGS+= -I. -I${HAL}/freebsd -I${HAL}
|
||||
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
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 usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
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 usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/bfe
|
||||
|
||||
KMOD= if_bfe
|
||||
SRCS= if_bfe.c miibus_if.h miidevs.h opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_bfe.c miibus_if.h miidevs.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/bge
|
||||
|
||||
KMOD= if_bge
|
||||
SRCS= opt_bge.h if_bge.c miibus_if.h miidevs.h opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= opt_bge.h if_bge.c miibus_if.h miidevs.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -1,7 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../net
|
||||
KMOD= bridge
|
||||
SRCS= bridge.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
KMOD= if_cdce
|
||||
SRCS= if_cdce.c opt_bdg.h opt_usb.h device_if.h bus_if.h
|
||||
SRCS= if_cdce.c opt_usb.h device_if.h bus_if.h
|
||||
SRCS+= usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
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 usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_dc
|
||||
SRCS= if_dc.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_dc.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_de
|
||||
SRCS= if_de.c opt_bdg.h opt_ddb.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_de.c opt_ddb.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
# Compile-time options.
|
||||
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
.PATH: ${.CURDIR}/../../netinet
|
||||
KMOD= dummynet
|
||||
SRCS= ip_dummynet.c opt_bdg.h
|
||||
SRCS= ip_dummynet.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
KMOD= if_em
|
||||
SRCS= if_em.c if_em_hw.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_bdg.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/fxp
|
||||
|
||||
KMOD= if_fxp
|
||||
SRCS= if_fxp.c opt_bdg.h device_if.h bus_if.h pci_if.h miibus_if.h
|
||||
SRCS= if_fxp.c device_if.h bus_if.h pci_if.h miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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
|
||||
|
||||
opt_hifn.h:
|
||||
echo "#define HIFN_DEBUG 1" > opt_hifn.h
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
KMOD= if_ndis
|
||||
SRCS= if_ndis.c if_ndis_pci.c if_ndis_pccard.c if_ndis_usb.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
|
||||
SRCS+= opt_usb.h usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/ipw
|
||||
|
||||
KMOD = if_ipw
|
||||
SRCS = if_ipw.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS = if_ipw.c device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/iwi
|
||||
|
||||
KMOD = if_iwi
|
||||
SRCS = if_iwi.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS = if_iwi.c device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
KMOD= if_ixgb
|
||||
SRCS= if_ixgb.c ixgb_hw.c ixgb_ee.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_bdg.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
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 usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/lge
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
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 pccarddevs.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h pccarddevs.h
|
||||
SRCS+= opt_cam.h opt_scsi.h opt_ddb.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -5,7 +5,7 @@
|
||||
KMOD= ndis
|
||||
SRCS= subr_pe.c subr_ndis.c subr_hal.c subr_ntoskrnl.c kern_ndis.c
|
||||
SRCS+= kern_windrv.c subr_usbd.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h vnode_if.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h vnode_if.h
|
||||
|
||||
.if ${MACHINE_ARCH} == "amd64"
|
||||
SRCS+= winx64_wrap.S
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/nge
|
||||
|
||||
KMOD= if_nge
|
||||
SRCS= if_nge.c miibus_if.h opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_nge.c miibus_if.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
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 pccarddevs.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h pccarddevs.h
|
||||
SRCS+= opt_cam.h opt_scsi.h opt_ddb.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
KMOD = if_ral
|
||||
SRCS = if_ral.c if_ralrate.c if_ral_pccard.c if_ral_pci.c \
|
||||
opt_bdg.h device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
|
||||
device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../dev/re
|
||||
|
||||
KMOD= if_re
|
||||
SRCS= if_re.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_re.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_rl
|
||||
SRCS= if_rl.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_rl.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
KMOD= if_rue
|
||||
SRCS= if_rue.c opt_bdg.h opt_usb.h device_if.h bus_if.h
|
||||
SRCS= if_rue.c opt_usb.h device_if.h bus_if.h
|
||||
SRCS+= miibus_if.h usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -30,7 +30,7 @@
|
||||
KMOD = safe
|
||||
SRCS = safe.c opt_safe.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
|
||||
|
||||
opt_safe.h:
|
||||
echo "#define SAFE_DEBUG 1" > opt_safe.h
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_sis
|
||||
SRCS= if_sis.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_sis.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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 <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
KMOD= if_snc
|
||||
SRCS= if_snc.c if_snc_cbus.c if_snc_pccard.c dp83932.c dp83932subr.c
|
||||
SRCS+= opt_inet.h opt_bdg.h device_if.h bus_if.h isa_if.h
|
||||
SRCS+= opt_inet.h device_if.h bus_if.h isa_if.h
|
||||
|
||||
opt_inet.h:
|
||||
echo "#define INET 1" > ${.TARGET}
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -7,7 +7,7 @@ SRCS= tmc18c30.c tmc18c30_subr.c \
|
||||
tmc18c30_isa.c isa_if.h \
|
||||
tmc18c30_pccard.c card_if.h pccarddevs.h \
|
||||
tmc18c30_pci.c pci_if.h
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h
|
||||
SRCS+= device_if.h bus_if.h
|
||||
SRCS+= opt_cam.h opt_scsi.h opt_ddb.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_ti
|
||||
SRCS= if_ti.c opt_bdg.h device_if.h bus_if.h pci_if.h opt_ti.h opt_zero.h
|
||||
SRCS= if_ti.c device_if.h bus_if.h pci_if.h opt_ti.h opt_zero.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../dev/tx
|
||||
|
||||
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 miidevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/txp
|
||||
|
||||
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 <bsd.kmod.mk>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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
|
||||
|
||||
opt_ubsec.h:
|
||||
echo "#define UBSEC_DEBUG 1" > opt_ubsec.h
|
||||
|
@ -3,7 +3,7 @@
|
||||
S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
KMOD= if_udav
|
||||
SRCS= if_udav.c opt_bdg.h opt_usb.h device_if.h bus_if.h opt_inet.h
|
||||
SRCS= if_udav.c opt_usb.h device_if.h bus_if.h opt_inet.h
|
||||
SRCS+= miibus_if.h usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/usb
|
||||
|
||||
KMOD = if_ural
|
||||
SRCS = if_ural.c opt_bdg.h opt_usb.h device_if.h bus_if.h usbdevs.h
|
||||
SRCS = if_ural.c opt_usb.h device_if.h bus_if.h usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,6 +3,6 @@
|
||||
.PATH: ${.CURDIR}/../../dev/vge
|
||||
|
||||
KMOD= if_vge
|
||||
SRCS= if_vge.c miibus_if.h opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_vge.c miibus_if.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_vr
|
||||
SRCS= if_vr.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_vr.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -7,6 +7,6 @@ SRCS= if_vx.c if_vx_pci.c
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
SRCS+= if_vx_eisa.c
|
||||
.endif
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h eisa_if.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h eisa_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
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
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -3,7 +3,7 @@
|
||||
.PATH: ${.CURDIR}/../../pci
|
||||
|
||||
KMOD= if_xl
|
||||
SRCS= if_xl.c opt_bdg.h device_if.h bus_if.h pci_if.h
|
||||
SRCS= if_xl.c device_if.h bus_if.h pci_if.h
|
||||
SRCS+= miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
1302
sys/net/bridge.c
1302
sys/net/bridge.c
File diff suppressed because it is too large
Load Diff
112
sys/net/bridge.h
112
sys/net/bridge.h
@ -1,112 +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$
|
||||
*/
|
||||
|
||||
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 ;
|
||||
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 mbuf *bridge_in_t(struct ifnet *, struct mbuf *);
|
||||
/* bdg_forward frees the mbuf if necessary, returning null */
|
||||
typedef struct mbuf *bdg_forward_t(struct mbuf *, 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 */
|
@ -34,7 +34,6 @@
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
#include "opt_ipx.h"
|
||||
#include "opt_bdg.h"
|
||||
#include "opt_mac.h"
|
||||
#include "opt_netgraph.h"
|
||||
#include "opt_carp.h"
|
||||
@ -60,7 +59,6 @@
|
||||
#include <net/if_types.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/bridge.h>
|
||||
#include <net/if_vlan_var.h>
|
||||
|
||||
#if defined(INET) || defined(INET6)
|
||||
@ -108,12 +106,6 @@ void (*ng_ether_detach_p)(struct ifnet *ifp);
|
||||
void (*vlan_input_p)(struct ifnet *, struct mbuf *);
|
||||
|
||||
/* 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 *);
|
||||
@ -378,18 +370,6 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
|
||||
#endif
|
||||
int error;
|
||||
|
||||
if (rule == NULL && BDG_ACTIVE(ifp)) {
|
||||
/*
|
||||
* Beware, the bridge code notices the null rcvif and
|
||||
* uses that identify that it's being called from
|
||||
* ether_output as opposd to ether_input. Yech.
|
||||
*/
|
||||
m->m_pkthdr.rcvif = NULL;
|
||||
m = bdg_forward_ptr(m, ifp);
|
||||
if (m != NULL)
|
||||
m_freem(m);
|
||||
return (0);
|
||||
}
|
||||
#if defined(INET) || defined(INET6)
|
||||
if (IPFW_LOADED && ether_ipfw != 0) {
|
||||
if (ether_ipfw_chk(&m, ifp, &rule, 0) == 0) {
|
||||
@ -414,9 +394,7 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
int
|
||||
ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
|
||||
@ -635,11 +613,6 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
|
||||
ifp = m->m_pkthdr.rcvif;
|
||||
}
|
||||
|
||||
/* Check for bridging mode */
|
||||
if (BDG_ACTIVE(ifp) )
|
||||
if ((m = bridge_in_ptr(ifp, m)) == NULL)
|
||||
return;
|
||||
|
||||
/* First chunk of an mbuf contains good entropy */
|
||||
if (harvest.ethernet)
|
||||
random_harvest(m, 16, 3, 0, RANDOM_NET);
|
||||
@ -672,7 +645,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
|
||||
goto post_stats;
|
||||
#endif
|
||||
|
||||
if (!(BDG_ACTIVE(ifp)) && !(ifp->if_bridge) &&
|
||||
if (!(ifp->if_bridge) &&
|
||||
!((ether_type == ETHERTYPE_VLAN || m->m_flags & M_VLANTAG) &&
|
||||
ifp->if_nvlans > 0)) {
|
||||
#ifdef DEV_CARP
|
||||
@ -929,8 +902,6 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *llc)
|
||||
bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
|
||||
if (ng_ether_attach_p != NULL)
|
||||
(*ng_ether_attach_p)(ifp);
|
||||
if (BDG_LOADED)
|
||||
bdgtakeifaces_ptr();
|
||||
|
||||
/* Announce Ethernet MAC address if non-zero. */
|
||||
for (i = 0; i < ifp->if_addrlen; i++)
|
||||
@ -955,8 +926,6 @@ ether_ifdetach(struct ifnet *ifp)
|
||||
}
|
||||
bpfdetach(ifp);
|
||||
if_detach(ifp);
|
||||
if (BDG_LOADED)
|
||||
bdgtakeifaces_ptr();
|
||||
}
|
||||
|
||||
SYSCTL_DECL(_net_link);
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/bridge.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
@ -644,9 +643,7 @@ ng_ether_rcv_upper(node_p node, struct mbuf *m)
|
||||
|
||||
m->m_pkthdr.rcvif = priv->ifp;
|
||||
|
||||
if (BDG_ACTIVE(priv->ifp) )
|
||||
if ((m = bridge_in_ptr(priv->ifp, m)) == NULL)
|
||||
return (0);
|
||||
/* XXX: if_bridge hook here? */
|
||||
|
||||
/* Route packet back in */
|
||||
ether_demux(priv->ifp, m);
|
||||
|
@ -37,7 +37,6 @@
|
||||
*/
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_bdg.h"
|
||||
#include "opt_mac.h"
|
||||
#include "opt_carp.h"
|
||||
|
||||
@ -59,7 +58,6 @@
|
||||
#include <net/netisr.h>
|
||||
#include <net/if_llc.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/bridge.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
@ -607,7 +605,7 @@ in_arpinput(m)
|
||||
int carp_match = 0;
|
||||
#endif
|
||||
|
||||
if (do_bridge || ifp->if_bridge)
|
||||
if (ifp->if_bridge)
|
||||
bridged = 1;
|
||||
|
||||
req_len = arphdr_len2(ifp->if_addrlen, sizeof(struct in_addr));
|
||||
|
@ -79,7 +79,6 @@
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <netinet/if_ether.h> /* for struct arpcom */
|
||||
#include <net/bridge.h>
|
||||
|
||||
#include <netinet/ip6.h> /* for ip6_input, ip6_output prototypes */
|
||||
#include <netinet6/ip6_var.h>
|
||||
@ -488,27 +487,6 @@ transmit_event(struct dn_pipe *pipe)
|
||||
|
||||
break;
|
||||
|
||||
case DN_TO_BDG_FWD :
|
||||
/*
|
||||
* The bridge requires/assumes the Ethernet header is
|
||||
* contiguous in the first mbuf header. Insure this is true.
|
||||
*/
|
||||
if (BDG_LOADED) {
|
||||
if (m->m_len < ETHER_HDR_LEN &&
|
||||
(m = m_pullup(m, ETHER_HDR_LEN)) == NULL) {
|
||||
printf("dummynet/bridge: pullup fail, dropping pkt\n");
|
||||
break;
|
||||
}
|
||||
m = bdg_forward_ptr(m, pkt->ifp);
|
||||
} else {
|
||||
/* somebody unloaded the bridge module. Drop pkt */
|
||||
/* XXX rate limit */
|
||||
printf("dummynet: dropping bridged packet trapped in pipe\n");
|
||||
}
|
||||
if (m)
|
||||
m_freem(m);
|
||||
break;
|
||||
|
||||
case DN_TO_ETH_DEMUX:
|
||||
/*
|
||||
* The Ethernet code assumes the Ethernet header is
|
||||
@ -1175,7 +1153,6 @@ locate_flowset(int pipe_nr, struct ip_fw *rule)
|
||||
* 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
|
||||
* rule matching rule, in case of multiple passes
|
||||
* flags flags from the caller, only used in ip_output
|
||||
*
|
||||
|
@ -121,7 +121,7 @@ struct dn_pkt_tag {
|
||||
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
|
||||
/* Obsolete: #define DN_TO_BDG_FWD 3 */
|
||||
#define DN_TO_ETH_DEMUX 4
|
||||
#define DN_TO_ETH_OUT 5
|
||||
#define DN_TO_IP6_IN 6
|
||||
|
@ -2076,7 +2076,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).
|
||||
*/
|
||||
|
@ -83,8 +83,6 @@ __FBSDID("$FreeBSD$");
|
||||
* three of my test boards seems fine.
|
||||
*/
|
||||
|
||||
#include "opt_bdg.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/sockio.h>
|
||||
|
@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/bridge.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/pfvar.h>
|
||||
#include <net/if_pfsync.h>
|
||||
@ -79,50 +78,8 @@ static void catchalarm (int);
|
||||
|
||||
#ifdef INET6
|
||||
static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */
|
||||
static int bdg_done;
|
||||
#endif
|
||||
|
||||
/* print bridge statistics */
|
||||
void
|
||||
bdg_stats(u_long dummy __unused, const char *name, int af1 __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] );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump pfsync statistics structure.
|
||||
*/
|
||||
|
@ -171,8 +171,6 @@ struct protox {
|
||||
{ -1, N_IPSECSTAT, 1, NULL,
|
||||
ipsec_stats, NULL, "ipsec", 0},
|
||||
#endif
|
||||
{ -1, -1, 1, NULL,
|
||||
bdg_stats, NULL, "bdg", 1 /* bridging... */ },
|
||||
{ -1, -1, 1, protopr,
|
||||
pim_stats, NULL, "pim", IPPROTO_PIM },
|
||||
{ -1, N_CARPSTAT, 1, 0,
|
||||
@ -203,8 +201,6 @@ struct protox ip6protox[] = {
|
||||
#endif
|
||||
{ -1, -1, 1, NULL,
|
||||
rip6_stats, NULL, "rip6", 0 },
|
||||
{ -1, -1, 1, NULL,
|
||||
bdg_stats, NULL, "bdg", 1 /* bridging... */ },
|
||||
{ -1, -1, 0, NULL,
|
||||
NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
@ -294,9 +294,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
|
||||
|
@ -99,8 +99,6 @@ void inet6print(struct in6_addr *, int, const char *, int);
|
||||
void pfkey_stats(u_long, const char *, int);
|
||||
#endif
|
||||
|
||||
void bdg_stats(u_long, const char *, int);
|
||||
|
||||
void mbpr(u_long, u_long, u_long, u_long, u_long, u_long,
|
||||
u_long, u_long, u_long, u_long, u_long);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user