HomeFreeBSD

ifconfig: fix ifconfig IFX inet[6] ADDR -alias

Description

ifconfig: fix ifconfig IFX inet[6] ADDR -alias

Internally, inet and inet6 family handlers store state for
address addition and deletion separately, as, for example,
"ifconfig lo0 inet 127.0.0.2/32" triggers a) deletion of the
first interface address and b) addition of a new one.
The current logic behind handling "-alias" being the last argument
is to copy the address from "addition" state to the "deletion"
state. It is done by the generic ifconfig code, which explicitly
typecasts opaque handler state pointers to "struct ifreq", which
doesn't work in the Netlink case.

Fix this by introducing family-specific "af_copyaddr" handler,
which removes the peeking & typecasting logic from the generic code.

Reported by: otis
Tested by: otis

Details

Provenance
melifaroAuthored on May 25 2023, 2:50 PM
Parents
rG6c08fd3dc804: Enable -Wstrict-prototypes by default in the kernel for clang 15+.
Branches
Unknown
Tags
Unknown