This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/2809 VTY: Add hlr node and bind ip field With this patch the address osmo-hlr binds to can be changed to something else than 0.0.0.0 Change-Id: I79f7a300480f308b21116dd14d1698be38725afd --- M doc/examples/osmo-hlr.cfg M src/hlr.c M src/hlr.h M src/hlr_vty.c M src/hlr_vty.h 5 files changed, 65 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/09/2809/1 diff --git a/doc/examples/osmo-hlr.cfg b/doc/examples/osmo-hlr.cfg index 2b49958..3c9a906 100644 --- a/doc/examples/osmo-hlr.cfg +++ b/doc/examples/osmo-hlr.cfg @@ -14,3 +14,5 @@ bind 127.0.0.1 ctrl bind 127.0.0.1 +hlr + bind ip 127.0.0.1 diff --git a/src/hlr.c b/src/hlr.c index b5777e2..70e4fca 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -435,7 +435,7 @@ vty_init(&vty_info); ctrl_vty_init(hlr_ctx); handle_options(argc, argv); - hlr_vty_init(&hlr_log_info); + hlr_vty_init(g_hlr, &hlr_log_info, hlr_ctx); rc = vty_read_config_file(cmdline_opts.config_file, NULL); if (rc < 0) { @@ -465,8 +465,8 @@ exit(1); } - g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb, - &g_lu_ops); + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, g_hlr->bind_addr, 2222, + read_cb, &g_lu_ops); if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); diff --git a/src/hlr.h b/src/hlr.h index 1e8eff8..afafbf4 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -34,4 +34,7 @@ /* Control Interface */ struct ctrl_handle *ctrl; const char *ctrl_bind_addr; + + /* Local bind addr */ + char *bind_addr; }; diff --git a/src/hlr_vty.c b/src/hlr_vty.c index e4eef8f..67be783 100644 --- a/src/hlr_vty.c +++ b/src/hlr_vty.c @@ -20,11 +20,52 @@ * */ +#include <osmocom/core/talloc.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> #include <osmocom/vty/logging.h> #include "hlr_vty.h" + +static struct hlr *g_hlr = NULL; +static void *tall_hlr_ctx = NULL; + +struct cmd_node hlr_node = { + HLR_NODE, + "%s(config-hlr)# ", + 1, +}; + +static int config_write_hlr(struct vty *vty) +{ + vty_out(vty, "hlr%s", VTY_NEWLINE); + if (g_hlr->bind_addr) + vty_out(vty, " bind ip %s%s", g_hlr->bind_addr, VTY_NEWLINE); + return CMD_SUCCESS; +} + +DEFUN(cfg_hlr, + cfg_hlr_cmd, + "hlr", + "Configure the HLR") +{ + vty->node = HLR_NODE; + return CMD_SUCCESS; +} + +DEFUN(cfg_hlr_bind_ip, + cfg_hlr_bind_ip_cmd, + "bind ip A.B.C.D", + "Listen/Bind related socket option\n" + IP_STR + "IPv4 Address to bind to\n") +{ + if(g_hlr->bind_addr) + talloc_free(g_hlr->bind_addr); + g_hlr->bind_addr = talloc_strdup(tall_hlr_ctx, argv[0]); + + return CMD_SUCCESS; +} int hlr_vty_is_config_node(struct vty *vty, int node) { @@ -38,7 +79,15 @@ } } -void hlr_vty_init(const struct log_info *cat) +void hlr_vty_init(struct hlr *hlr, const struct log_info *cat, void *tall_ctx) { + g_hlr = hlr; + tall_hlr_ctx = tall_ctx; + logging_vty_add_cmds(cat); + + install_element(CONFIG_NODE, &cfg_hlr_cmd); + install_node(&hlr_node, config_write_hlr); + install_element(HLR_NODE, &cfg_hlr_bind_ip_cmd); + install_default(HLR_NODE); } diff --git a/src/hlr_vty.h b/src/hlr_vty.h index abc9804..89a1e1d 100644 --- a/src/hlr_vty.h +++ b/src/hlr_vty.h @@ -24,6 +24,12 @@ #include <osmocom/core/logging.h> #include <osmocom/vty/vty.h> +#include <osmocom/vty/command.h> +#include "hlr.h" + +enum hlr_vty_node { + HLR_NODE = _LAST_OSMOVTY_NODE + 1, +}; int hlr_vty_is_config_node(struct vty *vty, int node); -void hlr_vty_init(const struct log_info *cat); +void hlr_vty_init(struct hlr *hlr, const struct log_info *cat, void *tall_ctx); -- To view, visit https://gerrit.osmocom.org/2809 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I79f7a300480f308b21116dd14d1698be38725afd Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>