Commit 09ef71d2 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use default_interface_conf in add_interface, not in main.

This avoids a crash when an interface is added both in the configuration
file and on the command-line.
parent 5c1d5665
...@@ -368,7 +368,7 @@ main(int argc, char **argv) ...@@ -368,7 +368,7 @@ main(int argc, char **argv)
} }
for(i = optind; i < argc; i++) { for(i = optind; i < argc; i++) {
vrc = add_interface(argv[i], default_interface_conf); vrc = add_interface(argv[i], NULL);
if(vrc == NULL) if(vrc == NULL)
goto fail; goto fail;
} }
......
...@@ -75,7 +75,7 @@ add_interface(char *ifname, struct interface_conf *if_conf) ...@@ -75,7 +75,7 @@ add_interface(char *ifname, struct interface_conf *if_conf)
memset(ifp, 0, sizeof(struct interface)); memset(ifp, 0, sizeof(struct interface));
strncpy(ifp->name, ifname, IF_NAMESIZE); strncpy(ifp->name, ifname, IF_NAMESIZE);
ifp->conf = if_conf; ifp->conf = if_conf ? if_conf : default_interface_conf;
ifp->bucket_time = now.tv_sec; ifp->bucket_time = now.tv_sec;
ifp->bucket = BUCKET_TOKENS_MAX; ifp->bucket = BUCKET_TOKENS_MAX;
ifp->hello_seqno = (random() & 0xFFFF); ifp->hello_seqno = (random() & 0xFFFF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment