ipa driver: make bind address vty configurable
Add VTY function to set the ipa bind address:
e1_input
ipa bind A.B.C.D
Add a priv pointer to struct e1inp_driver in order to communicate the bind
address parameter to ipaccess_line_update(). Add two "internal.h" functions to
get/set it in the ipa driver struct.
Add static ip_bind_addr() to use the IP address set from the VTY or, if NULL,
use "0.0.0.0". Apply in ipaccess_line_update().
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index 0b4adb2..5320bb3 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -168,6 +168,17 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_ipa_bind,
+ cfg_ipa_bind_cmd,
+ "ipa bind A.B.C.D",
+ "ipa driver config\n"
+ "Set ipa local bind address\n"
+ "Listen on this IP address (default 0.0.0.0)\n")
+{
+ e1inp_ipa_set_bind_addr(argv[0]);
+ return CMD_SUCCESS;
+}
+
static int e1inp_config_write(struct vty *vty)
{
struct e1inp_line *line;
@@ -202,6 +213,12 @@
VTY_NEWLINE);
}
+
+ const char *ipa_bind = e1inp_ipa_get_bind_addr();
+ if (ipa_bind && (strcmp(ipa_bind, "0.0.0.0") != 0))
+ vty_out(vty, " ipa bind %s%s",
+ ipa_bind, VTY_NEWLINE);
+
return CMD_SUCCESS;
}
@@ -351,6 +368,8 @@
install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_params_cmd);
install_element(L_E1INP_NODE, &cfg_e1_line_no_keepalive_cmd);
+ install_element(L_E1INP_NODE, &cfg_ipa_bind_cmd);
+
install_element_ve(&show_e1drv_cmd);
install_element_ve(&show_e1line_cmd);
install_element_ve(&show_e1ts_cmd);