diff options
author | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-16 00:17:44 +0000 |
---|---|---|
committer | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-16 00:17:44 +0000 |
commit | 04b269f5fe68dd08920decd62b115c58ac48b008 (patch) | |
tree | b08c38a278251a18b1953072e658c913107e240e /sys/net/if_iso88025subr.c | |
parent | bc33ea1acc76c96c94f8a9a97cd48c8d34a8e020 (diff) | |
download | src-04b269f5fe68dd08920decd62b115c58ac48b008.tar.gz src-04b269f5fe68dd08920decd62b115c58ac48b008.zip |
- Use IFP2AC().
- Support IFF_MONITOR.
- Borrow some consistency for if_input() routines from if_ethersubr.c.
- Correct comments regarding fddi_input() that no longer apply.
Notes
Notes:
svn path=/head/; revision=112308
Diffstat (limited to 'sys/net/if_iso88025subr.c')
-rw-r--r-- | sys/net/if_iso88025subr.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 0062f83d79bb..f6ef3f0bf9b9 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -246,7 +246,7 @@ iso88025_output(ifp, m, dst, rt0) struct iso88025_header gen_th; struct sockaddr_dl *sdl = NULL; struct rtentry *rt; - struct arpcom *ac = (struct arpcom *)ifp; + struct arpcom *ac = IFP2AC(ifp); #ifdef MAC error = mac_check_ifnet_transmit(ifp, m); @@ -254,6 +254,8 @@ iso88025_output(ifp, m, dst, rt0) senderr(error); #endif + if (ifp->if_flags & IFF_MONITOR) + senderr(ENETDOWN); if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); getmicrotime(&ifp->if_lastchange); @@ -429,6 +431,23 @@ iso88025_input(ifp, m) int isr; int mac_hdr_len; + /* + * Do consistency checks to verify assumptions + * made by code past this point. + */ + if ((m->m_flags & M_PKTHDR) == 0) { + if_printf(ifp, "discard frame w/o packet header\n"); + ifp->if_ierrors++; + m_freem(m); + return; + } + if (m->m_pkthdr.rcvif == NULL) { + if_printf(ifp, "discard frame w/o interface pointer\n"); + ifp->if_ierrors++; + m_freem(m); + return; + } + m = m_pullup(m, ISO88025_HDR_LEN); if (m == NULL) { ifp->if_ierrors++; @@ -443,6 +462,19 @@ iso88025_input(ifp, m) if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) goto dropanyway; + /* + * Give bpf a chance at the packet. + */ + BPF_MTAP(ifp, m); + + /* + * Interface marked for monitoring; discard packet. + */ + if (ifp->if_flags & IFF_MONITOR) { + m_freem(m); + return; + } + #ifdef MAC mac_create_mbuf_from_ifnet(ifp, m); #endif @@ -582,7 +614,7 @@ iso88025_input(ifp, m) int i; u_char c; - ac = (struct arpcom *)ifp; + ac = IFP2AC(ifp); c = l->llc_dsap; if (th->iso88025_shost[0] & TR_RII) { /* XXX */ |