All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Ludvig <mludvig@suse.cz>
To: Andrew Morton <akpm@osdl.org>
Cc: netdev@oss.sgi.com, Jan Kara <jack@suse.cz>
Subject: [PATCH] rtnetlink & address family problem
Date: Fri, 03 Dec 2004 18:43:16 +0100	[thread overview]
Message-ID: <41B0A5B4.6060108@suse.cz> (raw)

[-- 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;

             reply	other threads:[~2004-12-03 17:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-03 17:43 Michal Ludvig [this message]
2004-12-06 11:40 ` [PATCH] rtnetlink & address family problem 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

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=41B0A5B4.6060108@suse.cz \
    --to=mludvig@suse.cz \
    --cc=akpm@osdl.org \
    --cc=jack@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.