Bug 959693
| Summary: | ip -6 route add ::/0 results in File exists error | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Gene Czarcinski <gczarcinski> |
| Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 18 | CC: | gansalmon, itamar, jonathan, jpopelka, kernel-maint, madhu.chinakonda, nhorman, psabata, rvokal, twoerner |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-05-06 16:17:20 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Gene Czarcinski
2013-05-04 20:44:51 UTC
After looking into some of the source for iproute, ::/0 (or default for IPv6) appears to be a valid address. Therefore, this is an error. This should indeed work and I cannot reproduce your issue with a dummy interface. Given the netlink answer, I'm assigning this to kernel. Well, the fact that you're getting -EEXIST suggests that you already have a default route set that matches that. What does the route table on this system look like prior to your route add command? Since you are not specifying something else, I am assuming that you mean the output from executing "sbin/ip -6 route show". If it is anything else such as specifying a tableid for the above command, you will need to tell me.
Note: This is occurring with libvirt network bridge devices and the problem may lie there. I have not explored that possibility.
Since the code just runs command-line commands, I will do the tests with command line commands with show before, add, and then show after. For completeness, I will be doing both IPv4 and IPv6 and I will first start the virtual network so that I have the virtual bridge device to work with.
----------------------------------------------------------------------------
[root@falcon:~]#ip -4 route show
default via 192.168.18.91 dev p33p1 proto static
192.168.18.0/24 dev p33p1 proto kernel scope link src 192.168.18.2
[root@falcon:~]#ip -6 route
fd00:dead:beef:18:1::2 dev p33p1 proto kernel metric 256
fd00:dead:beef:18:1::6 via fd00:dead:beef:18:1::6 dev p33p1 metric 0
cache expires -4618625sec
fd00:dead:beef:18::/64 dev p33p1 proto kernel metric 256 expires 42807sec
fe80::/64 dev p33p1 proto kernel metric 256
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto static metric 1
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto ra metric 1024 expires 1407sec
[root@falcon:~]#virsh net-start net8
Network net8 started
[root@falcon:~]#ip -4 route show
default via 192.168.18.91 dev p33p1 proto static
192.168.8.0/24 dev virbr4 proto kernel scope link src 192.168.8.1
192.168.18.0/24 dev p33p1 proto kernel scope link src 192.168.18.2
192.168.81.0/24 via 192.168.8.2 dev virbr4 proto static metric 1
[root@falcon:~]#ip route add 0.0.0.0/0 via 192.168.8.3 dev virbr4 proto static metric 1
[root@falcon:~]#ip -4 route show
default via 192.168.18.91 dev p33p1 proto static
default via 192.168.8.3 dev virbr4 proto static metric 1
192.168.8.0/24 dev virbr4 proto kernel scope link src 192.168.8.1
192.168.18.0/24 dev p33p1 proto kernel scope link src 192.168.18.2
192.168.81.0/24 via 192.168.8.2 dev virbr4 proto static metric 1
[root@falcon:~]#ip -6 route show
fd00:beef:10:8::/64 dev virbr4 proto kernel metric 256
fd00:beef:13:1::/64 via fd00:beef:10:8::2:5 dev virbr4 proto static metric 1
fd00:dead:beef:18:1::2 dev p33p1 proto kernel metric 256
fd00:dead:beef:18:1::6 via fd00:dead:beef:18:1::6 dev p33p1 metric 0
cache expires -4618791sec
fd00:dead:beef:18::/64 dev p33p1 proto kernel metric 256 expires 43187sec
fe80::/64 dev p33p1 proto kernel metric 256
fe80::/64 dev virbr4 proto kernel metric 256
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto static metric 1
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto ra metric 1024 expires 1787sec
[root@falcon:~]#ip route add ::/0 via fd00:beef:10:8::2:6 dev virbr4 proto static metric 1
RTNETLINK answers: File exists
[root@falcon:~]#ip -6 route show
fd00:beef:10:8::/64 dev virbr4 proto kernel metric 256
fd00:beef:13:1::/64 via fd00:beef:10:8::2:5 dev virbr4 proto static metric 1
fd00:dead:beef:18:1::2 dev p33p1 proto kernel metric 256
fd00:dead:beef:18:1::6 via fd00:dead:beef:18:1::6 dev p33p1 metric 0
cache expires -4618912sec
fd00:dead:beef:18::/64 dev p33p1 proto kernel metric 256 expires 43066sec
fe80::/64 dev p33p1 proto kernel metric 256
fe80::/64 dev virbr4 proto kernel metric 256
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto static metric 1
default via fe80::2a0:ccff:fea2:4fad dev p33p1 proto ra metric 1024 expires 1666sec
[root@falcon:~]#
----------------------------------------------------------------------------
Note:
Both the 192.168.81.0/24 and fd00:beef:13:1::/64 static routes were created
by the modified libvirt code.
----------------------------------------------------------------------------
It appears to me that whatever is doing the checking for IPv6 is only checking for the address+prefix match and ignoring other factors such as the device, etc.
What do these extra default routes mean and how will thinks actual work, I have no idea. However, it this should not work for IPv6, then it is probably a bad idea for IPv4 also. The thing is, I can see multiple default (address=0, prefix=0) definitions but each one has something uniquely different about it.
------------------------------------------------------------------------------
And here is the output from /sbin/route -A inet6"
------------------------------------------------------------------------------
[root@falcon:~]#route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flag Met Ref Use If
localhost/128 [::] U 256 0 0 lo
fd00:beef:10:8::/64 [::] U 256 0 2 virbr4
fd00:beef:13:1::/64 fd00:beef:10:8::2:5 UG 1 0 0 virbr4
falcon.lcl/128 [::] U 256 0 0 p33p1
fd00:dead:beef:18::/64 [::] UAe 256 0 0 p33p1
fe80::/64 [::] U 256 0 0 p33p1
fe80::/64 [::] U 256 0 0 virbr4
[::]/0 fe80::2a0:ccff:fea2:4fad UG 1 0 0 p33p1
[::]/0 fe80::2a0:ccff:fea2:4fad UGDAe 1024 0 0 p33p1
[::]/0 [::] !n -1 1 56907 lo
localhost/128 [::] Un 0 1 248 lo
fd00:beef:10:8::/128 [::] Un 0 1 0 lo
fd00:beef:10:8::1/128 [::] Un 0 1 0 lo
falcon.lcl/128 [::] Un 0 3 16431 lo
fe80::/128 [::] Un 0 1 0 lo
fe80::/128 [::] Un 0 1 0 lo
fe80::3285:a9ff:fe8f:e982/128 [::] Un 0 1 576 lo
fe80::5054:ff:fe68:be31/128 [::] Un 0 1 0 lo
ff00::/8 [::] U 256 0 0 p33p1
ff00::/8 [::] U 256 0 0 virbr4
[::]/0 [::] !n -1 1 56907 lo
[root@falcon:~]#
--------------------------------------------------------------------------------
yeah, this isn't a bug as far as I can see. The magic that your looking for is in fib6_add_rt2node(). When adding a new route, we search for duplicate routes, and should we find one, we compare them to ensure that when the ipv6 stack does a route lookup, they have some way to select which route should be used. To do that they use the metric/preference number (I admit that use of the term metric in the iproute2 tool is a bit misleading, but if you check the ip-route(8) man page, you'll see its a synonym for preference). At any rate, since you already have a default gateway (which the stack sees as a duplicate for the one your adding), and the existing route has the same metric/preference as the one you are adding, you get the EXIST error. Ways to work around this: 1) Use the src option in the ip route add command to differentiate and prevent the existing default gw from being used (might be useful if you want different virt guests to use different default gw). 2) instead of using ip route add, use ip route replace, which will overwrite the existing default gw. 3) Use a different metric value than the existing default gw. Both routes will be added, but only the higest priority route will be used. Thank you for promptly addressing this! |