platinasystems / go

Other
9 stars 68 forks source link

fib: Extra /32 is added to dummy0 after admin-up #30

Open donnlee opened 7 years ago

donnlee commented 7 years ago

Before goes startup, I have a dummy0 interface with 5.5.5.5/32:

donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ ip add sho dummy0
9603: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 10
00
    link/ether 6e:c1:22:ab:15:5b brd ff:ff:ff:ff:ff:ff
    inet 5.5.5.5/0 brd 255.255.255.255 scope global dummy0
       valid_lft forever preferred_lft forever
    inet6 fe80::6cc1:22ff:feab:155b/64 scope link
       valid_lft forever preferred_lft forever

Then I start goes:

donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ sudo goes restart
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$

I expect the fib to have an entry for dummy0's address, but it does not:

donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ goes vnet sho ip fib
 Table                   Destination           Adjacency
     0                     0.0.0.0/0  2: punt
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$

To force vnet to add a fib entry for dummy0, I had to delete and re-add dummy0, like so:

donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ sudo ip link del dummy0
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ sudo ip link add dummy0 type dummy
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ sudo ifconfig dummy0 3.3.3.3/32
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$ goes vnet sho ip fib
 Table                   Destination           Adjacency
     0                     0.0.0.0/0  2: punt
     0                    3.3.3.3/32  2: punt
donn@invader8:~/workspace/go/src/github.com/platinasystems/go$

Expected condition: I expect goes to install any dummy interface addresses it finds upon starting up.

stigt commented 7 years ago

root@invader1:/home/stig# goes restart

root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency

root@invader1:/home/stig# ip link add name dummy0 type dummy root@invader1:/home/stig# ip link set up dummy0 root@invader1:/home/stig# ip ad add 100.0.0.1/24 dev dummy0

root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency 0 100.0.0.0/24 2: punt

root@invader1:/home/stig# ip link set down dummy0

root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency 0 100.0.0.0/24 2: punt

root@invader1:/home/stig# ip link set up dummy

root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency 0 100.0.0.0/24 2: punt 0 100.0.0.1/32 2: punt

root@invader1:/home/stig# goes restart

root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency 0 100.0.0.0/24 2: punt

donnlee commented 7 years ago

Sorry I wasn't clear when I opened this issue. I start without goes running.

  1. Ensure goes is not running.
  2. Add dummy0 and give it an IP address.
  3. Start goes.
  4. Observe: The dummy0's address is not in the fib. I expect it to be in the fib.
stigt commented 7 years ago

root@invader1:/home/stig# goes stop root@invader1:/home/stig# ip link add dummy0 type dummy root@invader1:/home/stig# ip link set up dummy0 root@invader1:/home/stig# ip add add 50.0.0.1/24 dev dummy0 root@invader1:/home/stig# goes start root@invader1:/home/stig# goes vnet show ip fib Table Destination Adjacency 0 50.0.0.0/24 2: punt root@invader1:/home/stig#

donnlee commented 7 years ago

I just tried it on a completely different invader (i16) with a fresh tree and got same behavior as before on i8.

root@invader16:~# goes stop
root@invader16:~#
root@invader16:~# ip add sho dummy0
5958: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 06:c4:fb:db:8f:0a brd ff:ff:ff:ff:ff:ff
    inet 5.5.5.5/0 brd 255.255.255.255 scope global dummy0
       valid_lft forever preferred_lft forever
    inet6 fe80::4c4:fbff:fedb:8f0a/64 scope link
       valid_lft forever preferred_lft forever
root@invader16:~# ip link set up dummy0
root@invader16:~#
root@invader16:~# goes start
root@invader16:~# goes vnet sho ip fib | grep "Dest"                                                   Table                   Destination           Adjacency
root@invader16:~# goes vnet sho ip fib | grep "5\.5\.5"
root@invader16:~#
root@invader16:~# /usr/bin/goes version
7d6b2baf82c482a043ce4d875b91fefbbf344c79
commit 7d6b2baf82c482a043ce4d875b91fefbbf344c79
Author: Jason Pang <jason@platinasystems.com>
Date:   Wed Mar 22 21:14:58 2017 -0700

    Adding non-volatile power logging functions to BMC
