svn commit: r300679 - head/sys/netinet

Gleb Smirnoff glebius at FreeBSD.org
Thu May 26 21:33:09 UTC 2016


  Michael,

On Wed, May 25, 2016 at 01:48:26PM +0000, Michael Tuexen wrote:
M> Author: tuexen
M> Date: Wed May 25 13:48:26 2016
M> New Revision: 300679
M> URL: https://svnweb.freebsd.org/changeset/base/300679
M> 
M> Log:
M>   Count packets as not being delivered only if they are neither
M>   processed by a kernel handler nor by a raw socket.
M>   
M>   MFC after:	1 week
M> 
M> Modified:
M>   head/sys/netinet/raw_ip.c
M> 
M> Modified: head/sys/netinet/raw_ip.c
M> ==============================================================================
M> --- head/sys/netinet/raw_ip.c	Wed May 25 13:09:06 2016	(r300678)
M> +++ head/sys/netinet/raw_ip.c	Wed May 25 13:48:26 2016	(r300679)
M> @@ -132,6 +132,8 @@ int (*ip_rsvp_vif)(struct socket *, stru
M>  void (*ip_rsvp_force_done)(struct socket *);
M>  #endif /* INET */
M>  
M> +extern	struct protosw inetsw[];
M> +
M>  u_long	rip_sendspace = 9216;
M>  SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
M>      &rip_sendspace, 0, "Maximum outgoing raw IP datagram size");
M> @@ -411,9 +413,11 @@ rip_input(struct mbuf **mp, int *offp, i
M>  			IPSTAT_INC(ips_delivered);
M>  		INP_RUNLOCK(last);
M>  	} else {
M> +		if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) {
M> +			IPSTAT_INC(ips_noproto);
M> +			IPSTAT_DEC(ips_delivered);
M> +		}
M>  		m_freem(m);
M> -		IPSTAT_INC(ips_noproto);
M> -		IPSTAT_DEC(ips_delivered);
M>  	}
M>  	return (IPPROTO_DONE);
M>  }

How could it happen at this place that inetsw[ip_protox[ip->ip_p]].pr_input != rip_input?

Another question. Can we get rid of ugly IPSTAT_DEC()? Since pr_input is an integer,
we could return error up to ip_input() that would indicate non-delivery.

-- 
Totus tuus, Glebius.


More information about the svn-src-all mailing list