netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtnetlink & address family problem
@ 2004-12-03 17:43 Michal Ludvig
  2004-12-06 11:40 ` jamal
  2004-12-06 14:02 ` Thomas Graf
  0 siblings, 2 replies; 12+ messages in thread
From: Michal Ludvig @ 2004-12-03 17:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: netdev, Jan Kara

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

Hi,

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.

Attached patch fixes it. Please apply.

BTW Credits to Jan Kara <jack@suse.cz> for discovering and analysing
this bug.

Michal Ludvig
-- 
SUSE Labs                    mludvig@suse.cz
(+420) 296.542.396        http://www.suse.cz
Personal homepage http://www.logix.cz/michal

[-- Attachment #2: rtnetlink-family.diff --]
[-- Type: text/plain, Size: 806 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/12/03 18:06:31+01:00 michal@logix.cz 
#   Return EAFNOSUPPORT if requested operation on unsupported family.
#   
#   Signed-off-by: Michal Ludvig <michal@logix.cz>
# 
# net/core/rtnetlink.c
#   2004/12/03 18:05:49+01:00 michal@logix.cz +4 -2
#   Return EAFNOSUPPORT if requested operation on unsupported family.
# 
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;

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-12-07 19:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).