Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2022 08:45:28 -0400
From:      mike tancsa <mike@sentex.net>
To:        Oleksandr Kryvulia <shuriku@shurik.kiev.ua>, pf@freebsd.org
Subject:   Re: updating "self" in RELENG_13
Message-ID:  <27e13b77-fc6a-1a15-78e9-c09c2cc8d0ae@sentex.net>
In-Reply-To: <5e97f42c-6099-7556-f440-39d549fcbfeb@shurik.kiev.ua>
References:  <7126c3de-2eab-733a-863d-0a38c409919e@sentex.net> <5e97f42c-6099-7556-f440-39d549fcbfeb@shurik.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?27e13b77-fc6a-1a15-78e9-c09c2cc8d0ae>