ip route del bug?
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · On Thu, 05 May 2005 07:53:36 -0700 Greg Varga <[email protected]> wrote:
Hey there,
I was working on one of our Linux routers yesterday, and when I issued a "ip route del" command (no arg's) by mistake, it deleted the default route.
Quoted 8 lines
I was just wondering if this is indeed the way it was intended, or if its a bug and in fact should have displayed an error message? I personally would have preferred that it error'd with some sort of message.
I'm running Fedora Core 2 with iproute-2.4.7-14 rpm installed.
Thanks,
--Greg
It looks like an accidental behaviour (of the kernel) in response to an ip route delete netlink message with no additional data.
Comments?
Quoted 2 lines · Stephen Hemminger
It looks like an accidental behaviour (of the kernel) in response to an ip route delete netlink message with no additional data.
I don't believe it is accidental, it seems correct to me to delete the default route when no more specific selector is given. To avoid this, iproute could print an error when dst.bytelen == 0.
Regards
Patrick
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Stephen Hemminger
It looks like an accidental behaviour (of the kernel) in response to an ip route delete netlink message with no additional data.
I don't believe it is accidental, it seems correct to me to delete the default route when no more specific selector is given. To avoid this, iproute could print an error when dst.bytelen == 0.
Agreed - basically the kernel does what its told.
I think the check should be on missing dst (default will always give you bytelen of 0 for example and is legit).
Patchlet attached.
cheers,
jamal
ip/iproute.c +5 -0
@@ -857,6 +857,11 @@ argc--; argv++; } +if (!dst_ok) { +fprintf (stderr,"route must specify destination address \n" ); +return -1 ; + } +if (rtnl_open (&rth,0 ) <0 )exit (1 );