diff options
author | simokawa <simokawa@FreeBSD.org> | 2002-10-23 15:16:37 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2002-10-23 15:16:37 +0000 |
commit | 372485c16e67734ed4d85e216efae2e84cee4427 (patch) | |
tree | f5ad4b248330447deaa6d0e514de5897392397ea /sys/net/if_tun.c | |
parent | 10c353978d286fbef98da6d001731dee2a84dfbf (diff) | |
download | FreeBSD-src-372485c16e67734ed4d85e216efae2e84cee4427.zip FreeBSD-src-372485c16e67734ed4d85e216efae2e84cee4427.tar.gz |
Don't send/recieve packets when the interface is down.
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 88051d2..d476590 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -459,6 +459,11 @@ tunoutput( return (EHOSTDOWN); } + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { + m_freem (m0); + return (EHOSTDOWN); + } + /* BPF write needs to be handled specially */ if (dst->sa_family == AF_UNSPEC) { dst->sa_family = *(mtod(m0, int *)); @@ -707,6 +712,10 @@ tunwrite(dev_t dev, struct uio *uio, int flag) TUNDEBUG("%s%d: tunwrite\n", ifp->if_name, ifp->if_unit); + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) + /* ignore silently */ + return (0); + if (uio->uio_resid == 0) return (0); |