Adding support for BGP confederation
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)
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.
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.
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.
Thank you for the confirmation. I will try lab the confederation and try to get it right for announcement too.
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.
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.
That would be great. I will need it to create the configuration side too.
Parsing is done, generation is left for version 4.0 with the new network configuration format.
Any information on how other vendors configure this, good or bad, would be welcome.
Hi all - "need-help" was added. We hit this bug.
What is required? Wat is the current status?
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.