Skip to content

SBR does not install IPv6 default route in source routing table when using ipRanges #222

@itsKritika18

Description

@itsKritika18

I am using IPVLAN CNI with Whereabouts IPAM and SBR for source-based routing.
The setup is dual-stack (IPv4 + IPv6), so IP allocation is done via ipRanges.

Because ipRanges does not support a top-level gateway field, I'm trying to inject default gateways via the routes section.

Observed behavior:

IPv4 default route is correctly installed in the per-source routing table created by SBR.
IPv6 default route (::/0) is not added/copied to the IPv6 source routing table and instead remains in the main table.

Issue

There is no way to insert ipv6 default route in source routing table.

Supporting evidence

Network Attachment Definition

Name:         ipvlan-test
Namespace:    ns1
Labels:       app.kubernetes.io/managed-by=Helm
Annotations:  meta.helm.sh/release-name: pre
              meta.helm.sh/release-namespace: ns1
API Version:  k8s.cni.cncf.io/v1
Kind:         NetworkAttachmentDefinition
Metadata:
  Creation Timestamp:  2026-01-28T14:11:13Z
  Generation:          1
  Resource Version:    182445897
  UID:                 e8c8945a-0302-43ce-b574-6fdd9e94662c
Spec:
  Config:  {
  "cniVersion": "1.0.0",
  "name": "ipvlan-test",
  "plugins": [
    {
      "type": "ipvlan",
      "master": "eth2",
      "mtu": 1500,
      "ipam": {
        "type": "whereabouts",
        "ipRanges": [{"gateway":"10.10.255.1","range":"10.10.0.0/16"","range_end":"10.10.1.20","range_start":"10.10.1.10"},{"gateway":"fd00:abcd:1234::1","range":"fd00:abcd:1234::/64","range_end":"fd00:abcd:1234::20","range_start":"fd00:abcd:1234::10"}
        ],
        "routes": [{"dst":"10.201.0.0/16","gw":"10.10.255.1"},{"dst":"0.0.0.0/0","gw":"10.10.255.1"},{"dst":"fd00:abcd:1234::12/64","gw":"fd00:abcd:1234::1"},{"dst":"fd00:abcd:1234::/64"},{"dst":"::/0","gw":"fd00:abcd:1234::1"}]
      }
    },
    {
      "type": "sbr"
    }
  ]
}

Logs:

Jan 28 19:41:40 vm1 containerd[1368]: 2026-01-28T19:41:40+05:30 [debug] IPManagement: [{10.10.1.10 ffff0000} {fd00:abcd:1234::10 ffffffffffffffff0000000000000000}], <nil>
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Configure SBR for new interface net1 - previous result: &{1.0.0 [{Name:net1 Mac:xx:xx:xx:xx:xx Sandbox:/var/run/netns/cni-feaf462e-a832-4216-c0fa-1aaa502463c0}] [{Interface:0xc000124ae0 Address:{IP:10.10.1.10 Mask:ffff0000} Gateway:<nil>} {Interface:0xc000124b20 Address:{IP:fd00:abcd:1234::10 Mask:ffffffffffffffff0000000000000000} Gateway:<nil>}] [{Dst:{IP:10.201.0.0 Mask:ffff0000} GW:10.10.255.1} {Dst:{IP:0.0.0.0 Mask:00000000} GW:10.10.255.1} {Dst:{IP:fd00:abcd:1234::12 Mask:ffffffffffffffff0000000000000000} GW:fd00:abcd:1234::1} {Dst:{IP:fd00:abcd:1234:: Mask:ffffffffffffffff0000000000000000} GW:<nil>} {Dst:{IP::: Mask:00000000000000000000000000000000} GW:fd00:abcd:1234::1}] {[]  [] []}}
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Checking for relevant interface: net1
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Found IP address 10.10.1.10
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Found IP address fd00:abcd:1234::10
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Network namespace to use and lock: /var/run/netns/cni-feaf462e-a832-4216-c0fa-1aaa502463c0
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 First unreferenced table: 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Set rule for source {Interface:0xc000124ae0 Address:{IP:10.10.1.10 Mask:ffff0000} Gateway:<nil>}
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Source to use 10.10.1.10/32
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: <nil> Src: <nil> Gw: 10.10.255.1 Flags: [] Table: 254 Realm: 0} from table 254 to 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: 10.201.0.0/16 Src: <nil> Gw: 10.10.255.1 Flags: [] Table: 254 Realm: 0} from table 254 to 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: 10.10.0.0/16" Src: 10.10.1.10 Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254 to 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: fd00:abcd:1234::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254 to 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: fe80::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254 to 100
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Set rule for source {Interface:0xc000124b20 Address:{IP:fd00:abcd:1234::10 Mask:ffffffffffffffff0000000000000000} Gateway:<nil>}
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Source to use fd00:abcd:1234::10/128
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: fd00:abcd:1234::12/64 Src: <nil> Gw: fd00:abcd:1234::1 Flags: [] Table: 254 Realm: 0} from table 254 to 101
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: fd00:abcd:1234::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254 to 101
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Copying route {Ifindex: 4 Dst: fe80::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254 to 101
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: <nil> Src: <nil> Gw: 10.10.255.1 Flags: [] Table: 254 Realm: 0} from table 254
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: 10.201.0.0/16 Src: <nil> Gw: 10.10.255.1 Flags: [] Table: 254 Realm: 0} from table 254
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: 10.10.0.0/16" Src: 10.10.1.10 Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: fd00:abcd:1234::12/64 Src: <nil> Gw: fd00:abcd:1234::1 Flags: [] Table: 254 Realm: 0} from table 254
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: fd00:abcd:1234::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254
Jan 28 19:41:40 vm1 containerd[1368]: 2026/01/28 19:41:40 Deleting route {Ifindex: 4 Dst: fe80::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254 Realm: 0} from table 254

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions