Page MenuHomeFreeBSD

add ADDR_ADD and ADDR_DEL devctl event for IFNET
ClosedPublic

Authored by rozhuk.im-gmail.com on Jun 21 2021, 11:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 29, 12:08 AM
Unknown Object (File)
Mon, May 13, 10:44 PM
Unknown Object (File)
Apr 28 2024, 11:26 PM
Unknown Object (File)
Apr 25 2024, 4:04 PM
Unknown Object (File)
Apr 24 2024, 5:47 AM
Unknown Object (File)
Apr 24 2024, 5:47 AM
Unknown Object (File)
Apr 24 2024, 5:47 AM
Unknown Object (File)
Feb 21 2024, 1:08 AM

Details

Summary

Add devd event on network iface address add/remove.
Can be used to automate actions on any address change.

Test Plan

Apply patch, rebuild and reinstall kernel.

Run in terminal1:
cat /var/run/devd.pipe

In terminal2:
ifconfig lan0 alias 192.168.1.1/24
ifconfig lan0 -alias 192.168.1.1
ifconfig lan0 inet6 1111::

Result
terminal1 will produce output:
!system=IFNET subsystem=lan0 type=ADDR_ADD address=192.168.1.1
!system=IFNET subsystem=lan0 type=ADDR_DEL address=192.168.1.1
!system=IFNET subsystem=lan0 type=ADDR_ADD address=1111::

*lan0 must me replaced with real network interface name.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

can you add the ADDR_ADD and ADDR_DEL to the table in sbin/devd/devd.conf.5 please?

Add "#if defined(INET) || defined(INET6)" for vars.

This revision is now accepted and ready to land.Jun 23 2021, 3:51 PM

Note: minor style tweaks I've noted here I've just done when landing.

sys/net/route.c
706

A blank line is needed before inet_ntoa_r.
Also, that can be on one line
Also, there's at least one extra set of parens here.

717

a blank line is needed between the strbuf and ip6_sprintf lines.