rtbrick / bngblaster

The BNG Blaster is an open-source network tester for access and routing protocols.
https://rtbrick.github.io/bngblaster/
BSD 3-Clause "New" or "Revised" License
202 stars 32 forks source link

Downstream traffic loses header information for one of the L2TP subscribers. #238

Closed ArunPrakashThangaraj closed 6 months ago

ArunPrakashThangaraj commented 6 months ago

Describe the bug

After clearing pppoe/ipoe subscribers and l2tp tunnel, downstream traffic from the blaster looks incomplete.

To Reproduce

Version (bngblaster -v):

Version: 0.8.36
Compiler: GNU (11.4.0)
IO Modes: packet_mmap_raw (default), packet_mmap, raw

JSON configuration:

  "interfaces": {
    "access": [
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "ipoe",
        "dhcp": true,
        "outer-vlan-min": 1001,
        "outer-vlan-max": 1001,
        "inner-vlan-min": 1001,
        "inner-vlan-max": 1001
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "ipoe",
        "dhcp": true,
        "outer-vlan-min": 1002,
        "outer-vlan-max": 1002,
        "inner-vlan-min": 1002,
        "inner-vlan-max": 1002
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "ipoe",
        "dhcp": true,
        "outer-vlan-min": 1003,
        "outer-vlan-max": 1003,
        "inner-vlan-min": 1003,
        "inner-vlan-max": 1003
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "ipoe",
        "dhcp": true,
        "outer-vlan-min": 1004,
        "outer-vlan-max": 1004,
        "inner-vlan-min": 1004,
        "inner-vlan-max": 1004
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "ipoe",
        "dhcp": true,
        "outer-vlan-min": 1005,
        "outer-vlan-max": 1005,
        "inner-vlan-min": 1005,
        "inner-vlan-max": 1005
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "user1@t-online.de",
        "password": "test",
        "outer-vlan-min": 1,
        "outer-vlan-max": 1,
        "inner-vlan-min": 1,
        "inner-vlan-max": 1,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "user2@t-online.de",
        "password": "test",
        "outer-vlan-min": 2,
        "outer-vlan-max": 2,
        "inner-vlan-min": 2,
        "inner-vlan-max": 2,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "user3@t-online.de",
        "password": "test",
        "outer-vlan-min": 3,
        "outer-vlan-max": 3,
        "inner-vlan-min": 3,
        "inner-vlan-max": 3,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "user4@t-online.de",
        "password": "test",
        "outer-vlan-min": 4,
        "outer-vlan-max": 4,
        "inner-vlan-min": 4,
        "inner-vlan-max": 4,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "user5@t-online.de",
        "password": "test",
        "outer-vlan-min": 5,
        "outer-vlan-max": 5,
        "inner-vlan-min": 5,
        "inner-vlan-max": 5,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "l2tp1server@rtbrick.com",
        "password": "test",
        "outer-vlan-min": 6,
        "outer-vlan-max": 6,
        "inner-vlan-min": 6,
        "inner-vlan-max": 6,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "l2tp1server@rtbrick.com",
        "password": "test",
        "outer-vlan-min": 7,
        "outer-vlan-max": 7,
        "inner-vlan-min": 7,
        "inner-vlan-max": 7,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "l2tp2server@rtbrick.com",
        "password": "test",
        "outer-vlan-min": 8,
        "outer-vlan-max": 8,
        "inner-vlan-min": 8,
        "inner-vlan-max": 8,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "l2tp2server@rtbrick.com",
        "password": "test",
        "outer-vlan-min": 9,
        "outer-vlan-max": 9,
        "inner-vlan-min": 9,
        "inner-vlan-max": 9,
        "authentication-protocol": "PAP"
      },
      {
        "interface": "SN1-2-C1",
        "network-interface": "SN1-3-C1",
        "type": "pppoe",
        "username": "l2tp2server@rtbrick.com",
        "password": "test",
        "outer-vlan-min": 10,
        "outer-vlan-max": 10,
        "inner-vlan-min": 10,
        "inner-vlan-max": 10,
        "authentication-protocol": "PAP"
      }
    ],
    "network": [
      {
        "interface": "SN1-3-C1",
        "address": "132.1.1.3",
        "gateway": "132.1.1.1",
        "address-ipv6": "2003:156:101:101::2",
        "gateway-ipv6": "2003:156:101:101::1"
      },
      {
        "interface": "SN1-6-C2",
        "address": "23.1.1.3/24",
        "gateway": "23.1.1.2",
        "isis-instance-id": 1,
        "isis-level": 1
      },
      {
        "interface": "SN1-7-RR",
        "address": "34.1.1.3/24",
        "gateway": "34.1.1.4",
        "isis-instance-id": 1,
        "isis-level": 1
      }
    ]
  },
  "sessions": {
    "count": 15,
    "max-outstanding": 100,
    "start-rate": 100,
    "stop-rate": 100
  },
  "pppoe": {
    "reconnect": true,
    "discovery-timeout": 5,
    "discovery-retry": 3
  },
  "access-line": {
    "agent-remote-id": "DEU.RTBRICK.{session-global}",
    "agent-circuit-id": "0.0.0.0/0.0.0.0 eth 0:{session-global}",
    "rate-up": 1024,
    "rate-down": 16384
  },
  "ppp": {
    "mru": 1492,
    "authentication": {
      "username": "user{session-global}@t-online.de",
      "password": "test",
      "timeout": 5,
      "retry": 30,
      "protocol": "PAP"
    },
    "lcp": {
      "conf-request-timeout": 5,
      "conf-request-retry": 10,
      "keepalive-interval": 30,
      "keepalive-retry": 3
    },
    "ipcp": {
      "enable": true,
      "conf-request-timeout": 5,
      "conf-request-retry": 10
    },
    "ip6cp": {
      "enable": true,
      "conf-request-timeout": 5,
      "conf-request-retry": 10
    }
  },
  "dhcp": {
    "enable": true
  },
  "dhcpv6": {
    "enable": true,
    "rapid-commit": true
  },
  "igmp": {
    "autostart": true,
    "version": 3,
    "start-delay": 5,
    "group": "232.1.1.1",
    "group-iter": "0.0.0.1",
    "source": "132.1.1.3",
    "group-count": 1,
    "send-multicast-traffic": false
  },
  "session-traffic": {
    "ipv4-pps": 10,
    "ipv6-pps": 10,
    "ipv6pd-pps": 10,
    "autostart": false
  },
  "l2tp-server": [
    {
      "name": "LNS1",
      "address": "134.1.1.11",
      "secret": "rtbrick",
      "receive-window-size": 8,
      "data-control-priority": "false",
      "data-length": "false",
      "data-offset": "false"
    },
    {
      "name": "LNS2",
      "address": "134.1.1.12",
      "secret": "rtbrick",
      "receive-window-size": 8,
      "data-control-priority": "false",
      "data-length": "false",
      "data-offset": "false"
    }
  ],
  "isis": [
    {
      "instance-id": 1,
      "area": [
        "49.0001/24"
      ],
      "system-id": "1921.6100.1003",
      "router-id": "172.168.1.3",
      "hostname": "sn1",
      "hello-padding": true,
      "sr-base": 300000,
      "sr-range": 2000,
      "sr-node-sid": 300,
      "teardown-time": 15,
      "lsp-tx-interval": 5,
      "lsp-tx-window-size": 5
    }
  ],
  "bgp": [
    {
      "__comment__": "RR-IPv4",
      "network-interface": "SN1-7-RR",
      "local-ipv4-address": "172.168.1.3",
      "peer-ipv4-address": "172.168.1.4",
      "raw-update-file": "/home/supervisor/ipv4_nlri.bgp",
      "local-as": 65001,
      "peer-as": 65001
    },
    {
      "__comment__": "RR-IPv6",
      "network-interface": "SN1-7-RR",
      "local-ipv4-address": "172.168.1.3",
      "peer-ipv4-address": "173.168.1.4",
      "raw-update-file": "/home/supervisor/ipv6_nlri.bgp",
      "local-as": 65001,
      "peer-as": 65001
    }
  ]
}

