neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30229 )
Change subject: VTY: rename 'gtp' to 'tunend' ......................................................................
VTY: rename 'gtp' to 'tunend'
So far the config nodes were named after the implementation: "GTP kernel module" = "gtp" and "netfilter" = "nft"
We found that this is confusing, since both are related to handling GTP. Rename "gtp" to "tunend"; a subsequent patch will rename "nft" to "tunmap".
Keep a hidden "gtp" VTY cmd as backwards compat alias.
In log output, also print "tunend" instead of "endecaps" (up_gtp_action_to_str_buf()).
Related: SYS#6192 Change-Id: I49ac7b1f8b5b74f586edfed1dfb29f9af55a521b --- M contrib/osmo-pfcp-tool-scripts/osmo-upf-11.cfg M contrib/osmo-pfcp-tool-scripts/osmo-upf-12.cfg M doc/examples/osmo-upf/osmo-upf-create-dev.cfg M doc/examples/osmo-upf/osmo-upf-mockup.cfg M include/osmocom/upf/upf.h M src/osmo-upf/up_gtp_action.c M src/osmo-upf/upf.c M src/osmo-upf/upf_gtp.c M src/osmo-upf/upf_vty.c M tests/upf.vty 10 files changed, 65 insertions(+), 57 deletions(-)
Approvals: Jenkins Builder: Verified
diff --git a/contrib/osmo-pfcp-tool-scripts/osmo-upf-11.cfg b/contrib/osmo-pfcp-tool-scripts/osmo-upf-11.cfg index 0184d46..2e5baa3 100644 --- a/contrib/osmo-pfcp-tool-scripts/osmo-upf-11.cfg +++ b/contrib/osmo-pfcp-tool-scripts/osmo-upf-11.cfg @@ -21,7 +21,7 @@ timer pfcp x24 5000 pfcp local-addr 127.0.0.11 -gtp +tunend dev create apn11 127.0.0.11 nft table-name osmo-upf-11 diff --git a/contrib/osmo-pfcp-tool-scripts/osmo-upf-12.cfg b/contrib/osmo-pfcp-tool-scripts/osmo-upf-12.cfg index 1fa620d..fcfd5be 100644 --- a/contrib/osmo-pfcp-tool-scripts/osmo-upf-12.cfg +++ b/contrib/osmo-pfcp-tool-scripts/osmo-upf-12.cfg @@ -21,7 +21,7 @@ timer pfcp x24 5000 pfcp local-addr 127.0.0.12 -gtp +tunend dev create apn12 127.0.0.12 nft table-name osmo-upf-12 diff --git a/doc/examples/osmo-upf/osmo-upf-create-dev.cfg b/doc/examples/osmo-upf/osmo-upf-create-dev.cfg index e4e25f9..e69f49c 100644 --- a/doc/examples/osmo-upf/osmo-upf-create-dev.cfg +++ b/doc/examples/osmo-upf/osmo-upf-create-dev.cfg @@ -11,5 +11,5 @@ timer pfcp x24 5000 pfcp local-addr 127.0.0.1 -gtp +tunend dev create apn23 diff --git a/doc/examples/osmo-upf/osmo-upf-mockup.cfg b/doc/examples/osmo-upf/osmo-upf-mockup.cfg index f1aafa9..36682a0 100644 --- a/doc/examples/osmo-upf/osmo-upf-mockup.cfg +++ b/doc/examples/osmo-upf/osmo-upf-mockup.cfg @@ -11,7 +11,7 @@ timer pfcp x24 5000 pfcp local-addr 127.0.0.1 -gtp +tunend mockup nft mockup diff --git a/include/osmocom/upf/upf.h b/include/osmocom/upf/upf.h index 1f8355d..1597e2c 100644 --- a/include/osmocom/upf/upf.h +++ b/include/osmocom/upf/upf.h @@ -44,7 +44,7 @@ uint16_t local_port; };
-struct gtp_vty_cfg_dev { +struct tunend_vty_cfg_dev { struct llist_head entry;
/* If true, osmo-upf creates the GTP device on startup. If false, the GTP device was created by the user, and we @@ -60,8 +60,8 @@ char *local_addr; };
-struct gtp_vty_cfg { - /* list of struct gtp_vty_cfg_dev, GTP devices as in the config file. The actual GTP devices in use are in +struct tunend_vty_cfg { + /* list of struct tunend_vty_cfg_dev, GTP devices as in the config file. The actual GTP devices in use are in * g_upf->gtp.devs. */ struct llist_head devs; }; @@ -80,7 +80,7 @@ bool mockup;
/* GTP devices as in osmo-upf.cfg */ - struct gtp_vty_cfg vty_cfg; + struct tunend_vty_cfg vty_cfg;
/* GTP devices actually in use, list of struct upf_gtp_dev. */ struct llist_head devs; diff --git a/src/osmo-upf/up_gtp_action.c b/src/osmo-upf/up_gtp_action.c index 9b8d528..568df48 100644 --- a/src/osmo-upf/up_gtp_action.c +++ b/src/osmo-upf/up_gtp_action.c @@ -84,7 +84,7 @@ switch (a->kind) { case UP_GTP_U_ENDECAPS: if (g_upf->gtp.mockup) { - LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "gtp/mockup active, skipping GTP action %s\n", + LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "tunend/mockup active, skipping GTP action %s\n", enable ? "enable" : "disable"); return 0; } @@ -166,7 +166,7 @@ struct osmo_strbuf sb = { .buf = buf, .len = buflen }; switch (a->kind) { case UP_GTP_U_ENDECAPS: - OSMO_STRBUF_PRINTF(sb, "GTP:endecaps GTP-access:"); + OSMO_STRBUF_PRINTF(sb, "GTP:tunend GTP-access:"); OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, &a->endecaps.gtp_remote_addr); OSMO_STRBUF_PRINTF(sb, " TEID-r:0x%"PRIx32" TEID-l:0x%"PRIx32" IP-core:", a->endecaps.remote_teid, a->endecaps.local_teid); diff --git a/src/osmo-upf/upf.c b/src/osmo-upf/upf.c index db699c7..3b8bfeb 100644 --- a/src/osmo-upf/upf.c +++ b/src/osmo-upf/upf.c @@ -87,8 +87,8 @@
int upf_gtp_devs_open() { - struct gtp_vty_cfg *c = &g_upf->gtp.vty_cfg; - struct gtp_vty_cfg_dev *d; + struct tunend_vty_cfg *c = &g_upf->gtp.vty_cfg; + struct tunend_vty_cfg_dev *d;
llist_for_each_entry(d, &c->devs, entry) { if (upf_gtp_dev_open(d->dev_name, d->create, d->local_addr, false, false)) diff --git a/src/osmo-upf/upf_gtp.c b/src/osmo-upf/upf_gtp.c index d75e8d7..880e587 100644 --- a/src/osmo-upf/upf_gtp.c +++ b/src/osmo-upf/upf_gtp.c @@ -173,7 +173,7 @@ struct upf_gtp_dev *dev;
if (g_upf->gtp.mockup) { - LOGP(DGTP, LOGL_NOTICE, "gtp/mockup active: not opening GTP device '%s'\n", name); + LOGP(DGTP, LOGL_NOTICE, "tunend/mockup active: not opening GTP device '%s'\n", name); return 0; }
diff --git a/src/osmo-upf/upf_vty.c b/src/osmo-upf/upf_vty.c index cfc65ea..c43b382 100644 --- a/src/osmo-upf/upf_vty.c +++ b/src/osmo-upf/upf_vty.c @@ -40,7 +40,7 @@
enum upf_vty_node { PFCP_NODE = _LAST_OSMOVTY_NODE + 1, - GTP_NODE, + TUNEND_NODE, NFT_NODE, };
@@ -51,7 +51,7 @@ };
#define pfcp_vty (g_upf->pfcp.vty_cfg) -#define gtp_vty (g_upf->gtp.vty_cfg) +#define tunend_vty (g_upf->gtp.vty_cfg)
DEFUN(cfg_pfcp, cfg_pfcp_cmd, "pfcp", @@ -78,29 +78,32 @@ return CMD_SUCCESS; }
-static struct cmd_node cfg_gtp_node = { - GTP_NODE, - "%s(config-gtp)# ", +static struct cmd_node cfg_tunend_node = { + TUNEND_NODE, + "%s(config-tunend)# ", 1, };
-DEFUN(cfg_gtp, cfg_gtp_cmd, - "gtp", - "Enter the 'gtp' node to configure Linux GTP kernel module usage\n") +#define TUNEND_NODE_STR "Enter the 'tunend' node to configure Linux GTP kernel module usage\n" + +DEFUN(cfg_tunend, cfg_tunend_cmd, "tunend", TUNEND_NODE_STR) { - vty->node = GTP_NODE; + vty->node = TUNEND_NODE; return CMD_SUCCESS; }
-static int config_write_gtp(struct vty *vty) +/* legacy compat: "tunend" was originally named "gtp" */ +DEFUN_CMD_ELEMENT(cfg_tunend, cfg_gtp_cmd, "gtp", TUNEND_NODE_STR, CMD_ATTR_HIDDEN, 0); + +static int config_write_tunend(struct vty *vty) { - struct gtp_vty_cfg_dev *d; - vty_out(vty, "gtp%s", VTY_NEWLINE); + struct tunend_vty_cfg_dev *d; + vty_out(vty, "tunend%s", VTY_NEWLINE);
if (g_upf->gtp.mockup) vty_out(vty, " mockup%s", VTY_NEWLINE);
- llist_for_each_entry(d, >p_vty.devs, entry) { + llist_for_each_entry(d, &tunend_vty.devs, entry) { if (d->create) { vty_out(vty, " dev create %s", d->dev_name); if (d->local_addr) @@ -115,7 +118,7 @@
#define DEV_STR "Configure the GTP device to use for encaps/decaps.\n"
-DEFUN(cfg_gtp_mockup, cfg_gtp_mockup_cmd, +DEFUN(cfg_tunend_mockup, cfg_tunend_mockup_cmd, "mockup", "don't actually send commands to the GTP kernel module, just return success\n") { @@ -123,7 +126,7 @@ return CMD_SUCCESS; }
-DEFUN(cfg_gtp_no_mockup, cfg_gtp_no_mockup_cmd, +DEFUN(cfg_tunend_no_mockup, cfg_tunend_no_mockup_cmd, "no mockup", NO_STR "operate GTP kernel module normally\n") @@ -132,7 +135,7 @@ return CMD_SUCCESS; }
-DEFUN(cfg_gtp_dev_create, cfg_gtp_dev_create_cmd, +DEFUN(cfg_tunend_dev_create, cfg_tunend_dev_create_cmd, "dev create DEVNAME [LISTEN_ADDR]", DEV_STR "Add GTP device, creating a new Linux kernel GTP device. Will listen on GTPv1 port " @@ -142,42 +145,42 @@ "device name, e.g. 'apn0'\n" "IPv4 or IPv6 address to listen on, omit for ANY\n") { - struct gtp_vty_cfg_dev *d = talloc_zero(g_upf, struct gtp_vty_cfg_dev); + struct tunend_vty_cfg_dev *d = talloc_zero(g_upf, struct tunend_vty_cfg_dev); d->create = true; d->dev_name = talloc_strdup(d, argv[0]); if (argc > 1) d->local_addr = talloc_strdup(d, argv[1]); - llist_add(&d->entry, >p_vty.devs); + llist_add(&d->entry, &tunend_vty.devs); vty_out(vty, "Added GTP device %s (create new)%s", d->dev_name, VTY_NEWLINE); return CMD_SUCCESS; }
-DEFUN(cfg_gtp_dev_use, cfg_gtp_dev_use_cmd, +DEFUN(cfg_tunend_dev_use, cfg_tunend_dev_use_cmd, "dev use DEVNAME", DEV_STR "Add GTP device, using an existing Linux kernel GTP device, e.g. created by 'gtp-link'\n" "device name, e.g. 'apn0'\n") { - struct gtp_vty_cfg_dev *d = talloc_zero(g_upf, struct gtp_vty_cfg_dev); + struct tunend_vty_cfg_dev *d = talloc_zero(g_upf, struct tunend_vty_cfg_dev); d->create = false; d->dev_name = talloc_strdup(d, argv[0]); - llist_add(&d->entry, >p_vty.devs); + llist_add(&d->entry, &tunend_vty.devs); vty_out(vty, "Added GTP device %s (use existing)%s", d->dev_name, VTY_NEWLINE); return CMD_SUCCESS; }
-DEFUN(cfg_gtp_dev_del, cfg_gtp_dev_del_cmd, +DEFUN(cfg_tunend_dev_del, cfg_tunend_dev_del_cmd, "dev delete DEVNAME", DEV_STR "Remove a GTP device from the configuration, and delete the Linux kernel GTP device if it was created here.\n" "device name, e.g. 'apn0'\n") { const char *dev_name = argv[0]; - struct gtp_vty_cfg_dev *d; + struct tunend_vty_cfg_dev *d; struct upf_gtp_dev *dev;
/* remove from VTY cfg */ - llist_for_each_entry(d, >p_vty.devs, entry) { + llist_for_each_entry(d, &tunend_vty.devs, entry) { if (strcmp(d->dev_name, dev_name)) continue; llist_del(&d->entry); @@ -280,8 +283,8 @@ return CMD_SUCCESS; }
-DEFUN(show_gtp, show_gtp_cmd, - "show gtp", +DEFUN(show_tunend, show_tunend_cmd, + "show tunend", SHOW_STR "Active GTP tunnels and forwardings\n") { @@ -345,7 +348,7 @@ OSMO_ASSERT(g_upf != NULL);
install_element_ve(&show_pdr_cmd); - install_element_ve(&show_gtp_cmd); + install_element_ve(&show_tunend_cmd); install_element_ve(&show_session_cmd);
install_node(&cfg_pfcp_node, config_write_pfcp); @@ -353,14 +356,15 @@
install_element(PFCP_NODE, &cfg_pfcp_local_addr_cmd);
- install_node(&cfg_gtp_node, config_write_gtp); + install_node(&cfg_tunend_node, config_write_tunend); + install_element(CONFIG_NODE, &cfg_tunend_cmd); install_element(CONFIG_NODE, &cfg_gtp_cmd);
- install_element(GTP_NODE, &cfg_gtp_mockup_cmd); - install_element(GTP_NODE, &cfg_gtp_no_mockup_cmd); - install_element(GTP_NODE, &cfg_gtp_dev_create_cmd); - install_element(GTP_NODE, &cfg_gtp_dev_use_cmd); - install_element(GTP_NODE, &cfg_gtp_dev_del_cmd); + install_element(TUNEND_NODE, &cfg_tunend_mockup_cmd); + install_element(TUNEND_NODE, &cfg_tunend_no_mockup_cmd); + install_element(TUNEND_NODE, &cfg_tunend_dev_create_cmd); + install_element(TUNEND_NODE, &cfg_tunend_dev_use_cmd); + install_element(TUNEND_NODE, &cfg_tunend_dev_del_cmd);
install_node(&cfg_nft_node, config_write_nft); install_element(CONFIG_NODE, &cfg_nft_cmd); diff --git a/tests/upf.vty b/tests/upf.vty index 6d40841..427209c 100644 --- a/tests/upf.vty +++ b/tests/upf.vty @@ -13,8 +13,9 @@ IP_ADDR IP address OsmoUPF(config-pfcp)# exit
+OsmoUPF(config)# # ensure its old name "gtp" enters the tunend node OsmoUPF(config)# gtp -OsmoUPF(config-gtp)# list +OsmoUPF(config-tunend)# list ... mockup no mockup @@ -22,24 +23,27 @@ dev use DEVNAME dev delete DEVNAME
-OsmoUPF(config-gtp)# mockup? - mockup don't actually send commands to the GTP kernel module, just return success -OsmoUPF(config-gtp)# no ? - mockup operate GTP kernel module normally +OsmoUPF(config-tunend)# exit +OsmoUPF(config)# tunend +OsmoUPF(config-tunend)# list +... + dev create DEVNAME [LISTEN_ADDR] + dev use DEVNAME + dev delete DEVNAME
-OsmoUPF(config-gtp)# dev? +OsmoUPF(config-tunend)# dev? dev Configure the GTP device to use for encaps/decaps. -OsmoUPF(config-gtp)# dev ? +OsmoUPF(config-tunend)# dev ? create Add GTP device, creating a new Linux kernel GTP device. Will listen on GTPv1 port 2152 and GTPv0 port 3386 on the specified interface, or on ANY if LISTEN_ADDR is omitted. use Add GTP device, using an existing Linux kernel GTP device, e.g. created by 'gtp-link' delete Remove a GTP device from the configuration, and delete the Linux kernel GTP device if it was created here. -OsmoUPF(config-gtp)# dev create ? +OsmoUPF(config-tunend)# dev create ? DEVNAME device name, e.g. 'apn0' -OsmoUPF(config-gtp)# dev create foo ? +OsmoUPF(config-tunend)# dev create foo ? [LISTEN_ADDR] IPv4 or IPv6 address to listen on, omit for ANY -OsmoUPF(config-gtp)# dev delete ? +OsmoUPF(config-tunend)# dev delete ? DEVNAME device name, e.g. 'apn0' -OsmoUPF(config-gtp)# exit +OsmoUPF(config-tunend)# exit
OsmoUPF(config)# nft OsmoUPF(config-nft)# list
null-- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30229 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I49ac7b1f8b5b74f586edfed1dfb29f9af55a521b Gerrit-Change-Number: 30229 Gerrit-PatchSet: 2 Gerrit-Owner: neels nhofmeyr@sysmocom.de Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge laforge@osmocom.org Gerrit-Reviewer: pespin pespin@sysmocom.de Gerrit-MessageType: merged