Skip to content

Instantly share code, notes, and snippets.

@adobley
Last active August 24, 2018 18:07
Show Gist options
  • Save adobley/418ef631be957466a4514af7490455b7 to your computer and use it in GitHub Desktop.
Save adobley/418ef631be957466a4514af7490455b7 to your computer and use it in GitHub Desktop.
list fdb issue on ubuntu-xenial, kernel 4.15.0, reproduction steps
package main
import (
"fmt"
"os"
"strconv"
"syscall"
"github.com/vishvananda/netlink"
)
// Call as `./listfdb ${link_index}` to see the entries for the link
func main() {
if len(os.Args) != 2 {
panic(fmt.Errorf("you must provide a single index number for the interface you are listing fdb rules for"))
}
index, err := strconv.Atoi(os.Args[1])
if err != nil {
panic(fmt.Errorf("you must provide an valid index number: %s", err))
}
neighs, err := netlink.NeighList(index, syscall.AF_BRIDGE)
if err != nil {
panic(fmt.Errorf("list fdb failed: %s", err))
}
for _, neigh := range neighs {
fmt.Printf("%#v\n", neigh)
}
}
all: deps build
deps:
go get github.com/vishvananda/netlink
build:
GOOS=linux GOARCH=amd64 go build

We have discovered an potential regression on ubuntu-xenial when upgrading our environments from ubuntu-trusty. The change appears to manifest somewhere between 4.4.0 and 4.15.0 kernel versions.

When listing bridge fdb entries via syscalls, we do not receive any data.

We have made a binary that makes the same calls, stripped down to only make the affected calls. We are making use of a library to wrap the netlink logic, https://github.com/vishvananda/netlink.

Steps to reproduce:

  1. install golang and vagrant
  2. place the main.go, Makefile, and Vagrantfile in ${GOPATH}/src/listfdb
  3. cd ${GOPATH}/src/listfdb
  4. make
  5. vagrant up to deploy ubuntu-xenial
  6. vagrant ssh
  7. uname -a and see that kernel version is 4.4.0
  8. bridge fdb and see that there are entries for enp0s3
  9. ip link to get the index for enp0s3
  10. /vagrant/listfdb ${link_index}, 2 should be the index for the enp0s3 device which has 3 fdb entries by default
  11. sudo apt-get install linux-image-4.15.0-33-generic -y
  12. exit
  13. vagrant reload to restart with 4.15 kernel
  14. vagrant ssh
  15. uname -a and see that kernel version is 4.15.0
  16. bridge fdb and see that there are entries for enp0s3
  17. ip link to get the index for enp0s3
  18. /vagrant/listfdb ${link_index}, 2 should be the index for the enp0s3 device, note that no results are returned

No entries are listed, despite being able to see them with bridge fdb.

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment