]> git.sur5r.net Git - ngadmin/commitdiff
more friendliness for non-eth0 ifaces
authorspeed <speed@localhost>
Tue, 16 Jun 2015 19:18:00 +0000 (21:18 +0200)
committerspeed <speed@localhost>
Tue, 16 Jun 2015 19:18:00 +0000 (21:18 +0200)
cli/src/admin.c

index 62e366f8a737695bb4218723871c0d0159660742..d017aca3bbf6fd714b1e8c61ca54fd313f0bd483 100644 (file)
@@ -208,7 +208,7 @@ int main (int argc, char **argv)
                {0, 0, 0, 0}
        };
        char *line, *com[MAXCOM];
                {0, 0, 0, 0}
        };
        char *line, *com[MAXCOM];
-       const char *iface = "eth0", *password = NULL;
+       const char *iface = NULL, *password = NULL;
        float timeout = 0.f;
        bool kb = false, force = false, global = true;
        struct timeval tv;
        float timeout = 0.f;
        bool kb = false, force = false, global = true;
        struct timeval tv;
@@ -287,13 +287,18 @@ int main (int argc, char **argv)
                printf("unknown trailing options\n");
                goto end;
        }
                printf("unknown trailing options\n");
                goto end;
        }
-       
+
+       if (iface == NULL)
+       {
+               fprintf(stderr, "no interface specified (-i), defaulting to eth0\n");
+               iface = "eth0";
+       }
        
        memset(com, 0, MAXCOM * sizeof(char*));
        
        nga = ngadmin_init(iface);
        if (nga == NULL) {
        
        memset(com, 0, MAXCOM * sizeof(char*));
        
        nga = ngadmin_init(iface);
        if (nga == NULL) {
-               fprintf(stderr, "initialization error\n");
+               fprintf(stderr, "initialization error (bad interface ?)\n");
                goto end;
        }
        
                goto end;
        }