summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_ether.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-12-03 14:51:06 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-12-03 14:51:06 +0000
commitf011df21d7190430bdfb5446677e0c2fcd867dd1 (patch)
treee995311624db6497e40ad244e6ca2569bd032f81 /sys/netinet/ip_ether.c
parent65ce751e45d7d4413ef1e39660d0a6a0266e8ae3 (diff)
add support for ifconfig clone/destroy; ok henning deraadt
Diffstat (limited to 'sys/netinet/ip_ether.c')
-rw-r--r--sys/netinet/ip_ether.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 419bf3f4942..97e47e3bdeb 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.45 2003/08/14 19:00:12 jason Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.46 2003/12/03 14:51:05 markus Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
*
@@ -86,7 +86,7 @@ etherip_input(struct mbuf *m, ...)
va_list ap;
#if NGIF > 0
- int i;
+ struct gif_softc *sc;
#if NBRIDGE > 0
int s;
#endif /* NBRIDGE */
@@ -222,27 +222,27 @@ etherip_input(struct mbuf *m, ...)
#if NGIF > 0
/* Find appropriate gif(4) interface */
- for (i = 0; i < ngif; i++) {
- if ((gif_softc[i].gif_psrc == NULL) ||
- (gif_softc[i].gif_pdst == NULL) ||
- !(gif_softc[i].gif_if.if_flags & (IFF_UP|IFF_RUNNING)))
+ LIST_FOREACH(sc, &gif_softc_list, gif_list) {
+ if ((sc->gif_psrc == NULL) ||
+ (sc->gif_pdst == NULL) ||
+ !(sc->gif_if.if_flags & (IFF_UP|IFF_RUNNING)))
continue;
- if (!bcmp(gif_softc[i].gif_psrc, &sdst, gif_softc[i].gif_psrc->sa_len) &&
- !bcmp(gif_softc[i].gif_pdst, &ssrc, gif_softc[i].gif_pdst->sa_len) &&
- gif_softc[i].gif_if.if_bridge != NULL)
+ if (!bcmp(sc->gif_psrc, &sdst, sc->gif_psrc->sa_len) &&
+ !bcmp(sc->gif_pdst, &ssrc, sc->gif_pdst->sa_len) &&
+ sc->gif_if.if_bridge != NULL)
break;
}
/* None found. */
- if (i >= ngif) {
+ if (sc == NULL) {
DPRINTF(("etherip_input(): no interface found\n"));
etheripstat.etherip_noifdrops++;
m_freem(m);
return;
}
#if NBPFILTER > 0
- if (gif_softc[i].gif_if.if_bpf) {
+ if (sc->gif_if.if_bpf) {
struct mbuf m0;
u_int32_t af = sdst.sa.sa_family;
@@ -251,7 +251,7 @@ etherip_input(struct mbuf *m, ...)
m0.m_len = 4;
m0.m_data = (char *)&af;
- bpf_mtap(gif_softc[i].gif_if.if_bpf, &m0);
+ bpf_mtap(sc->gif_if.if_bpf, &m0);
}
#endif
@@ -261,12 +261,12 @@ etherip_input(struct mbuf *m, ...)
* NULL if it has consumed the packet. In the case of gif's,
* bridge_input() returns non-NULL when an error occurs.
*/
- m->m_pkthdr.rcvif = &gif_softc[i].gif_if;
+ m->m_pkthdr.rcvif = &sc->gif_if;
if (m->m_flags & (M_BCAST|M_MCAST))
- gif_softc[i].gif_if.if_imcasts++;
+ sc->gif_if.if_imcasts++;
s = splnet();
- m = bridge_input(&gif_softc[i].gif_if, &eh, m);
+ m = bridge_input(&sc->gif_if, &eh, m);
splx(s);
if (m == NULL)
return;