Author: hrs
Date: Thu Jun 20 07:30:13 2013
New Revision: 252023
URL: http://svnweb.freebsd.org/changeset/base/252023

Log:
  MFC r250523:
  
  Add IFF_MONITOR support to gre(4).
  
  Tested by:    Chip Marshall

Modified:
  stable/9/sys/net/if_gre.c
  stable/9/sys/netinet/ip_gre.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/net/if_gre.c
==============================================================================
--- stable/9/sys/net/if_gre.c   Thu Jun 20 07:29:42 2013        (r252022)
+++ stable/9/sys/net/if_gre.c   Thu Jun 20 07:30:13 2013        (r252023)
@@ -343,6 +343,12 @@ gre_output(struct ifnet *ifp, struct mbu
                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) {

Modified: stable/9/sys/netinet/ip_gre.c
==============================================================================
--- stable/9/sys/netinet/ip_gre.c       Thu Jun 20 07:29:42 2013        
(r252022)
+++ stable/9/sys/netinet/ip_gre.c       Thu Jun 20 07:30:13 2013        
(r252023)
@@ -205,6 +205,11 @@ gre_input2(struct mbuf *m ,int hlen, u_c
                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);
@@ -289,6 +294,11 @@ gre_mobile_input(struct mbuf *m, int hle
                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);
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to