From: angelos Date: Mon, 10 Apr 2000 07:34:53 +0000 (+0000) Subject: Minor oops in sanity logic, IFF_RUNNING is set/unset with IFF_UP, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fc1f920f6a4d986a08efd2dff210f1db36cbc073;p=openbsd Minor oops in sanity logic, IFF_RUNNING is set/unset with IFF_UP, be paranoid with uninitialized variable. --- 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: