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

February 2023

  • 1 participants
  • 2601 discussions
Change in osmo-upf[master]: move GTP port definitions to upf.h
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/31162 ) Change subject: move GTP port definitions to upf.h ...................................................................... move GTP port definitions to upf.h upf_gtp.h is for the GTP kernel module interaction. The GTP port numbers are also relevant for the netfilter part, upf_nft.h. An upcoming patch will use PORT_GTP1_U in the nft ruleset. Related: SYS#6327 SYS#6264 Change-Id: I37d13cfee225c7ee2cc45525b76d9579d65e847c --- M include/osmocom/upf/upf.h M include/osmocom/upf/upf_gtp.h 2 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/62/31162/1 diff --git a/include/osmocom/upf/upf.h b/include/osmocom/upf/upf.h index fd4019c..c25acca 100644 --- a/include/osmocom/upf/upf.h +++ b/include/osmocom/upf/upf.h @@ -37,6 +37,12 @@ #define UPF_PFCP_LISTEN_DEFAULT "0.0.0.0" +#define PORT_GTP0_C 3386 +#define PORT_GTP0_U 3386 + +#define PORT_GTP1_C 2123 +#define PORT_GTP1_U 2152 + extern struct osmo_tdef_group g_upf_tdef_groups[]; struct pfcp_vty_cfg { diff --git a/include/osmocom/upf/upf_gtp.h b/include/osmocom/upf/upf_gtp.h index e3db918..ec27455 100644 --- a/include/osmocom/upf/upf_gtp.h +++ b/include/osmocom/upf/upf_gtp.h @@ -30,12 +30,6 @@ #define LOG_GTP_DEV(DEV, LEVEL, FMT, ARGS...) \ LOGP(DGTP, LEVEL, "%s: " FMT, upf_gtp_dev_to_str_c(OTC_SELECT, (DEV)), ##ARGS) -#define PORT_GTP0_C 3386 -#define PORT_GTP0_U 3386 - -#define PORT_GTP1_C 2123 -#define PORT_GTP1_U 2152 - struct upf_gtp_dev { struct llist_head entry; -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31162 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I37d13cfee225c7ee2cc45525b76d9579d65e847c Gerrit-Change-Number: 31162 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-upf[master]: deprecate cfg 'nft rule tunmap append'
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/31163 ) Change subject: deprecate cfg 'nft rule tunmap append' ...................................................................... deprecate cfg 'nft rule tunmap append' Subsequent patch will refactor the tunmap nft ruleset. Instead of adapting the 'tunmap append' feature to the new ruleset, rather drop this feature entirely. The 'nft rule tunmap append' was intended for enabling 'trace' in the nft ruleset. However, the same can be achieved via the nft cmdline tool. For example: sudo nft 'add chain filter trace_chain { type filter hook prerouting priority -301; }' sudo nft 'add rule filter trace_chain meta nftrace set 1' Related: SYS#6327 SYS#6264 Change-Id: I1ae36f2f520217254c81fd765d27333ff0f457b2 --- M include/osmocom/upf/upf.h M include/osmocom/upf/upf_nft.h M src/osmo-upf/up_gtp_action.c M src/osmo-upf/upf.c M src/osmo-upf/upf_nft.c M src/osmo-upf/upf_vty.c M tests/nft-rule.vty M tests/upf.vty 8 files changed, 33 insertions(+), 117 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/63/31163/1 diff --git a/include/osmocom/upf/upf.h b/include/osmocom/upf/upf.h index c25acca..ef7aa2b 100644 --- a/include/osmocom/upf/upf.h +++ b/include/osmocom/upf/upf.h @@ -112,9 +112,6 @@ char *table_name; int priority; uint32_t next_id_state; - - /* list of struct string_listitem */ - struct llist_head rule_append; } nft; struct llist_head netinst; diff --git a/include/osmocom/upf/upf_nft.h b/include/osmocom/upf/upf_nft.h index 8333877..4cdcb51 100644 --- a/include/osmocom/upf/upf_nft.h +++ b/include/osmocom/upf/upf_nft.h @@ -49,7 +49,6 @@ int upf_nft_init(); int upf_nft_free(); -char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap, - const struct llist_head *rule_append); -int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap, const struct llist_head *rule_append); +char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap); +int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap); int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap); diff --git a/src/osmo-upf/up_gtp_action.c b/src/osmo-upf/up_gtp_action.c index 3b3da86..238d652 100644 --- a/src/osmo-upf/up_gtp_action.c +++ b/src/osmo-upf/up_gtp_action.c @@ -135,7 +135,7 @@ return -ENOENT; } if (enable) - rc = upf_nft_tunmap_create(&a->tunmap, &g_upf->nft.rule_append); + rc = upf_nft_tunmap_create(&a->tunmap); else rc = upf_nft_tunmap_delete(&a->tunmap); if (rc) { diff --git a/src/osmo-upf/upf.c b/src/osmo-upf/upf.c index 1476270..0a84799 100644 --- a/src/osmo-upf/upf.c +++ b/src/osmo-upf/upf.c @@ -61,7 +61,6 @@ INIT_LLIST_HEAD(&g_upf->gtp.vty_cfg.devs); INIT_LLIST_HEAD(&g_upf->gtp.devs); - INIT_LLIST_HEAD(&g_upf->nft.rule_append); INIT_LLIST_HEAD(&g_upf->netinst); } diff --git a/src/osmo-upf/upf_nft.c b/src/osmo-upf/upf_nft.c index d1a83ff..f30e30c 100644 --- a/src/osmo-upf/upf_nft.c +++ b/src/osmo-upf/upf_nft.c @@ -126,8 +126,7 @@ static int tunmap_single_direction(char *buf, size_t buflen, const struct upf_nft_args *args, const struct upf_nft_args_peer *from_peer, - const struct upf_nft_args_peer *to_peer, - const struct llist_head *rule_append) + const struct upf_nft_args_peer *to_peer) { struct osmo_strbuf sb = { .buf = buf, .len = buflen }; @@ -156,20 +155,13 @@ OSMO_STRBUF_PRINTF(sb, " counter"); - if (rule_append) { - struct string_listitem *i; - llist_for_each_entry(i, rule_append, entry) - OSMO_STRBUF_PRINTF(sb, " %s", i->str); - } - OSMO_STRBUF_PRINTF(sb, " accept"); OSMO_STRBUF_PRINTF(sb, ";\n"); return sb.chars_needed; } -static int upf_nft_ruleset_tunmap_create_buf(char *buf, size_t buflen, const struct upf_nft_args *args, - const struct llist_head *rule_append) +static int upf_nft_ruleset_tunmap_create_buf(char *buf, size_t buflen, const struct upf_nft_args *args) { struct osmo_strbuf sb = { .buf = buf, .len = buflen }; @@ -178,17 +170,16 @@ args->table_name, args->chain_id, args->priority); /* Forwarding from peer_a to peer_b */ - OSMO_STRBUF_APPEND(sb, tunmap_single_direction, args, &args->peer_a, &args->peer_b, rule_append); + OSMO_STRBUF_APPEND(sb, tunmap_single_direction, args, &args->peer_a, &args->peer_b); /* And from peer_b to peer_a */ - OSMO_STRBUF_APPEND(sb, tunmap_single_direction, args, &args->peer_b, &args->peer_a, rule_append); + OSMO_STRBUF_APPEND(sb, tunmap_single_direction, args, &args->peer_b, &args->peer_a); return sb.chars_needed; } -static char *upf_nft_ruleset_tunmap_create_c(void *ctx, const struct upf_nft_args *args, - const struct llist_head *rule_append) +static char *upf_nft_ruleset_tunmap_create_c(void *ctx, const struct upf_nft_args *args) { - OSMO_NAME_C_IMPL(ctx, 512, "ERROR", upf_nft_ruleset_tunmap_create_buf, args, rule_append) + OSMO_NAME_C_IMPL(ctx, 512, "ERROR", upf_nft_ruleset_tunmap_create_buf, args) } static int upf_nft_ruleset_tunmap_delete_buf(char *buf, size_t buflen, const struct upf_nft_args *args) @@ -230,8 +221,7 @@ }; } -char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap, - const struct llist_head *rule_append) +char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap) { struct upf_nft_args args; @@ -244,12 +234,12 @@ } upf_nft_args_from_tunmap_desc(&args, tunmap); - return upf_nft_ruleset_tunmap_create_c(ctx, &args, rule_append); + return upf_nft_ruleset_tunmap_create_c(ctx, &args); } -int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap, const struct llist_head *rule_append) +int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap) { - return upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap, rule_append)); + return upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap)); } int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap) diff --git a/src/osmo-upf/upf_vty.c b/src/osmo-upf/upf_vty.c index afea28d..436d91f 100644 --- a/src/osmo-upf/upf_vty.c +++ b/src/osmo-upf/upf_vty.c @@ -222,8 +222,6 @@ static int config_write_tunmap(struct vty *vty) { - struct string_listitem *i; - vty_out(vty, "tunmap%s", VTY_NEWLINE); if (g_upf->nft.mockup) @@ -232,8 +230,6 @@ if (g_upf->nft.table_name && strcmp(g_upf->nft.table_name, "osmo-upf")) vty_out(vty, " table-name %s%s", g_upf->nft.table_name, VTY_NEWLINE); - llist_for_each_entry(i, &g_upf->nft.rule_append, entry) - vty_out(vty, " nft-rule tunmap append %s%s", i->str, VTY_NEWLINE); return CMD_SUCCESS; } @@ -268,47 +264,29 @@ #define NFT_RULE_STR "nftables rule specifics\n" #define TUNMAP_STR "GTP tunmap use case (a.k.a. forwarding between two GTP tunnels)\n" +#define TUNMAP_APPEND_STR "'tunmap append' feature is no longer available.\n" -DEFUN(cfg_tunmap_nft_rule_append, cfg_tunmap_nft_rule_append_cmd, +DEFUN_DEPRECATED(cfg_tunmap_nft_rule_append, cfg_tunmap_nft_rule_append_cmd, "nft-rule tunmap append .NFT_RULE", - NFT_RULE_STR TUNMAP_STR - "To each tunmap nft rule, append the given text. For example, 'nft-rule append meta nftrace set 1' adds the nftables" - " instructions 'meta nftrace set 1' to each of the tunmap rules passed to netfilter. This command is cumulative," - " multiple 'nft-rule append' will append all of the items.\n" - "The text to append\n") + NFT_RULE_STR TUNMAP_STR TUNMAP_APPEND_STR TUNMAP_APPEND_STR) { - struct string_listitem *i; - i = talloc_zero(g_upf, struct string_listitem); - i->str = argv_concat(argv, argc, 0); - talloc_steal(i, i->str); - llist_add_tail(&i->entry, &g_upf->nft.rule_append); + vty_out(vty, "%% deprecated config option: 'nft-rule tunmap append'%s", VTY_NEWLINE); return CMD_SUCCESS; } -DEFUN(cfg_tunmap_no_nft_rule_append, cfg_tunmap_no_nft_rule_append_cmd, +DEFUN_DEPRECATED(cfg_tunmap_no_nft_rule_append, cfg_tunmap_no_nft_rule_append_cmd, "no nft-rule tunmap append", - NO_STR NFT_RULE_STR TUNMAP_STR - "Drop all additions to tunmap nft rules added by earlier 'nft-rule append' config\n") + NO_STR NFT_RULE_STR TUNMAP_STR TUNMAP_APPEND_STR TUNMAP_APPEND_STR) { - struct string_listitem *i; - while ((i = llist_first_entry_or_null(&g_upf->nft.rule_append, struct string_listitem, entry))) { - llist_del(&i->entry); - talloc_free(i); - } + vty_out(vty, "%% deprecated config option: 'no nft-rule tunmap append'%s", VTY_NEWLINE); return CMD_SUCCESS; } -DEFUN(show_nft_rule_append, show_nft_rule_append_cmd, +DEFUN_DEPRECATED(show_nft_rule_append, show_nft_rule_append_cmd, "show nft-rule tunmap append", - SHOW_STR NFT_RULE_STR TUNMAP_STR "List all tunmap 'nft-rule append' entries\n") + SHOW_STR NFT_RULE_STR TUNMAP_STR TUNMAP_APPEND_STR) { - struct string_listitem *i; - if (llist_empty(&g_upf->nft.rule_append)) { - vty_out(vty, " no nft-rule tunmap append%s", VTY_NEWLINE); - return CMD_SUCCESS; - } - llist_for_each_entry(i, &g_upf->nft.rule_append, entry) - vty_out(vty, " nft-rule tunmap append %s%s", i->str, VTY_NEWLINE); + vty_out(vty, "%% deprecated config option: 'show nft-rule tunmap append'%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -342,7 +320,7 @@ osmo_sockaddr_str_from_str2(&str, "3.3.3.3"); osmo_sockaddr_str_to_sockaddr(&str, &d.core.gtp_remote_addr.u.sas); - vty_out(vty, "%s%s", upf_nft_tunmap_get_ruleset_str(OTC_SELECT, &d, &g_upf->nft.rule_append), VTY_NEWLINE); + vty_out(vty, "%s%s", upf_nft_tunmap_get_ruleset_str(OTC_SELECT, &d), VTY_NEWLINE); return CMD_SUCCESS; } diff --git a/tests/nft-rule.vty b/tests/nft-rule.vty index c52ef0e..ec719ab 100644 --- a/tests/nft-rule.vty +++ b/tests/nft-rule.vty @@ -2,53 +2,14 @@ OsmoUPF# configure terminal OsmoUPF(config)# tunmap -OsmoUPF(config-tunmap)# show nft-rule tunmap append - no nft-rule tunmap append OsmoUPF(config-tunmap)# show nft-rule tunmap example add chain inet osmo-upf tunmap123 { type filter hook prerouting priority -300; } add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.1 @ih,32,32 0x00000201 ip saddr set 2.2.2.3 ip daddr set 3.3.3.3 @ih,32,32 set 0x00000302 counter accept; add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.3 @ih,32,32 0x00000203 ip saddr set 2.2.2.1 ip daddr set 1.1.1.1 @ih,32,32 set 0x00000102 counter accept; +OsmoUPF(config-tunmap)# show nft-rule tunmap append +% deprecated config option: 'show nft-rule tunmap append' OsmoUPF(config-tunmap)# nft-rule tunmap append meta nftrace set 1 -OsmoUPF(config-tunmap)# show nft-rule tunmap append - nft-rule tunmap append meta nftrace set 1 -OsmoUPF(config-tunmap)# show nft-rule tunmap example -add chain inet osmo-upf tunmap123 { type filter hook prerouting priority -300; } -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.1 @ih,32,32 0x00000201 ip saddr set 2.2.2.3 ip daddr set 3.3.3.3 @ih,32,32 set 0x00000302 counter meta nftrace set 1 accept; -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.3 @ih,32,32 0x00000203 ip saddr set 2.2.2.1 ip daddr set 1.1.1.1 @ih,32,32 set 0x00000102 counter meta nftrace set 1 accept; - -OsmoUPF(config-tunmap)# nft-rule tunmap append foo -OsmoUPF(config-tunmap)# show nft-rule tunmap append - nft-rule tunmap append meta nftrace set 1 - nft-rule tunmap append foo -OsmoUPF(config-tunmap)# show nft-rule tunmap example -add chain inet osmo-upf tunmap123 { type filter hook prerouting priority -300; } -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.1 @ih,32,32 0x00000201 ip saddr set 2.2.2.3 ip daddr set 3.3.3.3 @ih,32,32 set 0x00000302 counter meta nftrace set 1 foo accept; -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.3 @ih,32,32 0x00000203 ip saddr set 2.2.2.1 ip daddr set 1.1.1.1 @ih,32,32 set 0x00000102 counter meta nftrace set 1 foo accept; - -OsmoUPF(config-tunmap)# nft-rule tunmap append bar -OsmoUPF(config-tunmap)# show nft-rule tunmap append - nft-rule tunmap append meta nftrace set 1 - nft-rule tunmap append foo - nft-rule tunmap append bar -OsmoUPF(config-tunmap)# show nft-rule tunmap example -add chain inet osmo-upf tunmap123 { type filter hook prerouting priority -300; } -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.1 @ih,32,32 0x00000201 ip saddr set 2.2.2.3 ip daddr set 3.3.3.3 @ih,32,32 set 0x00000302 counter meta nftrace set 1 foo bar accept; -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.3 @ih,32,32 0x00000203 ip saddr set 2.2.2.1 ip daddr set 1.1.1.1 @ih,32,32 set 0x00000102 counter meta nftrace set 1 foo bar accept; - -OsmoUPF(config-tunmap)# show running-config -... -tunmap -... - nft-rule tunmap append meta nftrace set 1 - nft-rule tunmap append foo - nft-rule tunmap append bar -... - +% deprecated config option: 'nft-rule tunmap append' OsmoUPF(config-tunmap)# no nft-rule tunmap append -OsmoUPF(config-tunmap)# show nft-rule tunmap append - no nft-rule tunmap append -OsmoUPF(config-tunmap)# show nft-rule tunmap example -add chain inet osmo-upf tunmap123 { type filter hook prerouting priority -300; } -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.1 @ih,32,32 0x00000201 ip saddr set 2.2.2.3 ip daddr set 3.3.3.3 @ih,32,32 set 0x00000302 counter accept; -add rule inet osmo-upf tunmap123 meta l4proto udp ip daddr 2.2.2.3 @ih,32,32 0x00000203 ip saddr set 2.2.2.1 ip daddr set 1.1.1.1 @ih,32,32 set 0x00000102 counter accept; +% deprecated config option: 'no nft-rule tunmap append' diff --git a/tests/upf.vty b/tests/upf.vty index bfaa0cc..6c278c9 100644 --- a/tests/upf.vty +++ b/tests/upf.vty @@ -56,9 +56,6 @@ mockup no mockup table-name TABLE_NAME - nft-rule tunmap append .NFT_RULE - no nft-rule tunmap append - show nft-rule tunmap append show nft-rule tunmap example OsmoUPF(config-tunmap)# exit @@ -68,16 +65,12 @@ mockup no mockup table-name TABLE_NAME - nft-rule tunmap append .NFT_RULE - no nft-rule tunmap append - show nft-rule tunmap append show nft-rule tunmap example OsmoUPF(config-tunmap)# mockup? mockup don't actually send rulesets to nftables, just return success OsmoUPF(config-tunmap)# no ? - mockup operate nftables rulesets normally - nft-rule nftables rule specifics + mockup operate nftables rulesets normally OsmoUPF(config-tunmap)# table-name? table-name Set the nft inet table name to create and place GTP tunnel forwarding chains in (as in 'nft add table inet foo'). If multiple instances of osmo-upf are running on the same system, each osmo-upf must have its own table name. Otherwise the names of created forwarding chains will collide. The default table name is "osmo-upf". @@ -85,13 +78,13 @@ TABLE_NAME nft inet table name OsmoUPF(config-tunmap)# nft-rule? - nft-rule nftables rule specifics +% There is no matched command. OsmoUPF(config-tunmap)# nft-rule ? - tunmap GTP tunmap use case (a.k.a. forwarding between two GTP tunnels) +% There is no matched command. OsmoUPF(config-tunmap)# nft-rule tunmap ? - append To each tunmap nft rule, append the given text. For example, 'nft-rule append meta nftrace set 1' adds the nftables instructions 'meta nftrace set 1' to each of the tunmap rules passed to netfilter. This command is cumulative, multiple 'nft-rule append' will append all of the items. +% There is no matched command. OsmoUPF(config-tunmap)# nft-rule tunmap append ? - NFT_RULE The text to append +% There is no matched command. OsmoUPF(config-tunmap)# show? show Show running system information @@ -102,5 +95,4 @@ OsmoUPF(config-tunmap)# show nft-rule ? tunmap GTP tunmap use case (a.k.a. forwarding between two GTP tunnels) OsmoUPF(config-tunmap)# show nft-rule tunmap ? - append List all tunmap 'nft-rule append' entries example Print a complete nftables ruleset for a tunmap filled with example IP addresses and TEIDs -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31163 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I1ae36f2f520217254c81fd765d27333ff0f457b2 Gerrit-Change-Number: 31163 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-upf[master]: fix deprecation: use telnet_init_default()
by neels 03 Feb '23

