Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.07k stars 445 forks source link

Unspecific/unsupported family ipv4 mpls-vpn with extended next-hop capability enabled #976

Closed alexejli closed 4 years ago

alexejli commented 4 years ago

Bug Report

While experimenting with sending different routes between two exabgp instances I came across a possible bug. When I send a route like one from your example (etc/exabgp/run/api-attributes-vpn.run):

announce attribute route-distinguisher 63333:100 label [ 110 ] next-hop 10.0.99.12 nlri 128.0.64.0/18

.. second exabgp peer breaks and keeps restarting session with error - UPDATE message error / Unspecific / unsupported family ipv4 mpls-vpn with extended next-hop capability enabled]

Edit: Sorry - forgot to mention the cause of the error (which is obvious from log) - capability nexthop. When I remove:

capability {
    nexthop true;
}
nexthop {
    ipv4 unicast ipv6;
    ipv4 mpls-vpn ipv6;
    ipv6 unicast ipv4;
}

everything works as supposed.

The question is why I shoud not be able to have next-hop capability enabled while sending such a route?

# 1 INSTANCE

source etc/snd.env exabgp -d -f . etc/snd.conf

snd.conf

process send {
        run send_rcv.py;
        encoder json;
    }

process test {
        run send.py;
        encoder json;
    }

