[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
laforge has submitted this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage It seems that 4 years ago in 2020 we merged Change-Id Iab17f09380d7cd914cf85746b794c6c04ec7de43 to add MNCCv7 support, but never actually tested mncc_sock.py ever since, as it still tries to unconditionally access the 'ip' and 'port' members of the message, which no longer exist due to the introduction of sockaddr_storage. Working with sockaddr_storage is a bit nasty as it contains double-underscores in the __ss_padding member, which means ctypes/python will make it a private member that we cannot access. Work around this with a small sed-script that removes the underscores from the clang2py-generated python source code. Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 --- M mncc.py M mncc_sock.py M regen-mncc-py.sh 3 files changed, 55 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved; Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve diff --git a/mncc.py b/mncc.py index 94ace48..627ef38 100644 --- a/mncc.py +++ b/mncc.py @@ -589,7 +589,7 @@ struct_sockaddr_storage._pack_ = 1 # source:False struct_sockaddr_storage._fields_ = [ ('ss_family', ctypes.c_uint16), -('__ss_padding', ctypes.c_char * 118), +('ss_padding', ctypes.c_char * 118), ('__ss_align', ctypes.c_uint64), ] diff --git a/mncc_sock.py b/mncc_sock.py index 79e2346..8918c3a 100644 --- a/mncc_sock.py +++ b/mncc_sock.py @@ -65,7 +65,39 @@ else: return "(???)" +def pad(x, l): +if len(x) < l: +return x + (l - len(x)) * b'\x00' +else: +return x + class mncc_rtp_msg(mncc.struct_gsm_mncc_rtp, mncc_msg_common): +def __init__(self, *args, **kwargs): +super().__init__(*args, **kwargs) +# we have to do this here to make sure our setters below are used +if 'ip' in kwargs: +self.ip = kwargs['ip'] +if 'port' in kwargs: +self.port = kwargs['port'] + +@property +def ip(self): +assert self.addr.ss_family == 2 +return int.from_bytes(self.addr.ss_padding[2:6], 'big') +@ip.setter +def ip(self, val): +self.addr.ss_family = 2 +val = pad(self.addr.ss_padding[:2], 2) + val.to_bytes(4, 'big') + self.addr.ss_padding[6:] +self.addr.ss_padding = val + +@property +def port(self): +return int.from_bytes(self.addr.ss_padding[:2], 'big') +@port.setter +def port(self, val): +self.addr.ss_family = 2 +self.addr.ss_padding = val.to_bytes(2, 'big') + self.addr.ss_padding[2:] + def __str__(self): return 'mncc_rtp_msg(type=0x%04x, callref=%u, ip=%x, port=%u)' % (self.msg_type, self.callref, self.ip, self.port) def __unicode__(self): diff --git a/regen-mncc-py.sh b/regen-mncc-py.sh index 08a92f1..4f9e3f3 100755 --- a/regen-mncc-py.sh +++ b/regen-mncc-py.sh @@ -4,3 +4,4 @@ echo clang2py -k ems -o mncc.py mncc.h +sed -e 's/__ss_padding/ss_padding/' -i mncc.py -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 4 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-MessageType: merged
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Patch Set 4: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 4 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 19 Mar 2024 13:22:20 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
Attention is currently required from: laforge. Hello fixeria, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email to look at the new patch set (#4). The following approvals got outdated and were removed: Verified+1 by laforge The change is no longer submittable: Verified is unsatisfied now. Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage It seems that 4 years ago in 2020 we merged Change-Id Iab17f09380d7cd914cf85746b794c6c04ec7de43 to add MNCCv7 support, but never actually tested mncc_sock.py ever since, as it still tries to unconditionally access the 'ip' and 'port' members of the message, which no longer exist due to the introduction of sockaddr_storage. Working with sockaddr_storage is a bit nasty as it contains double-underscores in the __ss_padding member, which means ctypes/python will make it a private member that we cannot access. Work around this with a small sed-script that removes the underscores from the clang2py-generated python source code. Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 --- M mncc.py M mncc_sock.py M regen-mncc-py.sh 3 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/22/36322/4 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 4 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-MessageType: newpatchset
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Patch Set 3: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 19 Mar 2024 13:16:04 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 19 Mar 2024 13:15:36 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-Comment-Date: Mon, 18 Mar 2024 09:58:04 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email ) Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Sun, 17 Mar 2024 08:29:30 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in mncc-python[master]: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
Attention is currently required from: pespin. Hello pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email to look at the new patch set (#2). Change subject: Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage .. Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage It seems that 4 years ago in 2020 we merged Change-Id Iab17f09380d7cd914cf85746b794c6c04ec7de43 to add MNCCv7 support, but never actually tested mncc_sock.py ever since, as it still tries to unconditionally access the 'ip' and 'port' members of the message, which no longer exist due to the introduction of sockaddr_storage. Working with sockaddr_storage is a bit nasty as it contains double-underscores in the __ss_padding member, which means ctypes/python will make it a private member that we cannot access. Work around this with a small sed-script that removes the underscores from the clang2py-generated python source code. Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 --- M mncc.py M mncc_sock.py M regen-mncc-py.sh 3 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/22/36322/2 -- To view, visit https://gerrit.osmocom.org/c/mncc-python/+/36322?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169 Gerrit-Change-Number: 36322 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: pespin Gerrit-Attention: pespin Gerrit-MessageType: newpatchset