From: Jo-Philipp Wich Date: Sat, 16 May 2009 17:15:11 +0000 (+0000) Subject: contrib/package/freifunk-watchdog: only monitor ad-hoc interfaces X-Git-Tag: 0.8.7~29 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5723346226525afc667bd5c5b4315e4de95b55ad;p=oweals%2Fluci.git contrib/package/freifunk-watchdog: only monitor ad-hoc interfaces --- diff --git a/contrib/package/freifunk-watchdog/Makefile b/contrib/package/freifunk-watchdog/Makefile index 439e0478c..e4cb550f6 100644 --- a/contrib/package/freifunk-watchdog/Makefile +++ b/contrib/package/freifunk-watchdog/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=freifunk-watchdog -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DEPENDS := uci 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); + } } } }