git: 5bd5774ff63c - main - netlink: Handle `ifhwioctl(SIOCSIFMTU)` failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Aug 2025 22:43:21 UTC
The branch main has been updated by obiwac:
URL: https://cgit.FreeBSD.org/src/commit/?id=5bd5774ff63c735087ff3a6604e4066a265d9b6c
commit 5bd5774ff63c735087ff3a6604e4066a265d9b6c
Author: Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2025-08-25 22:32:17 +0000
Commit: Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2025-08-25 22:32:21 +0000
netlink: Handle `ifhwioctl(SIOCSIFMTU)` failure
Print out error message if setting MTU fails when modifying interface
using netlink.
Reviewed by: saheed, melifaro, mckusick (mentor)
Approved by: saheed, melifaro, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52132
---
sys/netlink/route/iface_drivers.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c
index f177d8df2ad6..2a75e6abb2d0 100644
--- a/sys/netlink/route/iface_drivers.c
+++ b/sys/netlink/route/iface_drivers.c
@@ -93,7 +93,12 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs,
if (lattrs->ifla_mtu > 0) {
if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFMTU)) {
struct ifreq ifr = { .ifr_mtu = lattrs->ifla_mtu };
- error = ifhwioctl(SIOCSIFMTU, ifp, (char *)&ifr, curthread);
+ error = ifhwioctl(SIOCSIFMTU, ifp, (char *)&ifr,
+ curthread);
+ if (error != 0) {
+ nlmsg_report_err_msg(npt, "Failed to set mtu");
+ return (error);
+ }
} else {
nlmsg_report_err_msg(npt, "Not enough privileges to set mtu");
return (EPERM);