Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2016 11:13:07 +0200
From:      Michael Tuexen <tuexen@freebsd.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r300679 - head/sys/netinet
Message-ID:  <170591C9-DA72-4780-93C6-41B81131F9DB@freebsd.org>
In-Reply-To: <20160526213308.GJ58287@FreeBSD.org>
References:  <201605251348.u4PDmQdA040104@repo.freebsd.org> <20160526213308.GJ58287@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 26 May 2016, at 23:33, Gleb Smirnoff <glebius@FreeBSD.org> wrote:
>=20
>  Michael,
>=20
> 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>=20
> 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>  =20
> M>   MFC after:	1 week
> M>=20
> M> Modified:
> M>   head/sys/netinet/raw_ip.c
> M>=20
> M> Modified: head/sys/netinet/raw_ip.c
> M> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> 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> =20
> M> +extern	struct protosw inetsw[];
> M> +
> M>  u_long	rip_sendspace =3D 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 =3D=3D =
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>  }
>=20
> How could it happen at this place that =
inetsw[ip_protox[ip->ip_p]].pr_input !=3D rip_input?
Hi Gleb,

rip_input() does not only get called when there is no protocol handler =
in the kernel
for the protocol, but also, for example, for ICMP. See
=
http://svnweb.freebsd.org/base/head/sys/netinet/ip_icmp.c?revision=3D30069=
9&view=3Dmarkup#l684
I think we should only increment the ips_noproto counter when we neither =
have a handler for
it in the kernel nor any raw socket. That is why I added the condition. =
Did I miss anything?
>=20
> 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.
I think the return code indicates whether the packet processing is done =
or not, not
to return an error.

Best regards
Michael
>=20
> --=20
> Totus tuus, Glebius.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?170591C9-DA72-4780-93C6-41B81131F9DB>