* rtnetlink: propagate error from dev_change_flags in do_setlink()
@ 2008-11-16 13:10 Johannes Berg
2008-11-16 13:16 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2008-11-16 13:10 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Patrick McHardy
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>
---
net/core/rtnetlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- everything.orig/net/core/rtnetlink.c 2008-10-26 20:00:12.000000000 +0100
+++ everything/net/core/rtnetlink.c 2008-11-11 23:24:14.000000000 +0100
@@ -878,7 +878,9 @@ static int do_setlink(struct net_device
if (ifm->ifi_change)
flags = (flags & ifm->ifi_change) |
(dev->flags & ~ifm->ifi_change);
- dev_change_flags(dev, flags);
+ err = dev_change_flags(dev, flags);
+ if (err < 0)
+ goto errout;
}
if (tb[IFLA_TXQLEN])
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: rtnetlink: propagate error from dev_change_flags in do_setlink()
2008-11-16 13:10 rtnetlink: propagate error from dev_change_flags in do_setlink() Johannes Berg
@ 2008-11-16 13:16 ` Johannes Berg
2008-11-17 7:21 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2008-11-16 13:16 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Patrick McHardy
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
On Sun, 2008-11-16 at 14:10 +0100, Johannes Berg wrote:
> 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>
Maybe add
Cc: stable@kernel.org [since the beginning of time^Wgit]
when committing? Not sure it's appropriate for stable since so far
nobody complained, I suspect people just use the ioctl anyway.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: rtnetlink: propagate error from dev_change_flags in do_setlink()
2008-11-16 13:16 ` Johannes Berg
@ 2008-11-17 7:21 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-11-17 7:21 UTC (permalink / raw)
To: johannes; +Cc: netdev, kaber
From: Johannes Berg <johannes@sipsolutions.net>
Date: Sun, 16 Nov 2008 14:16:08 +0100
> On Sun, 2008-11-16 at 14:10 +0100, Johannes Berg wrote:
> > 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>
Patch applied.
> Maybe add
> Cc: stable@kernel.org [since the beginning of time^Wgit]
>
> when committing? Not sure it's appropriate for stable since so far
> nobody complained, I suspect people just use the ioctl anyway.
I'll queue it up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-17 7:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-16 13:10 rtnetlink: propagate error from dev_change_flags in do_setlink() Johannes Berg
2008-11-16 13:16 ` Johannes Berg
2008-11-17 7:21 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox