Add IFF_MONITOR support to gre(4).

Tested by:	Chip Marshall
MFC after:	1 week
This commit is contained in:
Hiroki Sato 2013-05-11 19:05:38 +00:00
parent 5af77b3ebd
commit b8992a6792
2 changed files with 16 additions and 0 deletions

View File

@ -341,6 +341,12 @@ gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
if (bpf_peers_present(ifp->if_bpf))
bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m);
if ((ifp->if_flags & IFF_MONITOR) != 0) {
m_freem(m);
error = ENETDOWN;
goto end;
}
m->m_flags &= ~(M_BCAST|M_MCAST);
if (sc->g_proto == IPPROTO_MOBILE) {

View File

@ -205,6 +205,11 @@ gre_input2(struct mbuf *m ,int hlen, u_char proto)
bpf_mtap2(GRE2IFP(sc)->if_bpf, &af, sizeof(af), m);
}
if ((GRE2IFP(sc)->if_flags & IFF_MONITOR) != 0) {
m_freem(m);
return(NULL);
}
m->m_pkthdr.rcvif = GRE2IFP(sc);
netisr_queue(isr, m);
@ -287,6 +292,11 @@ gre_mobile_input(struct mbuf *m, int hlen)
bpf_mtap2(GRE2IFP(sc)->if_bpf, &af, sizeof(af), m);
}
if ((GRE2IFP(sc)->if_flags & IFF_MONITOR) != 0) {
m_freem(m);
return;
}
m->m_pkthdr.rcvif = GRE2IFP(sc);
netisr_queue(NETISR_IP, m);