contrib/package/freifunk-watchdog: only monitor ad-hoc interfaces
This commit is contained in:
parent
e928518ba7
commit
5723346226
2 changed files with 35 additions and 31 deletions
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=freifunk-watchdog
|
PKG_NAME:=freifunk-watchdog
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
PKG_BUILD_DEPENDS := uci
|
PKG_BUILD_DEPENDS := uci
|
||||||
|
|
|
@ -205,44 +205,48 @@ static void load_wifi_uci_add_iface(const char *section, struct uci_itr_ctx *itr
|
||||||
const char *ucitmp;
|
const char *ucitmp;
|
||||||
int val = 0;
|
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( (t = (wifi_tuple_t *)malloc(sizeof(wifi_tuple_t))) != NULL )
|
||||||
if(ucitmp)
|
|
||||||
{
|
{
|
||||||
strncpy(t->ifname, ucitmp, sizeof(t->ifname));
|
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "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, "device");
|
|
||||||
if(ucitmp)
|
|
||||||
{
|
|
||||||
ucitmp = ucix_get_option(itr->ctx, "wireless", ucitmp, "channel");
|
|
||||||
if(ucitmp)
|
if(ucitmp)
|
||||||
{
|
{
|
||||||
t->channel = atoi(ucitmp);
|
strncpy(t->ifname, ucitmp, sizeof(t->ifname));
|
||||||
val++;
|
val++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( val == 3 )
|
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "bssid");
|
||||||
{
|
if(ucitmp)
|
||||||
syslog(LOG_INFO, "Monitoring %s: bssid=%s channel=%d",
|
{
|
||||||
t->ifname, t->bssid, t->channel);
|
strncpy(t->bssid, ucitmp, sizeof(t->bssid));
|
||||||
|
val++;
|
||||||
|
}
|
||||||
|
|
||||||
t->next = itr->list;
|
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "device");
|
||||||
itr->list = t;
|
if(ucitmp)
|
||||||
}
|
{
|
||||||
else
|
ucitmp = ucix_get_option(itr->ctx, "wireless", ucitmp, "channel");
|
||||||
{
|
if(ucitmp)
|
||||||
free(t);
|
{
|
||||||
|
t->channel = atoi(ucitmp);
|
||||||
|
val++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue