The branch main has been updated by obiwac:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5bd5774ff63c735087ff3a6604e4066a265d9b6c

commit 5bd5774ff63c735087ff3a6604e4066a265d9b6c
Author:     Aymeric Wibo <obi...@freebsd.org>
AuthorDate: 2025-08-25 22:32:17 +0000
Commit:     Aymeric Wibo <obi...@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);

Reply via email to