From: Michal Ludvig <hidden> Date: 2004-12-03 17:43:16
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 [off-list ref] 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
I think this patch will break more than it fixes. You need to do a lot
more testing to verify it doesnt. Actually you should probably fix whats
being invoked for the ifa messages when PF_UNSPEC is selected to check
that it only flushes v6 addresses when V6 is on and reject when it is
not compiled in.
cheers,
jamal
On Fri, 2004-12-03 at 12:43, Michal Ludvig wrote:
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 [off-list ref] for discovering and analysing
this bug.
Michal Ludvig
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-06 14:02:14
* Michal Ludvig [off-list ref] 2004-12-03 18:43
quoted hunk
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
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.
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.
Why would it be wrong? The PF_UNSPEC is there for a purpose.
If user space decides it wants to flush ipv4 addresses blindly that user
spaces fault. The patch you attached seems legit. did you verify it?
BTW, Stephen - are you still updating iproute2?
cheers,
jamal
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-07 12:49:22
* jamal [off-list ref] 2004-12-06 21:27
On Mon, 2004-12-06 at 09:02, Thomas Graf wrote:
quoted
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.
Why would it be wrong? The PF_UNSPEC is there for a purpose.
I don't think it is wrong myself but I understand if someone does. If
one sends a GETADDR request for PF_INET6 one might expect to either
receive all ipv6 addresses or none and to only receive all addresess
of any type if PF_UNSPEC was specified.
If user space decides it wants to flush ipv4 addresses blindly that user
spaces fault. The patch you attached seems legit. did you verify it?
Not yet, it probably has to be applied to iproute.c as well. I'll have
a look at it and do some testing.
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.
Why would it be wrong? The PF_UNSPEC is there for a purpose.
I don't think it is wrong myself but I understand if someone does.
If
one sends a GETADDR request for PF_INET6 one might expect to either
receive all ipv6 addresses or none and to only receive all addresess
of any type if PF_UNSPEC was specified.
Thats debatable.
Its user space that issues the flushing after a response from the
kernel. It happens to be flushing IPV4 addresses.
Thats why your filter in ip is the answer.
BTW, did the gnet_stats patches to iproute2 ever get merged?
If you have cycles, can you please look at that hang being reported
using older tc with 2.6.10-rc3?
cheers,
jamal
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-07 13:17:06
quoted
I don't think it is wrong myself but I understand if someone does. If
one sends a GETADDR request for PF_INET6 one might expect to either
receive all ipv6 addresses or none and to only receive all addresess
of any type if PF_UNSPEC was specified.
Thats debatable.
Its user space that issues the flushing after a response from the
kernel. It happens to be flushing IPV4 addresses.
Thats why your filter in ip is the answer.
Agreed.
BTW, did the gnet_stats patches to iproute2 ever get merged?
Not sure, I will check that.
If you have cycles, can you please look at that hang being reported
using older tc with 2.6.10-rc3?
It's not really related to the gnet_stats code. stats_lock isn't set
in the action code when using an older iproute2. I haven't tested this
case because it was marked as broken anyway. I compiled an older version
of iproute2 and will look into it today.
It's not really related to the gnet_stats code. stats_lock isn't set
in the action code when using an older iproute2. I haven't tested this
case because it was marked as broken anyway.
Can you ping my memory on this? Is this tc with initial support
for actions or something much older than that.
cheers,
jamal
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-07 14:10:33
* jamal [off-list ref] 2004-12-07 08:20
On Tue, 2004-12-07 at 08:17, Thomas Graf wrote:
quoted
It's not really related to the gnet_stats code. stats_lock isn't set
in the action code when using an older iproute2. I haven't tested this
case because it was marked as broken anyway.
Can you ping my memory on this? Is this tc with initial support
for actions or something much older than that.
I'm not sure, I'm testing with a version having no action support at
all. It should be fairly easy to find the bug once I have the time to
really look into it. I'm still getting interrupted all the time at
the moment.
All actions created via tcf_hash_create, tcf_police_locate, and
tcf_act_police_locate should be fine. There must be some bogus path
related to older tc versions.
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-07 16:55:01
* Thomas Graf [off-list ref] 2004-12-07 15:10
* jamal [off-list ref] 2004-12-07 08:20
quoted
On Tue, 2004-12-07 at 08:17, Thomas Graf wrote:
quoted
It's not really related to the gnet_stats code. stats_lock isn't set
in the action code when using an older iproute2. I haven't tested this
case because it was marked as broken anyway.
Can you ping my memory on this? Is this tc with initial support
for actions or something much older than that.
I'm not sure, I'm testing with a version having no action support at
all. It should be fairly easy to find the bug once I have the time to
really look into it. I'm still getting interrupted all the time at
the moment.
One major problem is that the tc_dump_action path doesn't take
care of TCA_OLD_COMPAT resulting in calling tcf_action_copy_stats
for policers which is a bad thing since their a->priv is set to
tcf_police instead of the generic header and thus causes random
behaviour.
One solution would be to make tcf_police compatible to tca_gen.
Thoughts?
From: Thomas Graf <tgraf@suug.ch> Date: 2004-12-07 17:52:59
BTW, did the gnet_stats patches to iproute2 ever get merged?
If you have cycles, can you please look at that hang being reported
using older tc with 2.6.10-rc3?