lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

May 2023

  • 1 participants
  • 2583 discussions
[S] Change in osmo-hnbgw[master]: eliminate function hnb_contexts()
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32617 ) Change subject: eliminate function hnb_contexts() ...................................................................... eliminate function hnb_contexts() It's really just a bloated llist_count() wrapper. (Cosmetic preparation for separate osmo_hnbgw_main.c file) Change-Id: Icd4100ddeb98f4dc2e2ec6de2d44a4b861a66078 --- M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/hnbgw.c 2 files changed, 14 insertions(+), 15 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 1bf140a..1d46cda 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -178,7 +178,6 @@ struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid); struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char *identity_info); const char *hnb_context_name(struct hnb_context *ctx); -unsigned hnb_contexts(const struct hnb_gw *gw); struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id); struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi); diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 4885a2c..8c6a293 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -133,19 +133,6 @@ return NULL; } - -unsigned hnb_contexts(const struct hnb_gw *gw) -{ - unsigned num_ctx = 0; - struct hnb_context *hnb; - - llist_for_each_entry(hnb, &gw->hnb_list, list) { - num_ctx++; - } - - return num_ctx; -} - struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id) { struct ue_context *ue; @@ -640,7 +627,8 @@ CTRL_CMD_DEFINE_RO(hnbs, "num-hnb"); static int get_hnbs(struct ctrl_cmd *cmd, void *data) { - cmd->reply = talloc_asprintf(cmd, "%u", hnb_contexts(data)); + struct hnb_gw *gw = data; + cmd->reply = talloc_asprintf(cmd, "%u", llist_count(&gw->hnb_list)); return CTRL_CMD_REPLY; } -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32617 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Icd4100ddeb98f4dc2e2ec6de2d44a4b861a66078 Gerrit-Change-Number: 32617 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-hnbgw[master]: rab_ass_fsm.c: fix asn1 memleak when replacing GTP address
by neels 06 May '23

