diff options
author | 2000-04-10 07:34:53 +0000 | |
---|---|---|
committer | 2000-04-10 07:34:53 +0000 | |
commit | fc1f920f6a4d986a08efd2dff210f1db36cbc073 (patch) | |
tree | faca5a854fec935f2a6d73ac8df0f06888628383 | |
parent | Oops on sanity logic. (diff) | |
download | wireguard-openbsd-fc1f920f6a4d986a08efd2dff210f1db36cbc073.tar.xz wireguard-openbsd-fc1f920f6a4d986a08efd2dff210f1db36cbc073.zip |
Minor oops in sanity logic, IFF_RUNNING is set/unset with IFF_UP,
be paranoid with uninitialized variable.
-rw-r--r-- | sys/net/if_enc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c index 339cc1037d0..9f7edda7e57 100644 --- a/sys/net/if_enc.c +++ b/sys/net/if_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_enc.c,v 1.26 2000/04/10 04:39:41 angelos Exp $ */ +/* $OpenBSD: if_enc.c,v 1.27 2000/04/10 07:34:53 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -164,8 +164,8 @@ struct ifnet *ifp; /* If the interface is not setup, flush the queue */ if ((enc->sc_spi == 0) && (enc->sc_sproto == 0) && - ((enc->sc_dst.sa.sa_family == AF_INET) || - (enc->sc_dst.sa.sa_family == AF_INET6))) + (enc->sc_dst.sa.sa_family != AF_INET) && + (enc->sc_dst.sa.sa_family != AF_INET6)) { DPRINTF(("%s: not initialized with SA\n", ifp->if_xname)); @@ -240,6 +240,8 @@ struct ifnet *ifp; if (m == NULL) /* Empty queue */ return; + mp = NULL; + /* Encapsulate in etherip or ip-in-ip, depending on interface flag */ if (ifp->if_flags & IFF_LINK0) err = ipip_output(m, tdb, &mp, 0, 0); /* Last 2 args not used */ @@ -352,6 +354,10 @@ caddr_t data; case SIOCAIFADDR: case SIOCSIFDSTADDR: case SIOCSIFFLAGS: + if (ifp->if_flags & IFF_UP) + ifp->if_flags |= IFF_RUNNING; + else + ifp->if_flags &= ~IFF_RUNNING; break; case SIOCGENCSA: |