From owner-freebsd-net@freebsd.org Sat Jul 22 13:55:20 2017 Return-Path: Delivered-To: freebsd-net@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 0E4C8D9D524 for ; Sat, 22 Jul 2017 13:55:20 +0000 (UTC) (envelope-from daniel.bilik@neosystem.cz) Received: from mail.neosystem.cz (mail.neosystem.cz [IPv6:2001:41d0:2:5ab8::10:15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEE317F13F for ; Sat, 22 Jul 2017 13:55:19 +0000 (UTC) (envelope-from daniel.bilik@neosystem.cz) Received: from mail.neosystem.cz (unknown [127.0.10.15]) by mail.neosystem.cz (Postfix) with ESMTP id 26415AE40; Sat, 22 Jul 2017 15:55:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.neosystem.cz Received: from dragon.sn.neosystem.cz (unknown [IPv6:2001:41d0:2:5ab8::100:f883]) by mail.neosystem.cz (Postfix) with ESMTPA id A7BDEAE38; Sat, 22 Jul 2017 15:55:16 +0200 (CEST) Date: Sat, 22 Jul 2017 15:51:57 +0200 From: Daniel Bilik To: "Andrey V. Elsukov" Cc: freebsd-net@freebsd.org Subject: Re: mbuf clusters leak in netinet6 Message-Id: <20170722155157.b29206752f49422e40e58c5d@neosystem.cz> In-Reply-To: <5dadd0d0-d5ce-3a2c-7ad6-1c0a39a4a0e7@yandex.ru> References: <20170721232112.82f6e78b76057312183be937@neosystem.cz> <5dadd0d0-d5ce-3a2c-7ad6-1c0a39a4a0e7@yandex.ru> Organization: neosystem.cz X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-portbld-dragonfly4.9) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jul 2017 13:55:20 -0000 On Sat, 22 Jul 2017 12:11:31 +0300 "Andrey V. Elsukov" wrote: > Freeing mbuf is under pfil hook responsibility, if it returns nonzero > value it must call m_freem(). So, it is bug in the ndpacket.c. Ah, thanks for clarifying this. It was quite unclear to me, because at other place I've seen m_freem() is called after non-zero pfil_run_hooks() result. [1] Nevertheless, I've patched and tested ndproxy as you suggested, and it works fine, with no mbuf leaks. Pull request created. [2] Thank you once again for looking at this. -- Dan [1] https://github.com/freebsd/freebsd/blob/master/sys/netinet/ip_fastfwd.c#L232 [2] https://github.com/AlexandreFenyo/ndproxy/pull/3