neighbor 192.168.5.65 {
    router-id 127.0.0.1;
    local-address 127.0.0.1;
    local-as 65003;
    peer-as 65004;
    hold-time 180;
    group-updates false;

    capability {
        add-path send/receive;
        route-refresh enable;
        nexthop true;
    }

    family {
        ipv4 multicast;
        ipv4 unicast;
        ipv4 flow;
        ipv4 flow-vpn;
        ipv4 mpls-vpn;
        ipv4 nlri-mpls;
        ipv6 unicast;
        ipv6 flow;
        ipv6 flow-vpn;
        ipv6 mpls-vpn;
        l2vpn vpls;
        l2vpn evpn;
    }

    nexthop {
        ipv4 unicast ipv6;
        ipv4 mpls-vpn ipv6;
        ipv6 unicast ipv4;
    }

    api send {
        processes [ test send ];
            neighbor-changes;
            receive {
                parsed;
                update;
            }
    }

snd.env

export exabgp_daemon_daemonize=false
export exabgp_daemon_drop=false
export exabgp_daemon_umask='0o137'
export exabgp_daemon_user='guest0'
export exabgp_log_destination='.log/snd_exabgp.log'
export exabgp_log_enable=true
export exabgp_log_level=DEBUG
export exabgp_log_all=true
export exabgp_log_configuration=true
export exabgp_log_reactor=true
export exabgp_log_daemon=true
export exabgp_log_processes=true
export exabgp_log_network=true
export exabgp_log_packets=false
export exabgp_log_rib=false
export exabgp_log_message=false
export exabgp_log_timers=false
export exabgp_log_routes=true
export exabgp_log_parser=false
export exabgp_log_short=false
export exabgp_tcp_once=false
export exabgp_tcp_delay=0
export exabgp_tcp_bind='127.0.0.1'
export exabgp_tcp_port=1790
export exabgp_tcp_acl=false
export exabgp_bgp_openwait=60
export exabgp_cache_attributes=true
export exabgp_cache_nexthops=true
export exabgp_api_ack=false
export exabgp_api_chunk=1
export exabgp_api_encoder=json
export exabgp_api_compact=false
export exabgp_api_respawn=true
export exabgp_api_terminate=false
export exabgp_api_cli=true
export exabgp_api_pipename='snd'

# 2 INSTANCE

source etc/rcv.env exabgp -d -f . etc/snd.conf

rcv.conf

process test {
        run receive.py;
        encoder json;
    }

neighbor 127.0.0.1 {
    router-id 192.168.5.65;
    local-address 192.168.5.65;
    local-as 65004;
    peer-as 65003;
    hold-time 180;
    group-updates false;

    capability {
        add-path send/receive;
        route-refresh enable;
        nexthop true;
    }

    family {
        #all;
        ipv4 multicast;
        ipv4 unicast;
        ipv4 flow;
        ipv4 flow-vpn;
        ipv4 mpls-vpn;
        ipv4 nlri-mpls;
        ipv6 unicast;
        ipv6 flow;
        ipv6 flow-vpn;
        ipv6 mpls-vpn;
        l2vpn vpls;
        l2vpn evpn;
    }

    nexthop {
        ipv4 unicast ipv6;
        ipv4 mpls-vpn ipv6;
        ipv6 unicast ipv4;
    }

    api test {
        processes [ test ];
            neighbor-changes;
            receive {
            }
    }

rcv.env

export exabgp_daemon_daemonize=false
export exabgp_daemon_drop=false
export exabgp_daemon_umask='0o137'
export exabgp_daemon_user='guest0'
export exabgp_log_destination='.log/rcv_exabgp.log'
export exabgp_log_enable=true
export exabgp_log_level=DEBUG
export exabgp_log_all=true
export exabgp_log_configuration=true
export exabgp_log_reactor=true
export exabgp_log_daemon=true
export exabgp_log_processes=true
export exabgp_log_network=true
export exabgp_log_packets=false
export exabgp_log_rib=false
export exabgp_log_message=false
export exabgp_log_timers=false
export exabgp_log_routes=true
export exabgp_log_parser=false
export exabgp_log_short=false
export exabgp_tcp_once=false
export exabgp_tcp_delay=0
export exabgp_tcp_bind='192.168.5.65'
export exabgp_tcp_port=1790
export exabgp_tcp_acl=false
export exabgp_bgp_openwait=60
export exabgp_cache_attributes=true
export exabgp_cache_nexthops=true
export exabgp_api_ack=false
export exabgp_api_chunk=1
export exabgp_api_encoder=json
export exabgp_api_compact=false
export exabgp_api_respawn=true
export exabgp_api_terminate=false
export exabgp_api_cli=true
export exabgp_api_pipename='rcv'

Environment

python3 -m venv --prompt bgp_send .venv
. .venv/bin/activate
pip install exabgp
$ pip -V
pip 9.0.1 from /home/alibor/01_PROJECTS/bgp_send/.venv/lib/python3.6/site-packages (python 3.6) 
$ exabgp -v
ExaBGP : 4.2.6
Python : 3.6.9 (default, Apr 18 2020, 01:56:04)  [GCC 8.4.0]
Uname  : Linux device 4.15.0-99-generic #100-Ubuntu SMP Wed Apr 22 20:32:56 UTC 2020 x86_64
Root   : /home/alibor/01_PROJECTS/bgp_send/.venv
$ uname -a
Linux device 4.15.0-99-generic #100-Ubuntu SMP Wed Apr 22 20:32:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Logs issue.log

thomas-mangin commented 4 years ago

master is currently in flux and but could you please test the fix above. The previous patch is also related.

alexejli commented 4 years ago

It works now:

Sun, 17 May 2020 10:19:10 8086 process command from process test : announce attribute route-distinguisher 63333:100 label [ 110 ] next-hop 10.0.99.12 nlri 129.0.64.0/18 Sun, 17 May 2020 10:19:10 8086 reactor async | test | announce attribute route-distinguisher 63333:100 label [ 110 ] next-hop 10.0.99.12 nlri 129.0.64.0/18 Sun, 17 May 2020 10:19:10 8086 configuration . attribute | 'route-distinguisher' '63333:100' 'label' '[' '110' ']' 'next-hop' '10.0.99.12' 'nlri' '129.0.64.0/18' Sun, 17 May 2020 10:19:10 8086 api route added to neighbor 192.168.5.65 local-ip 127.0.0.1 local-as 65003 peer-as 65004 router-id 127.0.0.1 family-allowed in-open : 129.0.64.0/18 label 110 next-hop 10.0.99.12 rd 63333:100 Sun, 17 May 2020 10:19:10 8086 outgoing-1 sending TCP payload ( 82) FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0052 0200 0000 3B40 0101 0040 0206 0201 0000 FDEB 4003 040A 0063 0C80 0E24 0001 800C 0000 0000 0000 0000 0A00 630C 0000 0000 006A 0006 E100 00F7 6500 0000 6481 0040 Sun, 17 May 2020 10:19:10 8086 outgoing-1 >> 1 UPDATE(s)

Sun, 17 May 2020 10:19:10 8076 incoming-1 received TCP payload ( 19) FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0052 02 Sun, 17 May 2020 10:19:10 8076 incoming-1 received TCP payload ( 63) 0000 003B 4001 0100 4002 0602 0100 00FD EB40 0304 0A00 630C 800E 2400 0180 0C00 0000 0000 0000 000A 0063 0C00 0000 0000 6A00 06E1 0000 F765 0000 0064 8100 40 Sun, 17 May 2020 10:19:10 8076 incoming-1 << message of type UPDATE Sun, 17 May 2020 10:19:10 8076 parser parsing UPDATE ( 63) 0000 003B 4001 0100 4002 0602 0100 00FD EB40 0304 0A00 630C 800E 2400 0180 0C00 0000 0000 0000 000A 0063 0C00 0000 0000 6A00 06E1 0000 F765 0000 0064 8100 40 Sun, 17 May 2020 10:19:10 8076 routes withdrawn NLRI none Sun, 17 May 2020 10:19:10 8076 parser attribute origin flag 0x40 type 0x01 len 0x01 payload 00 Sun, 17 May 2020 10:19:10 8076 parser attribute as-path flag 0x40 type 0x02 len 0x06 payload 0201 0000 FDEB Sun, 17 May 2020 10:19:10 8076 parser attribute next-hop flag 0x40 type 0x03 len 0x04 payload 0A00 630C Sun, 17 May 2020 10:19:10 8076 parser attribute mp-reach-nlri flag 0x80 type 0x0e len 0x24 payload 0001 800C 0000 0000 0000 0000 0A00 630C 0000 0000 006A 0006 E100 00F7 6500 0000 6481 0040 Sun, 17 May 2020 10:19:10 8076 parser NLRI ipv4 mpls-vpn with path-information payload 0000 0000 6A00 06E1 0000 F765 0000 0064 8100 40 Sun, 17 May 2020 10:19:10 8076 routes announced NLRI none Sun, 17 May 2020 10:19:10 8076 peer-1 << UPDATE #15 Sun, 17 May 2020 10:19:10 8076 peer-1 UPDATE #15 nlri ( 19) 129.0.64.0/18 path-information 0.0.0.0 label 110 next-hop 10.0.99.12 rd 63333:100