diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2018-07-27 13:43:23 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-29 12:57:26 -0700 |
commit | 7a4c53bee3324ac00bf964aa2f82d15d279e86e4 (patch) | |
tree | 39a64c3a2deb287eafc2bea2b4fa88d9ddf23b09 /net/core/rtnetlink.c | |
parent | 3e7a50ceb11ea75c27e944f1a01e478fd62a2d8d (diff) | |
download | lwn-7a4c53bee3324ac00bf964aa2f82d15d279e86e4.tar.gz lwn-7a4c53bee3324ac00bf964aa2f82d15d279e86e4.zip |
net: report invalid mtu value via netlink extack
If an invalid MTU value is set through rtnetlink return extra error
information instead of putting message in kernel log. For other cases
where there is no visible API, keep the error report in the log.
Example:
# ip li set dev enp12s0 mtu 10000
Error: mtu greater than device maximum.
# ifconfig enp12s0 mtu 10000
SIOCSIFMTU: Invalid argument
# dmesg | tail -1
[ 2047.795467] enp12s0: mtu greater than device maximum
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 510d4f765a13..24431e578310 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2382,7 +2382,7 @@ static int do_setlink(const struct sk_buff *skb, } if (tb[IFLA_MTU]) { - err = dev_set_mtu(dev, nla_get_u32(tb[IFLA_MTU])); + err = dev_set_mtu_ext(dev, nla_get_u32(tb[IFLA_MTU]), extack); if (err < 0) goto errout; status |= DO_SETLINK_MODIFIED; |