diff options
author | Jason Wright <jason@cvs.openbsd.org> | 1999-03-19 02:46:56 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 1999-03-19 02:46:56 +0000 |
commit | e851ae564f648165b1455149fbc4294d49050b11 (patch) | |
tree | d47352fc8da30b766a10ac3464263b5fd581353c /sys | |
parent | 590d0602794e98ae6b4e17a4792d79b06f61d42b (diff) |
Add the ability to mark an interface as "non-learning"
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_bridge.c | 62 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 4 | ||||
-rw-r--r-- | sys/sys/sockio.h | 4 |
3 files changed, 64 insertions, 6 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index cc777402272..9e3ed260c65 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.6 1999/03/12 02:40:43 jason Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.7 1999/03/19 02:46:54 jason Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -280,6 +280,7 @@ bridge_ioctl(ifp, cmd, data) } p->ifp = ifs; + p->bif_flags = IFBIF_LEARNING; LIST_INSERT_HEAD(&sc->sc_iflist, p, next); ifs->if_bridge = (caddr_t)sc; break; @@ -310,6 +311,48 @@ bridge_ioctl(ifp, cmd, data) case SIOCBRDGIFS: error = bridge_bifconf(sc, bifconf); break; + case SIOCBRDGGIFFLGS: + ifs = ifunit(req->ifbr_ifsname); + if (ifs == NULL) { + error = ENOENT; + break; + } + if ((caddr_t)sc != ifs->if_bridge) { + error = ESRCH; + break; + } + p = LIST_FIRST(&sc->sc_iflist); + while (p != NULL && p->ifp != ifs) { + p = LIST_NEXT(p, next); + } + if (p == NULL) { + error = ESRCH; + break; + } + req->ifbr_ifsflags = p->bif_flags; + break; + case SIOCBRDGSIFFLGS: + if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0) + break; + ifs = ifunit(req->ifbr_ifsname); + if (ifs == NULL) { + error = ENOENT; + break; + } + if ((caddr_t)sc != ifs->if_bridge) { + error = ESRCH; + break; + } + p = LIST_FIRST(&sc->sc_iflist); + while (p != NULL && p->ifp != ifs) { + p = LIST_NEXT(p, next); + } + if (p == NULL) { + error = ESRCH; + break; + } + p->bif_flags = req->ifbr_ifsflags; + break; case SIOCBRDGRTS: if ((ifp->if_flags & IFF_RUNNING) == 0) { error = ENETDOWN; @@ -643,6 +686,7 @@ bridge_input(ifp, eh, m) struct arpcom *ac; struct ether_addr *dst, *src; struct ifnet *dst_if; + struct bridge_iflist *ifl; int s; /* @@ -677,11 +721,21 @@ bridge_input(ifp, eh, m) dst = (struct ether_addr *)&eh->ether_dhost[0]; src = (struct ether_addr *)&eh->ether_shost[0]; + ifl = LIST_FIRST(&sc->sc_iflist); + while (ifl != NULL && ifl->ifp != ifp) { + ifl = LIST_NEXT(ifl, next); + } + if (ifl == NULL) { + splx(s); + return (m); + } + /* - * If source address is not broadcast or multicast, record - * it's address. + * If interface is learning, and if source address is not broadcast + * or multicast, record it's address. */ - if ((eh->ether_shost[0] & 1) == 0 && + if ((ifl->bif_flags & IFBIF_LEARNING) && + (eh->ether_shost[0] & 1) == 0 && !(eh->ether_shost[0] == 0 && eh->ether_shost[1] == 0 && eh->ether_shost[2] == 0 && eh->ether_shost[3] == 0 && eh->ether_shost[4] == 0 && eh->ether_shost[5] == 0)) diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 7838fdf2c6f..6ebcccf5df1 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.4 1999/03/12 02:40:43 jason Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.5 1999/03/19 02:46:54 jason Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -40,6 +40,8 @@ struct ifbreq { u_int32_t ifbr_ifsflags; /* memver ifs flags */ }; +#define IFBIF_LEARNING 0x1 /* ifs can learn */ + /* * Interface list structure */ diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index aad00f61001..28211d2613f 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sockio.h,v 1.8 1999/03/12 02:40:43 jason Exp $ */ +/* $OpenBSD: sockio.h,v 1.9 1999/03/19 02:46:55 jason Exp $ */ /* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */ /*- @@ -85,6 +85,8 @@ #define SIOCBRDGADD _IOWR('i', 60, struct ifbreq) /* add bridge ifs */ #define SIOCBRDGDEL _IOWR('i', 61, struct ifbreq) /* del bridge ifs */ +#define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */ +#define SIOCBRDGSIFFLGS _IOWR('i', 63, struct ifbreq) /* set brdg if flags */ #define SIOCBRDGSCACHE _IOWR('i', 64, struct ifbcachereq) /* set cache size */ #define SIOCBRDGGCACHE _IOWR('i', 65, struct ifbcachereq) /* get cache size */ #define SIOCBRDGIFS _IOWR('i', 66, struct ifbreq) /* get member ifs */ |