donnlee commented 7 years ago

Ok, this seems to happen because the dummy0 had a /0 mask. I re-tested with a /32 and vnet fib was ok:

root@invader16:~# goes vnet sho ip fib | grep "5\.5\.5"
     0                    5.5.5.5/32  2: punt
donnlee commented 7 years ago

Reopening this issue because @stigt alerted me to his bug repro. I was able to repro what Stig saw:

donn@invader8:~$ sudo ip add add 3.3.3.3/16 dev dummy0
donn@invader8:~$ ip add sho dummy0
9868: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 10
00
    link/ether 8a:49:0a:d8:81:1e brd ff:ff:ff:ff:ff:ff
    inet 3.3.3.3/16 scope global dummy0
       valid_lft forever preferred_lft forever
    inet6 fe80::8849:aff:fed8:811e/64 scope link
       valid_lft forever preferred_lft forever
donn@invader8:~$

donn@invader8:~$ sudo goes vnet sh ip fib
 Table                   Destination           Adjacency
     0                    3.3.0.0/16  2: punt
     0              192.168.155.0/24  3: glean eth-31-0
     0              192.168.155.2/32  5: rewrite eth-31-0 IP4: 02:46:8a:00:05:b4 -> 00:05:64:2f:3c:c9
     0              192.168.155.3/32  4: local eth-31-0
                                        tx pipe packets                8
                                        tx pipe bytes                644
donn@invader8:~$ sudo ip link set down dummy0
donn@invader8:~$ sudo goes vnet sh ip fib
 Table                   Destination           Adjacency
     0                    3.3.0.0/16  2: punt
     0              192.168.155.0/24  3: glean eth-31-0
     0              192.168.155.2/32  5: rewrite eth-31-0 IP4: 02:46:8a:00:05:b4 -> 00:05:64:2f:3c:c9
     0              192.168.155.3/32  4: local eth-31-0
                                        tx pipe packets                8
                                        tx pipe bytes                644
donn@invader8:~$

donn@invader8:~$ sudo ip link set up dummy0
donn@invader8:~$
donn@invader8:~$ sudo goes vnet sh ip fib
 Table                   Destination           Adjacency
     0                    3.3.0.0/16  2: punt
     0                    3.3.3.3/32  2: punt
     0              192.168.155.0/24  3: glean eth-31-0
     0              192.168.155.2/32  5: rewrite eth-31-0 IP4: 02:46:8a:00:05:b4 -> 00:05:64:2f:3c:c9
     0              192.168.155.3/32  4: local eth-31-0
                                        tx pipe packets                8
                                        tx pipe bytes                644
donn@invader8:~$
donn@invader8:~$
donn@invader8:~$ sudo goes restart
donn@invader8:~$ sudo goes vnet sh ip fib
 Table                   Destination           Adjacency
     0                    3.3.0.0/16  2: punt
donn@invader8:~$
stigt commented 6 years ago

This is still an issue if you use a subnet mask less than /32. However it may not make sense to use any thing other than a /32 on a dummy interface. Linux allows less than /32 on a dummy, so eventually we should make it work but for now just use /32 on dummy interfaces

jignesh045 commented 6 years ago

Issue verification status: Open (Still exists)

Issue verified in the following build:

root@invader45:~# goes version
github.com/platinasystems/go: v0.41-244-g49d9e6da
github.com/platinasystems/fe1: v0.2-520-g85494c1
github.com/platinasystems/firmware-fe1a: v0.2
root@invader45:~#

root@invader45:~# dpkg --list|grep kernel
ii  kmod                           18-3                             amd64        tools for managing Linux kernel modules
ii  libdrm2:amd64                  2.4.58-2                         amd64        Userspace interface to kernel DRM services -- runtime
ii  linux-image-4.13.0-platina-mk1 4.13-117-g00814e4e1a1e           amd64        Linux kernel, version 4.13.0-platina-mk1
ii  rsyslog                        8.4.2-1+deb8u2                   amd64        reliable system and kernel logging daemon
root@invader45:~#

Steps: Executed same steps as @donnlee commented on Mar 24, 2017