Commit 8eb70804 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Allow running with no interfaces given on command line.

parent 82ccad95
...@@ -133,9 +133,9 @@ main(int argc, char **argv) ...@@ -133,9 +133,9 @@ main(int argc, char **argv)
arg = argv; arg = argv;
SHIFTE(); SHIFT();
while((*arg)[0] == '-') { while(*arg && (*arg)[0] == '-') {
if(strcmp(*arg, "--") == 0) { if(strcmp(*arg, "--") == 0) {
SHIFTE(); SHIFTE();
break; break;
...@@ -234,7 +234,7 @@ main(int argc, char **argv) ...@@ -234,7 +234,7 @@ main(int argc, char **argv)
} else { } else {
goto syntax; goto syntax;
} }
SHIFTE(); SHIFT();
} }
...@@ -340,19 +340,19 @@ main(int argc, char **argv) ...@@ -340,19 +340,19 @@ main(int argc, char **argv)
goto fail_pid; goto fail_pid;
} }
{ if(*arg) {
unsigned char dummy[16]; unsigned char dummy[16];
rc = parse_address(*arg, dummy, NULL); rc = parse_address(*arg, dummy, NULL);
if(rc >= 0) { if(rc >= 0) {
fprintf(stderr, "Warning: obsolete router-id given.\n"); fprintf(stderr, "Warning: obsolete router-id given.\n");
SHIFTE(); SHIFT();
} }
} }
rc = finalise_config(); rc = finalise_config();
if(rc < 0) { if(rc < 0) {
fprintf(stderr, "Couldn't finalise configuration.\n"); fprintf(stderr, "Couldn't finalise configuration.\n");
exit(1); goto fail;
} }
while(*arg) { while(*arg) {
...@@ -363,6 +363,11 @@ main(int argc, char **argv) ...@@ -363,6 +363,11 @@ main(int argc, char **argv)
SHIFT(); SHIFT();
} }
if(networks == NULL) {
fprintf(stderr, "Eek... asked to run on no interfaces!\n");
goto fail;
}
FOR_ALL_NETS(net) { FOR_ALL_NETS(net) {
/* net->ifindex is not necessarily valid at this point */ /* net->ifindex is not necessarily valid at this point */
int ifindex = if_nametoindex(net->ifname); int ifindex = if_nametoindex(net->ifname);
......
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