git: f89f82e4042a - main - netlink: Fix IFF_UP flag handling in RTM_NEWLINK's modify_link handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Aug 2025 19:53:08 UTC
The branch main has been updated by obiwac:
URL: https://cgit.FreeBSD.org/src/commit/?id=f89f82e4042a24e451b5ba349119cc3446d55601
commit f89f82e4042a24e451b5ba349119cc3446d55601
Author: Muhammad Saheed <saheed@FreeBSD.org>
AuthorDate: 2025-08-25 19:50:46 +0000
Commit: Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2025-08-25 19:52:59 +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 succeeded, did not actually set the flag.
Reviewed by: obiwac, kp, mckusick (mentor)
Approved by: obiwac, kp, mckusick (mentor)
Sponsored by: Google LLC (GSoC)
Differential Revision: https://reviews.freebsd.org/D51871
---
sys/netlink/route/iface_drivers.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c
index 21db3017df18..f177d8df2ad6 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) {