git: 5af4db2ea6d3 - main - netlink: Do not change interface flags on an empty ifinfomsg
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Nov 2026 22:07:56 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=5af4db2ea6d382aa6500fb415a3fe63769acdea2
commit 5af4db2ea6d382aa6500fb415a3fe63769acdea2
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-11-26 19:52:20 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-11-26 22:06:56 +0000
netlink: Do not change interface flags on an empty ifinfomsg
Since f89f82e4042a, _nl_modify_ifp_generic() treats ifi_change == 0
as a request to apply all of ifi_flags. A RTM_NEWLINK request that
only modifies attributes carries a zeroed ifinfomsg, so it brought
the interface down and cleared its permanent promiscuous mode as a
side effect.
Only apply flags for an empty ifi_change when ifi_flags is set,
which matches the behavior of Linux.
Fixes: f89f82e4042a ("netlink: Fix IFF_UP flag handling in RTM_NEWLINK's modify_link handler")
Differential Revision: https://reviews.freebsd.org/D61504
---
sys/netlink/route/iface_drivers.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c
index 79daa4215dba..fdf96f690c77 100644
--- a/sys/netlink/route/iface_drivers.c
+++ b/sys/netlink/route/iface_drivers.c
@@ -81,7 +81,8 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs,
if_setlastchange(ifp);
}
- if ((lattrs->ifi_change & IFF_UP) != 0 || lattrs->ifi_change == 0) {
+ if ((lattrs->ifi_change & IFF_UP) != 0 ||
+ (lattrs->ifi_change == 0 && lattrs->ifi_flags != 0)) {
/* Request to up or down the interface */
if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFFLAGS)) {
nlmsg_report_err_msg(npt, "Not enough privileges to set flags");
@@ -108,7 +109,7 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs,
}
if ((lattrs->ifi_change & IFF_PROMISC) != 0 ||
- lattrs->ifi_change == 0) {
+ (lattrs->ifi_change == 0 && lattrs->ifi_flags != 0)) {
/*
* When asking for IFF_PROMISC, set permanent flag instead
* (IFF_PPROMISC) as we have no way of doing promiscuity