Bridging support. Wait for LINT to be updated before trying it.
This commit is contained in:
parent
10db74e96d
commit
fb5fbe465a
@ -77,6 +77,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h> /* for net/if.h */
|
||||
#include <sys/kernel.h>
|
||||
@ -89,9 +90,11 @@
|
||||
#include <netinet/if_ether.h> /* for struct arpcom */
|
||||
|
||||
#include "opt_ipfw.h"
|
||||
#include "opt_ipdn.h"
|
||||
|
||||
#if defined(IPFIREWALL) && defined(DUMMYNET)
|
||||
#include <net/route.h>
|
||||
#include <netinet/ip_fw.h>
|
||||
#include <netinet/ip_dummynet.h>
|
||||
#endif
|
||||
|
||||
@ -236,7 +239,7 @@ bdg_timeout(void *dummy)
|
||||
if (--slowtimer <= 0 ) {
|
||||
slowtimer = 5 ;
|
||||
|
||||
for (ifp = ifnet; ifp; ifp = ifp->if_next) {
|
||||
for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) {
|
||||
if (ifp->if_type != IFT_ETHER)
|
||||
continue ;
|
||||
if ( 0 == ( ifp->if_flags & IFF_UP) ) {
|
||||
@ -299,8 +302,9 @@ bdginit(dummy)
|
||||
bdg_ports = 0 ;
|
||||
eth_addr = bdg_addresses ;
|
||||
|
||||
printf("BRIDGE 980911, have %d interfaces\n", if_index);
|
||||
for (i = 0 , ifp = ifnet ; i < if_index ; i++, ifp = ifp->if_next)
|
||||
printf("BRIDGE 981214, have %d interfaces\n", if_index);
|
||||
for (i = 0 , ifp = ifnet.tqh_first ; i < if_index ;
|
||||
i++, ifp = ifp->if_link.tqe_next)
|
||||
if (ifp->if_type == IFT_ETHER) { /* ethernet ? */
|
||||
ac = (struct arpcom *)ifp;
|
||||
sprintf(bdg_stats.s[ifp->if_index].name,
|
||||
@ -322,7 +326,7 @@ bdginit(dummy)
|
||||
bdg_ports ++ ;
|
||||
}
|
||||
bdg_timeout(0);
|
||||
do_bridge=1;
|
||||
do_bridge=0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -464,7 +468,7 @@ bdg_forward (struct mbuf **m0, struct ifnet *dst)
|
||||
return 0;
|
||||
}
|
||||
if (dst == BDG_BCAST || dst == BDG_MCAST || dst == BDG_UNKNOWN) {
|
||||
ifp = ifnet ;
|
||||
ifp = ifnet.tqh_first ;
|
||||
once = 0 ;
|
||||
if (dst != BDG_UNKNOWN)
|
||||
canfree = 0 ;
|
||||
@ -515,7 +519,7 @@ bdg_forward (struct mbuf **m0, struct ifnet *dst)
|
||||
}
|
||||
|
||||
dummy = 0 ;
|
||||
off=(*ip_fw_chk_ptr)(NULL, 0, src, &dummy, &m, &rule) ;
|
||||
off= (*ip_fw_chk_ptr)(NULL, 0, src, &dummy, &m, &rule, NULL /*next hop */ ) ;
|
||||
if (m == NULL) { /* pkt discarded by firewall */
|
||||
printf("-- bdg: firewall discarded pkt\n");
|
||||
if (canfree)
|
||||
@ -556,12 +560,12 @@ forward:
|
||||
else
|
||||
m = NULL ;
|
||||
|
||||
for ( ; ifp ; ifp = ifp->if_next ) {
|
||||
for ( ; ifp ; ifp = ifp->if_link.tqe_next ) {
|
||||
if (ifp != src && ifp->if_type == IFT_ETHER &&
|
||||
(ifp->if_flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING) &&
|
||||
SAMEGROUP(ifp, src) && !MUTED(ifp) ) {
|
||||
if (m == NULL) { /* do i need to make a copy ? */
|
||||
if (canfree && ifp->if_next == NULL) /* last one! */
|
||||
if (canfree && ifp->if_link.tqe_next == NULL) /* last one! */
|
||||
m = *m0 ;
|
||||
else /* on a P5-90, m_packetcopy takes 540 ticks */
|
||||
m = m_copypacket(*m0, M_DONTWAIT);
|
||||
|
@ -108,7 +108,7 @@ struct bdg_stats {
|
||||
* BDG_DROP must be dropped
|
||||
* other ifp of the dest. interface (incl.self)
|
||||
*/
|
||||
static inline
|
||||
static __inline
|
||||
struct ifnet *
|
||||
bridge_dst_lookup(struct mbuf *m)
|
||||
{
|
||||
|
@ -31,12 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
|
||||
* $Id: if_ethersubr.c,v 1.51 1998/06/14 20:58:14 julian Exp $
|
||||
* $Id: if_ethersubr.c,v 1.52 1998/08/04 23:17:05 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_atalk.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipx.h"
|
||||
#include "opt_bdg.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -101,6 +102,10 @@ extern u_char at_org_code[3];
|
||||
extern u_char aarp_org_code[3];
|
||||
#endif /* NETATALK */
|
||||
|
||||
#ifdef BRIDGE
|
||||
#include <net/bridge.h>
|
||||
#endif
|
||||
|
||||
#include "vlan.h"
|
||||
#if NVLAN > 0
|
||||
#include <net/if_vlan_var.h>
|
||||
@ -372,7 +377,19 @@ ether_output(ifp, m0, dst, rt0)
|
||||
return(0); /* XXX */
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BRIDGE
|
||||
if (do_bridge) {
|
||||
struct ifnet *old_ifp = ifp ;
|
||||
struct mbuf *m0 = m ;
|
||||
if (m->m_pkthdr.rcvif )
|
||||
m->m_pkthdr.rcvif = NULL ;
|
||||
ifp = bridge_dst_lookup(m);
|
||||
bdg_forward(&m0, ifp);
|
||||
if (m0)
|
||||
m_freem(m0);
|
||||
return 0 ;
|
||||
}
|
||||
#endif
|
||||
s = splimp();
|
||||
/*
|
||||
* Queue message on interface, and start output if interface
|
||||
|
Loading…
x
Reference in New Issue
Block a user