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@xxxxxxx> for discovering and analysing
this bug.
Michal Ludvig
--
SUSE Labs mludvig@xxxxxxx
(+420) 296.542.396 http://www.suse.cz
Personal homepage http://www.logix.cz/michal
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/03 18:06:31+01:00 michal@xxxxxxxx
# Return EAFNOSUPPORT if requested operation on unsupported family.
#
# Signed-off-by: Michal Ludvig <michal@xxxxxxxx>
#
# net/core/rtnetlink.c
# 2004/12/03 18:05:49+01:00 michal@xxxxxxxx +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;
|