From nobody Mon Aug 02 19:12:18 2021 X-Original-To: freebsd-ipfw@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57DB812B6781 for ; Mon, 2 Aug 2021 19:12:20 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from dss.incore.de (dss.incore.de [195.145.1.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdngl567cz4sLG for ; Mon, 2 Aug 2021 19:12:19 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from dssresv3.local.incore (fwintern.dmz [10.0.0.253]) by dss.incore.de (Postfix) with ESMTP id AB3E76BC477 for ; Mon, 2 Aug 2021 21:12:18 +0200 (CEST) Received: from [192.168.14.27] (unknown [192.168.99.6]) by dssresv3.local.incore (Postfix) with ESMTPS id 8DBE727363 for ; Mon, 2 Aug 2021 21:12:18 +0200 (CEST) To: freebsd-ipfw@freebsd.org X-FromHeader: Inserted by smtpd-cleanup: Andreas Longwitz From: Andreas Longwitz Subject: Re: How to Force Packet Traversal Order (IPFW2 => PF) Message-ID: <8c98b127-3241-4d3f-378b-10c03595ab8a@incore.de> Date: Mon, 2 Aug 2021 21:12:18 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 List-Id: IPFW Technical Discussions List-Archive: https://lists.freebsd.org/archives/freebsd-ipfw List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ipfw@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4Gdngl567cz4sLG X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of longwitz@incore.de designates 195.145.1.138 as permitted sender) smtp.mailfrom=longwitz@incore.de X-Spamd-Result: default: False [-1.97 / 15.00]; ARC_NA(0.00)[]; FAKE_REPLY(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.145.1.138:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ipfw@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[incore.de]; NEURAL_HAM_SHORT(-0.67)[-0.672]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:3320, ipnet:195.145.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N If both pf and ipfw2 are active firewalls then I change their sequence with pfctl -d; pfctl -e to set pf in the first place or with sysctl net.inet.ip.fw.enable=0; sysctl net.inet.ip.fw.enable=1 to set ipfw2 in the first place. To check for the actual sequence I use a hack with the help of the kernel debugger: echo -n "Sequence of firewall functions for incoming pakets: " cat > .gdbinit << EOF p *(*pfil_head_list->lh_first)->ph_in->tqh_first p *(*(*pfil_head_list->lh_first)->ph_in->tqh_first)->pfil_chain->tqe_next quit EOF kernel=$(sysctl -n kern.bootfile) test -f ${kernel} || kernel="/boot/kernel/kernel" { kgdb ${kernel} /dev/mem } 2>/dev/null | \ { grep pfil_func | sed -e 's/.*<\(.*\)>.*/ \1/' | xargs echo; } rm .gdbinit It would be fine to have a sysctl variable to get this indormation. Andreas