3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 20:12:37 +01:00

main: Add command line options for white/black list

--interfaces (-i) tells iwd which interfaces to manage.  If the option
is ommitted, all interfaces will be managed.

--nointerfaces (-I) tells iwd which interfaces to blacklist.  If the
option is ommitted, no interfaces will be blacklisted.
This commit is contained in:
Denis Kenzior 2016-06-23 15:49:05 -05:00
parent cda2026b23
commit 04de3af41f

View File

@ -45,6 +45,8 @@
#include "src/backtrace.h" #include "src/backtrace.h"
static struct l_timeout *timeout = NULL; static struct l_timeout *timeout = NULL;
static const char *interfaces;
static const char *nointerfaces;
static void main_loop_quit(struct l_timeout *timeout, void *user_data) static void main_loop_quit(struct l_timeout *timeout, void *user_data)
{ {
@ -74,6 +76,8 @@ static void usage(void)
printf("Options:\n" printf("Options:\n"
"\t-B, --dbus-debug Enable DBus debugging\n" "\t-B, --dbus-debug Enable DBus debugging\n"
"\t-K, --kdbus Setup Kernel D-Bus\n" "\t-K, --kdbus Setup Kernel D-Bus\n"
"\t-i, --interfaces Interfaces to manage\n"
"\t-I, --nointerfaces Interfaces to ignore\n"
"\t-h, --help Show help options\n"); "\t-h, --help Show help options\n");
} }
@ -81,6 +85,8 @@ static const struct option main_options[] = {
{ "kdbus", no_argument, NULL, 'K' }, { "kdbus", no_argument, NULL, 'K' },
{ "dbus-debug", no_argument, NULL, 'B' }, { "dbus-debug", no_argument, NULL, 'B' },
{ "version", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'v' },
{ "interfaces", required_argument, NULL, 'i' },
{ "nointerfaces", required_argument, NULL, 'I' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ } { }
}; };
@ -134,7 +140,7 @@ int main(int argc, char *argv[])
for (;;) { for (;;) {
int opt; int opt;
opt = getopt_long(argc, argv, "KBvh", main_options, NULL); opt = getopt_long(argc, argv, "KBi:I:vh", main_options, NULL);
if (opt < 0) if (opt < 0)
break; break;
@ -145,6 +151,12 @@ int main(int argc, char *argv[])
case 'B': case 'B':
enable_dbus_debug = true; enable_dbus_debug = true;
break; break;
case 'i':
interfaces = optarg;
break;
case 'I':
nointerfaces = optarg;
break;
case 'v': case 'v':
printf("%s\n", VERSION); printf("%s\n", VERSION);
return EXIT_SUCCESS; return EXIT_SUCCESS;