osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.66k stars 699 forks source link

Possible Bug? GoBGP does not accept routes when peer AS and confederation sub AS are same. #2846

Open RajdeepMondal opened 1 month ago

RajdeepMondal commented 1 month ago

I have three routers R1, R2 and R3 connected in series. R1 runs ExaBGP while R2 and R3 both run GoBGP v3.13.0.

R1 is in AS 64512. R2 is in the confederation AS 1 and sub AS 256 R3 is in AS 256.

Here are the configurations for R2 and R3. R2:

global:
  config:
    router-id: 192.168.255.1
    as: 256
  confederation:
    config:
      enabled: true
      identifier: 1
      member-as-list: []
neighbors:
- config:
    neighbor-address: 3.0.0.3
    peer-as: 64512
  transport:
    config:
      local-address: 3.0.0.2
  afi-safis:
  - config:
      afi-safi-name: ipv4-unicast
- config:
    neighbor-address: 4.0.0.3
    peer-as: 256
  transport:
    config:
      local-address: 4.0.0.2
  afi-safis:
  - config:
      afi-safi-name: ipv4-unicast

R3:

global:
  config:
    router-id: 192.168.255.2
    as: 256
neighbors:
- config:
    neighbor-address: 4.0.0.2
    peer-as: 1
  transport:
    config:
      local-address: 4.0.0.3
  afi-safis:
  - config:
      afi-safi-name: ipv4-unicast

I advertise the route 200.20.0.0/24 next-hop self from R1 to R2. The route is installed in R2 but not in R3.

In R2, I ran the following command:

$ gobgp global rib
  Network              Next Hop             AS_PATH              Age        Attrs
*> 200.20.0.0/24        3.0.0.3              64512          00:00:30   [{Origin: i}]

In R3, on running the same command, I get:

$ gobgp global rib
Network not in table

On further investigation, I found that GoBGP does not establish a connection between R2 and R3. In R2:

$ gobgp neighbor
Peer       AS  Up/Down State       |#Received  Accepted
3.0.0.3 64512 00:00:10 Establ      |        1         1
4.0.0.3   256    never Active      |        0         0

However, if I keep R3 in AS 257, then the route does get installed without any issues. Here is the output:

$ gobgp global rib
  Network              Next Hop             AS_PATH              Age        Attrs
*> 200.20.0.0/24        4.0.0.2             1 64512         00:00:30   [{Origin: i}]

When I checked the connection status for the second case, I found R2 has established a BGP connection with both R1 and R3.

$ gobgp neighbor
Peer       AS  Up/Down State       |#Received  Accepted
3.0.0.3 64512 00:00:12 Establ      |        1         1
4.0.0.3   257 00:00:21 Establ      |        0         0

Expected behavior: Both R2 and R3 should install the advertised route in both the cases discussed above.