The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=39dbadb7a410f3955540041848d669264266e552
commit 39dbadb7a410f3955540041848d669264266e552 Author: Muhammad Saheed <sah...@freebsd.org> AuthorDate: 2025-08-18 13:50:08 +0000 Commit: Aymeric Wibo <obi...@freebsd.org> CommitDate: 2025-08-18 13:51:10 +0000 netlink: Fix IFF_UP flag handling in RTM_NEWLINK's modify_link handler IFF_UP could previously only be unset via RTM_NEWLINK. Requests to set IFF_UP, though they succeed, did not actually set the flag. RTM_NEWLINK messages with ifi_change=0 are treated as ifi_change=0xFFFFFFFF, modifying all the link flags (currently IFF_UP and IFF_PROMISC) to match the behavior seen on Linux. Reviewed by: obiwac, kp, mckusick (mentor) Approved by: obiwac, mckusick (mentor) Sponsored by: Google LLC (GSoC) Differential Revision: https://reviews.freebsd.org/D51871 --- sys/netlink/route/iface_drivers.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index 4bf913d9c978..5f605b05f7b8 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -82,9 +82,12 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, } } - if ((lattrs->ifi_change & IFF_UP) && (lattrs->ifi_flags & IFF_UP) == 0) { - /* Request to down the interface */ - if_down(ifp); + if ((lattrs->ifi_change & IFF_UP) != 0 || lattrs->ifi_change == 0) { + /* Request to up or down the interface */ + if (lattrs->ifi_flags & IFF_UP) + if_up(ifp); + else + if_down(ifp); } if (lattrs->ifla_mtu > 0) { @@ -97,7 +100,8 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, } } - if (lattrs->ifi_change & IFF_PROMISC) { + if ((lattrs->ifi_change & IFF_PROMISC) != 0 || + lattrs->ifi_change == 0) { error = ifpromisc(ifp, lattrs->ifi_flags & IFF_PROMISC); if (error != 0) { nlmsg_report_err_msg(npt, "unable to set promisc");