From 9eccd333089e13caf9d37871a6934770e8d0585c Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 9 Jun 2024 01:17:12 +0100 Subject: [PATCH] fixing bad mup t1st generation --- src/exabgp/bgp/message/update/nlri/mup/t1st.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/exabgp/bgp/message/update/nlri/mup/t1st.py b/src/exabgp/bgp/message/update/nlri/mup/t1st.py index d1f895592..ff8bea8dd 100644 --- a/src/exabgp/bgp/message/update/nlri/mup/t1st.py +++ b/src/exabgp/bgp/message/update/nlri/mup/t1st.py @@ -190,8 +190,9 @@ def unpack(cls, data, afi): size += 1 if endpoint_ip_len in [32, 128]: - endpoint_ip = IP.unpack(data[size : size + endpoint_ip_len]) - size += endpoint_ip_len + ep_len = endpoint_ip_len // 8 + endpoint_ip = IP.unpack(data[size : size + ep_len]) + size += ep_len else: raise RuntimeError('mup t1st endpoint ip length is not 32bit or 128bit, unexpect len: %d' % endpoint_ip_len) @@ -200,12 +201,13 @@ def unpack(cls, data, afi): source_ip_len = data[size] size += 1 if source_ip_len in [32, 128]: - source_ip = IP.unpack(data[size : size + source_ip_len]) - size += source_ip_len + sip_len = source_ip_len // 8 + source_ip = IP.unpack(data[size : size + sip_len]) + size += sip_len else: 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) + return cls(rd, ipprefix_len, ipprefix, teid, qfi, endpoint_ip_len, endpoint_ip, afi, source_ip_len, source_ip) def json(self, compact=None): content = '"arch": %d, ' % self.ARCHTYPE