From: Thomas Graf <tgraf@suug.ch>
To: Michal Ludvig <mludvig@suse.cz>
Cc: Andrew Morton <akpm@osdl.org>,
netdev@oss.sgi.com, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH] rtnetlink & address family problem
Date: Mon, 6 Dec 2004 15:02:14 +0100 [thread overview]
Message-ID: <20041206140214.GA749@postel.suug.ch> (raw)
In-Reply-To: <41B0A5B4.6060108@suse.cz>
* Michal Ludvig <41B0A5B4.6060108@suse.cz> 2004-12-03 18:43
> running 'ip -6 addr flush dev eth0' on a kernel without IPv6 support
> flushes *all* addresses from the interface, even those IPv4 ones,
> because the unsupported protocol is substituted by PF_UNSPEC.
> IMHO it should better return with an error EAFNOSUPPORT.
>
> diff -Nru a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> --- a/net/core/rtnetlink.c 2004-12-03 18:30:33 +01:00
> +++ b/net/core/rtnetlink.c 2004-12-03 18:30:33 +01:00
> @@ -477,8 +477,10 @@
> }
>
> link_tab = rtnetlink_links[family];
> - if (link_tab == NULL)
> - link_tab = rtnetlink_links[PF_UNSPEC];
> + if (link_tab == NULL) {
> + *errp = -EAFNOSUPPORT;
> + return -1;
> + }
> link = &link_tab[type];
>
> sz_idx = type>>2;
Your patch would fix this issue but might break various things. The
actual problem is that iproute2 doesn't check the family in its filter.
It blindly assumes that the kernel only returns addresses of the kind it
has requested. I can understand if you think the current behaviour
is wrong but we shouldn't change it in the middle of a stable tree.
--- iproute2-2.6.9.orig/ip/ipaddress.c 2004-10-19 22:49:02.000000000 +0200
+++ iproute2-2.6.9/ip/ipaddress.c 2004-12-06 14:55:58.000000000 +0100
@@ -330,6 +330,8 @@
return 0;
}
}
+ if (filter.family && filter.family != ifa->ifa_family)
+ return 0;
if (filter.flushb) {
struct nlmsghdr *fn;
next prev parent reply other threads:[~2004-12-06 14:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-03 17:43 [PATCH] rtnetlink & address family problem Michal Ludvig
2004-12-06 11:40 ` jamal
2004-12-06 14:02 ` Thomas Graf [this message]
2004-12-07 2:27 ` jamal
2004-12-07 12:49 ` Thomas Graf
2004-12-07 13:02 ` jamal
2004-12-07 13:17 ` Thomas Graf
2004-12-07 13:20 ` jamal
2004-12-07 14:10 ` Thomas Graf
2004-12-07 16:55 ` Thomas Graf
2004-12-07 17:52 ` Thomas Graf
2004-12-07 19:12 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041206140214.GA749@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=akpm@osdl.org \
--cc=jack@suse.cz \
--cc=mludvig@suse.cz \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).