03 Feb '23
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-upf/+/31159 to look at the new patch set (#2). Change subject: fix deprecation: use telnet_init_default() ...................................................................... fix deprecation: use telnet_init_default() Change-Id: Ib20ba77fcf65820e2992e252fb9d35e4219e3783 --- M src/osmo-pfcp-tool/osmo_pfcp_tool_main.c M src/osmo-upf/osmo_upf_main.c 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/59/31159/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31159 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: Ib20ba77fcf65820e2992e252fb9d35e4219e3783 Gerrit-Change-Number: 31159 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-upf[master]: check rc of osmo_use_count_get_put()
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/31160 ) Change subject: check rc of osmo_use_count_get_put() ...................................................................... check rc of osmo_use_count_get_put() Related: CID#307540 CID#307526 Change-Id: Iff450898618ce650ea1f4caa6c3d318e71485ffd --- M src/osmo-upf/up_peer.c M src/osmo-upf/up_session.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/60/31160/1 diff --git a/src/osmo-upf/up_peer.c b/src/osmo-upf/up_peer.c index 2c2eda1..6039b6a 100644 --- a/src/osmo-upf/up_peer.c +++ b/src/osmo-upf/up_peer.c @@ -188,7 +188,7 @@ m->ctx.peer_fi = peer->fi; m->ctx.peer_use_count = &peer->use_count; m->ctx.peer_use_token = (m->rx ? UP_USE_MSG_RX : UP_USE_MSG_TX); - osmo_use_count_get_put(m->ctx.peer_use_count, m->ctx.peer_use_token, 1); + OSMO_ASSERT(osmo_use_count_get_put(m->ctx.peer_use_count, m->ctx.peer_use_token, 1) == 0); } struct osmo_pfcp_msg *up_peer_init_tx(struct up_peer *peer, struct osmo_pfcp_msg *in_reply_to, diff --git a/src/osmo-upf/up_session.c b/src/osmo-upf/up_session.c index fae4c1e..0c2f103 100644 --- a/src/osmo-upf/up_session.c +++ b/src/osmo-upf/up_session.c @@ -48,7 +48,7 @@ m->ctx.session_fi = session->fi; m->ctx.session_use_count = &session->use_count; m->ctx.session_use_token = (m->rx ? UP_USE_MSG_RX : UP_USE_MSG_TX); - osmo_use_count_get_put(m->ctx.session_use_count, m->ctx.session_use_token, 1); + OSMO_ASSERT(osmo_use_count_get_put(m->ctx.session_use_count, m->ctx.session_use_token, 1) == 0); } enum up_session_fsm_state { -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31160 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: Iff450898618ce650ea1f4caa6c3d318e71485ffd Gerrit-Change-Number: 31160 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-upf[master]: error log: fix msg for gtp_del_tunnel() failure
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/31161 ) Change subject: error log: fix msg for gtp_del_tunnel() failure ...................................................................... error log: fix msg for gtp_del_tunnel() failure gtp_del_tunnel() doesn't return an errno constant, only -1. Related: CID#307535 Change-Id: I22533db1f9174e725fb00c44877eed90ac222ab5 --- M src/osmo-upf/upf_gtp.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/61/31161/1 diff --git a/src/osmo-upf/upf_gtp.c b/src/osmo-upf/upf_gtp.c index 2c37bc4..fea4453 100644 --- a/src/osmo-upf/upf_gtp.c +++ b/src/osmo-upf/upf_gtp.c @@ -468,7 +468,7 @@ rc = gtp_del_tunnel(g_upf->gtp.genl_id, g_upf->gtp.nl, t); if (rc) - LOG_GTP_TUN(tun, LOGL_ERROR, "Failed to delete tunnel: %d %s\n", rc, strerror(rc)); + LOG_GTP_TUN(tun, LOGL_ERROR, "Failed to delete tunnel\n"); else tun->active = false; -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31161 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I22533db1f9174e725fb00c44877eed90ac222ab5 Gerrit-Change-Number: 31161 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-upf[master]: fix deprecation: use telnet_init_default()
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/31159 ) Change subject: fix deprecation: use telnet_init_default() ...................................................................... fix deprecation: use telnet_init_default() Change-Id: Ib20ba77fcf65820e2992e252fb9d35e4219e3783 --- M src/osmo-pfcp-tool/osmo_pfcp_tool_main.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/59/31159/1 diff --git a/src/osmo-pfcp-tool/osmo_pfcp_tool_main.c b/src/osmo-pfcp-tool/osmo_pfcp_tool_main.c index 9a760d4..8705e0f 100644 --- a/src/osmo-pfcp-tool/osmo_pfcp_tool_main.c +++ b/src/osmo-pfcp-tool/osmo_pfcp_tool_main.c @@ -300,7 +300,7 @@ } /* start telnet, after reading config for vty_get_bind_addr() */ - rc = telnet_init_dynif(tall_pfcp_tool_ctx, &g_pfcp_tool, vty_get_bind_addr(), OSMO_VTY_PORT_PFCP_TOOL); + rc = telnet_init_default(tall_pfcp_tool_ctx, &g_pfcp_tool, OSMO_VTY_PORT_PFCP_TOOL); if (rc < 0) return 2; -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31159 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: Ib20ba77fcf65820e2992e252fb9d35e4219e3783 Gerrit-Change-Number: 31159 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libgtpnl[master]: fix memleak on del_tunnel() failure
by neels 03 Feb '23

