Attention is currently required from: fixeria, laforge, pespin.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email )
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
Patch Set 3:
(1 comment)
File doc/manuals/chapters/server.adoc:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/6625a68c_8a8e78c5?us… :
PS3, Line 117:
> Maybe worth document what happens if the system's localtime goes backward (daylight savings time or […]
This is actually quite a lengthy discussion.
Yes, in theory it can happen that we try to reopen an existing file. Right now we use creat() in restart_pcap(), which will truncate the file to zero length if it already exists.
In general it's more difficult than it seems to actually ending up opening the same file, because the file name is based on the timestamp of the time at which we received the packet up to second granularity, so we have further entropy there to end up with a different file name. But yes, it could happen, see test_check_localtime_dst_europe() I just added.
We could add an extra check to avoid store the "last_write" tm if the current tm is older in time than the one in use. But it makes sense to do this in a follow-up patch imho.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Dec 2024 11:30:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, pespin.
Hello Jenkins Builder, fixeria, laforge, osmith,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
pcap-server: Make rotate-localtime feature configurable through VTY
Related: SYS#7100
Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
---
M .gitignore
M configure.ac
M doc/manuals/chapters/server.adoc
M include/osmo-pcap/osmo_pcap_server.h
M src/osmo_server_main.c
M src/osmo_server_network.c
M src/osmo_server_vty.c
M tests/Makefile.am
A tests/rotate_localtime/Makefile.am
A tests/rotate_localtime/rotate_localtime_test.c
A tests/rotate_localtime/rotate_localtime_test.err
A tests/rotate_localtime/rotate_localtime_test.ok
M tests/testsuite.at
13 files changed, 1,748 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/58/39158/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email )
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
Patch Set 3:
(2 comments)
File configure.ac:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/14e77d80_743b12b7?us… :
PS3, Line 65: dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
> Well they start to be needed here since I'm adding unit tests for the feature I'm adding, I think it […]
Acknowledged
File src/osmo_server_vty.c:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/cd8cd9ec_e649c37e?us… :
PS3, Line 246: max_mod = 4294967295;
> We cannot use it easily in DEFUN since stringifying it then adds eg. "UL" at the end. […]
Acknowledged
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Dec 2024 11:10:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, osmith.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email )
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
Patch Set 3:
(4 comments)
File configure.ac:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/8887d85c_e3ee174c?us… :
PS3, Line 65: dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
> put the configure.ac and . […]
Well they start to be needed here since I'm adding unit tests for the feature I'm adding, I think it makes sense to have it here.
File src/osmo_server_network.c:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/816682d3_352d8f98?us… :
PS3, Line 231: /* Checks if we are in a new record period since last time we wrote to a pcap, to know (return true) whether a new pcap file needs to be opened.
> cosmetic: very long line
Acknowledged
File src/osmo_server_vty.c:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/a316200e_85782104?us… :
PS3, Line 219: frecuency
> frequency
Acknowledged
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/e236778c_3498c22d?us… :
PS3, Line 246: max_mod = 4294967295;
> (that will take a while :D) […]
We cannot use it easily in DEFUN since stringifying it then adds eg. "UL" at the end.
I think it doesn't really matter in this case, take it as simply a big enough year :)
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Dec 2024 10:50:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email )
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
Patch Set 3:
(5 comments)
File configure.ac:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/2fcc87ea_b9b4ffa1?us… :
PS3, Line 65: dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
put the configure.ac and .gitignore changes into an extra commit?
File doc/manuals/chapters/server.adoc:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/2590661c_f1a8c82c?us… :
PS3, Line 117:
Maybe worth document what happens if the system's localtime goes backward (daylight savings time or drifting and getting adjusted?)
Actually I'm wondering if that could lead to overwriting previous files, if going backwards 1h because of DST and you have e.g. "rotate-localtime minute". That could happen if the timestamp is part of the filename instead of an ever increasing number (not sure if that is the case, maybe also worth documenting here if it isn't in the docs yet).
File src/osmo_server_network.c:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/082cef03_26f31753?us… :
PS3, Line 231: /* Checks if we are in a new record period since last time we wrote to a pcap, to know (return true) whether a new pcap file needs to be opened.
cosmetic: very long line
File src/osmo_server_vty.c:
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/f903f301_613af12d?us… :
PS3, Line 219: frecuency
frequency
https://gerrit.osmocom.org/c/osmo-pcap/+/39158/comment/f5948c45_38536a53?us… :
PS3, Line 246: max_mod = 4294967295;
(that will take a while :D)
is there some constant we could use instead of this magic number? Same in DEFUN(cfg_server_rotate_localtime_mod_n.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Dec 2024 10:41:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/39162?usp=email )
Change subject: construct: add length steps to StripTrailerAdapter
......................................................................
construct: add length steps to StripTrailerAdapter
The class StripTrailerAdapter allows to remove trailing bytes that
match a specified value from the encoding result of a sub-construct.
The result is always the shortest possible remainder of bytes that
do not match the secified value.
Unfortunately there are specifications that explicitly require the
length of the result to fit into a limited set of possible length
values. For example: A result may be either one byte or three byte
long. To cover those cases as well, let's add an array parameter
where we can configure the allowed length values of the encoding
result.
Related: OS#6679
Change-Id: I86df064fa41db85923eeb0d83cc399504fdd4488
---
M src/osmocom/construct.py
M tests/test_construct.py
2 files changed, 41 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/62/39162/1
diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py
index c69b44f..1f5bd45 100644
--- a/src/osmocom/construct.py
+++ b/src/osmocom/construct.py
@@ -413,16 +413,20 @@
Encoder removes all trailing bytes matching the default_value
Decoder pads input data up to total_length with default_value
+ In case the encoding restricts the length of the result to specific values, the API user may set those restrictions
+ using the steps parameter. (e.g. encoded result must be either 1 or 3 byte long, steps would be set to [1,3])
+
This is used in constellations like "FlagsEnum(StripTrailerAdapter(GreedyBytes, 3), ..."
where you have a bit-mask that may have 1, 2 or 3 bytes, depending on whether or not any
of the LSBs are actually set.
"""
- def __init__(self, subcon, total_length:int, default_value=b'\x00', min_len=1):
+ def __init__(self, subcon, total_length:int, default_value=b'\x00', min_len=1, steps:[int]=[]):
super().__init__(subcon)
assert len(default_value) == 1
self.total_length = total_length
self.default_value = default_value
self.min_len = min_len
+ self.steps = steps
def _decode(self, obj, context, path):
assert isinstance(obj, bytes)
@@ -435,9 +439,17 @@
assert isinstance(obj, int)
obj = obj.to_bytes(self.total_length, 'big')
# remove trailing bytes if they are zero
+
+ obj_step_aligned = obj
while len(obj) > self.min_len and obj[-1] == self.default_value[0]:
obj = obj[:-1]
- return obj
+ if len(obj) in self.steps:
+ obj_step_aligned = obj
+
+ if self.steps == []:
+ return obj
+ else:
+ return obj_step_aligned;
def filter_dict(d, exclude_prefix='_'):
diff --git a/tests/test_construct.py b/tests/test_construct.py
index bcb2cf8..e4234db 100755
--- a/tests/test_construct.py
+++ b/tests/test_construct.py
@@ -90,13 +90,39 @@
final_application=0x0200, global_service=0x0100,
receipt_generation=0x80, ciphered_load_file_data_block=0x40,
contactless_activation=0x20, contactless_self_activation=0x10)
+ PrivilegesSteps = FlagsEnum(StripTrailerAdapter(GreedyBytes, 3, steps = [1,3]), security_domain=0x800000,
+ dap_verification=0x400000,
+ delegated_management=0x200000, card_lock=0x100000,
+ card_terminate=0x080000, card_reset=0x040000,
+ cvm_management=0x020000, mandated_dap_verification=0x010000,
+ trusted_path=0x8000, authorized_management=0x4000,
+ token_management=0x2000, global_delete=0x1000,
+ global_lock=0x0800, global_registry=0x0400,
+ final_application=0x0200, global_service=0x0100,
+ receipt_generation=0x80, ciphered_load_file_data_block=0x40,
+ contactless_activation=0x20, contactless_self_activation=0x10)
examples = ['00', '80', '8040', '400010']
- def test_examples(self):
+ def test_encdec(self):
for e in self.examples:
dec = self.Privileges.parse(h2b(e))
reenc = self.Privileges.build(dec)
self.assertEqual(e, b2h(reenc))
+ def test_enc(self):
+ enc = self.Privileges.build({'dap_verification' : True})
+ self.assertEqual(b2h(enc), '40')
+ enc = self.Privileges.build({'dap_verification' : True, 'global_service' : True})
+ self.assertEqual(b2h(enc), '4001')
+ enc = self.Privileges.build({'dap_verification' : True, 'global_service' : True, 'contactless_self_activation' : True})
+ self.assertEqual(b2h(enc), '400110')
+
+ enc = self.PrivilegesSteps.build({'dap_verification' : True})
+ self.assertEqual(b2h(enc), '40')
+ enc = self.PrivilegesSteps.build({'dap_verification' : True, 'global_service' : True})
+ self.assertEqual(b2h(enc), '400100')
+ enc = self.PrivilegesSteps.build({'dap_verification' : True, 'global_service' : True, 'contactless_self_activation' : True})
+ self.assertEqual(b2h(enc), '400110')
+
class TestAdapters(unittest.TestCase):
def test_dns_adapter(self):
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/39162?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I86df064fa41db85923eeb0d83cc399504fdd4488
Gerrit-Change-Number: 39162
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, osmith, pespin.
Hello Jenkins Builder, fixeria, laforge, osmith,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
pcap-server: Make rotate-localtime feature configurable through VTY
Related: SYS#7100
Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
---
M .gitignore
M configure.ac
M doc/manuals/chapters/server.adoc
M include/osmo-pcap/osmo_pcap_server.h
M src/osmo_server_main.c
M src/osmo_server_network.c
M src/osmo_server_vty.c
M tests/Makefile.am
A tests/rotate_localtime/Makefile.am
A tests/rotate_localtime/rotate_localtime_test.c
A tests/rotate_localtime/rotate_localtime_test.err
A tests/rotate_localtime/rotate_localtime_test.ok
M tests/testsuite.at
13 files changed, 1,704 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/58/39158/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, osmith.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email )
Change subject: pcap-server: Make rotate-localtime feature configurable through VTY
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39158?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Idf17a161c17050bb62793a82e39179a093b35f73
Gerrit-Change-Number: 39158
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 17 Dec 2024 15:13:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Attention is currently required from: laforge, pespin.
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/libgtpnl/+/39160?usp=email )
Change subject: dev_create: support returning -EEXIST
......................................................................
Patch Set 2:
(1 comment)
File src/gtp-rtnl.c:
https://gerrit.osmocom.org/c/libgtpnl/+/39160/comment/b2efcac9_cd66cfd9?usp… :
PS1, Line 149: if (rc < 0 && errno == EEXIST)
> why not doing this for any kind of error returned from netlink?
Done
--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/39160?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: Ib99bd8eed854014a5c9118c23e4058a41f3145f2
Gerrit-Change-Number: 39160
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 17 Dec 2024 14:09:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>