From f1e344b11eee5d4774b2036fd0e2e87ab81ac32e Mon Sep 17 00:00:00 2001 From: Takeru Hayasaka Date: Sat, 16 Dec 2023 13:09:11 +0900 Subject: [PATCH 1/6] mup: add Source Address to Type 1 ST Route --- etc/exabgp/conf-srv6-mup.conf | 12 +++- qa/encoding/conf-srv6-mup.msg | 2 + .../bgp/message/update/nlri/mup/t1st.py | 62 +++++++++++++++---- src/exabgp/configuration/announce/mup.py | 2 +- src/exabgp/configuration/static/mpls.py | 19 +++++- 5 files changed, 81 insertions(+), 16 deletions(-) diff --git a/etc/exabgp/conf-srv6-mup.conf b/etc/exabgp/conf-srv6-mup.conf index c333881f2..cb35ce47d 100644 --- a/etc/exabgp/conf-srv6-mup.conf +++ b/etc/exabgp/conf-srv6-mup.conf @@ -27,6 +27,11 @@ neighbor 127.0.0.1 { next-hop 10.0.0.2 \ extended-community [ target:10:10 ]; + mup \ + mup-t1st 192.168.0.2/32 rd 100:100 teid 12345 qfi 9 endpoint 10.0.0.1 source 10.0.1.1 \ + next-hop 10.0.0.2 \ + extended-community [ target:10:10 ]; + mup \ mup-t2st 10.0.0.1 rd 100:100 teid 12345/32 \ next-hop 10.0.0.2 \ @@ -56,7 +61,12 @@ neighbor 127.0.0.1 { bgp-prefix-sid-srv6 ( l3-service 2001:db8:2:2:: 0x18 [64,24,16,0,0,0] ); mup \ - mup-t1st 2001:db8:1:1::1/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1\ + mup-t1st 2001:db8:1:1::1/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 \ + next-hop 10.0.0.2 \ + extended-community [ target:10:10 ]; + + mup \ + mup-t1st 2001:db8:1:1::2/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 source 2002::2 \ next-hop 10.0.0.2 \ extended-community [ target:10:10 ]; diff --git a/qa/encoding/conf-srv6-mup.msg b/qa/encoding/conf-srv6-mup.msg index d81bf2f44..a90c4e0ad 100644 --- a/qa/encoding/conf-srv6-mup.msg +++ b/qa/encoding/conf-srv6-mup.msg @@ -1,10 +1,12 @@ 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0080:02:000000694001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004800010006401810000000800E250001551020010000000000000000000000000001000100010C0000006400000064180A0001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0088:02:000000714001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800010001000000000000000000001300010006401810000000800E250001551020010000000000000000000000000002000100020C00000064000000640A000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005E:02:00000047400101004002004003040A00000240050400000064C010080002000A0000000A800E24000155040A0000020001000317000000640000006420C0A800010000303909200A000001 +1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0063:02:0000004C400101004002004003040A00000240050400000064C010080002000A0000000A800E29000155040A000002000100031C000000640000006420C0A800020000303909200A000001200A000101 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0060:02:00000049400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1E000155040A00000200010004110000006400000064400A00000100003039 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005F:02:00000048400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1D000155040A00000200010004100000006400000064370A000001000030 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005C:02:00000045400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1A000155040A000002000100040D0000006400000064200A000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0085:02:0000006E4001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004700010006401810000000800E2A000255102001000000000000000000000000000200010001110000006400000064402001000000000000 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0094:02:0000007D4001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800020002000000000000000000001800010006401810000000800E3100025510200100000000000000000000000000020001000218000000640000006420010000000000000000000000000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:007B:02:000000644001010040020040050400000064C010080002000A0000000A800E480002551000000000000000000000FFFF0A000002000100032F00000064000000648020010DB800010001000000000000000100003039098020010000000000000000000000000001 +1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:008C:02:000000754001010040020040050400000064C010080002000A0000000A800E590002551000000000000000000000FFFF0A000002000100034000000064000000648020010DB8000100010000000000000002000030390980200100000000000000000000000000018020020000000000000000000000000002 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0071:02:0000005A4001010040020040050400000064C010100002000A0000000A0C00000A0000000A800E360002551000000000000000000000FFFF0A000002000100041D0000006400000064A02001000000000000000000000000000100003039 diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index 5a58f6f23..e67cb52ac 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -25,15 +25,19 @@ # +-----------------------------------+ # 3gpp-5g Specific BGP Type 1 ST Route -# +-----------------------------------+ -# | TEID (4 octets) | -# +-----------------------------------+ -# | QFI (1 octet) | -# +-----------------------------------+ -# | Endpoint Address Length (1 octet) | -# +-----------------------------------+ -# | Endpoint Address (variable) | -# +-----------------------------------+ +# +-----------------------------------+ +# | TEID (4 octets) | +# +-----------------------------------+ +# | QFI (1 octet) | +# +-----------------------------------+ +# | Endpoint Address Length (1 octet) | +# +-----------------------------------+ +# | Endpoint Address (variable) | +# +-----------------------------------+ +# | Source Address Length (1 octet) | +# +-----------------------------------+ +# | Source Address (variable) | +# +-----------------------------------+ @MUP.register @@ -53,6 +57,8 @@ def __init__( endpoint_ip_len, endpoint_ip, afi, + source_ip_len, + source_ip, packed=None, ): MUP.__init__(self, afi) @@ -63,6 +69,8 @@ def __init__( self.qfi = qfi self.endpoint_ip_len = endpoint_ip_len self.endpoint_ip = endpoint_ip + self.source_ip_len = source_ip_len + self.source_ip = source_ip self._pack(packed) def __eq__(self, other): @@ -77,13 +85,15 @@ def __eq__(self, other): and self.qfi == other.qfi and self.endpoint_ip_len == other.endpoint_ip_len and self.endpoint_ip == other.endpoint_ip + and self.source_ip_len == other.source_ip_len + and self.source_ip == other.source_ip ) def __ne__(self, other): return not self.__eq__(other) def __str__(self): - return "%s:%s:%s%s:%s:%s:%s:%s" % ( + return "%s:%s:%s%s:%s:%s:%s:%s:%s:%s" % ( self._prefix(), self.rd._str(), self.ipprefix, @@ -92,6 +102,8 @@ def __str__(self): self.qfi, self.endpoint_ip_len, self.endpoint_ip, + self.source_ip_len, + self.source_ip, ) def pack_index(self): @@ -112,6 +124,8 @@ def __hash__(self): self.qfi, self.endpoint_ip_len, self.endpoint_ip, + self.source_ip_len, + self.source_ip, ) ) @@ -129,6 +143,7 @@ def _pack(self, packed=None): offset += 1 ipprefix_packed = self.ipprefix.pack() + # fmt: off self._packed = ( self.rd.pack() @@ -138,11 +153,16 @@ def _pack(self, packed=None): + pack('!B',self.endpoint_ip_len) + self.endpoint_ip.pack() ) + + if self.source_ip_len != 0: + self._packed += pack('!B', self.source_ip_len) + self.source_ip.pack() + # fmt: on return self._packed @classmethod def unpack(cls, data, afi): + datasize = len(data) rd = RouteDistinguisher.unpack(data[:8]) ipprefix_len = data[8] ip_offset = ipprefix_len // 8 @@ -165,8 +185,24 @@ def unpack(cls, data, afi): size += 1 endpoint_ip_len = data[size] size += 1 - endpoint_ip = IP.unpack(data[size:]) - return cls(rd, ipprefix_len, ipprefix, teid, qfi, endpoint_ip_len, endpoint_ip, afi) + + if endpoint_ip_len in [32, 128]: + endpoint_ip = IP.unpack(data[size : size + endpoint_ip_len]) + size += endpoint_ip_len + else: + raise RuntimeError('endpoint ip length is not 4 or 16') + + source_ip_size = datasize - size + if 0 < source_ip_size: + source_ip_len = data[size] + size += 1 + if source_ip_len in [4, 16]: + source_ip = IP.unpack(data[size : size + source_ip_len]) + size += source_ip_len + else: + raise RuntimeError('source ip length is not 4 or 16') + + return cls(rd, ipprefix_len, ipprefix, teid, qfi, endpoint_ip_len, endpoint_ip, source_ip_len, source_ip, afi) def json(self, compact=None): content = '"arch": %d, ' % self.ARCHTYPE @@ -180,4 +216,6 @@ def json(self, compact=None): content += '"qfi": "%s", ' % str(self.qfi) content += '"endpoint_ip_len": %d, ' % self.endpoint_ip_len content += '"endpoint_ip": "%s"' % str(self.endpoint_ip) + content += '"source_ip_len": %d, ' % self.source_ip_len + content += '"source_ip": "%s"' % str(self.source_ip) return '{ %s }' % content diff --git a/src/exabgp/configuration/announce/mup.py b/src/exabgp/configuration/announce/mup.py index 68a859236..8e80614ea 100644 --- a/src/exabgp/configuration/announce/mup.py +++ b/src/exabgp/configuration/announce/mup.py @@ -32,7 +32,7 @@ class AnnounceMup(ParseAnnounce): definition = [ 'mup-isd rd ', 'mup-dsd rd ', - 'mup-t1st rd teid qfi endpoint ', + 'mup-t1st rd teid qfi endpoint [source ]', 'mup-t2st rd teid ', 'next-hop ', 'extended-community [ mup:<16 bits number>: target:<16 bits number>: ]', diff --git a/src/exabgp/configuration/static/mpls.py b/src/exabgp/configuration/static/mpls.py index 87d60836a..192417872 100644 --- a/src/exabgp/configuration/static/mpls.py +++ b/src/exabgp/configuration/static/mpls.py @@ -248,7 +248,7 @@ def srv6_mup_dsd(tokeniser, afi): ) -# 'mup-t1st rd teid qfi endpoint ', +# 'mup-t1st rd teid qfi endpoint [source ]', def srv6_mup_t1st(tokeniser, afi): ip, length = parse_ip_prefix(tokeniser()) @@ -283,6 +283,19 @@ def srv6_mup_t1st(tokeniser, afi): else: raise Exception("expect endpoint, but received '%s'" % value) + source_ip = b"" + source_ip_len = 0 + if "source" == tokeniser.peek(): + tokeniser() + if afi == AFI.ipv4: + source_ip = IPv4.unpack(IPv4.pton(tokeniser())) + source_ip_len = 32 + elif afi == AFI.ipv6: + source_ip = IPv6.unpack(IPv6.pton(tokeniser())) + source_ip_len = 128 + else: + raise Exception("unexpect afi: %s" % afi) + return Type1SessionTransformedRoute( rd=rd, ipprefix_len=int(length), @@ -290,8 +303,10 @@ def srv6_mup_t1st(tokeniser, afi): teid=int(teid), qfi=int(qfi), afi=afi, - endpoint_ip=endpoint_ip, endpoint_ip_len=int(endpoint_ip_len), + endpoint_ip=endpoint_ip, + source_ip_len=int(source_ip_len), + source_ip=source_ip, ) From de4d280f5fbf6da538c37c2f894229079cf44b75 Mon Sep 17 00:00:00 2001 From: Takeru Hayasaka Date: Tue, 19 Dec 2023 21:37:57 +0900 Subject: [PATCH 2/6] test: mup t1st separation of test functions --- etc/exabgp/conf-srv6-mup-v3.conf | 25 +++++++++++++++++++ etc/exabgp/conf-srv6-mup.conf | 10 -------- qa/encoding/conf-srv6-mup-v3.ci | 1 + qa/encoding/conf-srv6-mup-v3.msg | 2 ++ qa/encoding/conf-srv6-mup.msg | 2 -- .../bgp/message/update/nlri/mup/t1st.py | 17 +++++++------ 6 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 etc/exabgp/conf-srv6-mup-v3.conf create mode 100644 qa/encoding/conf-srv6-mup-v3.ci create mode 100644 qa/encoding/conf-srv6-mup-v3.msg diff --git a/etc/exabgp/conf-srv6-mup-v3.conf b/etc/exabgp/conf-srv6-mup-v3.conf new file mode 100644 index 000000000..7b03ffae5 --- /dev/null +++ b/etc/exabgp/conf-srv6-mup-v3.conf @@ -0,0 +1,25 @@ +neighbor 127.0.0.1 { + router-id 10.0.0.1; + local-address 127.0.0.1; + local-as 65000; + peer-as 65000; + + family { + ipv4 mup; + ipv6 mup; + } + announce { + ipv4 { + mup \ + mup-t1st 192.168.0.2/32 rd 100:100 teid 12345 qfi 9 endpoint 10.0.0.1 source 10.0.1.1 \ + next-hop 10.0.0.2 \ + extended-community [ target:10:10 ]; + } + ipv6 { + mup \ + mup-t1st 2001:db8:1:1::2/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 source 2002::2 \ + next-hop 10.0.0.2 \ + extended-community [ target:10:10 ]; + } + } +} diff --git a/etc/exabgp/conf-srv6-mup.conf b/etc/exabgp/conf-srv6-mup.conf index cb35ce47d..3b7bade19 100644 --- a/etc/exabgp/conf-srv6-mup.conf +++ b/etc/exabgp/conf-srv6-mup.conf @@ -27,11 +27,6 @@ neighbor 127.0.0.1 { next-hop 10.0.0.2 \ extended-community [ target:10:10 ]; - mup \ - mup-t1st 192.168.0.2/32 rd 100:100 teid 12345 qfi 9 endpoint 10.0.0.1 source 10.0.1.1 \ - next-hop 10.0.0.2 \ - extended-community [ target:10:10 ]; - mup \ mup-t2st 10.0.0.1 rd 100:100 teid 12345/32 \ next-hop 10.0.0.2 \ @@ -65,11 +60,6 @@ neighbor 127.0.0.1 { next-hop 10.0.0.2 \ extended-community [ target:10:10 ]; - mup \ - mup-t1st 2001:db8:1:1::2/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 source 2002::2 \ - next-hop 10.0.0.2 \ - extended-community [ target:10:10 ]; - mup \ mup-t2st 2001::1 rd 100:100 teid 12345/32 \ next-hop 10.0.0.2 \ diff --git a/qa/encoding/conf-srv6-mup-v3.ci b/qa/encoding/conf-srv6-mup-v3.ci new file mode 100644 index 000000000..3f6ddfa38 --- /dev/null +++ b/qa/encoding/conf-srv6-mup-v3.ci @@ -0,0 +1 @@ +conf-srv6-mup-v3.conf diff --git a/qa/encoding/conf-srv6-mup-v3.msg b/qa/encoding/conf-srv6-mup-v3.msg new file mode 100644 index 000000000..da2c88ee7 --- /dev/null +++ b/qa/encoding/conf-srv6-mup-v3.msg @@ -0,0 +1,2 @@ +1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0063:02:0000004C400101004002004003040A00000240050400000064C010080002000A0000000A800E29000155040A000002000100031C000000640000006420C0A800020000303909200A000001200A000101 +1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:008C:02:000000754001010040020040050400000064C010080002000A0000000A800E590002551000000000000000000000FFFF0A000002000100034000000064000000648020010DB8000100010000000000000002000030390980200100000000000000000000000000018020020000000000000000000000000002 diff --git a/qa/encoding/conf-srv6-mup.msg b/qa/encoding/conf-srv6-mup.msg index a90c4e0ad..d81bf2f44 100644 --- a/qa/encoding/conf-srv6-mup.msg +++ b/qa/encoding/conf-srv6-mup.msg @@ -1,12 +1,10 @@ 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0080:02:000000694001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004800010006401810000000800E250001551020010000000000000000000000000001000100010C0000006400000064180A0001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0088:02:000000714001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800010001000000000000000000001300010006401810000000800E250001551020010000000000000000000000000002000100020C00000064000000640A000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005E:02:00000047400101004002004003040A00000240050400000064C010080002000A0000000A800E24000155040A0000020001000317000000640000006420C0A800010000303909200A000001 -1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0063:02:0000004C400101004002004003040A00000240050400000064C010080002000A0000000A800E29000155040A000002000100031C000000640000006420C0A800020000303909200A000001200A000101 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0060:02:00000049400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1E000155040A00000200010004110000006400000064400A00000100003039 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005F:02:00000048400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1D000155040A00000200010004100000006400000064370A000001000030 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005C:02:00000045400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1A000155040A000002000100040D0000006400000064200A000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0085:02:0000006E4001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004700010006401810000000800E2A000255102001000000000000000000000000000200010001110000006400000064402001000000000000 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0094:02:0000007D4001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800020002000000000000000000001800010006401810000000800E3100025510200100000000000000000000000000020001000218000000640000006420010000000000000000000000000001 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:007B:02:000000644001010040020040050400000064C010080002000A0000000A800E480002551000000000000000000000FFFF0A000002000100032F00000064000000648020010DB800010001000000000000000100003039098020010000000000000000000000000001 -1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:008C:02:000000754001010040020040050400000064C010080002000A0000000A800E590002551000000000000000000000FFFF0A000002000100034000000064000000648020010DB8000100010000000000000002000030390980200100000000000000000000000000018020020000000000000000000000000002 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0071:02:0000005A4001010040020040050400000064C010100002000A0000000A0C00000A0000000A800E360002551000000000000000000000FFFF0A000002000100041D0000006400000064A02001000000000000000000000000000100003039 diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index e67cb52ac..3e89005bd 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -93,19 +93,22 @@ def __ne__(self, other): return not self.__eq__(other) def __str__(self): - return "%s:%s:%s%s:%s:%s:%s:%s:%s:%s" % ( + s = "%s:%s:%s%s:%s:%s:%s%s" % ( self._prefix(), self.rd._str(), self.ipprefix, "/%d" % self.ipprefix_len, self.teid, self.qfi, - self.endpoint_ip_len, self.endpoint_ip, - self.source_ip_len, - self.source_ip, + "/%d" % self.ipprefix_len, ) + if self.source_ip_len != 0 and self.source_ip != b'': + s += "%s%s" % (self.source_ip, "/%d" % self.source_ip_len) + + return s + def pack_index(self): # removed teid, qfi, endpointip packed = self.rd.pack() + pack('!B', self.ipprefix_len) + self.ipprefix.pack() @@ -190,17 +193,17 @@ def unpack(cls, data, afi): endpoint_ip = IP.unpack(data[size : size + endpoint_ip_len]) size += endpoint_ip_len else: - raise RuntimeError('endpoint ip length is not 4 or 16') + raise RuntimeError('mup t1st endpoint ip length is not 32bit or 128bit, unexpect len: %d' % endpoint_ip_len) source_ip_size = datasize - size if 0 < source_ip_size: source_ip_len = data[size] size += 1 - if source_ip_len in [4, 16]: + if source_ip_len in [32, 128]: source_ip = IP.unpack(data[size : size + source_ip_len]) size += source_ip_len else: - raise RuntimeError('source ip length is not 4 or 16') + raise RuntimeError('mup t1st source ip length is not 32bit or 128bit, unexpect len: %d' % source_ip_len) return cls(rd, ipprefix_len, ipprefix, teid, qfi, endpoint_ip_len, endpoint_ip, source_ip_len, source_ip, afi) From 14dd27a8cdce95f3626336d8408662e778782d1c Mon Sep 17 00:00:00 2001 From: Takeru Hayasaka Date: Thu, 21 Dec 2023 04:29:44 +0900 Subject: [PATCH 3/6] mup: update __str__ fmt struct --- src/exabgp/bgp/message/update/nlri/mup/t1st.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index 3e89005bd..eb12cedec 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -93,7 +93,7 @@ def __ne__(self, other): return not self.__eq__(other) def __str__(self): - s = "%s:%s:%s%s:%s:%s:%s%s" % ( + return"%s:%s:%s%s:%s:%s:%s%s:%s%s" % ( self._prefix(), self.rd._str(), self.ipprefix, @@ -102,13 +102,10 @@ def __str__(self): self.qfi, self.endpoint_ip, "/%d" % self.ipprefix_len, + self.source_ip if self.source_ip != b"" else "", + "/%d" % (self.source_ip_len if self.source_ip_len != 0 else 0), ) - if self.source_ip_len != 0 and self.source_ip != b'': - s += "%s%s" % (self.source_ip, "/%d" % self.source_ip_len) - - return s - def pack_index(self): # removed teid, qfi, endpointip packed = self.rd.pack() + pack('!B', self.ipprefix_len) + self.ipprefix.pack() From 3c1a0b1397c885e71941f19495e9238826ddf9e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:13:47 +0000 Subject: [PATCH 4/6] Bump github/codeql-action from 2 to 3 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0da973c24..8670e9f00 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 From 8c46bb172113cb14d00b34e606801138c30a703b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:46:29 +0000 Subject: [PATCH 5/6] Bump actions/setup-python from 4.7.1 to 5.0.0 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.7.1 to 5.0.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4.7.1...v5.0.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1b553f609..bfda784fa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4.7.1 + uses: actions/setup-python@v5.0.0 - name: Install dependencies run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 448a29fb3..27dce1669 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,7 +19,7 @@ jobs: fetch-depth: 0 - name: Set up Python 3.8 - uses: actions/setup-python@v4.7.1 + uses: actions/setup-python@v5.0.0 with: python-version: 3.8 From c7315350672a3fd23253211d48014076d650b236 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Tue, 9 Jan 2024 09:41:15 +0000 Subject: [PATCH 6/6] ensure backward compatibility of string repr #1193 --- src/exabgp/bgp/message/update/nlri/mup/t1st.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index eb12cedec..d1f895592 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -93,7 +93,7 @@ def __ne__(self, other): return not self.__eq__(other) def __str__(self): - return"%s:%s:%s%s:%s:%s:%s%s:%s%s" % ( + s = "%s:%s:%s%s:%s:%s:%s%s" % ( self._prefix(), self.rd._str(), self.ipprefix, @@ -102,10 +102,13 @@ def __str__(self): self.qfi, self.endpoint_ip, "/%d" % self.ipprefix_len, - self.source_ip if self.source_ip != b"" else "", - "/%d" % (self.source_ip_len if self.source_ip_len != 0 else 0), ) + if self.source_ip_len != 0 and self.source_ip != b'': + s += ":%s/%d" % (self.source_ip, self.source_ip_len) + + return s + def pack_index(self): # removed teid, qfi, endpointip packed = self.rd.pack() + pack('!B', self.ipprefix_len) + self.ipprefix.pack()