Steps to reproduce the behavior:

  1. ...

Expected behavior

Header part featuring the IP addresses of LNS & LAC must be present in the downstream traffic

ArunPrakashThangaraj commented 6 months ago

Expected downstream traffic: (For subscriber with inner/outer-vlan 7/7)

2024-03-01T09:47:07.822173+0000 12:70:ab:70:37:53 > 7a:00:b2:c0:00:02, ethertype IPv4 (0x0800), length 128: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 114) 134.1.1.11.1701 > 182.168.1.1.1701: l2tp: {IP (0x0021), length 80: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 76) 10.0.0.10.65056 > 10.10.10.10.65056: UDP, length 48} supervisor@C1-STD-26-2701>bm13-tst.fsn.rtbrick.net: op>

Actual downstream traffic:

2024-03-01T09:58:39.489320+0000 12:70:ab:70:37:53 > 7a:00:b2:c0:00:02, ethertype IPv4 (0x0800), length 90: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 76) 132.1.1.3.65056 > 10.100.128.6.65056: UDP, length 48

2024-03-01T09:58:39.489391+0000 12:70:ab:70:37:53 > 7a:00:b2:c0:00:02, ethertype IPv4 (0x0800), length 90: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 76) 132.1.1.3.65056 > 10.10.10.10.65056: UDP, length 48

The header with source-ip as LNS and dest-ip as LAC is missing in this traffic.

134.1.1.11.1701 > 182.168.1.1.1701: l2tp:[] --> This is missing for this subscriber.

Steps:

  1. supervisor@SN1-STD-26-2701:~ $ sudo bngblaster -C config.json -I -S run.sock -P test.pcap -l pppoe -l l2tp -l ip -lag -L report.log

  2. Reboot container (it has last-load-config: true) and the configs will be played after rebooting.

  3. Ensure that 5 subscribers each for IPoE/PPPoE/L2TP are established

  4. Clear subscribers as follows clear pppoe session all clear ipoe subscriber all clear l2tp tunnel all

  5. After step4, all 15 subscribers will be established again

  6. Reset/Start/Stop session traffic for the inner/outer-vlan pairs 6:6, 7:7, 8:8

For 8:8 alone verified stream will be 1 (for 6:6 & 7:7, it will be 2) as the downstream traffic does not work for 8:8. This will be confirmed when you capture on the container C1-STD-26-2701 as the header has the following problem.

GIC-de commented 6 months ago

Fixed with 7e65668ff194c62046186dc73ee24690b2eeb5da!

GIC-de commented 6 months ago

Fixed with version 0.8.40!