exabgp icon indicating copy to clipboard operation
exabgp copied to clipboard

Adding support for BGP confederation

Open oriordan opened this issue 11 years ago • 11 comments

Since the AS_PATH value has to be one of [('AS_SET','0x01'), ('AS_SEQUENCE', '0x02')], the peer drops after connection. I've read that BGP confederation will not be supported (it was written a year ago, don't know the current status) but there's a fairly light patch to keep the peer up so you can still get routing updates.

As per http://www.rfc-editor.org/rfc/rfc3065.txt:

diff -rupN exabgp-3.3.0.orig/lib/exabgp/bgp/message/update/attribute/aspath.py exabgp-3.3.0/lib/exabgp/bgp/message/update/attribute/aspath.py
--- exabgp-3.3.0.orig/lib/exabgp/bgp/message/update/attribute/aspath.py 2014-01-06 21:18:57.000000000 +0000
+++ exabgp-3.3.0/lib/exabgp/bgp/message/update/attribute/aspath.py  2014-01-31 12:02:33.010393759 +0000
@@ -14,8 +14,10 @@ from exabgp.bgp.message.open.asn import
 # =================================================================== ASPath (2)

 class ASPath (Attribute):
-   AS_SET      = 0x01
-   AS_SEQUENCE = 0x02
+   AS_SET             = 0x01
+   AS_SEQUENCE        = 0x02
+   AS_CONFED_SEQUENCE = 0x03
+   AS_CONFED_SET      = 0x04

    ID = AttributeID.AS_PATH
    FLAG = Flag.TRANSITIVE
diff -rupN exabgp-3.3.0.orig/lib/exabgp/bgp/message/update/attributes/__init__.py exabgp-3.3.0/lib/exabgp/bgp/message/update/attributes/__init__.py
--- exabgp-3.3.0.orig/lib/exabgp/bgp/message/update/attributes/__init__.py  2014-01-06 21:18:57.000000000 +0000
+++ exabgp-3.3.0/lib/exabgp/bgp/message/update/attributes/__init__.py   2014-01-31 12:03:47.561369457 +0000
@@ -585,8 +585,10 @@ class Attributes (dict):
            True : 4,
        }
        as_choice = {
-           ASPath.AS_SEQUENCE : as_seq,
-           ASPath.AS_SET      : as_set,
+           ASPath.AS_SEQUENCE        : as_seq,
+           ASPath.AS_SET             : as_set,
+           ASPath.AS_CONFED_SEQUENCE : as_seq,
+           ASPath.AS_CONFED_SET      : as_set,
        }

        upr = unpacker[asn4]
@@ -598,7 +600,7 @@ class Attributes (dict):
                stype = ord(data[0])
                slen  = ord(data[1])

-               if stype not in (ASPath.AS_SET, ASPath.AS_SEQUENCE):
+               if stype not in as_choice:
                    raise Notify(3,11,'invalid AS Path type sent %d' % stype)

                end = 2+(slen*length)

oriordan avatar Jan 31 '14 12:01 oriordan

This patch is good but very incomplete .. I will try to build on it for a fuller version on my own tree. Thank you for your help.

thomas-mangin avatar Jan 31 '14 16:01 thomas-mangin

Your feedback on https://github.com/thomas-mangin/exabgp/tree/confed would be welcome.

I believe the code supports parsing and generating updates with ASN4 support but the generation could be totally buggy as I wrote this quickly and as I can not test it (and never used confed myself).

The next step would be to allow the creation of a confederation option on the peer to generate the AS_PATH accordingly.

thomas-mangin avatar Jan 31 '14 16:01 thomas-mangin

I'm running your patch in production and so far it's seamless. However unfortunately I'm not allowed to send updates to any of the peers, so I can't test that functionality either. This might change in the next few months though.

Thanks a lot for the prompt response, this project is awesome.

oriordan avatar Feb 03 '14 13:02 oriordan

Thank you for the confirmation. I will try lab the confederation and try to get it right for announcement too.

thomas-mangin avatar Feb 03 '14 14:02 thomas-mangin

To close this issue, I need some help with testing the conferation code. Therefore if anyone can establish working sessions with ExaBGP using confed, and provide me the packet dump of what was exchanged to add to the unit-testing, I will be able to officially support the feature. Until then, it will have to remain half finished.

thomas-mangin avatar Jun 30 '14 19:06 thomas-mangin

As the patch is working since Feb 3, I'd consider it stable. I'll try to get you some pcaps later this week, but poke me if I'd forget.

oriordan avatar Jun 30 '14 19:06 oriordan

That would be great. I will need it to create the configuration side too.

thomas-mangin avatar Jun 30 '14 20:06 thomas-mangin

Parsing is done, generation is left for version 4.0 with the new network configuration format.

thomas-mangin avatar Nov 17 '14 07:11 thomas-mangin

Any information on how other vendors configure this, good or bad, would be welcome.

thomas-mangin avatar Jan 03 '15 09:01 thomas-mangin

Hi all - "need-help" was added. We hit this bug.

What is required? Wat is the current status?

job avatar Apr 25 '18 13:04 job

Well, need some configuration parsing for generation, reverse when the data is received from the peer, most of the rest of the code is there but I have never configured confed and therefore never took on the work.

thomas-mangin avatar Apr 25 '18 17:04 thomas-mangin