platinasystems / go

Other
9 stars 68 forks source link

kernel vs. vnet fib unreachable routes inconsistency #128

Open fszyang opened 6 years ago

fszyang commented 6 years ago

Add a static route via a nexthop address that's part of the subnet of an interface (eth-1-1 in this example)

platina@invader34:~$ ip route
default via 192.168.101.2 dev eth0 
10.10.1.0/24 dev eth-1-1  proto kernel  scope link  src 10.10.1.34 
172.18.0.0/16 dev docker0  proto kernel  scope link  src 172.18.0.1 
192.168.100.0/23 dev eth0  proto kernel  scope link  src 192.168.101.154 
platina@invader34:~$ 
platina@invader34:~$ goes vnet show ip fib
 Table                   Destination                               Adjacency
     default                  10.10.1.0/24       3: glean eth-1-1
     default                 10.10.1.34/32       4: local eth-1-1
platina@invader34:~$ 
platina@invader34:~$ sudo ip route add 10.50.2.0/24 via 10.10.1.4

kernel shows new static route as reachable via eth-1-1

platina@invader34:~$ ip route
default via 192.168.101.2 dev eth0 
10.10.1.0/24 dev eth-1-1  proto kernel  scope link  src 10.10.1.34 
10.50.2.0/24 via 10.10.1.4 dev eth-1-1 
172.18.0.0/16 dev docker0  proto kernel  scope link  src 172.18.0.1 
192.168.100.0/23 dev eth0  proto kernel  scope link  src 192.168.101.154 

vnet shows as unreachable

platina@invader34:~$ goes vnet show ip fib
 Table                   Destination                               Adjacency
     default                  10.10.1.0/24       3: glean eth-1-1
     default                 10.10.1.34/32       4: local eth-1-1
     default                  10.50.2.0/24          unreachable via 10.10.1.4

When flushing all interfaces on eth-1-1, static route is removed in kernel

platina@invader34:~$ sudo ip addr flush dev eth-1-1
platina@invader34:~$ ip route
default via 192.168.101.2 dev eth0 
172.18.0.0/16 dev docker0  proto kernel  scope link  src 172.18.0.1 
192.168.100.0/23 dev eth0  proto kernel  scope link  src 192.168.101.154 

but not removed in vnet

platina@invader34:~$ goes vnet show ip fib
 Table                   Destination                               Adjacency
     default                  10.50.2.0/24          unreachable via 10.10.1.4