@@ -117,6 +117,7 @@ struct globals {
int clientmode_version;
uint8_t verbose:1;
uint8_t ipv4mode:1;
+ uint8_t force:1;
int unix_sock;
const char *unix_path;
@@ -164,6 +164,7 @@ static struct globals *alfred_init(int argc, char *argv[])
{"version", no_argument, NULL, 'v'},
{"verbose", no_argument, NULL, 'd'},
{"sync-period", required_argument, NULL, 'p'},
+ {"force", no_argument, NULL, 'f'},
{NULL, 0, NULL, 0},
};
@@ -184,6 +185,7 @@ static struct globals *alfred_init(int argc, char *argv[])
globals->unix_path = ALFRED_SOCK_PATH_DEFAULT;
globals->verbose = false;
globals->ipv4mode = false;
+ globals->force = false;
globals->update_command = NULL;
globals->sync_period.tv_sec = ALFRED_INTERVAL;
globals->sync_period.tv_nsec = 0;
@@ -191,7 +193,7 @@ static struct globals *alfred_init(int argc, char *argv[])
time_random_seed();
- while ((opt = getopt_long(argc, argv, "ms:r:hi:b:vV:M:I:u:dc:p:4:", long_options,
+ while ((opt = getopt_long(argc, argv, "ms:r:hi:b:vV:M:I:u:dc:p:4:f", long_options,
&opt_ind)) != -1) {
switch (opt) {
case 'r':
@@ -273,6 +275,9 @@ static struct globals *alfred_init(int argc, char *argv[])
inet_pton(AF_INET, optarg, &alfred_mcast.ipv4);
printf(" ** IPv4 Multicast Mode: %x\n", alfred_mcast.ipv4.s_addr);
break;
+ case 'f':
+ globals->force = true;
+ break;
case 'h':
default:
alfred_usage();
@@ -72,6 +72,9 @@ Collect data from the network and prints it on the network
\fB\-d\fP, \fB\-\-verbose\fP
Show extra information in the data output
.TP
+\fB\-d\fP, \fB\-\-force\fP
+Start server even when batman-adv or interface(s) are not yet available.
+.TP
\fB\-V\fP, \fB\-\-req\-version\fP \fIversion\fP
Specify the data version set for \fB\-s\fP
@@ -386,14 +386,15 @@ int alfred_server(struct globals *globals)
}
if (strcmp(globals->mesh_iface, "none") != 0 &&
- batadv_interface_check(globals->mesh_iface) < 0) {
+ batadv_interface_check(globals->mesh_iface) < 0 &&
+ !globals->force) {
fprintf(stderr, "Can't start server: batman-adv interface %s not found\n",
globals->mesh_iface);
return -1;
}
num_socks = netsock_open_all(globals);
- if (num_socks <= 0) {
+ if (num_socks <= 0 && !globals->force) {
fprintf(stderr, "Failed to open interfaces\n");
return -1;
}