From nobody Wed Jul 20 12:45:28 2022 X-Original-To: pf@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 4LnwQz5Gtbz4Wxk9 for ; Wed, 20 Jul 2022 12:45:31 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1.sentex.ca [IPv6:2607:f3e0:0:1::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smarthost1.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LnwQy6CYvz3SvC for ; Wed, 20 Jul 2022 12:45:30 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [199.212.134.19]) by smarthost1.sentex.ca (8.16.1/8.16.1) with ESMTPS id 26KCjSiL085423 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 20 Jul 2022 08:45:28 -0400 (EDT) (envelope-from mike@sentex.net) Received: from [IPV6:2607:f3e0:0:4:4c4:1e6c:8e03:d8c0] ([IPv6:2607:f3e0:0:4:4c4:1e6c:8e03:d8c0]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 26KCjRID013480 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 20 Jul 2022 08:45:28 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <27e13b77-fc6a-1a15-78e9-c09c2cc8d0ae@sentex.net> Date: Wed, 20 Jul 2022 08:45:28 -0400 List-Id: Technical discussion and general questions about packet filter (pf) List-Archive: https://lists.freebsd.org/archives/freebsd-pf List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-pf@freebsd.org X-BeenThere: freebsd-pf@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Subject: Re: updating "self" in RELENG_13 Content-Language: en-US To: Oleksandr Kryvulia , pf@freebsd.org References: <7126c3de-2eab-733a-863d-0a38c409919e@sentex.net> <5e97f42c-6099-7556-f440-39d549fcbfeb@shurik.kiev.ua> From: mike tancsa In-Reply-To: <5e97f42c-6099-7556-f440-39d549fcbfeb@shurik.kiev.ua> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 64.7.153.18 X-Rspamd-Queue-Id: 4LnwQy6CYvz3SvC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mike@sentex.net designates 2607:f3e0:0:1::12 as permitted sender) smtp.mailfrom=mike@sentex.net X-Spamd-Result: default: False [-3.40 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_ALLOW(-0.20)[+ip6:2607:f3e0::/32]; MIME_GOOD(-0.10)[text/plain]; RCVD_IN_DNSWL_LOW(-0.10)[199.212.134.19:received]; ASN(0.00)[asn:11647, ipnet:2607:f3e0::/32, country:CA]; MLMMJ_DEST(0.00)[pf@freebsd.org]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; R_DKIM_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEFALL_USER(0.00)[mike]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[sentex.net]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 7/20/2022 3:08 AM, Oleksandr Kryvulia wrote: > 19.07.22 23:02, mike tancsa пише: >> I have an endpoint where interfaces come and go or change IP >> addresses due to dynamic IPs being handed out.  One thing I noticed >> is that if I want to make use of the "self" keyword, the automatic >> table that it abstracts away does not get automatically updated with >> new IP addresses.  If I manually do a pfctl -f /etc/pf.conf, it fixes >> the issue.  So to automate it, I looked at devd to create >> >> % cat /etc/devd/interface.conf >> notify 0 { >>     match "system"        "IFNET"; >>     match "type"          "(LINK_DOWN|LINK_UP)"; >>     action "/usr/local/bin/interface-change.sh $subsystem $interface"; >> }; >> >> and in the script I call /sbin/pfctl -f /etc/pf.conf >> >> But the next issue I ran into is the interface often comes up before >> its given an IP. So to make it work I had to add a >> >> sleep 5 ; /sbin/pfctl -f /etc/pf.conf & >> >> Not really happy with this method as sleeps are a bit hackish and >> probably wont reliably work.  Anyone else run into this issue and how >> do you work around it ? Or am I approaching it the wrong way ? >> >> I also noticed that if I do something like >> >>  ifconfig lo0 192.168.99.2/32 alias >> >> devd does not fire >> >>     ---Mike >> > > Hi, using interface groups instead makes sense for you? > Maybe. The rules as written are nice and easy to read in this case.  If possible I would like to keep using self, but might have to reconsider if there is no easy way to update via devd or some other mechanism     ---Mike