06 May '23
Attention is currently required from: daniel. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32614 ) Change subject: rab_ass_fsm.c: fix asn1 memleak when replacing GTP address ...................................................................... Patch Set 1: Code-Review+2 (1 comment) Patchset: PS1: > Just to check I got this right, the calls to `ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_SetupO […] that's the idea, yes. I don't really claim to understand it, but I can confirm that this patch makes ttcn3 tests run without any leftovers in talloc_asn1_ctx. -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32614 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I315d04a07b7dfd4dce26e5b5f871318e27e2bdf6 Gerrit-Change-Number: 32614 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Sat, 06 May 2023 03:51:56 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-smlc[master]: ctrl-test: drop bogus 'rm -f $(CTRL_TEST_DB)'
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-smlc/+/32622 ) Change subject: ctrl-test: drop bogus 'rm -f $(CTRL_TEST_DB)' ...................................................................... ctrl-test: drop bogus 'rm -f $(CTRL_TEST_DB)' That is a copy-paste artifact from osmo-hlr.git and looks pretty dangerous when CTRL_TEST_DB is not defined. Change-Id: Idcf9296a6e7e520c2f0b42f8aace01d616bcfc56 --- M tests/Makefile.am 1 file changed, 12 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified daniel: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/tests/Makefile.am b/tests/Makefile.am index b2e1bee..5ced1ea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,13 +63,10 @@ # pass -u to ctrl_script_runner.py by doing: # make ctrl-test U=-u ctrl-test: $(top_builddir)/src/osmo-smlc/osmo-smlc - -rm -f $(CTRL_TEST_DB) osmo_verify_transcript_ctrl.py -v \ -p 4272 \ -r "$(top_builddir)/src/osmo-smlc/osmo-smlc -c $(top_srcdir)/tests/osmo-smlc.cfg" \ $(U) $(srcdir)/*.ctrl - -rm -f $(CTRL_TEST_DB) - -rm $(CTRL_TEST_DB)-* check-local: atconfig $(TESTSUITE) $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) -- To view, visit https://gerrit.osmocom.org/c/osmo-smlc/+/32622 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-smlc Gerrit-Branch: master Gerrit-Change-Id: Idcf9296a6e7e520c2f0b42f8aace01d616bcfc56 Gerrit-Change-Number: 32622 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: vty: move struct vty_parent_node to private API
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32576 ) Change subject: vty: move struct vty_parent_node to private API ...................................................................... vty: move struct vty_parent_node to private API Change-Id: Id2070f03b09feea966c5342361d409551e557d38 --- M TODO-RELEASE M include/osmocom/vty/vty.h M src/vty/command.c 3 files changed, 26 insertions(+), 16 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/TODO-RELEASE b/TODO-RELEASE index 2935a81..bade6f5 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,4 +8,5 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmogsm new header osmocom/gsm/protocol/gsm_44_060.h -libosmocore ADD new defines in osmocom/gsm/protocol/gsm_04_08.h (old ones marked deprecated) \ No newline at end of file +libosmocore ADD new defines in osmocom/gsm/protocol/gsm_04_08.h (old ones marked deprecated) +libosmovty drop API drop struct vty_parent_node from public API, it should never have been public diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index 155501e..3a2ec6f 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -56,21 +56,6 @@ VTY_SHELL_SERV }; -struct vty_parent_node { - struct llist_head entry; - - /*! private data, specified by creator */ - void *priv; - void *index; - - /*! Node status of this vty */ - int node; - - /*! When reading from a config file, these are the indenting characters expected for children of - * this VTY node. */ - char *indent; -}; - /*! Internal representation of a single VTY */ struct vty { /*! underlying file (if any) */ diff --git a/src/vty/command.c b/src/vty/command.c index a60b544..e67fd86 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -77,6 +77,21 @@ /* Host information structure. */ struct host host; +struct vty_parent_node { + struct llist_head entry; + + /*! private data, specified by creator */ + void *priv; + void *index; + + /*! Node status of this vty */ + int node; + + /*! When reading from a config file, these are the indenting characters expected for children of + * this VTY node. */ + char *indent; +}; + /* Standard command node structures. */ struct cmd_node auth_node = { AUTH_NODE, -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32576 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id2070f03b09feea966c5342361d409551e557d38 Gerrit-Change-Number: 32576 Gerrit-PatchSet: 3 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: vty: show bug in implicit go_parent_node
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32561 ) Change subject: vty: show bug in implicit go_parent_node ...................................................................... vty: show bug in implicit go_parent_node Add test to show a problem in VTY node exiting. Back in 2017 when I introduced VTY config file scopes by indenting [1], I actually mistook the vty->priv for the vty->index that we use everywhere to link to the state for our VTY nodes. The intention was that each VTY node child level has its own object linked to it by the vty->index pointer. When the config file leaves a scope, the vty->index should reflect the parent object. Instead I implemented that for the vty->priv pointer only, but we don't use that. Why did this bug not show? A problem happens only if: - a node that uses vty->index is nested inside a node that also uses vty->index. - config sets parent node attributes after a child node. - there is no legacy vty_go_parent() function that sets the correct index via a switch(). [1] "VTY: implicit node exit by de-indenting, not parent lookup" 4a31ffa2f0097d96201f80305a0495c57552f0ad I24cbb3f6de111f2d31110c3c484c066f1153aac9 Change-Id: I2472daed7436a1947655b06d34eb217e595bc7f3 --- M tests/vty/vty_transcript_test.c M tests/vty/vty_transcript_test.vty 2 files changed, 138 insertions(+), 0 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c index 1754b67..5602c50 100644 --- a/tests/vty/vty_transcript_test.c +++ b/tests/vty/vty_transcript_test.c @@ -211,6 +211,9 @@ enum { ATTR_TEST_NODE = _LAST_OSMOVTY_NODE + 1, + NEST_A_NODE, + NEST_B_NODE, + NEST_C_NODE, }; static struct cmd_node attr_test_node = { @@ -315,6 +318,62 @@ return CMD_SUCCESS; } +static struct cmd_node nest_a_node = { + NEST_A_NODE, + "%s(config-a)# ", + 1 +}; + +static struct cmd_node nest_b_node = { + NEST_B_NODE, + "%s(config-b)# ", + 1 +}; + +static struct cmd_node nest_c_node = { + NEST_C_NODE, + "%s(config-c)# ", + 1 +}; + +DEFUN(cfg_nest_a, cfg_nest_a_cmd, + "nest NAME", + "Enter nest level a\n" + "Set a name to mark the node's state\n") +{ + vty->index = talloc_strdup(root_ctx, argv[0]); + vty->node = NEST_A_NODE; + return CMD_SUCCESS; +} + +DEFUN(cfg_nest_b, cfg_nest_b_cmd, + "nest NAME", + "Enter nest level b\n" + "Set a name to mark the node's state\n") +{ + vty->index = talloc_strdup(root_ctx, argv[0]); + vty->node = NEST_B_NODE; + return CMD_SUCCESS; +} + +DEFUN(cfg_nest_c, cfg_nest_c_cmd, + "nest NAME", + "Enter nest level c\n" + "Set a name to mark the node's state\n") +{ + vty->index = talloc_strdup(root_ctx, argv[0]); + vty->node = NEST_C_NODE; + return CMD_SUCCESS; +} + +DEFUN(cfg_nest_state, cfg_nest_state_cmd, + "state", + "Show this node's mark\n") +{ + vty_out(vty, "%s%s", (const char *)vty->index, VTY_NEWLINE); + return CMD_SUCCESS; +} + static void init_vty_cmds(void) { install_element_ve(&single0_cmd); @@ -336,6 +395,17 @@ install_element(ATTR_TEST_NODE, &cfg_app_attr_unbelievable_magnificent_cmd); install_element(ATTR_TEST_NODE, &cfg_app_attr_unbelievable_wonderful_cmd); install_element(ATTR_TEST_NODE, &cfg_attr_hidden_app_attr_unbelievable_cmd); + + install_element(CONFIG_NODE, &cfg_nest_a_cmd); + install_node(&nest_a_node, NULL); + install_element(NEST_A_NODE, &cfg_nest_b_cmd); + install_node(&nest_b_node, NULL); + install_element(NEST_B_NODE, &cfg_nest_c_cmd); + install_node(&nest_c_node, NULL); + + install_element(NEST_A_NODE, &cfg_nest_state_cmd); + install_element(NEST_B_NODE, &cfg_nest_state_cmd); + install_element(NEST_C_NODE, &cfg_nest_state_cmd); } int main(int argc, char **argv) diff --git a/tests/vty/vty_transcript_test.vty b/tests/vty/vty_transcript_test.vty index 7b8241e..79c9f4c 100644 --- a/tests/vty/vty_transcript_test.vty +++ b/tests/vty/vty_transcript_test.vty @@ -177,3 +177,37 @@ [expert-mode] But can be seen in the expert mode vty_transcript_test(config-attr-test)# app-hidden-unbelievable? app-hidden-unbelievable Hidden, but still unbelievable help message + +vty_transcript_test(config-attr-test)# exit + +vty_transcript_test(config)# nest A +vty_transcript_test(config-a)# state +A +vty_transcript_test(config-a)# nest B +vty_transcript_test(config-b)# state +B +vty_transcript_test(config-b)# nest C +vty_transcript_test(config-c)# state +C +vty_transcript_test(config-c)# exit +vty_transcript_test(config-b)# state +C +vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B +vty_transcript_test(config-b)# exit +vty_transcript_test(config-a)# state +C +vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A +vty_transcript_test(config-a)# nest B2 +vty_transcript_test(config-b)# state +B2 +vty_transcript_test(config-b)# nest C2 +vty_transcript_test(config-c)# state +C2 +vty_transcript_test(config-c)# exit +vty_transcript_test(config-b)# state +C2 +vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B2 +vty_transcript_test(config-b)# exit +vty_transcript_test(config-a)# state +C2 +vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32561 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I2472daed7436a1947655b06d34eb217e595bc7f3 Gerrit-Change-Number: 32561 Gerrit-PatchSet: 3 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: vty: fix vty->index for implicit go_parent_node
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32562 ) Change subject: vty: fix vty->index for implicit go_parent_node ...................................................................... vty: fix vty->index for implicit go_parent_node After this patch, most vty_go_parent() functions are really obsolete, as originally intended: A vty_go_parent() is only needed if the program requires an action to run on VTY node exit. vty_transcript_test.vty shows the fixed behavior. For details, see preceding patch "vty: show bug in implicit go_parent_node" I2472daed7436a1947655b06d34eb217e595bc7f3 Change-Id: Id408c678d18ba19b1c1394c3fb657536153d2094 --- M include/osmocom/vty/vty.h M src/vty/command.c M tests/vty/vty_transcript_test.vty 3 files changed, 27 insertions(+), 8 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index ed9f439..155501e 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -61,6 +61,7 @@ /*! private data, specified by creator */ void *priv; + void *index; /*! Node status of this vty */ int node; diff --git a/src/vty/command.c b/src/vty/command.c index 1e76474..a60b544 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -2438,6 +2438,7 @@ llist_del(&parent->entry); vty->node = parent->node; vty->priv = parent->priv; + vty->index = parent->index; if (vty->indent) talloc_free(vty->indent); vty->indent = parent->indent; @@ -2648,6 +2649,7 @@ struct vty_parent_node this_node = { .node = vty->node, .priv = vty->priv, + .index = vty->index, .indent = vty->indent, }; struct vty_parent_node *parent = vty_parent(vty); @@ -2923,6 +2925,7 @@ this_node = (struct vty_parent_node){ .node = vty->node, .priv = vty->priv, + .index = vty->index, .indent = vty->indent, }; diff --git a/tests/vty/vty_transcript_test.vty b/tests/vty/vty_transcript_test.vty index 79c9f4c..7df2a60 100644 --- a/tests/vty/vty_transcript_test.vty +++ b/tests/vty/vty_transcript_test.vty @@ -191,12 +191,10 @@ C vty_transcript_test(config-c)# exit vty_transcript_test(config-b)# state -C -vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B +B vty_transcript_test(config-b)# exit vty_transcript_test(config-a)# state -C -vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A +A vty_transcript_test(config-a)# nest B2 vty_transcript_test(config-b)# state B2 @@ -205,9 +203,7 @@ C2 vty_transcript_test(config-c)# exit vty_transcript_test(config-b)# state -C2 -vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B2 +B2 vty_transcript_test(config-b)# exit vty_transcript_test(config-a)# state -C2 -vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A +A -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32562 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id408c678d18ba19b1c1394c3fb657536153d2094 Gerrit-Change-Number: 32562 Gerrit-PatchSet: 3 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: gsm: add osmo_mobile_identity_decode_from_l3_buf()
by neels 06 May '23

06 May '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32577 ) Change subject: gsm: add osmo_mobile_identity_decode_from_l3_buf() ...................................................................... gsm: add osmo_mobile_identity_decode_from_l3_buf() We have osmo_mobile_identity_decode_from_l3(), which takes a msgb as argument, and decodes msg->l3h. Not all callers have their data in this form. Offer a more flexible API for the same decoding. For example, before the new function, osmo-hnbgw, which extracts a NAS PDU from asn.1 packed data for CN pooling, would allocate a new msgb and copy the NAS data just to pass a data pointer as argument. Related: SYS#6412 Change-Id: I9bd99ccd01f0eedc091fe51687ff92ae1fdff60b --- M include/osmocom/gsm/gsm48.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 50 insertions(+), 12 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/gsm/gsm48.h b/include/osmocom/gsm/gsm48.h index 93a9e21..8323c72 100644 --- a/include/osmocom/gsm/gsm48.h +++ b/include/osmocom/gsm/gsm48.h @@ -96,6 +96,8 @@ int osmo_mobile_identity_cmp(const struct osmo_mobile_identity *a, const struct osmo_mobile_identity *b); int osmo_mobile_identity_decode(struct osmo_mobile_identity *mi, const uint8_t *mi_data, uint8_t mi_len, bool allow_hex); +int osmo_mobile_identity_decode_from_l3_buf(struct osmo_mobile_identity *mi, const uint8_t *l3_data, size_t l3_len, + bool allow_hex); int osmo_mobile_identity_decode_from_l3(struct osmo_mobile_identity *mi, struct msgb *msg, bool allow_hex); int osmo_mobile_identity_encoded_len(const struct osmo_mobile_identity *mi, int *mi_digits); int osmo_mobile_identity_encode_buf(uint8_t *buf, size_t buflen, const struct osmo_mobile_identity *mi, bool allow_hex); diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index dee6813..df455ac 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -863,11 +863,13 @@ * osmo_mobile_identity. * * \param[out] mi Return buffer for decoded Mobile Identity. - * \param[in] msg The Complete Layer 3 message to extract from (LU, CM Service Req or Paging Resp). + * \param[in] l3_data The Complete Layer 3 message to extract from (LU, CM Service Req or Paging Resp). + * \param[in] l3_len Length of l3_data in bytes. * \returns 0 on success, negative on error: return codes as defined in osmo_mobile_identity_decode(), or * -ENOTSUP = not a Complete Layer 3 message, */ -int osmo_mobile_identity_decode_from_l3(struct osmo_mobile_identity *mi, struct msgb *msg, bool allow_hex) +int osmo_mobile_identity_decode_from_l3_buf(struct osmo_mobile_identity *mi, const uint8_t *l3_data, size_t l3_len, + bool allow_hex) { const struct gsm48_hdr *gh; int8_t pdisc = 0; @@ -886,10 +888,10 @@ .tmsi = GSM_RESERVED_TMSI, }; - if (msgb_l3len(msg) < sizeof(*gh)) + if (l3_len < sizeof(*gh)) return -EBADMSG; - gh = msgb_l3(msg); + gh = (void *)l3_data; pdisc = gsm48_hdr_pdisc(gh); mtype = gsm48_hdr_msg_type(gh); @@ -899,12 +901,12 @@ switch (mtype) { case GSM48_MT_MM_LOC_UPD_REQUEST: /* First make sure that lu-> can be dereferenced */ - if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*lu)) + if (l3_len < sizeof(*gh) + sizeof(*lu)) return -EBADMSG; /* Now we know there is enough msgb data to read a lu->mi_len, so also check that */ lu = (struct gsm48_loc_upd_req*)gh->data; - if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*lu) + lu->mi_len) + if (l3_len < sizeof(*gh) + sizeof(*lu) + lu->mi_len) return -EBADMSG; mi_data = lu->mi; mi_len = lu->mi_len; @@ -914,7 +916,7 @@ case GSM48_MT_MM_CM_REEST_REQ: /* Unfortunately in Phase1 the Classmark2 length is variable, so we cannot * just use gsm48_service_request struct, and need to parse it manually. */ - if (msgb_l3len(msg) < sizeof(*gh) + 2) + if (l3_len < sizeof(*gh) + 2) return -EBADMSG; cm2_len = gh->data[1]; @@ -922,7 +924,7 @@ goto got_cm2; case GSM48_MT_MM_IMSI_DETACH_IND: - if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*idi)) + if (l3_len < sizeof(*gh) + sizeof(*idi)) return -EBADMSG; idi = (struct gsm48_imsi_detach_ind*) gh->data; mi_data = idi->mi; @@ -930,7 +932,7 @@ goto got_mi; case GSM48_MT_MM_ID_RESP: - if (msgb_l3len(msg) < sizeof(*gh) + 2) + if (l3_len < sizeof(*gh) + 2) return -EBADMSG; mi_data = gh->data+1; mi_len = gh->data[0]; @@ -945,7 +947,7 @@ switch (mtype) { case GSM48_MT_RR_PAG_RESP: - if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*paging_response)) + if (l3_len < sizeof(*gh) + sizeof(*paging_response)) return -EBADMSG; paging_response = (struct gsm48_pag_resp*)gh->data; cm2_len = paging_response->cm2_len; @@ -964,7 +966,7 @@ /* MI (Mobile Identity) LV follows the Classmark2 */ /* There must be at least a mi_len byte after the CM2 */ - if (cm2_buf + cm2_len + 1 > msg->tail) + if (cm2_buf + cm2_len + 1 > l3_data + l3_len) return -EBADMSG; mi_start = cm2_buf + cm2_len; @@ -973,12 +975,27 @@ got_mi: /* mi_data points at the start of the Mobile Identity coding of mi_len bytes */ - if (mi_data + mi_len > msg->tail) + if (mi_data + mi_len > l3_data + l3_len) return -EBADMSG; return osmo_mobile_identity_decode(mi, mi_data, mi_len, allow_hex); } +/*! Extract Mobile Identity from a Complete Layer 3 message. + * + * Determine the Mobile Identity data and call osmo_mobile_identity_decode() to return a decoded struct + * osmo_mobile_identity. + * + * \param[out] mi Return buffer for decoded Mobile Identity. + * \param[in] msg The Complete Layer 3 message to extract from (LU, CM Service Req or Paging Resp). + * \returns 0 on success, negative on error: return codes as defined in osmo_mobile_identity_decode(), or + * -ENOTSUP = not a Complete Layer 3 message, + */ +int osmo_mobile_identity_decode_from_l3(struct osmo_mobile_identity *mi, struct msgb *msg, bool allow_hex) +{ + return osmo_mobile_identity_decode_from_l3_buf(mi, msgb_l3(msg), msgb_l3len(msg), allow_hex); +} + /*! Return a human readable representation of a struct osmo_mobile_identity. * Write a string like "IMSI-1234567", "TMSI-0x1234ABCD" or "NONE", "NULL". * \param[out] buf String buffer to write to. diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 6795c57..0018e1c 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -391,6 +391,7 @@ osmo_mobile_identity_to_str_c; osmo_mobile_identity_cmp; osmo_mobile_identity_decode; +osmo_mobile_identity_decode_from_l3_buf; osmo_mobile_identity_decode_from_l3; osmo_mobile_identity_encoded_len; osmo_mobile_identity_encode_buf; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32577 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9bd99ccd01f0eedc091fe51687ff92ae1fdff60b Gerrit-Change-Number: 32577 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: gsm: add osmo_mobile_identity_decode_from_l3_buf()
by fixeria 06 May '23

06 May '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32577 ) Change subject: gsm: add osmo_mobile_identity_decode_from_l3_buf() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32577 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9bd99ccd01f0eedc091fe51687ff92ae1fdff60b Gerrit-Change-Number: 32577 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Sat, 06 May 2023 00:46:50 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: vty: move struct vty_parent_node to private API
by fixeria 06 May '23

06 May '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32576 ) Change subject: vty: move struct vty_parent_node to private API ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32576 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id2070f03b09feea966c5342361d409551e557d38 Gerrit-Change-Number: 32576 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Sat, 06 May 2023 00:44:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: vty: fix vty->index for implicit go_parent_node
by fixeria 06 May '23

06 May '23
Attention is currently required from: neels, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32562 ) Change subject: vty: fix vty->index for implicit go_parent_node ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32562 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id408c678d18ba19b1c1394c3fb657536153d2094 Gerrit-Change-Number: 32562 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Sat, 06 May 2023 00:43:51 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.