From owner-svn-src-all@freebsd.org Fri May 27 09:13:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBF00B4A487; Fri, 27 May 2016 09:13:24 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B685B145D; Fri, 27 May 2016 09:13:24 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.100] (p508F1C85.dip0.t-ipconnect.de [80.143.28.133]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 5FA65721E281E; Fri, 27 May 2016 11:13:11 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r300679 - head/sys/netinet From: Michael Tuexen In-Reply-To: <20160526213308.GJ58287@FreeBSD.org> Date: Fri, 27 May 2016 11:13:07 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <170591C9-DA72-4780-93C6-41B81131F9DB@freebsd.org> References: <201605251348.u4PDmQdA040104@repo.freebsd.org> <20160526213308.GJ58287@FreeBSD.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.3124) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 09:13:25 -0000 > On 26 May 2016, at 23:33, Gleb Smirnoff 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.