03 Feb '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/31158 ) Change subject: fix memleak on del_tunnel() failure ...................................................................... fix memleak on del_tunnel() failure Related: CID#307542 Change-Id: Ie29840a7518435447acf48f12e81fc520308a265 --- M tools/gtp-tunnel.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/58/31158/1 diff --git a/tools/gtp-tunnel.c b/tools/gtp-tunnel.c index 1d8486c..1868097 100644 --- a/tools/gtp-tunnel.c +++ b/tools/gtp-tunnel.c @@ -130,6 +130,7 @@ gtp_ifidx = if_nametoindex(argv[2]); if (gtp_ifidx == 0) { fprintf(stderr, "wrong GTP interface %s\n", argv[2]); + gtp_tunnel_free(t); return EXIT_FAILURE; } gtp_tunnel_set_ifidx(t, gtp_ifidx); @@ -143,6 +144,7 @@ } else { fprintf(stderr, "wrong GTP version %s, use v0 or v1\n", argv[3]); + gtp_tunnel_free(t); return EXIT_FAILURE; } -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/31158 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: Ie29840a7518435447acf48f12e81fc520308a265 Gerrit-Change-Number: 31158 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmocom-bb[master]: layer23: Support configuring GSMTAP through VTY in l23 apps.
by pespin 02 Feb '23

