From owner-freebsd-net@FreeBSD.ORG Sun Feb 23 06:13:08 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 168F0A8E for ; Sun, 23 Feb 2014 06:13:08 +0000 (UTC) Received: from mail-qc0-x234.google.com (mail-qc0-x234.google.com [IPv6:2607:f8b0:400d:c01::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C58801C4B for ; Sun, 23 Feb 2014 06:13:07 +0000 (UTC) Received: by mail-qc0-f180.google.com with SMTP id i17so7896393qcy.39 for ; Sat, 22 Feb 2014 22:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=PwiV1J5XFmfeXEbvUT7rgL33B7F9DQ/lA0Iw9hYOihM=; b=rGvHJaGFOq6Vfb0QUwrrP3P0NamRhtGdIWniRvSJjApqjn/mv/VNWKI1Nwb7g1Qtpw jZli++5oD3jg082OjXq9A5iv28zTvhv/fnvAR/b5SclHjDGHdgAeOqcxmBIKEHjtH2kw d17E53pXEgER5bHm2IHnYNz2jzpiXlys1CiN682yXMWAtO3D2cDiq+4+f/fN7vCzhvHG duqNZeJ5XPCsTJHrNZA9Slebp/RP1bu4kMMldkbIUxKJjrHdGKEPzmghjj/T/b7IEVuB z5lmDMSpqRsp0vUKC2T7fTX7ck3XMZW+2qBRj0iF2AtLLIva07rfwJ9oN7fXYU8m4n40 O5fA== MIME-Version: 1.0 X-Received: by 10.140.96.180 with SMTP id k49mr20237754qge.4.1393135987023; Sat, 22 Feb 2014 22:13:07 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.16.10 with HTTP; Sat, 22 Feb 2014 22:13:06 -0800 (PST) In-Reply-To: <1393109280.11968.3.camel@fr-wks3.corp.novso.com> References: <1391725273.22934.16.camel@fr-wks3.corp.novso.com> <1392417340.10711.5.camel@fr-wks3.corp.novso.com> <52FEA4F5.5010702@yandex.ru> <52FEA5A2.3050106@yandex.ru> <1392641917.21759.1.camel@srv31.corp.novso.com> <53020F0F.9050809@yandex.ru> <1392648453.22762.2.camel@srv31.corp.novso.com> <5304DA80.6010403@yandex.ru> <1393109280.11968.3.camel@fr-wks3.corp.novso.com> Date: Sat, 22 Feb 2014 22:13:06 -0800 X-Google-Sender-Auth: C_pmwbo_poVPlWiC7ZCgssCHQCc Message-ID: Subject: Re: IPsec filtertunnel broken on FreeBSD 10 From: Adrian Chadd To: Nicolas DEFFAYET Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD Net , "Andrey V. Elsukov" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Feb 2014 06:13:08 -0000 Hi, Please make sure you file a PR and loop andre@freebsd.org into it too. thanks, -a On 22 February 2014 14:48, Nicolas DEFFAYET wrote: > On Wed, 2014-02-19 at 20:23 +0400, Andrey V. Elsukov wrote: > Hello, > > After very long testing, i have discovered the route cause. > Testing is not easy as there is a dependency between kernel and > userland, it's not like on a Linux where the kernel is not depend of > userland. > Broken userland can generate false-positive result. > > The revision 254519 break the firewall with IPsec. > http://svnweb.freebsd.org/base?view=revision&revision=254519 > > "Move the global M_SKIP_FIREWALL mbuf flags to a protocol layer specific > flag instead. The flag is only used within the IP and IPv6 layer 3 > protocols. > > Because some firewall packages treat IPv4 and IPv6 packets the same the > flag should have the same value for both." > > It seem that some code doesn't have been updated for allow firewall to > work with IPsec. > > > FreeBSD 10.0-CURRENT #0 r254518 (10-userland) > ------------------------------- > # ipfw -a list > 00010 6 326 allow log logamount 10000 tcp from 192.168.0.1 to > 192.168.0.2 dst-port 22 via re0 in > 00020 0 0 allow log logamount 10000 tcp from 192.168.0.2 to > 192.168.0.1 dst-port 22 via re0 out > 65535 5149 411660 allow ip from any to any > => ipfw counters are ok for inbound > > Feb 22 22:16:44 host2 kernel: ipfw: 10 Accept TCP 192.168.0.1:51691 > 192.168.0.2:22 in via re0 > => ipfw see the connection > > 22:18:16.127112 IP 192.168.0.1 > 224.0.0.5: OSPFv2, Hello, length 44 > 22:18:21.042325 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc15a), length 92 > 22:18:21.042548 IP 192.168.0.2 > 192.168.0.1: > ESP(spi=0x00003039,seq=0x6), length 92 > 22:18:21.042785 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc15b), length 84 > 22:18:21.074818 IP 192.168.0.2 > 192.168.0.1: > ESP(spi=0x00003039,seq=0x7), length 116 > 22:18:21.174651 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc15c), length 84 > => traffic is encrypted by IPsec > > > FreeBSD 10.0-CURRENT #0 r254519 (10-userland) > ------------------------------- > # ipfw -a list > 00010 0 0 allow log logamount 10000 tcp from 192.168.0.1 to > 192.168.0.2 dst-port 22 via re0 in > 00020 0 0 allow log logamount 10000 tcp from 192.168.0.2 to > 192.168.0.1 dst-port 22 via re0 out > 65535 3132 249778 allow ip from any to any > => ipfw counters are not increased! > > nothing in log > => ipfw DO NOT see the connection! > > 22:22:05.890386 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc165), length 92 > 22:22:05.890565 IP 192.168.0.2 > 192.168.0.1: > ESP(spi=0x00003039,seq=0x6), length 92 > 22:22:05.890793 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc166), length 84 > 22:22:05.922544 IP 192.168.0.2 > 192.168.0.1: > ESP(spi=0x00003039,seq=0x7), length 116 > 22:22:06.022056 IP 192.168.0.1 > 192.168.0.2: > ESP(spi=0x00003039,seq=0xc167), length 84 > => traffic is encrypted by IPsec > > > Many thanks > > -- > Nicolas DEFFAYET > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"