- 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.
This commit is contained in:
parent
bc33ea1acc
commit
04b269f5fe
@ -128,6 +128,8 @@ fddi_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);
|
||||
@ -324,9 +326,7 @@ fddi_output(ifp, m, dst, rt0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Process a received FDDI packet;
|
||||
* the packet is in the mbuf chain m without
|
||||
* the fddi header, which is provided separately.
|
||||
* Process a received FDDI packet.
|
||||
*/
|
||||
static void
|
||||
fddi_input(ifp, m)
|
||||
@ -337,7 +337,30 @@ fddi_input(ifp, m)
|
||||
struct llc *l;
|
||||
struct fddi_header *fh;
|
||||
|
||||
/*
|
||||
* 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, FDDI_HDR_LEN);
|
||||
if (m == NULL) {
|
||||
ifp->if_ierrors++;
|
||||
goto dropanyway;
|
||||
}
|
||||
fh = mtod(m, struct fddi_header *);
|
||||
m->m_pkthdr.header = (void *)fh;
|
||||
|
||||
/*
|
||||
* Discard packet if interface is not up.
|
||||
@ -345,6 +368,19 @@ fddi_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
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user