VTY: rename 'nft' to 'tunmap'
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 "nft" to "tunmap"; a previous patch already renamed "gtp" to "tunend". Keep a hidden "nft" VTY cmd as backwards compat alias. Related: SYS#6192 Change-Id: Ia3c5224dd3b5f5c9437bbdec997d02176818cc97
This commit is contained in:
parent
95eb2c6a89
commit
701bb8addc
|
@ -23,5 +23,5 @@ pfcp
|
|||
local-addr 127.0.0.11
|
||||
tunend
|
||||
dev create apn11 127.0.0.11
|
||||
nft
|
||||
tunmap
|
||||
table-name osmo-upf-11
|
||||
|
|
|
@ -23,5 +23,5 @@ pfcp
|
|||
local-addr 127.0.0.12
|
||||
tunend
|
||||
dev create apn12 127.0.0.12
|
||||
nft
|
||||
tunmap
|
||||
table-name osmo-upf-12
|
||||
|
|
|
@ -13,5 +13,5 @@ pfcp
|
|||
local-addr 127.0.0.1
|
||||
tunend
|
||||
mockup
|
||||
nft
|
||||
tunmap
|
||||
mockup
|
||||
|
|
|
@ -112,7 +112,7 @@ static int up_gtp_action_enable_disable(struct up_gtp_action *a, bool enable)
|
|||
|
||||
case UP_GTP_U_TUNMAP:
|
||||
if (g_upf->nft.mockup) {
|
||||
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "nft/mockup active, skipping nftables ruleset %s\n",
|
||||
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "tunmap/mockup active, skipping nftables ruleset %s\n",
|
||||
enable ? "enable" : "disable");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ static int upf_nft_run(const char *ruleset)
|
|||
int rc;
|
||||
|
||||
if (g_upf->nft.mockup) {
|
||||
LOGP(DNFT, LOGL_NOTICE, "nft/mockup active: not running nft ruleset: '%s'\n", ruleset);
|
||||
LOGP(DNFT, LOGL_NOTICE, "tunmap/mockup active: not running nft ruleset: '%s'\n", ruleset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ int upf_nft_init()
|
|||
int rc;
|
||||
if (g_upf->nft.mockup) {
|
||||
LOGP(DNFT, LOGL_NOTICE,
|
||||
"nft/mockup active: not allocating libnftables nft_ctx. FOR TESTING PURPOSES ONLY.\n");
|
||||
"tunmap/mockup active: not allocating libnftables nft_ctx. FOR TESTING PURPOSES ONLY.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
enum upf_vty_node {
|
||||
PFCP_NODE = _LAST_OSMOVTY_NODE + 1,
|
||||
TUNEND_NODE,
|
||||
NFT_NODE,
|
||||
TUNMAP_NODE,
|
||||
};
|
||||
|
||||
static struct cmd_node cfg_pfcp_node = {
|
||||
|
@ -194,23 +194,26 @@ DEFUN(cfg_tunend_dev_del, cfg_tunend_dev_del_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static struct cmd_node cfg_nft_node = {
|
||||
NFT_NODE,
|
||||
"%s(config-nft)# ",
|
||||
static struct cmd_node cfg_tunmap_node = {
|
||||
TUNMAP_NODE,
|
||||
"%s(config-tunmap)# ",
|
||||
1,
|
||||
};
|
||||
|
||||
DEFUN(cfg_nft, cfg_nft_cmd,
|
||||
"nft",
|
||||
"Enter the 'nft' node to configure nftables usage\n")
|
||||
#define TUNMAP_NODE_STR "Enter the 'tunmap' node to configure nftables usage\n"
|
||||
|
||||
DEFUN(cfg_tunmap, cfg_tunmap_cmd, "tunmap", TUNMAP_NODE_STR)
|
||||
{
|
||||
vty->node = NFT_NODE;
|
||||
vty->node = TUNMAP_NODE;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int config_write_nft(struct vty *vty)
|
||||
/* legacy compat: "tunmap" was originally named "nft" */
|
||||
DEFUN_CMD_ELEMENT(cfg_tunmap, cfg_nft_cmd, "nft", TUNMAP_NODE_STR, CMD_ATTR_HIDDEN, 0);
|
||||
|
||||
static int config_write_tunmap(struct vty *vty)
|
||||
{
|
||||
vty_out(vty, "nft%s", VTY_NEWLINE);
|
||||
vty_out(vty, "tunmap%s", VTY_NEWLINE);
|
||||
|
||||
if (g_upf->nft.mockup)
|
||||
vty_out(vty, " mockup%s", VTY_NEWLINE);
|
||||
|
@ -220,7 +223,7 @@ static int config_write_nft(struct vty *vty)
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_nft_mockup, cfg_nft_mockup_cmd,
|
||||
DEFUN(cfg_tunmap_mockup, cfg_tunmap_mockup_cmd,
|
||||
"mockup",
|
||||
"don't actually send rulesets to nftables, just return success\n")
|
||||
{
|
||||
|
@ -228,7 +231,7 @@ DEFUN(cfg_nft_mockup, cfg_nft_mockup_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_nft_no_mockup, cfg_nft_no_mockup_cmd,
|
||||
DEFUN(cfg_tunmap_no_mockup, cfg_tunmap_no_mockup_cmd,
|
||||
"no mockup",
|
||||
NO_STR
|
||||
"operate nftables rulesets normally\n")
|
||||
|
@ -237,7 +240,7 @@ DEFUN(cfg_nft_no_mockup, cfg_nft_no_mockup_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_nft_table_name, cfg_nft_table_name_cmd,
|
||||
DEFUN(cfg_tunmap_table_name, cfg_tunmap_table_name_cmd,
|
||||
"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"
|
||||
|
@ -366,10 +369,11 @@ void upf_vty_init()
|
|||
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_node(&cfg_tunmap_node, config_write_tunmap);
|
||||
install_element(CONFIG_NODE, &cfg_tunmap_cmd);
|
||||
install_element(CONFIG_NODE, &cfg_nft_cmd);
|
||||
|
||||
install_element(NFT_NODE, &cfg_nft_mockup_cmd);
|
||||
install_element(NFT_NODE, &cfg_nft_no_mockup_cmd);
|
||||
install_element(NFT_NODE, &cfg_nft_table_name_cmd);
|
||||
install_element(TUNMAP_NODE, &cfg_tunmap_mockup_cmd);
|
||||
install_element(TUNMAP_NODE, &cfg_tunmap_no_mockup_cmd);
|
||||
install_element(TUNMAP_NODE, &cfg_tunmap_table_name_cmd);
|
||||
}
|
||||
|
|
|
@ -45,19 +45,28 @@ OsmoUPF(config-tunend)# dev delete ?
|
|||
DEVNAME device name, e.g. 'apn0'
|
||||
OsmoUPF(config-tunend)# exit
|
||||
|
||||
OsmoUPF(config)# # ensure its old name "nft" enters the tunmap node
|
||||
OsmoUPF(config)# nft
|
||||
OsmoUPF(config-nft)# list
|
||||
OsmoUPF(config-tunmap)# list
|
||||
...
|
||||
mockup
|
||||
no mockup
|
||||
table-name TABLE_NAME
|
||||
OsmoUPF(config-tunmap)# exit
|
||||
|
||||
OsmoUPF(config)# tunmap
|
||||
OsmoUPF(config-tunmap)# list
|
||||
...
|
||||
mockup
|
||||
no mockup
|
||||
table-name TABLE_NAME
|
||||
|
||||
OsmoUPF(config-nft)# mockup?
|
||||
OsmoUPF(config-tunmap)# mockup?
|
||||
mockup don't actually send rulesets to nftables, just return success
|
||||
OsmoUPF(config-nft)# no ?
|
||||
OsmoUPF(config-tunmap)# no ?
|
||||
mockup operate nftables rulesets normally
|
||||
|
||||
OsmoUPF(config-nft)# table-name?
|
||||
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".
|
||||
OsmoUPF(config-nft)# table-name ?
|
||||
OsmoUPF(config-tunmap)# table-name ?
|
||||
TABLE_NAME nft inet table name
|
||||
|
|
Loading…
Reference in New Issue