diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-11-17 02:20:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-17 02:20:31 -0500 |
commit | 5f9021cfdc3524a4c5e3d7ae2d049eb7adcd6776 (patch) | |
tree | 53e42bd9bb7db0858af5c1de4dd47e0af3ad3c47 /net | |
parent | 584c650b4e6fa16f9ab45d382f86ad6d9c625227 (diff) |
rtnetlink: propagate error from dev_change_flags in do_setlink()
Unlike ifconfig, iproute doesn't report an error when setting
an interface up fails:
(example: put wireless network mac80211 interface into repeater mode
with iwconfig but do not set a peer MAC address, it should fail with
-ENOLINK)
without patch:
# ip link set wlan0 up ; echo $?
0
#
with patch:
# ip link set wlan0 up ; echo $?
RTNETLINK answers: Link has been severed
2
#
Propagate the return value from dev_change_flags() to fix this.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/rtnetlink.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 31f29d2989fd..4dfb6b4d4559 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -878,7 +878,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, | |||
878 | if (ifm->ifi_change) | 878 | if (ifm->ifi_change) |
879 | flags = (flags & ifm->ifi_change) | | 879 | flags = (flags & ifm->ifi_change) | |
880 | (dev->flags & ~ifm->ifi_change); | 880 | (dev->flags & ~ifm->ifi_change); |
881 | dev_change_flags(dev, flags); | 881 | err = dev_change_flags(dev, flags); |
882 | if (err < 0) | ||
883 | goto errout; | ||
882 | } | 884 | } |
883 | 885 | ||
884 | if (tb[IFLA_TXQLEN]) | 886 | if (tb[IFLA_TXQLEN]) |