mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-05 14:29:28 +00:00
Don't send/recieve packets when the interface is down.
This commit is contained in:
parent
08675def10
commit
3983050934
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105804
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user