From nobody Wed Jul 20 07:08:47 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 4Lnmyd07VLz4XGVp for ; Wed, 20 Jul 2022 07:08:57 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Received: from mail.flex-it.com.ua (mail.flex-it.com.ua [193.239.74.7]) (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 4Lnmyc04G2z3xXg for ; Wed, 20 Jul 2022 07:08:55 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Received: from [46.211.87.228] (helo=[192.168.1.179]) by mail.flex-it.com.ua with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.95 (FreeBSD)) (envelope-from ) id 1oE3pA-0008W4-AG for pf@freebsd.org; Wed, 20 Jul 2022 10:08:48 +0300 Message-ID: <5e97f42c-6099-7556-f440-39d549fcbfeb@shurik.kiev.ua> Date: Wed, 20 Jul 2022 10:08:47 +0300 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 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: updating "self" in RELENG_13 Content-Language: en-US To: pf@freebsd.org References: <7126c3de-2eab-733a-863d-0a38c409919e@sentex.net> From: Oleksandr Kryvulia In-Reply-To: <7126c3de-2eab-733a-863d-0a38c409919e@sentex.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Lnmyc04G2z3xXg X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of shuriku@shurik.kiev.ua designates 193.239.74.7 as permitted sender) smtp.mailfrom=shuriku@shurik.kiev.ua X-Spamd-Result: default: False [-3.30 / 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)[+mx]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:35297, ipnet:193.239.72.0/22, country:UA]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[pf@freebsd.org]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[shurik.kiev.ua]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 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?