Author: tuexen
Date: Wed May 25 13:48:26 2016
New Revision: 300679
URL: https://svnweb.freebsd.org/changeset/base/300679

Log:
  Count packets as not being delivered only if they are neither
  processed by a kernel handler nor by a raw socket.
  
  MFC after:    1 week

Modified:
  head/sys/netinet/raw_ip.c

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c   Wed May 25 13:09:06 2016        (r300678)
+++ head/sys/netinet/raw_ip.c   Wed May 25 13:48:26 2016        (r300679)
@@ -132,6 +132,8 @@ int (*ip_rsvp_vif)(struct socket *, stru
 void (*ip_rsvp_force_done)(struct socket *);
 #endif /* INET */
 
+extern struct protosw inetsw[];
+
 u_long rip_sendspace = 9216;
 SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
     &rip_sendspace, 0, "Maximum outgoing raw IP datagram size");
@@ -411,9 +413,11 @@ rip_input(struct mbuf **mp, int *offp, i
                        IPSTAT_INC(ips_delivered);
                INP_RUNLOCK(last);
        } else {
+               if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) {
+                       IPSTAT_INC(ips_noproto);
+                       IPSTAT_DEC(ips_delivered);
+               }
                m_freem(m);
-               IPSTAT_INC(ips_noproto);
-               IPSTAT_DEC(ips_delivered);
        }
        return (IPPROTO_DONE);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to