diff options
author | mdodd <mdodd@FreeBSD.org> | 2003-03-15 21:42:19 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2003-03-15 21:42:19 +0000 |
commit | b4d176598f1e20be1f27efaf34904800989306fc (patch) | |
tree | 007cd12a3df2992b8c5a5954098d62797665f86b /sys | |
parent | b9f3e4fdb77f3d888d58d514c210d171a35a09c7 (diff) | |
download | FreeBSD-src-b4d176598f1e20be1f27efaf34904800989306fc.zip FreeBSD-src-b4d176598f1e20be1f27efaf34904800989306fc.tar.gz |
- Adopt tests for (IFF_UP|IFF_RUNNING) and non local unicast packets
in promiscuous mode from if_fddisubr.c.
- Add comment to reduce diffs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_iso88025subr.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 457a5ab..249391c 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -412,17 +412,32 @@ iso88025_input(ifp, th, m) int isr; struct llc *l; - if ((ifp->if_flags & IFF_UP) == 0) { - m_freem(m); - return; - } + /* + * Discard packet if interface is not up. + */ + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) + goto dropanyway; #ifdef MAC mac_create_mbuf_from_ifnet(ifp, m); #endif - getmicrotime(&ifp->if_lastchange); + /* + * Update interface statistics. + */ ifp->if_ibytes += m->m_pkthdr.len + sizeof(*th); + getmicrotime(&ifp->if_lastchange); + + /* + * Discard non local unicast packets when interface + * is in promiscuous mode. + */ + if ((ifp->if_flags & IFF_PROMISC) && + ((th->iso88025_dhost[0] & 1) == 0) && + (bcmp(IFP2AC(ifp)->ac_enaddr, (caddr_t) th->iso88025_dhost, + ISO88025_ADDR_LEN) != 0)) + goto dropanyway; + } /* * Set mbuf flags for bcast/mcast. |