02 Feb '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31108 ) Change subject: layer23: Support configuring GSMTAP through VTY in l23 apps. ...................................................................... layer23: Support configuring GSMTAP through VTY in l23 apps. This allow all l23 apps supporting L23_OPT_VTY and L23_OPT_TAP to dynamically configure gsmtap through a "gsmtap" VTY node: gsmtap remote-host 127.0.0.1 lchan sacch lchan lsacch lchan sacch/4 lchan sacch/8 lchan sacch/f lchan sacch/h lchan unknown lchan bcch lchan ccch lchan rach lchan agch lchan pch lchan sdcch lchan sdcch/4 lchan sdcch/8 lchan facch/f lchan facch/h lchan pacch lchan cbch lchan pdch lchan pttch lchan cbch lchan tch/f lchan tch/h category gprs dl-unknown category gprs dl-dummy category gprs dl-ctrl category gprs dl-data-gprs category gprs dl-data-egprs category gprs ul-unknown category gprs ul-dummy category gprs ul-ctrl category gprs ul-data-gprs category gprs ul-data-egprs VTY cmd "lchan" enables/disables tapping on general channel types, while "category" allows fine-grained selection of messages being tapped within the enabled lchan which would tap those messages. Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839 --- M src/host/layer23/include/osmocom/bb/common/l23_app.h M src/host/layer23/include/osmocom/bb/common/vty.h M src/host/layer23/src/common/l1ctl.c M src/host/layer23/src/common/main.c M src/host/layer23/src/common/sim.c M src/host/layer23/src/common/vty.c M src/host/layer23/src/mobile/main.c 7 files changed, 335 insertions(+), 20 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/layer23/include/osmocom/bb/common/l23_app.h b/src/host/layer23/include/osmocom/bb/common/l23_app.h index d442e7e..290a09b 100644 --- a/src/host/layer23/include/osmocom/bb/common/l23_app.h +++ b/src/host/layer23/include/osmocom/bb/common/l23_app.h @@ -2,6 +2,7 @@ #define _L23_APP_H #include <osmocom/core/tun.h> +#include <osmocom/core/gsmtap.h> struct option; struct vty_app_info; @@ -15,6 +16,33 @@ L23_OPT_DBG = 1 << 4, }; +/* see (struct l23_global_config)->gsmtap.categ_gprs_mask */ +enum l23_gsmtap_gprs_category { + L23_GSMTAP_GPRS_C_DL_UNKNOWN = 0, /* unknown or undecodable downlink blocks */ + L23_GSMTAP_GPRS_C_DL_DUMMY = 1, /* downlink dummy blocks */ + L23_GSMTAP_GPRS_C_DL_CTRL = 2, /* downlink control blocks */ + L23_GSMTAP_GPRS_C_DL_DATA_GPRS = 3, /* downlink GPRS data blocks */ + L23_GSMTAP_GPRS_C_DL_DATA_EGPRS = 4, /* downlink EGPRS data blocks */ + + L23_GSMTAP_GPRS_C_UL_UNKNOWN = 5, /* unknown or undecodable uplink blocks */ + L23_GSMTAP_GPRS_C_UL_DUMMY = 6, /* uplink dummy blocks */ + L23_GSMTAP_GPRS_C_UL_CTRL = 7, /* uplink control blocks */ + L23_GSMTAP_GPRS_C_UL_DATA_GPRS = 8, /* uplink GPRS data blocks */ + L23_GSMTAP_GPRS_C_UL_DATA_EGPRS = 9, /* uplink EGPRS data blocks */ +}; + +struct l23_global_config { + struct { + char *remote_host; + uint32_t lchan_mask; /* see l23_gsmtap_gprs_category */ + uint32_t lchan_acch_mask; /* see l23_gsmtap_gprs_category */ + bool lchan_acch; + uint32_t categ_gprs_mask; + struct gsmtap_inst *inst; + } gsmtap; +}; +extern struct l23_global_config l23_cfg; + extern void *l23_ctx; /* initialization, called once when starting the app, before reading VTY config */ diff --git a/src/host/layer23/include/osmocom/bb/common/vty.h b/src/host/layer23/include/osmocom/bb/common/vty.h index 259725e..4ff96fe 100644 --- a/src/host/layer23/include/osmocom/bb/common/vty.h +++ b/src/host/layer23/include/osmocom/bb/common/vty.h @@ -10,6 +10,7 @@ enum l23_vty_node { MS_NODE = _LAST_OSMOVTY_NODE + 1, + GSMTAP_NODE, _LAST_L23VTY_NODE, }; diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index 5ba1a1f..34051fd 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -39,14 +39,13 @@ #include <osmocom/gsm/rsl.h> #include <osmocom/bb/common/l1ctl.h> +#include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/common/l1l2_interface.h> #include <osmocom/gsm/lapdm.h> #include <osmocom/bb/common/logging.h> -extern struct gsmtap_inst *gsmtap_inst; - #define CB_FCCH -1 #define CB_SCH -2 #define CB_BCCH -3 @@ -317,7 +316,7 @@ * to clog up your logs */ if (!is_fill_frame(gsmtap_chan_type, ccch->data)) { /* send CCCH data via GSMTAP */ - gsmtap_send(gsmtap_inst, ntohs(dl->band_arfcn), chan_ts, + gsmtap_send(l23_cfg.gsmtap.inst, ntohs(dl->band_arfcn), chan_ts, gsmtap_chan_type, chan_ss, tm.fn, dl->rx_level-110, dl->snr, ccch->data, sizeof(ccch->data)); } @@ -394,7 +393,7 @@ /* send copy via GSMTAP */ if (rsl_dec_chan_nr(chan_nr, &chan_type, &chan_ss, &chan_ts) == 0) { uint8_t gsmtap_chan_type = chantype_rsl2gsmtap2(chan_type, link_id, false); - gsmtap_send(gsmtap_inst, ms->rrlayer.cd_now.arfcn | GSMTAP_ARFCN_F_UPLINK, + gsmtap_send(l23_cfg.gsmtap.inst, ms->rrlayer.cd_now.arfcn | GSMTAP_ARFCN_F_UPLINK, chan_ts, gsmtap_chan_type, chan_ss, 0, 127, 0, msg->l2h, msgb_l2len(msg)); } else { diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c index c456488..e82457f 100644 --- a/src/host/layer23/src/common/main.c +++ b/src/host/layer23/src/common/main.c @@ -33,7 +33,6 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/application.h> #include <osmocom/core/gsmtap_util.h> -#include <osmocom/core/gsmtap.h> #include <osmocom/core/utils.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/logging.h> @@ -53,6 +52,7 @@ #include "config.h" void *l23_ctx = NULL; +struct l23_global_config l23_cfg; static char *sap_socket_path = "/tmp/osmocom_sap"; struct llist_head ms_list; @@ -63,7 +63,6 @@ int (*l23_app_work)(void) = NULL; int (*l23_app_exit)(void) = NULL; int quit = 0; -struct gsmtap_inst *gsmtap_inst; static void print_usage(const char *app) { @@ -285,13 +284,29 @@ exit(1); } - if (gsmtap_ip) { - gsmtap_inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); - if (!gsmtap_inst) { - fprintf(stderr, "Failed during gsmtap_init()\n"); - exit(1); + if (app_supp_opt & L23_OPT_TAP) { + if (gsmtap_ip) { + if (l23_cfg.gsmtap.remote_host != NULL) { + LOGP(DLGLOBAL, LOGL_NOTICE, + "Command line argument '-i %s' overrides node " + "'gsmtap' cmd 'remote-host %s' from the config file\n", + gsmtap_ip, l23_cfg.gsmtap.remote_host); + talloc_free(l23_cfg.gsmtap.remote_host); + } + l23_cfg.gsmtap.remote_host = talloc_strdup(l23_ctx, gsmtap_ip); } - gsmtap_source_add_sink(gsmtap_inst); + + if (l23_cfg.gsmtap.remote_host) { + LOGP(DLGLOBAL, LOGL_NOTICE, + "Setting up GSMTAP Um forwarding to '%s:%u'\n", + l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT); + l23_cfg.gsmtap.inst = gsmtap_source_init(l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT, 1); + if (!l23_cfg.gsmtap.inst) { + fprintf(stderr, "Failed during gsmtap_init()\n"); + exit(1); + } + gsmtap_source_add_sink(l23_cfg.gsmtap.inst); + } } if (l23_app_start) { diff --git a/src/host/layer23/src/common/sim.c b/src/host/layer23/src/common/sim.c index bd50f62..4a4144a 100644 --- a/src/host/layer23/src/common/sim.c +++ b/src/host/layer23/src/common/sim.c @@ -24,12 +24,11 @@ #include <osmocom/core/gsmtap.h> #include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/common/l1ctl.h> -extern struct gsmtap_inst *gsmtap_inst; - static int sim_process_job(struct osmocom_ms *ms); /* @@ -874,7 +873,7 @@ if ((ms->sim.apdu_len + length) <= sizeof(ms->sim.apdu_data)) { memcpy(ms->sim.apdu_data + ms->sim.apdu_len, data, length); ms->sim.apdu_len += length; - gsmtap_send_ex(gsmtap_inst, GSMTAP_TYPE_SIM, + gsmtap_send_ex(l23_cfg.gsmtap.inst, GSMTAP_TYPE_SIM, 0, 0, 0, 0, 0, 0, 0, ms->sim.apdu_data, ms->sim.apdu_len); } } diff --git a/src/host/layer23/src/common/vty.c b/src/host/layer23/src/common/vty.c index 2e7dea8..48d07b3 100644 --- a/src/host/layer23/src/common/vty.c +++ b/src/host/layer23/src/common/vty.c @@ -26,9 +26,12 @@ #include <osmocom/gsm/gsm48.h> #include <osmocom/core/talloc.h> #include <osmocom/core/signal.h> +#include <osmocom/core/gsmtap.h> +#include <osmocom/core/gsmtap_util.h> #include <osmocom/crypt/auth.h> #include <osmocom/bb/common/vty.h> +#include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/common/networks.h> @@ -38,7 +41,6 @@ #include <osmocom/bb/mobile/mncc_ms.h> #include <osmocom/bb/mobile/transaction.h> #include <osmocom/bb/mobile/vty.h> -#include <osmocom/bb/mobile/app_mobile.h> #include <osmocom/bb/mobile/gsm480_ss.h> #include <osmocom/bb/mobile/gsm411_sms.h> #include <osmocom/vty/telnet_interface.h> @@ -52,6 +54,12 @@ 1 }; +static struct cmd_node gsmtap_node = { + GSMTAP_NODE, + "%s(gsmtap)# ", + 1 +}; + static void l23_vty_restart_required_warn(struct vty *vty, struct osmocom_ms *ms) { if (l23_vty_reading) @@ -120,6 +128,171 @@ VTY_NEWLINE); } +/* "gsmtap" config */ +gDEFUN(l23_cfg_gsmtap, l23_cfg_gsmtap_cmd, "gsmtap", + "Configure GSMTAP\n") +{ + vty->node = GSMTAP_NODE; + return CMD_SUCCESS; +} + +static const struct value_string gsmtap_categ_gprs_names[] = { + { L23_GSMTAP_GPRS_C_DL_UNKNOWN, "dl-unknown" }, + { L23_GSMTAP_GPRS_C_DL_DUMMY, "dl-dummy" }, + { L23_GSMTAP_GPRS_C_DL_CTRL, "dl-ctrl" }, + { L23_GSMTAP_GPRS_C_DL_DATA_GPRS, "dl-data-gprs" }, + { L23_GSMTAP_GPRS_C_DL_DATA_EGPRS, "dl-data-egprs" }, + { L23_GSMTAP_GPRS_C_UL_UNKNOWN, "ul-unknown" }, + { L23_GSMTAP_GPRS_C_UL_DUMMY, "ul-dummy" }, + { L23_GSMTAP_GPRS_C_UL_CTRL, "ul-ctrl" }, + { L23_GSMTAP_GPRS_C_UL_DATA_GPRS, "ul-data-gprs" }, + { L23_GSMTAP_GPRS_C_UL_DATA_EGPRS, "ul-data-egprs" }, + { 0, NULL } +}; + +static const struct value_string gsmtap_categ_gprs_help[] = { + { L23_GSMTAP_GPRS_C_DL_UNKNOWN, "Unknown / Unparseable / Erroneous Downlink Blocks" }, + { L23_GSMTAP_GPRS_C_DL_DUMMY, "Downlink Dummy Blocks" }, + { L23_GSMTAP_GPRS_C_DL_CTRL, "Downlink Control Blocks" }, + { L23_GSMTAP_GPRS_C_DL_DATA_GPRS, "Downlink Data Blocks (GPRS)" }, + { L23_GSMTAP_GPRS_C_DL_DATA_EGPRS, "Downlink Data Blocks (EGPRS)" }, + { L23_GSMTAP_GPRS_C_UL_UNKNOWN, "Unknown / Unparseable / Erroneous Downlink Blocks" }, + { L23_GSMTAP_GPRS_C_UL_DUMMY, "Uplink Dummy Blocks" }, + { L23_GSMTAP_GPRS_C_UL_CTRL, "Uplink Control Blocks" }, + { L23_GSMTAP_GPRS_C_UL_DATA_GPRS, "Uplink Data Blocks (GPRS)" }, + { L23_GSMTAP_GPRS_C_UL_DATA_EGPRS, "Uplink Data Blocks (EGPRS)" }, + { 0, NULL } +}; + +DEFUN(cfg_gsmtap_gsmtap_remote_host, + cfg_gsmtap_gsmtap_remote_host_cmd, + "remote-host [HOSTNAME]", + "Enable GSMTAP Um logging\n" + "Remote IP address or hostname ('localhost' if omitted)\n") +{ + osmo_talloc_replace_string(l23_ctx, &l23_cfg.gsmtap.remote_host, + argc > 0 ? argv[0] : "localhost"); + + if (vty->type != VTY_FILE) + vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE); + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_no_gsmtap_remote_host, + cfg_gsmtap_no_gsmtap_remote_host_cmd, + "no remote-host", + NO_STR "Disable GSMTAP Um logging\n") +{ + TALLOC_FREE(l23_cfg.gsmtap.remote_host); + if (vty->type != VTY_FILE) + vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE); + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_gsmtap_lchan_all, cfg_gsmtap_gsmtap_lchan_all_cmd, + "lchan (enable-all|disable-all)", + "Enable/disable sending of UL/DL messages over GSMTAP\n" + "Enable all kinds of messages (all LCHAN)\n" + "Disable all kinds of messages (all LCHAN)\n") +{ + if (argv[0][0] == 'e') { + l23_cfg.gsmtap.lchan_mask = UINT32_MAX; + l23_cfg.gsmtap.lchan_acch_mask = UINT32_MAX; + l23_cfg.gsmtap.lchan_acch = true; + } else { + l23_cfg.gsmtap.lchan_mask = 0x00; + l23_cfg.gsmtap.lchan_acch_mask = 0x00; + l23_cfg.gsmtap.lchan_acch = false; + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_gsmtap_lchan, cfg_gsmtap_gsmtap_lchan_cmd, + "HIDDEN", "HIDDEN") +{ + unsigned int channel; + + if (osmo_str_startswith(argv[0], "sacch")) { + if (strcmp(argv[0], "sacch") == 0) { + l23_cfg.gsmtap.lchan_acch = true; + } else { + channel = get_string_value(gsmtap_gsm_channel_names, argv[0]); + channel &= ~GSMTAP_CHANNEL_ACCH; + l23_cfg.gsmtap.lchan_acch_mask |= (1 << channel); + } + } else { + channel = get_string_value(gsmtap_gsm_channel_names, argv[0]); + l23_cfg.gsmtap.lchan_mask |= (1 << channel); + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_no_gsmtap_lchan, cfg_gsmtap_no_gsmtap_lchan_cmd, + "HIDDEN", "HIDDEN") +{ + unsigned int channel; + + if (osmo_str_startswith(argv[0], "sacch")) { + if (strcmp(argv[0], "sacch") == 0) { + l23_cfg.gsmtap.lchan_acch = false; + } else { + channel = get_string_value(gsmtap_gsm_channel_names, argv[0]); + channel &= ~GSMTAP_CHANNEL_ACCH; + l23_cfg.gsmtap.lchan_acch_mask &= ~(1 << channel); + } + } else { + channel = get_string_value(gsmtap_gsm_channel_names, argv[0]); + l23_cfg.gsmtap.lchan_mask &= ~(1 << channel); + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_gsmtap_categ_gprs_all, cfg_gsmtap_gsmtap_categ_gprs_all_cmd, + "category gprs (enable-all|disable-all)", + "Enable/disable sending of UL/DL messages over GSMTAP\n" + "Enable all kinds of messages (all categories)\n" + "Disable all kinds of messages (all categories)\n") +{ + + if (strcmp(argv[0], "enable-all") == 0) + l23_cfg.gsmtap.categ_gprs_mask = UINT32_MAX; + else + l23_cfg.gsmtap.categ_gprs_mask = 0x00; + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_gsmtap_categ_gprs, cfg_gsmtap_gsmtap_categ_gprs_cmd, "HIDDEN", "HIDDEN") +{ + int categ; + + categ = get_string_value(gsmtap_categ_gprs_names, argv[0]); + if (categ < 0) + return CMD_WARNING; + + l23_cfg.gsmtap.categ_gprs_mask |= (1 << categ); + + return CMD_SUCCESS; +} + +DEFUN(cfg_gsmtap_no_gsmtap_categ_gprs, cfg_gsmtap_no_gsmtap_categ_gprs_cmd, "HIDDEN", "HIDDEN") +{ + int categ; + + categ = get_string_value(gsmtap_categ_gprs_names, argv[0]); + if (categ < 0) + return CMD_WARNING; + + l23_cfg.gsmtap.categ_gprs_mask &= ~(1 << categ); + + return CMD_SUCCESS; +} + gDEFUN(l23_show_ms, l23_show_ms_cmd, "show ms [MS_NAME]", SHOW_STR "Display available MS entities\n") @@ -228,6 +401,53 @@ return data.ms_stop.rc; } +static int l23_vty_config_write_gsmtap_node(struct vty *vty) +{ + const char *chan_buf; + unsigned int i; + + vty_out(vty, "gsmtap%s", VTY_NEWLINE); + + if (l23_cfg.gsmtap.remote_host) + vty_out(vty, " remote-host %s%s", l23_cfg.gsmtap.remote_host, VTY_NEWLINE); + else + vty_out(vty, " no remote-host%s", VTY_NEWLINE); + + if (l23_cfg.gsmtap.lchan_acch) + vty_out(vty, " lchan sacch%s", VTY_NEWLINE); + + for (i = 0; i < sizeof(uint32_t) * 8; i++) { + if (l23_cfg.gsmtap.lchan_acch_mask & ((uint32_t) 1 << i)) { + chan_buf = get_value_string_or_null(gsmtap_gsm_channel_names, GSMTAP_CHANNEL_ACCH | i); + if (chan_buf == NULL) + continue; + chan_buf = osmo_str_tolower(chan_buf); + vty_out(vty, " lchan %s%s", chan_buf, VTY_NEWLINE); + } + } + + for (i = 0; i < sizeof(uint32_t) * 8; i++) { + if (l23_cfg.gsmtap.lchan_mask & ((uint32_t) 1 << i)) { + chan_buf = get_value_string_or_null(gsmtap_gsm_channel_names, i); + if (chan_buf == NULL) + continue; + chan_buf = osmo_str_tolower(chan_buf); + vty_out(vty, " lchan %s%s", chan_buf, VTY_NEWLINE); + } + } + + for (i = 0; i < 32; i++) { + if (l23_cfg.gsmtap.categ_gprs_mask & ((uint32_t)1 << i)) { + const char *category_buf; + if (!(category_buf = get_value_string_or_null(gsmtap_categ_gprs_names, i))) + continue; + vty_out(vty, " category gprs %s%s", category_buf, VTY_NEWLINE); + } + } + + return CMD_SUCCESS; +} + void l23_vty_config_write_ms_node(struct vty *vty, const struct osmocom_ms *ms, const char *prefix) { size_t prefix_len = strlen(prefix); @@ -260,9 +480,62 @@ vty_out(vty, "!%s", VTY_NEWLINE); } +static void l23_vty_init_gsmtap(void) +{ + cfg_gsmtap_gsmtap_lchan_cmd.string = vty_cmd_string_from_valstr(l23_ctx, gsmtap_gsm_channel_names, + "lchan (sacch|", + "|", ")", VTY_DO_LOWER); + cfg_gsmtap_gsmtap_lchan_cmd.doc = vty_cmd_string_from_valstr(l23_ctx, gsmtap_gsm_channel_names, + "Enable sending of UL/DL messages over GSMTAP\n" "SACCH\n", + "\n", "", 0); + + cfg_gsmtap_no_gsmtap_lchan_cmd.string = vty_cmd_string_from_valstr(l23_ctx, gsmtap_gsm_channel_names, + "no lchan (sacch|", + "|", ")", VTY_DO_LOWER); + cfg_gsmtap_no_gsmtap_lchan_cmd.doc = vty_cmd_string_from_valstr(l23_ctx, gsmtap_gsm_channel_names, + NO_STR "Disable sending of UL/DL messages over GSMTAP\n" "SACCH\n", + "\n", "", 0); + + + cfg_gsmtap_gsmtap_categ_gprs_cmd.string = vty_cmd_string_from_valstr(l23_ctx, gsmtap_categ_gprs_names, + "category gprs (", + "|", ")", VTY_DO_LOWER); + cfg_gsmtap_gsmtap_categ_gprs_cmd.doc = vty_cmd_string_from_valstr(l23_ctx, gsmtap_categ_gprs_help, + "GSMTAP Category\n" "GPRS\n", + "\n", "", 0); + cfg_gsmtap_no_gsmtap_categ_gprs_cmd.string = vty_cmd_string_from_valstr(l23_ctx, gsmtap_categ_gprs_names, + "no category gprs (", + "|", ")", VTY_DO_LOWER); + cfg_gsmtap_no_gsmtap_categ_gprs_cmd.doc = vty_cmd_string_from_valstr(l23_ctx, gsmtap_categ_gprs_help, + NO_STR "GSMTAP Category\n" "GPRS\n", + "\n", "", 0); + + install_element(CONFIG_NODE, &l23_cfg_gsmtap_cmd); + + install_node(&gsmtap_node, l23_vty_config_write_gsmtap_node); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_remote_host_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_remote_host_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_lchan_all_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_lchan_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_lchan_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_categ_gprs_all_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_categ_gprs_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_categ_gprs_cmd); +} + int l23_vty_init(int (*config_write_ms_node_cb)(struct vty *), osmo_signal_cbfn *l23_vty_signal_cb) { + struct l23_app_info *app; + unsigned int app_supp_opt = 0x00; int rc = 0; + + app = l23_app_info(); + if (app && app->cfg_supported != NULL) + app_supp_opt = app->cfg_supported(); + + if (app_supp_opt & L23_OPT_TAP) + l23_vty_init_gsmtap(); + install_node(&ms_node, config_write_ms_node_cb); install_element(MS_NODE, &cfg_ms_layer2_cmd); install_element(MS_NODE, &cfg_ms_shutdown_cmd); diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 8938e30..deb7948 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -51,10 +51,10 @@ #include "config.h" void *l23_ctx = NULL; +struct l23_global_config l23_cfg; struct llist_head ms_list; static char *gsmtap_ip = 0; static const char *custom_cfg_file = NULL; -struct gsmtap_inst *gsmtap_inst = NULL; static char *config_file = NULL; char *config_dir = NULL; int daemonize = 0; @@ -312,12 +312,12 @@ } if (gsmtap_ip) { - gsmtap_inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); - if (!gsmtap_inst) { + l23_cfg.gsmtap.inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); + if (!l23_cfg.gsmtap.inst) { fprintf(stderr, "Failed during gsmtap_init()\n"); exit(1); } - gsmtap_source_add_sink(gsmtap_inst); + gsmtap_source_add_sink(l23_cfg.gsmtap.inst); } if (l23_app_start) { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31108 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839 Gerrit-Change-Number: 31108 Gerrit-PatchSet: 8 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: layer23: Support configuring GSMTAP through VTY in l23 apps.
by pespin 02 Feb '23

02 Feb '23
Attention is currently required from: jolly. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31108 ) Change subject: layer23: Support configuring GSMTAP through VTY in l23 apps. ...................................................................... Patch Set 8: Code-Review+2 (1 comment) Patchset: PS8: Readding +1 from laforge after fixing small stuff raised by fixeria. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31108 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839 Gerrit-Change-Number: 31108 Gerrit-PatchSet: 8 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Comment-Date: Thu, 02 Feb 2023 17:28:38 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmocom-bb[master]: layer23: Support configuring GSMTAP through VTY in l23 apps.
by fixeria 02 Feb '23

02 Feb '23
Attention is currently required from: jolly, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31108 ) Change subject: layer23: Support configuring GSMTAP through VTY in l23 apps. ...................................................................... Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31108 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839 Gerrit-Change-Number: 31108 Gerrit-PatchSet: 8 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Feb 2023 17:19:39 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • ...
  • 261
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.