]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow hostapd to be started without interfaces
authorShan Palanisamy <shanp@qca.qualcomm.com>
Sat, 25 Aug 2012 08:42:30 +0000 (11:42 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 25 Aug 2012 10:47:59 +0000 (13:47 +0300)
If the control interface is enabled, allow hostapd to be started
without any configuration files specific on the command line since
the interfaces can be added dynamically.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

hostapd/main.c

index d6c914a9f913fc5215a089dfe656fe7cccde050f..56f00023bea829b81ea3108726e2f73f2d3b2bfa 100644 (file)
@@ -601,7 +601,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       if (optind == argc)
+       if (optind == argc && interfaces.global_iface_path == NULL)
                usage();
 
        wpa_msg_register_ifname_cb(hostapd_msg_ifname_cb);
@@ -610,11 +610,13 @@ int main(int argc, char *argv[])
                wpa_debug_open_file(log_file);
 
        interfaces.count = argc - optind;
-       interfaces.iface = os_calloc(interfaces.count,
-                                    sizeof(struct hostapd_iface *));
-       if (interfaces.iface == NULL) {
-               wpa_printf(MSG_ERROR, "malloc failed");
-               return -1;
+       if (interfaces.count) {
+               interfaces.iface = os_calloc(interfaces.count,
+                                            sizeof(struct hostapd_iface *));
+               if (interfaces.iface == NULL) {
+                       wpa_printf(MSG_ERROR, "malloc failed");
+                       return -1;
+               }
        }
 
        if (hostapd_global_init(&interfaces, entropy_file))