kernelkit / infix

Linux :yellow_heart: NETCONF = Infix
https://kernelkit.org
GNU General Public License v2.0
46 stars 12 forks source link

ospf: all router neighbors reported as neighbor on every interface #635

Closed jovatn closed 2 days ago

jovatn commented 1 week ago

Current Behavior

Tested on Infix 24.06.0 in GNS3, but bug ought to exist in 24.08.0 as well.

By reading out interface neighbors from ietf-ospf.yang, you should be able to list neighbor(s) per interface

    container neighbors {
      config false;
      description
        "All neighbors for the interface.";
      list neighbor {
        key "neighbor-router-id";
        description
          "List of interface OSPF neighbors.";
        leaf neighbor-router-id {
          type rt-types:router-id;
          description
            "Neighbor's Router ID.";
        }
        uses neighbor-state;
      }
    }

However, infix lists all neighbors of the device as neighbors on every interface (even the loopback).

Look at router "r6" in the picture below. Screenshot from 2024-09-16 09-13-00

On its interface "eth0" it should list r4 as neighbor, which happens to have router-id 10.1.1.4, but it lists r3 (10.1.1.3) and r5 (10.1.1.5) as well. And it does so on every OSPF interface (eth0, eth1, eth2 and lo).

admin@R6:~$ sysrepocfg -X -d operational -fjson -x "/ietf-routing:routing/ietf-routing:control-plane-protocols"
{
  "ietf-routing:routing": {
    "control-plane-protocols": {
      "control-plane-protocol": [
        {
          "type": "ietf-ospf:ospfv2",
          "name": "default",
          "ietf-ospf:ospf": {
            "address-family": "ipv4",
            "router-id": "10.1.1.6",
...
            "areas": {
              "area": [
                {
                  "area-id": "0.0.0.0",
                  "area-type": "normal-area",
                  "interfaces": {
                    "interface": [
                      {
                        "name": "eth0",
                        "interface-type": "point-to-point",
                        "passive": false,
                        "enabled": true,
                        "state": "point-to-point",
                        "neighbors": {
                          "neighbor": [
                            {
                              "neighbor-router-id": "10.1.1.4",
                              "address": "10.1.1.4",
                              "dr-router-id": "0.0.0.0",
                              "bdr-router-id": "0.0.0.0",
                              "state": "full",
                              "dead-timer": 35695
                            },
                            {
                              "neighbor-router-id": "10.1.1.3",
                              "address": "10.1.1.3",
                              "dr-router-id": "0.0.0.0",
                              "bdr-router-id": "0.0.0.0",
                              "state": "full",
                              "dead-timer": 35138
                            },
                            {
                              "neighbor-router-id": "10.1.1.5",
                              "address": "10.1.1.5",
                              "dr-router-id": "0.0.0.0",
                              "bdr-router-id": "0.0.0.0",
                              "state": "full",
                              "dead-timer": 36525
                            }
                          ]
                        }
                      },
                      {
                        "name": "eth1",
                        "interface-type": "point-to-point",
  ...

Compare this with CLI status output

admin@R6:/> show ospf neighbor 

Neighbor ID     Pri State           Up Time         Dead Time Address         Interface                        RXmtL RqstL DBsmL
10.1.1.4          1 Full/-          42m49s            30.010s 10.1.1.4        eth0:10.1.1.6                        0     0     0
10.1.1.3          1 Full/-          42m50s            39.453s 10.1.1.3        eth1:10.1.1.6                        0     0     0
10.1.1.5          1 Full/-          42m49s            30.840s 10.1.1.5        eth2:10.1.1.6                        0     0     0

admin@R6:/> 

Expected Behavior

admin@R6:~$ sysrepocfg -X -d operational -fjson -x "/ietf-routing:routing/ietf-routing:control-plane-protocols"
{
  "ietf-routing:routing": {
    "control-plane-protocols": {
      "control-plane-protocol": [
        {
          "type": "ietf-ospf:ospfv2",
          "name": "default",
          "ietf-ospf:ospf": {
            "address-family": "ipv4",
            "router-id": "10.1.1.6",
...
            "areas": {
              "area": [
                {
                  "area-id": "0.0.0.0",
                  "area-type": "normal-area",
                  "interfaces": {
                    "interface": [
                      {
                        "name": "eth0",
                        "interface-type": "point-to-point",
                        "passive": false,
                        "enabled": true,
                        "state": "point-to-point",
                        "neighbors": {
                          "neighbor": [
                            {
                              "neighbor-router-id": "10.1.1.4",
                              "address": "10.1.1.4",
                              "dr-router-id": "0.0.0.0",
                              "bdr-router-id": "0.0.0.0",
                              "state": "full",
                              "dead-timer": 35695
                          }
                          ]
                        }
                      },
                      {
                        "name": "eth1",
                        "interface-type": "point-to-point",
  ...

Steps To Reproduce

  1. Setup Infix 24.06.0 on (at least) three devices in GNS3 and connect them (R1 <=> R2 <=> R3)
  2. Setup OSPF, preferably by point-to-point links
  3. Check in CLI that they get ospf connectivity ('show ospf neighbor') on R2, and verify that R2 has a neighbor on two different interfaces.
  4. Use sysrepocfg to extract yang-model of operational state on R2, sysrepocfg -X -d operational -fjson -x "/ietf-routing:routing/ietf-routing:control-plane-protocols
  5. You should see that " lists R1 and R3 as neighbors on both sides.