From owner-svn-src-all@freebsd.org Thu May 26 21:33:09 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 879BDB4C1B3; Thu, 26 May 2016 21:33:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7272E1E0C; Thu, 26 May 2016 21:33:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u4QLX8FC009446 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 May 2016 14:33:08 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u4QLX8U6009445; Thu, 26 May 2016 14:33:08 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 26 May 2016 14:33:08 -0700 From: Gleb Smirnoff To: Michael Tuexen 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: <20160526213308.GJ58287@FreeBSD.org> References: <201605251348.u4PDmQdA040104@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201605251348.u4PDmQdA040104@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) 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: Thu, 26 May 2016 21:33:09 -0000 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.