updating "self" in RELENG_13
- Reply: Oleksandr Kryvulia : "Re: updating "self" in RELENG_13"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Jul 2022 20:02:40 UTC
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