summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog/src/watchdog.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-16 17:19:06 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-16 17:19:06 +0000
commit07b6a704c4e121d603307bcf5d036651e23d3532 (patch)
tree5ba03098c75742a51fd59d58e3e1cc8252ba395f /contrib/package/freifunk-watchdog/src/watchdog.c
parent82b15b30abd1ed278550bdeb38168462d0b91674 (diff)
merge r4529 to trunk
Diffstat (limited to 'contrib/package/freifunk-watchdog/src/watchdog.c')
-rw-r--r--contrib/package/freifunk-watchdog/src/watchdog.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/contrib/package/freifunk-watchdog/src/watchdog.c b/contrib/package/freifunk-watchdog/src/watchdog.c
index 7bbb7c7ab..b5a573d49 100644
--- a/contrib/package/freifunk-watchdog/src/watchdog.c
+++ b/contrib/package/freifunk-watchdog/src/watchdog.c
@@ -205,44 +205,48 @@ static void load_wifi_uci_add_iface(const char *section, struct uci_itr_ctx *itr
const char *ucitmp;
int val = 0;
- if( (t = (wifi_tuple_t *)malloc(sizeof(wifi_tuple_t))) != NULL )
+ ucitmp = ucix_get_option(itr->ctx, "wireless", section, "mode");
+ if( ucitmp && !strncmp(ucitmp, "adhoc", 5) )
{
- ucitmp = ucix_get_option(itr->ctx, "wireless", section, "ifname");
- if(ucitmp)
+ if( (t = (wifi_tuple_t *)malloc(sizeof(wifi_tuple_t))) != NULL )
{
- strncpy(t->ifname, ucitmp, sizeof(t->ifname));
- val++;
- }
-
- ucitmp = ucix_get_option(itr->ctx, "wireless", section, "bssid");
- if(ucitmp)
- {
- strncpy(t->bssid, ucitmp, sizeof(t->bssid));
- val++;
- }
+ ucitmp = ucix_get_option(itr->ctx, "wireless", section, "ifname");
+ if(ucitmp)
+ {
+ strncpy(t->ifname, ucitmp, sizeof(t->ifname));
+ val++;
+ }
- ucitmp = ucix_get_option(itr->ctx, "wireless", section, "device");
- if(ucitmp)
- {
- ucitmp = ucix_get_option(itr->ctx, "wireless", ucitmp, "channel");
+ ucitmp = ucix_get_option(itr->ctx, "wireless", section, "bssid");
if(ucitmp)
{
- t->channel = atoi(ucitmp);
+ strncpy(t->bssid, ucitmp, sizeof(t->bssid));
val++;
}
- }
- if( val == 3 )
- {
- syslog(LOG_INFO, "Monitoring %s: bssid=%s channel=%d",
- t->ifname, t->bssid, t->channel);
+ ucitmp = ucix_get_option(itr->ctx, "wireless", section, "device");
+ if(ucitmp)
+ {
+ ucitmp = ucix_get_option(itr->ctx, "wireless", ucitmp, "channel");
+ if(ucitmp)
+ {
+ t->channel = atoi(ucitmp);
+ val++;
+ }
+ }
- t->next = itr->list;
- itr->list = t;
- }
- else
- {
- free(t);
+ if( val == 3 )
+ {
+ syslog(LOG_INFO, "Monitoring %s: bssid=%s channel=%d",
+ t->ifname, t->bssid, t->channel);
+
+ t->next = itr->list;
+ itr->list = t;
+ }
+ else
+ {
+ free(t);
+ }
}
}
}