We used to read the configuration file /after/ binding the cli. Fix that.
Signed-off-by: Benjamin Cama <benoar@dolka.fr>
char buf[4096];
struct cli_command *c;
struct cli_command *c2;
char buf[4096];
struct cli_command *c;
struct cli_command *c2;
- int on = 1;
- struct sockaddr_in addr;
+}
+
+void cli_init_complete(char *hostname)
+{
+ int on = 1;
+ struct sockaddr_in addr;
+
+ if (hostname && *hostname)
+ cli_set_hostname(cli, hostname);
+ else
+ cli_set_hostname(cli, "l2tpns");
memset(&addr, 0, sizeof(addr));
clifd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
memset(&addr, 0, sizeof(addr));
clifd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
-void cli_init_hostname(char *hostname)
-{
- if (hostname && *hostname)
- cli_set_hostname(cli, hostname);
- else
- cli_set_hostname(cli, "l2tpns");
-}
-
void cli_do(int sockfd)
{
int require_auth = 1;
void cli_do(int sockfd)
{
int require_auth = 1;
/* set hostname /after/ having read the config file */
if (*config->hostname)
strcpy(hostname, config->hostname);
/* set hostname /after/ having read the config file */
if (*config->hostname)
strcpy(hostname, config->hostname);
- cli_init_hostname(hostname);
+ cli_init_complete(hostname);
update_config();
init_tbf(config->num_tbfs);
update_config();
init_tbf(config->num_tbfs);
// cli.c
void init_cli();
// cli.c
void init_cli();
-void cli_init_hostname(char *hostname);
+void cli_init_complete(char *hostname);
void cli_do_file(FILE *fh);
void cli_do(int sockfd);
int cli_arg_help(struct cli_def *cli, int cr_ok, char *entry, ...);
void cli_do_file(FILE *fh);
void cli_do(int sockfd);
int cli_arg_help(struct cli_def *cli, int cr_ok, char *entry, ...);