Skip to content

Instantly share code, notes, and snippets.

@adobley
Last active August 24, 2018 18:07
Show Gist options
  • Select an option

  • Save adobley/418ef631be957466a4514af7490455b7 to your computer and use it in GitHub Desktop.

Select an option

Save adobley/418ef631be957466a4514af7490455b7 to your computer and use it in GitHub Desktop.

Revisions

  1. adobley revised this gist Aug 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion usage.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    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 recieve any data.
    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.
  2. adobley created this gist Aug 24, 2018.
    7 changes: 7 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    all: deps build

    deps:
    go get github.com/vishvananda/netlink

    build:
    GOOS=linux GOARCH=amd64 go build
    6 changes: 6 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/xenial64"
    end
    30 changes: 30 additions & 0 deletions main.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    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)
    }
    }
    29 changes: 29 additions & 0 deletions usage.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    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 recieve 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`
    1. place the `main.go`, `Makefile`, and `Vagrantfile` in `${GOPATH}/src/listfdb`
    1. `cd ${GOPATH}/src/listfdb`
    1. `make`
    1. `vagrant up` to deploy ubuntu-xenial
    1. `vagrant ssh`
    1. `uname -a` and see that kernel version is `4.4.0`
    1. `bridge fdb` and see that there are entries for `enp0s3`
    1. `ip link` to get the index for `enp0s3`
    1. `/vagrant/listfdb ${link_index}`, 2 should be the index for the `enp0s3` device which has 3 fdb entries by default
    1. `sudo apt-get install linux-image-4.15.0-33-generic -y`
    1. `exit`
    1. `vagrant reload` to restart with `4.15` kernel
    1. `vagrant ssh`
    1. `uname -a` and see that kernel version is `4.15.0`
    1. `bridge fdb` and see that there are entries for `enp0s3`
    1. `ip link` to get the index for `enp0s3`
    1. `/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`.