Show
Ignore:
Timestamp:
10/28/11 16:15:27 (19 months ago)
Author:
jow
Message:

luci-0.10: sync with trunk, drop broken and unfinished applications

Location:
luci/branches/luci-0.10/contrib/package
Files:
2 removed
30 modified
95 copied

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.10/contrib/package

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/contrib/package/freifunk-firewall/files/etc/firewall.freifunk

    r7038 r7810  
    3737config_foreach apply_advanced advanced 
    3838 
    39  
    40 # 
    41 # Apply fixes for masquerading rules 
    42 # 
    43 apply_nat_fix() { 
    44     local up 
    45     local ifname 
    46     config_get up $1 up 
    47     [ -n "$up" ] || return 0 
    48     (ACTION="ifup" INTERFACE="$1" . /etc/hotplug.d/iface/22-firewall-nat-fix ) 
    49 } 
    50  
    51 uci_set_state firewall core loaded 1 
    52 config_foreach fw_addif interface 
    53 config_foreach apply_nat_fix interface 
    54  
    5539[ -x /etc/init.d/luci_splash ] && ( sleep 3; /etc/init.d/luci_splash restart )& 
    5640 
  • luci/branches/luci-0.10/contrib/package/freifunk-firewall/files/etc/hotplug.d/firewall/23-restricted-wan

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/contrib/package/freifunk-firewall/Makefile

    r5310 r7810  
    1717  SECTION:=luci 
    1818  CATEGORY:=LuCI 
    19   SUBMENU:=Freifunk 
     19  SUBMENU:=9. Freifunk 
    2020  TITLE:=Freifunk Firewall Addon 
    2121  DEPENDS:=+firewall 
  • luci/branches/luci-0.10/contrib/package/freifunk-p2pblock

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/contrib/package/freifunk-p2pblock/Makefile

    r7243 r7810  
    1818  SECTION:=luci 
    1919  CATEGORY:=LuCI 
    20   SUBMENU:=Freifunk 
     20  SUBMENU:=9. Freifunk 
    2121  TITLE:=Freifunk p2pblock Addon 
    2222  DEPENDS:=+iptables-mod-filter +iptables-mod-ipp2p +l7-protocols +iptables-mod-conntrack-extra 
  • luci/branches/luci-0.10/contrib/package/freifunk-policyrouting

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/contrib/package/freifunk-policyrouting/Makefile

    r7038 r7810  
    1414  SECTION:=luci 
    1515  CATEGORY:=LuCI 
    16   SUBMENU:=Freifunk 
     16  SUBMENU:=9. Freifunk 
    1717  TITLE:=Freifunk policy routing addon 
    1818  DEPENDS:=+firewall +ip 
  • luci/branches/luci-0.10/contrib/package/freifunk-watchdog/Makefile

    r5359 r7810  
    1919  SECTION:=luci 
    2020  CATEGORY:=LuCI 
    21   SUBMENU:=Freifunk 
     21  SUBMENU:=9. Freifunk 
    2222  TITLE:=Freifunk Ad-Hoc watchdog daemon 
    2323  DEPENDS:=libuci 
  • luci/branches/luci-0.10/contrib/package/iwinfo

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/contrib/package/iwinfo/Makefile

    r7248 r7810  
    88 
    99PKG_NAME:=libiwinfo 
    10 PKG_RELEASE:=15 
     10PKG_RELEASE:=16 
    1111 
    1212PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 
     
    1818  SECTION:=luci 
    1919  CATEGORY:=LuCI 
    20   SUBMENU:=Libraries 
     20  SUBMENU:=8. Libraries 
    2121  TITLE:=Generalized Wireless Information Library (iwinfo) 
    2222  DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny +liblua +lua 
  • luci/branches/luci-0.10/contrib/package/iwinfo/src/iwinfo_nl80211.c

    r7335 r7810  
    3535    int err, fd; 
    3636 
    37     if( !nls ) 
     37    if (!nls) 
    3838    { 
    3939        nls = malloc(sizeof(struct nl80211_state)); 
    40         if( !nls ) { 
     40        if (!nls) { 
    4141            err = -ENOMEM; 
    4242            goto err; 
     
    4444 
    4545        nls->nl_sock = nl_socket_alloc(); 
    46         if( !nls->nl_sock ) { 
     46        if (!nls->nl_sock) { 
    4747            err = -ENOMEM; 
    4848            goto err; 
     
    5555 
    5656        fd = nl_socket_get_fd(nls->nl_sock); 
    57         if( fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC) < 0 ) 
     57        if (fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC) < 0) 
    5858        { 
    5959            err = -EINVAL; 
     
    6767 
    6868        nls->nl80211 = genl_ctrl_search_by_name(nls->nl_cache, "nl80211"); 
    69         if( !nls->nl80211 ) 
     69        if (!nls->nl80211) 
    7070        { 
    7171            err = -ENOENT; 
     
    106106static int nl80211_msg_response(struct nl_msg *msg, void *arg) 
    107107{ 
    108     struct nl80211_msg_conveyor *cv = arg; 
    109  
    110     nlmsg_get(msg); 
    111  
    112     cv->msg = msg; 
    113     cv->hdr = nlmsg_data(nlmsg_hdr(cv->msg)); 
    114  
    115     nla_parse(cv->attr, NL80211_ATTR_MAX, 
    116         genlmsg_attrdata(cv->hdr, 0), 
    117         genlmsg_attrlen(cv->hdr, 0), NULL); 
    118  
    119108    return NL_SKIP; 
    120109} 
     
    122111static void nl80211_free(struct nl80211_msg_conveyor *cv) 
    123112{ 
    124     if( cv ) 
    125     { 
    126         if( cv->cb ) 
     113    if (cv) 
     114    { 
     115        if (cv->cb) 
    127116            nl_cb_put(cv->cb); 
    128117 
    129         if( cv->msg ) 
     118        if (cv->msg) 
    130119            nlmsg_free(cv->msg); 
    131120 
     
    143132    struct nl_cb *cb = NULL; 
    144133 
    145     if( nl80211_init() < 0 ) 
     134    if (nl80211_init() < 0) 
    146135        goto err; 
    147136 
    148     if( !strncmp(ifname, "phy", 3) ) 
     137    if (!strncmp(ifname, "phy", 3)) 
    149138        phyidx = atoi(&ifname[3]); 
    150     else if( !strncmp(ifname, "radio", 5) ) 
     139    else if (!strncmp(ifname, "radio", 5)) 
    151140        phyidx = atoi(&ifname[5]); 
    152     else if( !strncmp(ifname, "mon.", 4) ) 
     141    else if (!strncmp(ifname, "mon.", 4)) 
    153142        ifidx = if_nametoindex(&ifname[4]); 
    154143    else 
    155144        ifidx = if_nametoindex(ifname); 
    156145 
    157     if( (ifidx < 0) && (phyidx < 0) ) 
     146    if ((ifidx < 0) && (phyidx < 0)) 
    158147        return NULL; 
    159148 
    160149    req = nlmsg_alloc(); 
    161     if( !req ) 
     150    if (!req) 
    162151        goto err; 
    163152 
    164153    cb = nl_cb_alloc(NL_CB_DEFAULT); 
    165     if( !cb ) 
     154    if (!cb) 
    166155        goto err; 
    167156 
     
    169158        flags, cmd, 0); 
    170159 
    171     if( ifidx > -1 ) 
     160    if (ifidx > -1) 
    172161        NLA_PUT_U32(req, NL80211_ATTR_IFINDEX, ifidx); 
    173162 
    174     if( phyidx > -1 ) 
     163    if (phyidx > -1) 
    175164        NLA_PUT_U32(req, NL80211_ATTR_WIPHY, phyidx); 
    176165 
    177     nlmsg_get(req); 
    178  
    179     cv.msg       = req; 
    180     cv.cb        = cb; 
    181     cv.custom_cb = 0; 
     166    cv.msg = req; 
     167    cv.cb  = cb; 
    182168 
    183169    return &cv; 
     
    185171err: 
    186172nla_put_failure: 
    187     if( cb ) 
     173    if (cb) 
    188174        nl_cb_put(cb); 
    189175 
    190     if( req ) 
     176    if (req) 
    191177        nlmsg_free(req); 
    192178 
     
    194180} 
    195181 
    196 static void nl80211_cb(struct nl80211_msg_conveyor *cv, 
    197     int (*cb)(struct nl_msg *, void *), void *arg) 
    198 { 
    199     cv->custom_cb = 1; 
    200     nl_cb_set(cv->cb, NL_CB_VALID, NL_CB_CUSTOM, cb, arg); 
    201 } 
    202  
    203 static struct nl80211_msg_conveyor * nl80211_send(struct nl80211_msg_conveyor *cv) 
    204 { 
     182static struct nl80211_msg_conveyor * nl80211_send( 
     183    struct nl80211_msg_conveyor *cv, 
     184    int (*cb_func)(struct nl_msg *, void *), void *cb_arg 
     185) { 
    205186    static struct nl80211_msg_conveyor rcv; 
    206187    int err = 1; 
    207188 
    208     if( !cv->custom_cb ) 
     189    if (cb_func) 
     190        nl_cb_set(cv->cb, NL_CB_VALID, NL_CB_CUSTOM, cb_func, cb_arg); 
     191    else 
    209192        nl_cb_set(cv->cb, NL_CB_VALID, NL_CB_CUSTOM, nl80211_msg_response, &rcv); 
    210193 
    211     if( nl_send_auto_complete(nls->nl_sock, cv->msg) < 0 ) 
     194    if (nl_send_auto_complete(nls->nl_sock, cv->msg) < 0) 
    212195        goto err; 
    213196 
     
    226209 
    227210    return NULL; 
     211} 
     212 
     213static struct nlattr ** nl80211_parse(struct nl_msg *msg) 
     214{ 
     215    struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); 
     216    static struct nlattr *attr[NL80211_ATTR_MAX + 1]; 
     217 
     218    nla_parse(attr, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), 
     219        genlmsg_attrlen(gnlh, 0), NULL); 
     220 
     221    return attr; 
    228222} 
    229223 
     
    251245    for( i = 0, len = strlen(buf); i < len; i++ ) 
    252246    { 
    253         if( !lkey[0] && (buf[i] == ' ' || buf[i] == '\t') ) 
     247        if (!lkey[0] && (buf[i] == ' ' || buf[i] == '\t')) 
    254248        { 
    255249            ln++; 
    256250        } 
    257         else if( !lkey[0] && (buf[i] == '=') ) 
    258         { 
    259             if( (&buf[i] - ln) > 0 ) 
     251        else if (!lkey[0] && (buf[i] == '=')) 
     252        { 
     253            if ((&buf[i] - ln) > 0) 
    260254                memcpy(lkey, ln, min(sizeof(lkey) - 1, &buf[i] - ln)); 
    261255        } 
    262         else if( buf[i] == '\n' ) 
    263         { 
    264             if( lkey[0] ) 
     256        else if (buf[i] == '\n') 
     257        { 
     258            if (lkey[0]) 
    265259            { 
    266260                memcpy(lval, ln + strlen(lkey) + 1, 
    267261                    min(sizeof(lval) - 1, &buf[i] - ln - strlen(lkey) - 1)); 
    268262 
    269                 if( (ifname != NULL ) && 
     263                if ((ifname != NULL) && 
    270264                    (!strcmp(lkey, "interface") || !strcmp(lkey, "bss")) ) 
    271265                { 
    272266                    matched_if = !strcmp(lval, ifname); 
    273267                } 
    274                 else if( matched_if && !strcmp(lkey, key) ) 
     268                else if (matched_if && !strcmp(lkey, key)) 
    275269                { 
    276270                    return lval; 
     
    287281} 
    288282 
     283static int nl80211_ifname2phy_cb(struct nl_msg *msg, void *arg) 
     284{ 
     285    char *buf = arg; 
     286    struct nlattr **attr = nl80211_parse(msg); 
     287 
     288    if (attr[NL80211_ATTR_WIPHY_NAME]) 
     289        sprintf(buf, "%s", nla_data(attr[NL80211_ATTR_WIPHY_NAME])); 
     290    else 
     291        buf[0] = 0; 
     292 
     293    return NL_SKIP; 
     294} 
     295 
    289296static char * nl80211_ifname2phy(const char *ifname) 
    290297{ 
    291298    static char phy[32] = { 0 }; 
    292     struct nl80211_msg_conveyor *req, *res; 
     299    struct nl80211_msg_conveyor *req; 
    293300 
    294301    req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0); 
    295     if( req ) 
    296     { 
    297         res = nl80211_send(req); 
    298         if( res ) 
    299         { 
    300             if( res->attr[NL80211_ATTR_WIPHY_NAME] ) 
    301             { 
    302                 snprintf(phy, sizeof(phy), "%s", 
    303                      nla_get_string(res->attr[NL80211_ATTR_WIPHY_NAME])); 
    304             } 
    305             nl80211_free(res); 
    306         } 
     302    if (req) 
     303    { 
     304        nl80211_send(req, nl80211_ifname2phy_cb, phy); 
    307305        nl80211_free(req); 
    308306    } 
     
    318316    FILE *conf; 
    319317 
    320     if( (phy = nl80211_ifname2phy(ifname)) != NULL ) 
     318    if ((phy = nl80211_ifname2phy(ifname)) != NULL) 
    321319    { 
    322320        snprintf(path, sizeof(path), "/var/run/hostapd-%s.conf", phy); 
    323321 
    324         if( (conf = fopen(path, "r")) != NULL ) 
     322        if ((conf = fopen(path, "r")) != NULL) 
    325323        { 
    326324            fread(buf, sizeof(buf) - 1, 1, conf); 
     
    345343 
    346344 
    347     if( select(sock + 1, &rfds, NULL, NULL, &tv) < 0 ) 
     345    if (select(sock + 1, &rfds, NULL, NULL, &tv) < 0) 
    348346        return -1; 
    349347 
    350     if( !FD_ISSET(sock, &rfds) ) 
     348    if (!FD_ISSET(sock, &rfds)) 
    351349        return -1; 
    352350 
     
    368366 
    369367    sock = socket(PF_UNIX, SOCK_DGRAM, 0); 
    370     if( sock < 0 ) 
     368    if (sock < 0) 
    371369        return NULL; 
    372370 
     
    375373        "/var/run/wpa_supplicant-%s/%s", ifname, ifname); 
    376374 
    377     if( fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC) < 0 ) 
     375    if (fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC) < 0) 
    378376        goto out; 
    379377 
    380     if( connect(sock, (struct sockaddr *) &remote, remote_length) ) 
     378    if (connect(sock, (struct sockaddr *) &remote, remote_length)) 
    381379        goto out; 
    382380 
     
    385383        "/var/run/iwinfo-%s-%d", ifname, getpid()); 
    386384 
    387     if( bind(sock, (struct sockaddr *) &local, local_length) ) 
     385    if (bind(sock, (struct sockaddr *) &local, local_length)) 
    388386        goto out; 
    389387 
     
    391389    send(sock, "ATTACH", 6, 0); 
    392390 
    393     if( nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0 ) 
     391    if (nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0) 
    394392        goto out; 
    395393 
     
    399397    while( numtry++ < 5 ) 
    400398    { 
    401         if( nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0 ) 
    402         { 
    403             if( event ) 
     399        if (nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0) 
     400        { 
     401            if (event) 
    404402                continue; 
    405403 
     
    407405        } 
    408406 
    409         if( (!event && buffer[0] != '<') || strstr(buffer, event) ) 
     407        if ((!event && buffer[0] != '<') || strstr(buffer, event)) 
    410408            break; 
    411409    } 
     
    416414    close(sock); 
    417415 
    418     if( local.sun_family ) 
     416    if (local.sun_family) 
    419417        unlink(local.sun_path); 
    420418 
     
    428426    char buffer[16]; 
    429427 
    430     if( (fd = open(path, O_RDONLY)) > -1 ) 
    431     { 
    432         if( read(fd, buffer, sizeof(buffer)) > 0 ) 
     428    if ((fd = open(path, O_RDONLY)) > -1) 
     429    { 
     430        if (read(fd, buffer, sizeof(buffer)) > 0) 
    433431            rv = atoi(buffer); 
    434432 
     
    448446    struct dirent *e; 
    449447 
    450     if( !ifname ) 
     448    if (!ifname) 
    451449        return NULL; 
    452     else if( !strncmp(ifname, "phy", 3) ) 
     450    else if (!strncmp(ifname, "phy", 3)) 
    453451        phyidx = atoi(&ifname[3]); 
    454     else if( !strncmp(ifname, "radio", 5) ) 
     452    else if (!strncmp(ifname, "radio", 5)) 
    455453        phyidx = atoi(&ifname[5]); 
    456454 
    457     if( phyidx > -1 ) 
    458     { 
    459         if( (d = opendir("/sys/class/net")) != NULL ) 
     455    if (phyidx > -1) 
     456    { 
     457        if ((d = opendir("/sys/class/net")) != NULL) 
    460458        { 
    461459            while( (e = readdir(d)) != NULL ) 
     
    464462                    "/sys/class/net/%s/phy80211/index", e->d_name); 
    465463 
    466                 if( nl80211_readint(buffer) == phyidx ) 
     464                if (nl80211_readint(buffer) == phyidx) 
    467465                { 
    468466                    snprintf(buffer, sizeof(buffer), 
     
    493491 
    494492    req = nl80211_msg(ifname, NL80211_CMD_NEW_INTERFACE, 0); 
    495     if( req ) 
     493    if (req) 
    496494    { 
    497495        snprintf(nif, sizeof(nif), "tmp.%s", ifname); 
     
    500498        NLA_PUT_U32(req->msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_STATION); 
    501499 
    502         res = nl80211_send(req); 
    503         if( res ) 
    504         { 
    505             rv = nif; 
    506             nl80211_free(res); 
    507         } 
     500        nl80211_send(req, NULL, NULL); 
     501 
     502        rv = nif; 
    508503 
    509504    nla_put_failure: 
     
    519514 
    520515    req = nl80211_msg(ifname, NL80211_CMD_DEL_INTERFACE, 0); 
    521     if( req ) 
     516    if (req) 
    522517    { 
    523518        NLA_PUT_STRING(req->msg, NL80211_ATTR_IFNAME, ifname); 
    524519 
    525         nl80211_free(nl80211_send(req)); 
     520        nl80211_send(req, NULL, NULL); 
    526521 
    527522    nla_put_failure: 
     
    536531    char *phy = nl80211_ifname2phy(ifname); 
    537532 
    538     if( phy ) 
     533    if (phy) 
    539534    { 
    540535        snprintf(buf, sizeof(buf), "/var/run/wifi-%s.pid", phy); 
    541         if( (fd = open(buf, O_RDONLY)) > 0 ) 
    542         { 
    543             if( read(fd, buf, sizeof(buf)) > 0 ) 
     536        if ((fd = open(buf, O_RDONLY)) > 0) 
     537        { 
     538            if (read(fd, buf, sizeof(buf)) > 0) 
    544539                pid = atoi(buf); 
    545540 
     
    547542        } 
    548543 
    549         if( pid > 0 ) 
     544        if (pid > 0) 
    550545            kill(pid, 1); 
    551546    } 
     
    560555void nl80211_close(void) 
    561556{ 
    562     if( nls ) 
    563     { 
    564         if( nls->nl_sock ) 
     557    if (nls) 
     558    { 
     559        if (nls->nl_sock) 
    565560            nl_socket_free(nls->nl_sock); 
    566561 
    567         if( nls->nl_cache ) 
     562        if (nls->nl_cache) 
    568563            nl_cache_free(nls->nl_cache); 
    569564 
     
    582577    char *ssid; 
    583578 
    584     if( !wext_get_ssid(ifname, buf) ) 
     579    if (!wext_get_ssid(ifname, buf)) 
    585580    { 
    586581        return 0; 
     
    601596    unsigned char mac[6]; 
    602597 
    603     if( !wext_get_bssid(ifname, buf) ) 
     598    if (!wext_get_bssid(ifname, buf)) 
    604599    { 
    605600        return 0; 
    606601    } 
    607     else if( (bssid = nl80211_hostapd_info(ifname)) && 
    608              (bssid = nl80211_getval(ifname, bssid, "bssid")) ) 
     602    else if((bssid = nl80211_hostapd_info(ifname)) && 
     603             (bssid = nl80211_getval(ifname, bssid, "bssid"))) 
    609604    { 
    610605        mac[0] = strtol(&bssid[0],  NULL, 16); 
     
    628623    char *first; 
    629624 
    630     if( !wext_get_channel(ifname, buf) ) 
     625    if (!wext_get_channel(ifname, buf)) 
    631626        return 0; 
    632627 
    633     else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL ) 
     628    else if ((first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL) 
    634629        return wext_get_channel(first, buf); 
    635630 
     
    641636    char *first; 
    642637 
    643     if( !wext_get_frequency(ifname, buf) ) 
     638    if (!wext_get_frequency(ifname, buf)) 
    644639        return 0; 
    645640 
    646     else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL ) 
     641    else if ((first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL) 
    647642        return wext_get_frequency(first, buf); 
    648643 
     
    661656    int16_t mbit; 
    662657    struct nl80211_rssi_rate *rr = arg; 
    663  
    664     struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); 
    665     struct nlattr *attr[NL80211_ATTR_MAX + 1]; 
     658    struct nlattr **attr = nl80211_parse(msg); 
    666659    struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1]; 
    667660    struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1]; 
     
    687680    }; 
    688681 
    689     nla_parse(attr, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), 
    690           genlmsg_attrlen(gnlh, 0), NULL); 
    691  
    692     if( attr[NL80211_ATTR_STA_INFO] ) 
     682    if (attr[NL80211_ATTR_STA_INFO]) 
    693683    { 
    694684        if( !nla_parse_nested(sinfo, NL80211_STA_INFO_MAX, 
    695685                attr[NL80211_ATTR_STA_INFO], stats_policy) ) 
    696686        { 
    697             if( sinfo[NL80211_STA_INFO_SIGNAL] ) 
     687            if (sinfo[NL80211_STA_INFO_SIGNAL]) 
    698688            { 
    699689                dbm = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]); 
     
    701691            } 
    702692 
    703             if( sinfo[NL80211_STA_INFO_TX_BITRATE] ) 
     693            if (sinfo[NL80211_STA_INFO_TX_BITRATE]) 
    704694            { 
    705695                if( !nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX, 
    706696                        sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy) ) 
    707697                { 
    708                     if( rinfo[NL80211_RATE_INFO_BITRATE] ) 
     698                    if (rinfo[NL80211_RATE_INFO_BITRATE]) 
    709699                    { 
    710700                        mbit = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]); 
     
    742732                if (req) 
    743733                { 
    744                     nl80211_cb(req, nl80211_fill_signal_cb, r); 
    745                     nl80211_send(req); 
     734                    nl80211_send(req, nl80211_fill_signal_cb, r); 
    746735                    nl80211_free(req); 
    747736                } 
     
    757746    struct nl80211_rssi_rate rr; 
    758747 
    759     if( !wext_get_bitrate(ifname, buf) ) 
     748    if (!wext_get_bitrate(ifname, buf)) 
    760749        return 0; 
    761750 
     
    775764    struct nl80211_rssi_rate rr; 
    776765 
    777     if( !wext_get_signal(ifname, buf) ) 
     766    if (!wext_get_signal(ifname, buf)) 
    778767        return 0; 
    779768 
     
    792781{ 
    793782    int8_t *noise = arg; 
    794     struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); 
    795     struct nlattr *tb[NL80211_ATTR_MAX + 1]; 
     783    struct nlattr **tb = nl80211_parse(msg); 
    796784    struct nlattr *si[NL80211_SURVEY_INFO_MAX + 1]; 
    797785 
     
    801789    }; 
    802790 
    803     nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), 
    804         genlmsg_attrlen(gnlh, 0), NULL); 
    805  
    806791    if (!tb[NL80211_ATTR_SURVEY_INFO]) 
    807792        return NL_SKIP; 
     
    831816        noise = 0; 
    832817 
    833         nl80211_cb(req, nl80211_get_noise_cb, &noise); 
    834         nl80211_send(req); 
     818        nl80211_send(req, nl80211_get_noise_cb, &noise); 
    835819        nl80211_free(req); 
    836820 
     
    849833    int signal; 
    850834 
    851     if( wext_get_quality(ifname, buf) ) 
     835    if (wext_get_quality(ifname, buf)) 
    852836    { 
    853837        *buf = 0; 
    854838 
    855         if( !nl80211_get_signal(ifname, &signal) ) 
     839        if (!nl80211_get_signal(ifname, &signal)) 
    856840        { 
    857841            /* A positive signal level is usually just a quality 
    858842             * value, pass through as-is */ 
    859             if( signal >= 0 ) 
     843            if (signal >= 0) 
    860844            { 
    861845                *buf = signal; 
     
    867851            else 
    868852            { 
    869                 if( signal < -110 ) 
     853                if (signal < -110) 
    870854                    signal = -110; 
    871                 else if( signal > -40 ) 
     855                else if (signal > -40) 
    872856                    signal = -40; 
    873857 
     
    882866int nl80211_get_quality_max(const char *ifname, int *buf) 
    883867{ 
    884     if( wext_get_quality_max(ifname, buf) ) 
     868    if (wext_get_quality_max(ifname, buf)) 
    885869        /* The cfg80211 wext compat layer assumes a maximum 
    886870         * quality of 70 */ 
     
    897881    struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf; 
    898882 
     883    /* WPA supplicant */ 
     884    if( (res = nl80211_wpactl_info(ifname, "STATUS", NULL)) && 
     885        (val = nl80211_getval(NULL, res, "pairwise_cipher")) ) 
     886    { 
     887        /* WEP */ 
     888        if (strstr(val, "WEP")) 
     889        { 
     890            if (strstr(val, "WEP-40")) 
     891                c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
     892 
     893            else if (strstr(val, "WEP-104")) 
     894                c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
     895 
     896            c->enabled       = 1; 
     897            c->group_ciphers = c->pair_ciphers; 
     898 
     899            c->auth_suites |= IWINFO_KMGMT_NONE; 
     900            c->auth_algs   |= IWINFO_AUTH_OPEN; /* XXX: assumption */ 
     901        } 
     902 
     903        /* WPA */ 
     904        else 
     905        { 
     906            if (strstr(val, "TKIP")) 
     907                c->pair_ciphers |= IWINFO_CIPHER_TKIP; 
     908 
     909            else if (strstr(val, "CCMP")) 
     910                c->pair_ciphers |= IWINFO_CIPHER_CCMP; 
     911 
     912            else if (strstr(val, "NONE")) 
     913                c->pair_ciphers |= IWINFO_CIPHER_NONE; 
     914 
     915            else if (strstr(val, "WEP-40")) 
     916                c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
     917 
     918            else if (strstr(val, "WEP-104")) 
     919                c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
     920 
     921 
     922            if ((val = nl80211_getval(NULL, res, "group_cipher"))) 
     923            { 
     924                if (strstr(val, "TKIP")) 
     925                    c->group_ciphers |= IWINFO_CIPHER_TKIP; 
     926 
     927                else if (strstr(val, "CCMP")) 
     928                    c->group_ciphers |= IWINFO_CIPHER_CCMP; 
     929 
     930                else if (strstr(val, "NONE")) 
     931                    c->group_ciphers |= IWINFO_CIPHER_NONE; 
     932 
     933                else if (strstr(val, "WEP-40")) 
     934                    c->group_ciphers |= IWINFO_CIPHER_WEP40; 
     935 
     936                else if (strstr(val, "WEP-104")) 
     937                    c->group_ciphers |= IWINFO_CIPHER_WEP104; 
     938            } 
     939 
     940 
     941            if ((val = nl80211_getval(NULL, res, "key_mgmt"))) 
     942            { 
     943                if (strstr(val, "WPA2")) 
     944                    c->wpa_version = 2; 
     945 
     946                else if (strstr(val, "WPA")) 
     947                    c->wpa_version = 1; 
     948 
     949 
     950                if (strstr(val, "PSK")) 
     951                    c->auth_suites |= IWINFO_KMGMT_PSK; 
     952 
     953                else if (strstr(val, "EAP") || strstr(val, "802.1X")) 
     954                    c->auth_suites |= IWINFO_KMGMT_8021x; 
     955 
     956                else if (strstr(val, "NONE")) 
     957                    c->auth_suites |= IWINFO_KMGMT_NONE; 
     958            } 
     959 
     960            c->enabled = (c->wpa_version && c->auth_suites) ? 1 : 0; 
     961        } 
     962 
     963        return 0; 
     964    } 
     965 
    899966    /* Hostapd */ 
    900     if( (res = nl80211_hostapd_info(ifname)) ) 
    901     { 
    902         if( (val = nl80211_getval(ifname, res, "wpa")) != NULL ) 
     967    else if ((res = nl80211_hostapd_info(ifname))) 
     968    { 
     969        if ((val = nl80211_getval(ifname, res, "wpa")) != NULL) 
    903970            c->wpa_version = atoi(val); 
    904971 
    905972        val = nl80211_getval(ifname, res, "wpa_key_mgmt"); 
    906973 
    907         if( !val || strstr(val, "PSK") ) 
     974        if (!val || strstr(val, "PSK")) 
    908975            c->auth_suites |= IWINFO_KMGMT_PSK; 
    909976 
    910         if( val && strstr(val, "EAP") ) 
     977        if (val && strstr(val, "EAP")) 
    911978            c->auth_suites |= IWINFO_KMGMT_8021x; 
    912979 
    913         if( val && strstr(val, "NONE") ) 
     980        if (val && strstr(val, "NONE")) 
    914981            c->auth_suites |= IWINFO_KMGMT_NONE; 
    915982 
    916         if( (val = nl80211_getval(ifname, res, "wpa_pairwise")) != NULL ) 
    917         { 
    918             if( strstr(val, "TKIP") ) 
     983        if ((val = nl80211_getval(ifname, res, "wpa_pairwise")) != NULL) 
     984        { 
     985            if (strstr(val, "TKIP")) 
    919986                c->pair_ciphers |= IWINFO_CIPHER_TKIP; 
    920987 
    921             if( strstr(val, "CCMP") ) 
     988            if (strstr(val, "CCMP")) 
    922989                c->pair_ciphers |= IWINFO_CIPHER_CCMP; 
    923990 
    924             if( strstr(val, "NONE") ) 
     991            if (strstr(val, "NONE")) 
    925992                c->pair_ciphers |= IWINFO_CIPHER_NONE; 
    926993        } 
    927994 
    928         if( (val = nl80211_getval(ifname, res, "auth_algs")) != NULL ) 
     995        if ((val = nl80211_getval(ifname, res, "auth_algs")) != NULL) 
    929996        { 
    930997            switch(atoi(val)) { 
     
    9501017                snprintf(k, sizeof(k), "wep_key%d", i); 
    9511018 
    952                 if( (val = nl80211_getval(ifname, res, k)) ) 
     1019                if ((val = nl80211_getval(ifname, res, k))) 
    9531020                { 
    954                     if( (strlen(val) == 5) || (strlen(val) == 10) ) 
     1021                    if ((strlen(val) == 5) || (strlen(val) == 10)) 
    9551022                        c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
    9561023 
    957                     else if( (strlen(val) == 13) || (strlen(val) == 26) ) 
     1024                    else if ((strlen(val) == 13) || (strlen(val) == 26)) 
    9581025                        c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
    9591026                } 
     
    9671034    } 
    9681035 
    969     /* WPA supplicant */ 
    970     else if( (res = nl80211_wpactl_info(ifname, "STATUS", NULL)) && 
    971              (val = nl80211_getval(NULL, res, "pairwise_cipher")) ) 
    972     { 
    973         /* WEP */ 
    974         if( strstr(val, "WEP") ) 
    975         { 
    976             if( strstr(val, "WEP-40") ) 
    977                 c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
    978  
    979             else if( strstr(val, "WEP-104") ) 
    980                 c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
    981  
    982             c->enabled       = 1; 
    983             c->group_ciphers = c->pair_ciphers; 
    984  
    985             c->auth_suites |= IWINFO_KMGMT_NONE; 
    986             c->auth_algs   |= IWINFO_AUTH_OPEN; /* XXX: assumption */ 
    987         } 
    988  
    989         /* WPA */ 
    990         else 
    991         { 
    992             if( strstr(val, "TKIP") ) 
    993                 c->pair_ciphers |= IWINFO_CIPHER_TKIP; 
    994  
    995             else if( strstr(val, "CCMP") ) 
    996                 c->pair_ciphers |= IWINFO_CIPHER_CCMP; 
    997  
    998             else if( strstr(val, "NONE") ) 
    999                 c->pair_ciphers |= IWINFO_CIPHER_NONE; 
    1000  
    1001             else if( strstr(val, "WEP-40") ) 
    1002                 c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
    1003  
    1004             else if( strstr(val, "WEP-104") ) 
    1005                 c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
    1006  
    1007  
    1008             if( (val = nl80211_getval(NULL, res, "group_cipher")) ) 
    1009             { 
    1010                 if( strstr(val, "TKIP") ) 
    1011                     c->group_ciphers |= IWINFO_CIPHER_TKIP; 
    1012  
    1013                 else if( strstr(val, "CCMP") ) 
    1014                     c->group_ciphers |= IWINFO_CIPHER_CCMP; 
    1015  
    1016                 else if( strstr(val, "NONE") ) 
    1017                     c->group_ciphers |= IWINFO_CIPHER_NONE; 
    1018  
    1019                 else if( strstr(val, "WEP-40") ) 
    1020                     c->group_ciphers |= IWINFO_CIPHER_WEP40; 
    1021  
    1022                 else if( strstr(val, "WEP-104") ) 
    1023                     c->group_ciphers |= IWINFO_CIPHER_WEP104; 
    1024             } 
    1025  
    1026  
    1027             if( (val = nl80211_getval(NULL, res, "key_mgmt")) ) 
    1028             { 
    1029                 if( strstr(val, "WPA2") ) 
    1030                     c->wpa_version = 2; 
    1031  
    1032                 else if( strstr(val, "WPA") ) 
    1033                     c->wpa_version = 1; 
    1034  
    1035  
    1036                 if( strstr(val, "PSK") ) 
    1037                     c->auth_suites |= IWINFO_KMGMT_PSK; 
    1038  
    1039                 else if( strstr(val, "EAP") || strstr(val, "802.1X") ) 
    1040                     c->auth_suites |= IWINFO_KMGMT_8021x; 
    1041  
    1042                 else if( strstr(val, "NONE") ) 
    1043                     c->auth_suites |= IWINFO_KMGMT_NONE; 
    1044             } 
    1045  
    1046             c->enabled = (c->wpa_version && c->auth_suites) ? 1 : 0; 
    1047         } 
    1048  
    1049         return 0; 
    1050     } 
    1051  
    10521036    return -1; 
    10531037} 
     
    10561040static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg) 
    10571041{ 
    1058     struct nl80211_assoc_count *ac = arg; 
    1059     struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); 
    1060     struct nlattr *attr[NL80211_ATTR_MAX + 1]; 
     1042    struct nl80211_array_buf *arr = arg; 
     1043    struct iwinfo_assoclist_entry *e = arr->buf; 
     1044    struct nlattr **attr = nl80211_parse(msg); 
    10611045    struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1]; 
    10621046 
     
    10741058    }; 
    10751059 
    1076     nla_parse(attr, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), 
    1077         genlmsg_attrlen(gnlh, 0), NULL); 
    1078  
    1079     if( attr[NL80211_ATTR_MAC] ) 
    1080         memcpy(ac->entry->mac, nla_data(attr[NL80211_ATTR_MAC]), 6); 
    1081  
    1082     if( attr[NL80211_ATTR_STA_INFO] ) 
    1083     { 
    1084         if( !nla_parse_nested(sinfo, NL80211_STA_INFO_MAX, 
    1085                 attr[NL80211_ATTR_STA_INFO], stats_policy) ) 
    1086         { 
    1087             if( sinfo[NL80211_STA_INFO_SIGNAL] ) 
    1088                 ac->entry->signal = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]); 
    1089         } 
    1090     } 
    1091  
    1092     ac->entry->noise = ac->noise; 
    1093     ac->entry++; 
    1094     ac->count++; 
     1060    /* advance to end of array */ 
     1061    e += arr->count; 
     1062 
     1063    if (attr[NL80211_ATTR_MAC]) 
     1064        memcpy(e->mac, nla_data(attr[NL80211_ATTR_MAC]), 6); 
     1065 
     1066    if (attr[NL80211_ATTR_STA_INFO]) 
     1067    { 
     1068        if (!nla_parse_nested(sinfo, NL80211_STA_INFO_MAX, 
     1069                attr[NL80211_ATTR_STA_INFO], stats_policy)) 
     1070        { 
     1071            if (sinfo[NL80211_STA_INFO_SIGNAL]) 
     1072                e->signal = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]); 
     1073        } 
     1074    } 
     1075 
     1076    e->noise = 0; /* filled in by caller */ 
     1077    arr->count++; 
    10951078 
    10961079    return NL_SKIP; 
     
    11001083{ 
    11011084    DIR *d; 
     1085    int i, noise = 0; 
    11021086    struct dirent *de; 
    1103     struct nl80211_assoc_count ac; 
    11041087    struct nl80211_msg_conveyor *req; 
     1088    struct nl80211_array_buf arr = { .buf = buf, .count = 0 }; 
     1089    struct iwinfo_assoclist_entry *e; 
    11051090 
    11061091    if ((d = opendir("/sys/class/net")) != NULL) 
    11071092    { 
    1108         ac.count = 0; 
    1109         ac.entry = (struct iwinfo_assoclist_entry *)buf; 
    1110  
    1111         nl80211_get_noise(ifname, &ac.noise); 
    1112  
    11131093        while ((de = readdir(d)) != NULL) 
    11141094        { 
     
    11221102                if (req) 
    11231103                { 
    1124                     nl80211_cb(req, nl80211_get_assoclist_cb, &ac); 
    1125                     nl80211_send(req); 
     1104                    nl80211_send(req, nl80211_get_assoclist_cb, &arr); 
    11261105                    nl80211_free(req); 
    11271106                } 
     1107 
     1108                break; 
    11281109            } 
    11291110        } 
     
    11311112        closedir(d); 
    11321113 
    1133         *len = (ac.count * sizeof(struct iwinfo_assoclist_entry)); 
     1114        if (!nl80211_get_noise(ifname, &noise)) 
     1115            for (i = 0, e = arr.buf; i < arr.count; i++, e++) 
     1116                e->noise = noise; 
     1117 
     1118        *len = (arr.count * sizeof(struct iwinfo_assoclist_entry)); 
    11341119        return 0; 
    11351120    } 
     
    11381123} 
    11391124 
    1140 int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len) 
    1141 { 
     1125static int nl80211_get_txpwrlist_cb(struct nl_msg *msg, void *arg) 
     1126{ 
     1127    int *dbm_max = arg; 
    11421128    int ch_cur, ch_cmp, bands_remain, freqs_remain; 
    1143     int dbm_max = -1, dbm_cur, dbm_cnt; 
    1144     struct nl80211_msg_conveyor *req, *res; 
     1129 
     1130    struct nlattr **attr = nl80211_parse(msg); 
    11451131    struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1]; 
    11461132    struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1]; 
    11471133    struct nlattr *band, *freq; 
    1148     struct iwinfo_txpwrlist_entry entry; 
    11491134 
    11501135    static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { 
     
    11571142    }; 
    11581143 
    1159     if( nl80211_get_channel(ifname, &ch_cur) ) 
     1144    ch_cur = *dbm_max; /* value int* is initialized with channel by caller */ 
     1145    *dbm_max = -1; 
     1146 
     1147    nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
     1148    { 
     1149        nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
     1150              nla_len(band), NULL); 
     1151 
     1152        nla_for_each_nested(freq, 
     1153            bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
     1154        { 
     1155            nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
     1156                nla_data(freq), nla_len(freq), freq_policy); 
     1157 
     1158            ch_cmp = nl80211_freq2channel( 
     1159                nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ])); 
     1160 
     1161            if( (!ch_cur || (ch_cmp == ch_cur)) && 
     1162                freqs[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] ) 
     1163            { 
     1164                *dbm_max = (int)(0.01 * nla_get_u32( 
     1165                    freqs[NL80211_FREQUENCY_ATTR_MAX_TX_POWER])); 
     1166 
     1167                break; 
     1168            } 
     1169        } 
     1170    } 
     1171 
     1172    return NL_SKIP; 
     1173} 
     1174 
     1175int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len) 
     1176{ 
     1177    int ch_cur; 
     1178    int dbm_max = -1, dbm_cur, dbm_cnt; 
     1179    struct nl80211_msg_conveyor *req; 
     1180    struct iwinfo_txpwrlist_entry entry; 
     1181 
     1182    if (nl80211_get_channel(ifname, &ch_cur)) 
    11601183        ch_cur = 0; 
    11611184 
    11621185    req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0); 
    1163     if( req ) 
    1164     { 
    1165         res = nl80211_send(req); 
    1166         if( res ) 
    1167         { 
    1168             nla_for_each_nested(band, 
    1169                 res->attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
    1170             { 
    1171                 nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
    1172                       nla_len(band), NULL); 
    1173  
    1174                 nla_for_each_nested(freq, 
    1175                     bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
    1176                 { 
    1177                     nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
    1178                         nla_data(freq), nla_len(freq), freq_policy); 
    1179  
    1180                     ch_cmp = nl80211_freq2channel( 
    1181                         nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ])); 
    1182  
    1183                     if( (!ch_cur || (ch_cmp == ch_cur)) && 
    1184                         freqs[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] ) 
    1185                     { 
    1186                         dbm_max = (int)(0.01 * nla_get_u32( 
    1187                             freqs[NL80211_FREQUENCY_ATTR_MAX_TX_POWER])); 
    1188  
    1189                         break; 
    1190                     } 
    1191                 } 
    1192             } 
    1193  
    1194             nl80211_free(res); 
    1195         } 
     1186    if (req) 
     1187    { 
     1188        /* initialize the value pointer with channel for callback */ 
     1189        dbm_max = ch_cur; 
     1190 
     1191        nl80211_send(req, nl80211_get_txpwrlist_cb, &dbm_max); 
    11961192        nl80211_free(req); 
    11971193    } 
    11981194 
    1199     if( dbm_max > -1 ) 
    1200     { 
    1201         for( dbm_cur = 0, dbm_cnt = 0; 
     1195    if (dbm_max > -1) 
     1196    { 
     1197        for (dbm_cur = 0, dbm_cnt = 0; 
    12021198             dbm_cur < dbm_max; 
    1203              dbm_cur++, dbm_cnt++ ) 
     1199             dbm_cur++, dbm_cnt++) 
    12041200        { 
    12051201            entry.dbm = dbm_cur; 
     
    12251221    struct iwinfo_crypto_entry *c) 
    12261222{ 
    1227     if( strstr(spec, "WPA") || strstr(spec, "WEP") ) 
     1223    if (strstr(spec, "WPA") || strstr(spec, "WEP")) 
    12281224    { 
    12291225        c->enabled = 1; 
    12301226 
    1231         if( strstr(spec, "WPA2-") && strstr(spec, "WPA-") ) 
     1227        if (strstr(spec, "WPA2-") && strstr(spec, "WPA-")) 
    12321228            c->wpa_version = 3; 
    12331229 
    1234         else if( strstr(spec, "WPA2") ) 
     1230        else if (strstr(spec, "WPA2")) 
    12351231            c->wpa_version = 2; 
    12361232 
    1237         else if( strstr(spec, "WPA") ) 
     1233        else if (strstr(spec, "WPA")) 
    12381234            c->wpa_version = 1; 
    12391235 
    1240         else if( strstr(spec, "WEP") ) 
     1236        else if (strstr(spec, "WEP")) 
    12411237            c->auth_algs = IWINFO_AUTH_OPEN | IWINFO_AUTH_SHARED; 
    12421238 
    12431239 
    1244         if( strstr(spec, "PSK") ) 
     1240        if (strstr(spec, "PSK")) 
    12451241            c->auth_suites |= IWINFO_KMGMT_PSK; 
    12461242 
    1247         if( strstr(spec, "802.1X") || strstr(spec, "EAP") ) 
     1243        if (strstr(spec, "802.1X") || strstr(spec, "EAP")) 
    12481244            c->auth_suites |= IWINFO_KMGMT_8021x; 
    12491245 
    1250         if( strstr(spec, "WPA-NONE") ) 
     1246        if (strstr(spec, "WPA-NONE")) 
    12511247            c->auth_suites |= IWINFO_KMGMT_NONE; 
    12521248 
    12531249 
    1254         if( strstr(spec, "TKIP") ) 
     1250        if (strstr(spec, "TKIP")) 
    12551251            c->pair_ciphers |= IWINFO_CIPHER_TKIP; 
    12561252 
    1257         if( strstr(spec, "CCMP") ) 
     1253        if (strstr(spec, "CCMP")) 
    12581254            c->pair_ciphers |= IWINFO_CIPHER_CCMP; 
    12591255 
    1260         if( strstr(spec, "WEP-40") ) 
     1256        if (strstr(spec, "WEP-40")) 
    12611257            c->pair_ciphers |= IWINFO_CIPHER_WEP40; 
    12621258 
    1263         if( strstr(spec, "WEP-104") ) 
     1259        if (strstr(spec, "WEP-104")) 
    12641260            c->pair_ciphers |= IWINFO_CIPHER_WEP104; 
    12651261 
     
    12811277 
    12821278    /* Got a radioX pseudo interface, find some interface on it or create one */ 
    1283     if( !strncmp(ifname, "radio", 5) ) 
     1279    if (!strncmp(ifname, "radio", 5)) 
    12841280    { 
    12851281        /* Reuse existing interface */ 
    1286         if( (res = nl80211_phy2ifname(ifname)) != NULL ) 
     1282        if ((res = nl80211_phy2ifname(ifname)) != NULL) 
    12871283        { 
    12881284            return nl80211_get_scanlist(res, buf, len); 
     
    12901286 
    12911287        /* Need to spawn a temporary iface for scanning */ 
    1292         else if( (res = nl80211_ifadd(ifname)) != NULL ) 
     1288        else if ((res = nl80211_ifadd(ifname)) != NULL) 
    12931289        { 
    12941290            count = nl80211_get_scanlist(res, buf, len); 
     
    13011297 
    13021298    /* WPA supplicant */ 
    1303     if( (res = nl80211_wpactl_info(ifname, "SCAN", "CTRL-EVENT-SCAN-RESULTS")) ) 
    1304     { 
    1305         if( (res = nl80211_wpactl_info(ifname, "SCAN_RESULTS", NULL)) ) 
     1299    if ((res = nl80211_wpactl_info(ifname, "SCAN", "CTRL-EVENT-SCAN-RESULTS"))) 
     1300    { 
     1301        if ((res = nl80211_wpactl_info(ifname, "SCAN_RESULTS", NULL))) 
    13061302        { 
    13071303            nl80211_get_quality_max(ifname, &qmax); 
     
    13371333 
    13381334                /* Quality */ 
    1339                 if( rssi < 0 ) 
     1335                if (rssi < 0) 
    13401336                { 
    13411337                    /* The cfg80211 wext compat layer assumes a signal range 
    13421338                     * of -110 dBm to -40 dBm, the quality value is derived 
    13431339                     * by adding 110 to the signal level */ 
    1344                     if( rssi < -110 ) 
     1340                    if (rssi < -110) 
    13451341                        rssi = -110; 
    1346                     else if( rssi > -40 ) 
     1342                    else if (rssi > -40) 
    13471343                        rssi = -40; 
    13481344 
     
    13801376    { 
    13811377        /* Got a temp interface, don't create yet another one */ 
    1382         if( !strncmp(ifname, "tmp.", 4) ) 
    1383         { 
    1384             if( !iwinfo_ifup(ifname) ) 
     1378        if (!strncmp(ifname, "tmp.", 4)) 
     1379        { 
     1380            if (!iwinfo_ifup(ifname)) 
    13851381                return -1; 
    13861382 
     
    13931389        else 
    13941390        { 
    1395             if( !(res = nl80211_ifadd(ifname)) ) 
     1391            if (!(res = nl80211_ifadd(ifname))) 
    13961392                goto out; 
    13971393 
    1398             if( !iwinfo_ifmac(res) ) 
     1394            if (!iwinfo_ifmac(res)) 
    13991395                goto out; 
    14001396 
    14011397            /* if we can take the new interface up, the driver supports an 
    14021398             * additional interface and there's no need to tear down the ap */ 
    1403             if( iwinfo_ifup(res) ) 
     1399            if (iwinfo_ifup(res)) 
    14041400            { 
    14051401                wext_get_scanlist(res, buf, len); 
     
    14091405            /* driver cannot create secondary interface, take down ap 
    14101406             * during scan */ 
    1411             else if( iwinfo_ifdown(ifname) && iwinfo_ifup(res) ) 
     1407            else if (iwinfo_ifdown(ifname) && iwinfo_ifup(res)) 
    14121408            { 
    14131409                wext_get_scanlist(res, buf, len); 
     
    14261422} 
    14271423 
    1428 int nl80211_get_freqlist(const char *ifname, char *buf, int *len) 
    1429 { 
    1430     int count = 0, bands_remain, freqs_remain; 
    1431     struct nl80211_msg_conveyor *req, *res; 
     1424static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg) 
     1425{ 
     1426    int bands_remain, freqs_remain; 
     1427 
     1428    struct nl80211_array_buf *arr = arg; 
     1429    struct iwinfo_freqlist_entry *e = arr->buf; 
     1430 
     1431    struct nlattr **attr = nl80211_parse(msg); 
    14321432    struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1]; 
    14331433    struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1]; 
    14341434    struct nlattr *band, *freq; 
    1435     struct iwinfo_freqlist_entry *e = (struct iwinfo_freqlist_entry *)buf; 
     1435 
     1436    static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { 
     1437        [NL80211_FREQUENCY_ATTR_FREQ]         = { .type = NLA_U32  }, 
     1438        [NL80211_FREQUENCY_ATTR_DISABLED]     = { .type = NLA_FLAG }, 
     1439        [NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG }, 
     1440        [NL80211_FREQUENCY_ATTR_NO_IBSS]      = { .type = NLA_FLAG }, 
     1441        [NL80211_FREQUENCY_ATTR_RADAR]        = { .type = NLA_FLAG }, 
     1442        [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32  }, 
     1443    }; 
     1444 
     1445    nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
     1446    { 
     1447        nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
     1448            nla_len(band), NULL); 
     1449 
     1450        nla_for_each_nested(freq, 
     1451            bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
     1452        { 
     1453            nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
     1454                nla_data(freq), nla_len(freq), NULL); 
     1455 
     1456            if( !freqs[NL80211_FREQUENCY_ATTR_FREQ] || 
     1457                freqs[NL80211_FREQUENCY_ATTR_DISABLED] ) 
     1458                continue; 
     1459 
     1460            e->mhz = nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]); 
     1461            e->channel = nl80211_freq2channel(e->mhz); 
     1462 
     1463            e->restricted = ( 
     1464                freqs[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] || 
     1465                freqs[NL80211_FREQUENCY_ATTR_NO_IBSS]      || 
     1466                freqs[NL80211_FREQUENCY_ATTR_RADAR] 
     1467            ) ? 1 : 0; 
     1468 
     1469            e++; 
     1470            arr->count++; 
     1471        } 
     1472    } 
     1473 
     1474    return NL_SKIP; 
     1475} 
     1476 
     1477int nl80211_get_freqlist(const char *ifname, char *buf, int *len) 
     1478{ 
     1479    struct nl80211_msg_conveyor *req; 
     1480    struct nl80211_array_buf arr = { .buf = buf, .count = 0 }; 
    14361481 
    14371482    req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0); 
    1438     if( req ) 
    1439     { 
    1440         res = nl80211_send(req); 
    1441         if( res && res->attr[NL80211_ATTR_WIPHY_BANDS] ) 
    1442         { 
    1443             nla_for_each_nested(band, 
    1444                 res->attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
    1445             { 
    1446                 nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
    1447                       nla_len(band), NULL); 
    1448  
    1449                 nla_for_each_nested(freq, 
    1450                     bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
    1451                 { 
    1452                     nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
    1453                         nla_data(freq), nla_len(freq), NULL); 
    1454  
    1455                     if( !freqs[NL80211_FREQUENCY_ATTR_FREQ] || 
    1456                         freqs[NL80211_FREQUENCY_ATTR_DISABLED] ) 
    1457                         continue; 
    1458  
    1459                     e->mhz = nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]); 
    1460                     e->channel = nl80211_freq2channel(e->mhz); 
    1461  
    1462                     e->restricted = ( 
    1463                         freqs[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] || 
    1464                         freqs[NL80211_FREQUENCY_ATTR_NO_IBSS]      || 
    1465                         freqs[NL80211_FREQUENCY_ATTR_RADAR] 
    1466                     ) ? 1 : 0; 
    1467  
    1468                     e++; 
    1469                     count++; 
    1470                 } 
    1471             } 
    1472             nl80211_free(res); 
    1473         } 
     1483    if (req) 
     1484    { 
     1485        nl80211_send(req, nl80211_get_freqlist_cb, &arr); 
    14741486        nl80211_free(req); 
    14751487    } 
    14761488 
    1477     if( count > 0 ) 
    1478     { 
    1479         *len = count * sizeof(struct iwinfo_freqlist_entry); 
     1489    if (arr.count > 0) 
     1490    { 
     1491        *len = arr.count * sizeof(struct iwinfo_freqlist_entry); 
    14801492        return 0; 
    14811493    } 
     
    14841496} 
    14851497 
     1498static int nl80211_get_country_cb(struct nl_msg *msg, void *arg) 
     1499{ 
     1500    char *buf = arg; 
     1501    struct nlattr **attr = nl80211_parse(msg); 
     1502 
     1503    if (attr[NL80211_ATTR_REG_ALPHA2]) 
     1504        memcpy(buf, nla_data(attr[NL80211_ATTR_REG_ALPHA2]), 2); 
     1505    else 
     1506        buf[0] = 0; 
     1507 
     1508    return NL_SKIP; 
     1509} 
     1510 
    14861511int nl80211_get_country(const char *ifname, char *buf) 
    14871512{ 
    14881513    int rv = -1; 
    1489     struct nl80211_msg_conveyor *req, *res; 
     1514    struct nl80211_msg_conveyor *req; 
    14901515 
    14911516    req = nl80211_msg(ifname, NL80211_CMD_GET_REG, 0); 
    1492     if( req ) 
    1493     { 
    1494         res = nl80211_send(req); 
    1495         if( res ) 
    1496         { 
    1497             if( res->attr[NL80211_ATTR_REG_ALPHA2] ) 
    1498             { 
    1499                 memcpy(buf, nla_data(res->attr[NL80211_ATTR_REG_ALPHA2]), 2); 
    1500                 rv = 0; 
    1501             } 
    1502             nl80211_free(res); 
    1503         } 
     1517    if (req) 
     1518    { 
     1519        nl80211_send(req, nl80211_get_country_cb, buf); 
    15041520        nl80211_free(req); 
     1521 
     1522        if (buf[0]) 
     1523            rv = 0; 
    15051524    } 
    15061525 
     
    15251544} 
    15261545 
    1527 int nl80211_get_hwmodelist(const char *ifname, int *buf) 
    1528 { 
     1546static int nl80211_get_hwmodelist_cb(struct nl_msg *msg, void *arg) 
     1547{ 
     1548    int *modes = arg; 
    15291549    int bands_remain, freqs_remain; 
    1530     struct nl80211_msg_conveyor *req, *res; 
     1550    uint16_t caps = 0; 
     1551    struct nlattr **attr = nl80211_parse(msg); 
    15311552    struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1]; 
    15321553    struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1]; 
    15331554    struct nlattr *band, *freq; 
    1534     uint16_t caps = 0; 
    1535  
    1536     req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0); 
    1537     if( req ) 
    1538     { 
    1539         res = nl80211_send(req); 
    1540         if( res && res->attr[NL80211_ATTR_WIPHY_BANDS] ) 
    1541         { 
    1542             nla_for_each_nested(band, 
    1543                 res->attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
     1555 
     1556    *modes = 0; 
     1557 
     1558    if (attr[NL80211_ATTR_WIPHY_BANDS]) 
     1559    { 
     1560        nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) 
     1561        { 
     1562            nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
     1563                nla_len(band), NULL); 
     1564 
     1565            if (bands[NL80211_BAND_ATTR_HT_CAPA]) 
     1566                caps = nla_get_u16(bands[NL80211_BAND_ATTR_HT_CAPA]); 
     1567 
     1568            /* Treat any nonzero capability as 11n */ 
     1569            if (caps > 0) 
     1570                *modes |= IWINFO_80211_N; 
     1571 
     1572            nla_for_each_nested(freq, 
     1573                bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
    15441574            { 
    1545                 nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), 
    1546                       nla_len(band), NULL); 
    1547  
    1548                 if( bands[NL80211_BAND_ATTR_HT_CAPA] ) 
    1549                     caps = nla_get_u16(bands[NL80211_BAND_ATTR_HT_CAPA]); 
    1550  
    1551                 /* Treat any nonzero capability as 11n */ 
    1552                 if( caps > 0 ) 
    1553                     *buf |= IWINFO_80211_N; 
    1554  
    1555                 nla_for_each_nested(freq, 
    1556                     bands[NL80211_BAND_ATTR_FREQS], freqs_remain) 
     1575                nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
     1576                    nla_data(freq), nla_len(freq), NULL); 
     1577 
     1578                if (!freqs[NL80211_FREQUENCY_ATTR_FREQ]) 
     1579                    continue; 
     1580 
     1581                if (nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]) < 2485) 
    15571582                { 
    1558                     nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX, 
    1559                         nla_data(freq), nla_len(freq), NULL); 
    1560  
    1561                     if( !freqs[NL80211_FREQUENCY_ATTR_FREQ] ) 
    1562                         continue; 
    1563  
    1564                     if( nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]) < 2485 ) 
    1565                     { 
    1566                         *buf |= IWINFO_80211_B; 
    1567                         *buf |= IWINFO_80211_G; 
    1568                     } 
    1569                     else 
    1570                     { 
    1571                         *buf |= IWINFO_80211_A; 
    1572                     } 
     1583                    *modes |= IWINFO_80211_B; 
     1584                    *modes |= IWINFO_80211_G; 
     1585                } 
     1586                else 
     1587                { 
     1588                    *modes |= IWINFO_80211_A; 
    15731589                } 
    15741590            } 
    1575             nl80211_free(res); 
    1576         } 
     1591        } 
     1592    } 
     1593 
     1594    return NL_SKIP; 
     1595} 
     1596 
     1597int nl80211_get_hwmodelist(const char *ifname, int *buf) 
     1598{ 
     1599    struct nl80211_msg_conveyor *req; 
     1600 
     1601    req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0); 
     1602    if (req) 
     1603    { 
     1604        nl80211_send(req, nl80211_get_hwmodelist_cb, buf); 
    15771605        nl80211_free(req); 
    15781606    } 
     
    15861614    char *nif = nl80211_ifadd(ifname); 
    15871615 
    1588     if( nif ) 
     1616    if (nif) 
    15891617    { 
    15901618        *buf = (iwinfo_ifmac(nif) && iwinfo_ifup(nif)); 
  • luci/branches/luci-0.10/contrib/package/iwinfo/src/iwinfo_nl80211.h

    r6334 r7810  
    4343 
    4444struct nl80211_msg_conveyor { 
    45     int custom_cb; 
    4645    struct nl_msg *msg; 
    4746    struct nl_cb *cb; 
    48     struct genlmsghdr *hdr; 
    49     struct nlattr *attr[NL80211_ATTR_MAX + 1]; 
    5047}; 
    5148 
     
    5552}; 
    5653 
    57 struct nl80211_assoc_count { 
    58     struct iwinfo_assoclist_entry *entry; 
    59     int noise; 
     54struct nl80211_array_buf { 
     55    void *buf; 
    6056    int count; 
    6157}; 
  • luci/branches/luci-0.10/contrib/package/luci/Makefile

    r7228 r7810  
    5454  URL:=http://luci.subsignal.org/ 
    5555  MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    56   SUBMENU:=Libraries 
     56  SUBMENU:=8. Libraries 
    5757  DEPENDS:=+lua +libuci-lua 
    5858  TITLE:=LuCI core libraries 
     
    115115    URL:=http://luci.subsignal.org/ 
    116116    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    117     SUBMENU:=Libraries 
     117    SUBMENU:=8. Libraries 
    118118    TITLE:=$(if $(2),$(2),LuCI $(1) library) 
    119119    $(if $(3),DEPENDS:=+luci-lib-core $(3)) 
     
    188188 
    189189 
     190### Protocols ### 
     191define protocol 
     192  define Package/luci-proto-$(1) 
     193    SECTION:=luci 
     194    CATEGORY:=LuCI 
     195    TITLE:=LuCI - Lua Configuration Interface 
     196    URL:=http://luci.subsignal.org/ 
     197    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
     198    SUBMENU:=6. Protocols 
     199    TITLE:=$(if $(2),$(2),LuCI $(1) protocol support) 
     200    DEPENDS:=$(3) 
     201  endef 
     202 
     203  define Package/luci-proto-$(1)/install 
     204    $(call Package/luci/install/template,$$(1),protocols/$(1)) 
     205  endef 
     206 
     207  ifneq ($(CONFIG_PACKAGE_luci-proto-$(1)),) 
     208    LUCI_SELECTED_MODULES+=protocols/$(1) 
     209  endif 
     210 
     211  LUCI_BUILD_PACKAGES += luci-proto-$(1) 
     212endef 
     213 
     214$(eval $(call protocol,core,Support for static/dhcp/none)) 
     215$(eval $(call protocol,ppp,Support for PPP/PPPoE/PPPoA)) 
     216$(eval $(call protocol,pptp,Support for PPtP,+pptp)) 
     217$(eval $(call protocol,6x4,Support for 6in4/6to4,+6in4 +6to4)) 
     218$(eval $(call protocol,3g,Support for 3G,+comgt)) 
     219$(eval $(call protocol,relay,Support for relayd pseudo bridges,+relayd)) 
     220 
     221 
    190222### Community Packages ### 
    191223define Package/luci-mod-freifunk-community 
     
    195227  URL:=http://luci.subsignal.org/ 
    196228  MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    197   SUBMENU:=Freifunk 
     229  SUBMENU:=9. Freifunk 
    198230  TITLE:=Freifunk Community Meta-Package 
    199231  DEPENDS+= \ 
     
    202234   +PACKAGE_luci-mod-freifunk-community:olsrd-mod-txtinfo +PACKAGE_luci-mod-freifunk-community:olsrd-mod-nameservice \ 
    203235   +PACKAGE_luci-mod-freifunk-community:olsrd-mod-watchdog +PACKAGE_luci-mod-freifunk-community:kmod-tun \ 
    204    +PACKAGE_luci-mod-freifunk-community:ip +PACKAGE_luci-mod-freifunk-community:freifunk-watchdog +luci-app-olsr +luci-app-olsr-services 
     236   +PACKAGE_luci-mod-freifunk-community:ip +PACKAGE_luci-mod-freifunk-community:freifunk-watchdog +luci-app-olsr \ 
     237   +luci-app-olsr-services +freifunk-gwcheck +freifunk-mapupdate 
    205238endef 
    206239 
     
    224257    URL:=http://luci.subsignal.org/ 
    225258    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    226     SUBMENU:=Modules 
     259    SUBMENU:=2. Modules 
    227260    TITLE:=$(if $(2),$(2),LuCI $(1) module) 
    228261    $(if $(3),DEPENDS+=$(3)) 
     
    246279endef 
    247280 
    248 define Package/luci-mod-freifunk/conffiles 
    249 /etc/config/freifunk 
    250 endef 
    251  
    252 $(eval $(call module,admin-core,Web UI Core module,+luci-lib-web +luci-i18n-english)) 
     281$(eval $(call module,admin-core,Web UI Core module,+luci-lib-web +luci-proto-core +luci-i18n-english)) 
    253282$(eval $(call module,admin-mini,LuCI Essentials - stripped down and user-friendly,+luci-mod-admin-core @BROKEN)) 
    254283$(eval $(call module,admin-full,LuCI Administration - full-featured for full control,+luci-mod-admin-core +luci-lib-ipkg)) 
    255284$(eval $(call module,rpc,LuCI RPC - JSON-RPC API,+luci-lib-json)) 
    256 $(eval $(call module,freifunk,LuCI Freifunk module,+luci-mod-admin-full +luci-lib-json +PACKAGE_luci-mod-freifunk:freifunk-firewall)) 
     285$(eval $(call module,freifunk,LuCI Freifunk module,+luci-mod-admin-full +luci-lib-json +PACKAGE_luci-mod-freifunk:freifunk-firewall +freifunk-common +community-profiles)) 
    257286$(eval $(call module,niu,NIU - Next Generation Interface,+luci-mod-admin-core @BROKEN)) 
    258287 
     
    266295    URL:=http://luci.subsignal.org/ 
    267296    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    268     SUBMENU:=Applications 
     297    SUBMENU:=3. Applications 
    269298    TITLE:=$(if $(2),$(2),LuCI $(1) application) 
    270     DEPENDS:=+luci-mod-admin-core $(3) 
     299    DEPENDS:=$(3) 
    271300  endef 
    272301 
     
    296325 
    297326 
    298 $(eval $(call application,ffwizard,Freifunk configuration wizard,\ 
    299     +luci-mod-freifunk)) 
    300  
    301327$(eval $(call application,siitwizard,SIIT IPv4-over-IPv6 configuration wizard,\ 
    302328    +PACKAGE_luci-app-siitwizard:kmod-siit)) 
     
    306332 
    307333$(eval $(call application,freifunk-policyrouting,Policy routing for mesh traffic,\ 
    308         +PACKAGE_luci-app-freifunk-policyrouting:freifunk-policyrouting +luci-mod-freifunk)) 
     334        +PACKAGE_luci-app-freifunk-policyrouting:freifunk-policyrouting)) 
    309335 
    310336$(eval $(call application,meshwizard, Shellscript based wizard to setup mesh networks,\ 
    311         +meshwizard +luci-mod-freifunk)) 
     337        +PACKAGE_luci-app-freifunk-meshwizard:meshwizard)) 
    312338 
    313339$(eval $(call application,olsr,OLSR configuration and status module,\ 
    314     +luci-mod-admin-full +PACKAGE_luci-app-olsr:olsrd +PACKAGE_luci-app-olsr:olsrd-mod-txtinfo)) 
     340    +olsrd-mod-txtinfo)) 
    315341 
    316342$(eval $(call application,olsr-viz,OLSR Visualisation,\ 
    317     +PACKAGE_luci-app-olsr-viz:luci-app-olsr +PACKAGE_luci-app-olsr-viz:olsrd-mod-txtinfo)) 
     343    luci-app-olsr +olsrd-mod-txtinfo)) 
    318344 
    319345$(eval $(call application,olsr-services,Show services announced with the nameservice plugin,\ 
    320     +PACKAGE_luci-app-olsr-services:olsrd-mod-nameservice +luci-mod-freifunk +PACKAGE_luci-app-olsr-services:luci-app-olsr)) 
     346    luci-app-olsr +olsrd-mod-nameservice)) 
    321347 
    322348$(eval $(call application,qos,Quality of Service configuration module,\ 
     
    324350 
    325351$(eval $(call application,splash,Freifunk DHCP-Splash application,\ 
    326     +luci-lib-nixio +PACKAGE_luci-app-splash:tc \ 
    327     +PACKAGE_luci-app-splash:kmod-sched +PACKAGE_luci-app-splash:iptables-mod-nat-extra \ 
    328     +PACKAGE_luci-app-splash:iptables-mod-ipopt)) 
     352    +luci-lib-nixio +tc +kmod-sched +iptables-mod-nat-extra +iptables-mod-ipopt)) 
    329353 
    330354$(eval $(call application,statistics,LuCI Statistics Application,\ 
    331     +luci-mod-admin-full +PACKAGE_luci-app-statistics:collectd \ 
     355    +PACKAGE_luci-app-statistics:collectd \ 
    332356    +PACKAGE_luci-app-statistics:rrdtool1 \ 
    333357    +PACKAGE_luci-app-statistics:collectd-mod-rrdtool \ 
     
    351375 
    352376$(eval $(call application,voice-diag,LuCI Voice Software (Diagnostics),\ 
    353     +luci-app-voice-core +luci-app-diag-devinfo)) 
     377    luci-app-diag-devinfo)) 
    354378 
    355379$(eval $(call application,upnp,Universal Plug & Play configuration module,\ 
     
    363387 
    364388$(eval $(call application,samba,Network Shares - Samba SMB/CIFS module,\ 
    365     +luci-mod-admin-full +PACKAGE_luci-app-samba:samba3)) 
     389    +PACKAGE_luci-app-samba:samba3)) 
    366390 
    367391$(eval $(call application,mmc-over-gpio,MMC-over-GPIO configuration module,\ 
    368     +luci-mod-admin-full +PACKAGE_luci-app-mmc-over-gpio:kmod-mmc-over-gpio)) 
     392    +PACKAGE_luci-app-mmc-over-gpio:kmod-mmc-over-gpio)) 
    369393 
    370394$(eval $(call application,p910nd,p910nd - Printer server module,\ 
    371     +luci-mod-admin-full +PACKAGE_luci-app-p910nd:p910nd)) 
     395    +PACKAGE_luci-app-p910nd:p910nd)) 
    372396 
    373397$(eval $(call application,ushare,uShare - UPnP A/V & DLNA Media Server,\ 
    374     +luci-mod-admin-full +PACKAGE_luci-app-ushare:ushare)) 
     398    +PACKAGE_luci-app-ushare:ushare)) 
    375399 
    376400$(eval $(call application,hd-idle,Hard Disk Idle Spin-Down module,\ 
    377     +luci-mod-admin-full +PACKAGE_luci-app-hd-idle:hd-idle)) 
     401    +PACKAGE_luci-app-hd-idle:hd-idle)) 
    378402 
    379403$(eval $(call application,tinyproxy,Tinyproxy - HTTP(S)-Proxy configuration,\ 
    380     +luci-mod-admin-full +PACKAGE_luci-app-tinyproxy:tinyproxy)) 
     404    +PACKAGE_luci-app-tinyproxy:tinyproxy)) 
    381405 
    382406$(eval $(call application,polipo,LuCI Support for the Polipo Proxy,\ 
     
    387411 
    388412$(eval $(call application,p2pblock,LuCI Support for the Freifunk P2P-Block addon,\ 
    389     +luci-app-firewall +PACKAGE_luci-app-p2pblock:freifunk-p2pblock)) 
     413    luci-app-firewall +PACKAGE_luci-app-p2pblock:freifunk-p2pblock)) 
    390414 
    391415$(eval $(call application,multiwan,LuCI Support for the OpenWrt MultiWAN agent,\ 
    392     +luci-app-firewall +PACKAGE_luci-app-multiwan:multiwan)) 
     416    luci-app-firewall +PACKAGE_luci-app-multiwan:multiwan)) 
    393417 
    394418$(eval $(call application,wol,LuCI Support for Wake-on-LAN,\ 
     
    400424 
    401425$(eval $(call application,radvd,LuCI Support for Radvd,\ 
    402     +luci-mod-admin-full +PACKAGE_luci-app-radvd:radvd)) 
     426    +PACKAGE_luci-app-radvd:radvd)) 
    403427 
    404428$(eval $(call application,ahcp,LuCI Support for AHCPd,\ 
    405     +luci-mod-admin-full +PACKAGE_luci-app-ahcp:ahcpd)) 
     429    +PACKAGE_luci-app-ahcp:ahcpd)) 
     430 
     431$(eval $(call application,wshaper,LuCI Support for wshaper,\ 
     432    +PACKAGE_luci-app-wshaper:wshaper)) 
    406433 
    407434$(eval $(call application,lqtapifoss,Lantiq voip)) 
     
    415442    URL:=http://luci.subsignal.org/ 
    416443    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    417     SUBMENU:=Server Interfaces 
     444    SUBMENU:=7. Server Interfaces 
    418445    TITLE:=$(if $(2),$(2),LuCI $(1) server gateway interface) 
    419     $(if $(3),DEPENDS:=$(3)) 
     446    DEPENDS:=$(3) 
    420447  endef 
    421448 
     
    442469    TITLE:=LuCI - Lua Configuration Interface 
    443470    URL:=http://luci.subsignal.org/ 
    444     SUBMENU:=Themes 
     471    SUBMENU:=4. Themes 
    445472    TITLE:=$(if $(2),$(2),LuCI $(1) theme) 
    446473    MAINTAINER:=$(if $(3),$(3),LuCI Development Team <luci@lists.subsignal.org>) 
     
    460487endef 
    461488 
    462 $(eval $(call theme,base,Common base for all themes,,+luci-lib-web)) 
     489$(eval $(call theme,base,Common base for all themes)) 
    463490$(eval $(call theme,openwrt,OpenWrt.org (default),,,1)) 
    464491$(eval $(call theme,fledermaus,Fledermaus Theme)) 
     
    484511    URL:=http://luci.subsignal.org/ 
    485512    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    486     SUBMENU:=Translations 
     513    SUBMENU:=5. Translations 
    487514    TITLE:=$(if $(2),$(2),$(1)) 
    488515  endef 
     
    515542$(eval $(call translation,norwegian,Norwegian (by Lars Hardy))) 
    516543$(eval $(call translation,hebrew,Hebrew)) 
     544$(eval $(call translation,romanian,Romanian)) 
    517545 
    518546 
     
    525553    URL:=http://luci.subsignal.org/ 
    526554    MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org> 
    527     SUBMENU:=Collections 
     555    SUBMENU:=1. Collections 
    528556    TITLE:=$(if $(2),$(2),LuCI $(if $(1),$(1),general) collection) 
    529557    $(if $(3),DEPENDS:=$(3)) 
     
    538566 
    539567$(eval $(call collection,,\ 
    540     Standard OpenWrt set including full and mini admin and the standard theme,\ 
     568    Standard OpenWrt set including full admin with ppp support and the \ 
     569    default OpenWrt theme,\ 
    541570    +uhttpd +luci-mod-admin-full +luci-theme-openwrt +luci-app-firewall \ 
    542     +libiwinfo)) 
     571    +luci-proto-core +luci-proto-ppp +libiwinfo)) 
    543572 
    544573$(eval $(call collection,ssl,\ 
    545574    Standard OpenWrt set with HTTPS support,\ 
    546     +uhttpd +uhttpd-mod-tls +px5g +luci-mod-admin-full +luci-theme-openwrt \ 
    547     +luci-app-firewall +libiwinfo)) 
     575    +luci +uhttpd-mod-tls +px5g)) 
    548576 
    549577$(eval $(call collection,light,\ 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh

    r7228 r7810  
    1313} 
    1414 
    15 set_defaults() { 
    16     for def in $(env |grep "^$1"); do 
    17         option=${def/$1/} 
    18         uci set $2.$option 
    19         echo "    ${option/=/: }" 
     15# Takes 2 arguments 
     16# $1 = text to be displayed in the output for this section 
     17# $2 = section (optional) 
     18uci_commitverbose() { 
     19    echo "+ $1" 
     20    uci changes $2 | while read line; do 
     21        echo "    $line" 
    2022    done 
     23    uci commit $2 
    2124} 
    2225 
    23 # 1 argument: section to remove 
    24 section_cleanup() { 
    25     uci -q delete $1 && msg_cleanup $1 || msg_cleanup_error $1 
     26set_defaults() { 
     27    for def in $(env |grep "^$1" | sed 's/ /_/g'); do 
     28        option="${def/$1/}" 
     29        a="$(echo $option |cut -d '=' -f1)" 
     30        b="$(echo $option |cut -d '=' -f2)" 
     31        b="${b//_/ }" 
     32        uci set $2.$a="$b" 
     33    done 
    2634} 
    2735 
     
    2937section_rename() { 
    3038    uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.2 $1.$3 
    31 } 
    32  
    33 msg_start() { 
    34     echo "  Starting configuration of $1" 
    35 } 
    36  
    37 msg_cleanup() { 
    38     echo "    Cleanup: Removed section $1." 
    39 } 
    40  
    41 msg_cleanup_error() { 
    42     echo -e "    \033[1mWarning:\033[0m Cleanup of $1 failed." 
    4339} 
    4440 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_bssid.sh

    r7228 r7810  
    1212config_load profile_$community 
    1313config_get bssid bssidscheme $channel 
     14if [ -z "$bssid" ]; then 
     15    config_get bssid bssidscheme "all" 
     16fi 
    1417 
    1518if [ -z "$bssid" ]; then 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh

    r7228 r7810  
    33# It sets up the initial config for this node. 
    44 
    5  
    65. /etc/functions.sh 
    76. $dir/functions.sh 
    8  
    9 ### System config 
    107 
    118config_load system 
     
    1916config_foreach handle_system system 
    2017 
    21 if [ -n "$(uci -q get meshwizard.system)" ]; then 
    22     echo "    + Setup system" 
    23     uci show meshwizard.system | sed 's/^meshwizard/uci set system/g' | while read line; do 
    24         eval $line 
    25         echo "    $line" 
    26     done 
    27     uci -q delete meshwizard.system 
     18if [ -n "$(uci -q get meshwizard.community)" ]; then 
     19    set_defaults "community_" freifunk.community 
     20    uci -q delete meshwizard.community 
     21fi 
     22[ -n "$profile_homepage" ] && uci set freifunk.community.homepage="$profile_homepage" 
     23uci_commitverbose "Setup community" freifunk 
     24 
     25if [ -n "$(uci -q get meshwizard.contact)" ]; then 
     26    set_defaults "contact_" freifunk.contact 
     27    uci -q delete meshwizard.contact && uci_commitverbose "Setup contact" freifunk 
    2828fi 
    2929 
    30 if [ -n "$(uci -q get meshwizard.community)" ]; then 
    31     echo "    + Setup community" 
    32     uci show meshwizard.community | sed 's/^meshwizard/freifunk/g' | while read line; do 
    33         eval uci set $line 
    34         echo "    $line" 
    35     done 
    36     uci -q delete meshwizard.community 
     30if [ "$has_luci" == TRUE ]; then 
     31    set_defaults "luci_main_" luci.main 
     32    uci -q delete meshwizard.luci_main && uci_commitverbose "Setup luci" luci 
    3733fi 
    38  
    39 if [ -n "$(uci -q get meshwizard.contact)" ]; then 
    40     echo "    + Setup contact" 
    41     uci show meshwizard.contact | sed 's/^meshwizard/freifunk/g' | while read line; do 
    42         eval uci set $line 
    43         echo "    $line" 
    44     done 
    45     uci -q delete meshwizard.contact 
    46 fi 
    47  
    48 if [ -n "$(uci -q get meshwizard.luci_main)" ]; then 
    49     echo "    + Setup luci" 
    50     uci show meshwizard.luci_main |sed -e 's/^meshwizard/luci/g' -e 's/luci_main/main/' | while read line; do  
    51         eval uci set $line 
    52         echo "    $line" 
    53     done 
    54     uci -q delete meshwizard.luci_main 
    55 fi 
    56  
    57 uci commit 
    58  
    59  
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh

    r7228 r7810  
    1919    get_var profile_$community.$v 
    2020done 
     21 
     22# read values from meshwizard 
     23for v in system luci_main contact community wan lan; do 
     24        get_var meshwizard.$v 
     25done 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh

    r7228 r7810  
    33# E.g. wireless.IB_wifi0 would become wireless.wifi0 on madwifi and wireless.radio0 on mac80211 
    44 
     5. $dir/functions.sh 
     6 
    57posIB=-1 
    68 
    79IBwifis="$(uci show meshwizard.netconfig | grep -v 'netconfig=netconfig' | sed 's/meshwizard.netconfig\.\(IB_wifi.*\)_.*/\1/' |uniq)" 
     10[ -z "$(echo $IBwifis |grep IB_wifi)" ] && exit 
    811 
    912for w in $IBwifis; do 
     
    4144done 
    4245 
    43 uci commit 
     46uci_commitverbose "Renaming wifi-devices in /etc/config/meshwizard" meshwizard 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh

    r7228 r7810  
    1010    config_get interface "$1" interface 
    1111    if [ "$interface" == "${netrenamed}dhcp" ]; then 
    12         if [ "$cleanup" == 1 ]; then 
    13             section_cleanup dhcp.$1 
    14         else 
    15             if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    16                 section_rename dhcp $1 ${netrenamed}dhcp 
    17                         fi 
    18                 fi 
    19         fi 
     12        if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     13            section_rename dhcp $1 ${netrenamed}dhcp 
     14        fi 
     15    fi 
    2016} 
    2117config_load dhcp 
     
    2319 
    2420uci batch << EOF 
    25 set dhcp.${netrenamed}dhcp="dhcp" 
    26 set dhcp.${netrenamed}dhcp.leasetime="${dhcp_leasetime}" 
    27 set dhcp.${netrenamed}dhcp.force="1" 
    28 set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp" 
     21    set dhcp.${netrenamed}dhcp="dhcp" 
     22    set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp" 
    2923EOF 
    3024 
    31 echo "    leasetime: ${dhcp_leasetime} 
    32     interface: ${netrenamed}dhcp" 
     25set_defaults "dhcp_" dhcp.${netrenamed}dhcp 
    3326 
     27uci_commitverbose "Setup DHCP for $netrenamed" dhcp 
     28 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh

    r7228 r7810  
    1414config_foreach handle_dhcp dnsmasq 
    1515 
    16 echo "    + Setup dnsmasq" 
    17  
    18 uci set dhcp.dnsmasq.local="/$profile_suffix/" 
    19 uci set dhcp.dnsmasq.domain="$profile_suffix" 
    20  
    21 echo "    local: /$profile_suffix/ 
    22     domain: $profile_suffix" 
     16uci batch << EOF 
     17    set dhcp.dnsmasq.local="/$profile_suffix/" 
     18    set dhcp.dnsmasq.domain="$profile_suffix" 
     19EOF 
    2320 
    2421config_get addnhosts dnsmasq addnhosts 
    2522if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then 
    2623    uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr" 
    27     echo "    addnhosts: /var/etc/hosts.olsr" 
    2824fi 
    2925 
    30 uci commit 
    31  
     26uci_commitverbose "Setup dnsmasq" dhcp 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh

    r7291 r7810  
    11#!/bin/sh 
    2 # This will add $net to the zone firewall (and remove it from other zones where it is referenced) 
    3 # It will also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community> 
    4 # Arg $1 = $net 
     2# Add "freifunk" firewall zone 
     3# If wan/lan is used for olsr then remove these networks from wan/lan zones 
     4# Also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community> 
    55 
    6 net=$1 
    76. /etc/functions.sh 
    87. $dir/functions.sh 
     8 
     9wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config) 
     10lan_is_olsr=$(uci -q get meshwizard.netconfig.lan_config) 
     11 
    912config_load firewall 
    1013 
    11 # Get some variables 
    12 type="$(uci -q get wireless.$net.type)" 
    13 vap="$(uci -q get meshwizard.netconfig.$net\_vap)" 
     14# Rename firewall zone for freifunk if unnamed 
     15# If wan is used for olsr then set network for the firewall zone wan to ' ' to remove the wan interface from it, else add local restrict to it 
     16# If lan is used for olsr then set network for the firewall zone lan to ' ' to remove the lan interface from it 
    1417 
    15 # Add local_restrict to wan firewall zone 
    16 handle_zonewan() { 
    17     config_get name "$1" name 
    18     if [ "$name" == "wan" ]; then 
    19         uci set firewall.$1.local_restrict=1 
    20     fi 
    21 } 
    22 config_foreach handle_zonewan zone && echo "    + Enable local_restrict for zone wan" 
    23  
    24 # Delete old firewall zone for freifunk 
    2518handle_fwzone() { 
    2619    config_get name "$1" name 
    2720    config_get network "$1" network 
    2821 
    29     if [ "$2" == "zoneconf" ]; then 
    30         # clean zone 
    31         if [ "$name" == "freifunk" ]; then 
    32             if [ "$cleanup" == 1 ]; then 
    33                 section_cleanup firewall.$1 
    34             else 
    35                 # rename section if unnamed 
    36                 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    37                     section_rename firewall $1 zone_freifunk 
    38                 fi 
    39             fi 
     22    if [ "$name" == "freifunk" ]; then 
     23        # rename section if unnamed 
     24        if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     25            section_rename firewall $1 zone_freifunk 
     26        fi 
     27    fi 
     28 
     29    if [ "$name" == "wan" ]; then 
     30        if  [ "$wan_is_olsr" == 1 ]; then 
     31            uci set firewall.$1.network=' ' && uci_commitverbose "WAN is used for olsr, removed the wan interface from zone wan" firewall 
    4032        else 
     33            uci set firewall.$1.local_restrict=1 && uci_commitverbose "Enable local_restrict for zone wan" firewall 
     34        fi 
     35    fi 
    4136 
    42             if [ "$name" == "$netrenamed" ]; then 
    43                 section_cleanup firewall.$1 
    44             fi 
    45             if [ -n "$netrenamed" -a -n "$(echo $network | grep $netrenamed)" ] && [ ! "$name" == "freifunk" ]; then 
    46                 echo "    Removed $netrenamed from firewall zone $name." 
    47                 network_new=$(echo $network | sed -e 's/'$netrenamed'//' -e 's/^ //' -e 's/  / /' -e 's/ $//') 
    48                 uci set firewall.$1.network="$network_new" 
    49             fi 
    50         fi 
    51     else 
    52         # clean fw_rule, fw_forwarding, include and advanced 
    53         for option in src tcp_ecn path; do 
    54             config_get $option $1 $option 
    55         done 
    56         if [ "$src" == "freifunk" -o "$path" == "/etc/firewall.freifunk" -o -n "$tcpecn" ]; then 
    57             section_cleanup firewall.$1 
    58         fi 
     37    if [ "$name" == "lan" ] && [ "$lan_is_olsr" == 1 ]; then 
     38            uci set firewall.$1.network=' ' && uci_commitverbose "LAN is used for olsr, removed the lan interface from zone lan" firewall 
    5939    fi 
    6040} 
    6141 
    62 config_foreach handle_fwzone zone zoneconf 
    63  
    64 if [ "$cleanup" == 1 ]; then 
    65     for target in include advanced rule forwarding; do 
    66         config_foreach handle_fwzone $target 
    67     done 
    68 fi 
    69  
    70 # setup freifunk firewall zone 
    71  
    72 echo "    + Setup firewall zone." 
    73  
    74 # add $netrenamed and if needed ${netrenamed}dhcp to the networks for this zone 
    75 config_get network zone_freifunk network 
    76  
    77 # remove ${netrenamed}dhcp from networks list 
    78 [ -n "$network" -a -n "$net" ] && network="${network/${netrenamed}dhcp/}" 
    79 network=$(echo $network) # Removes leading and trailing whitespaces 
    80  
    81 [ -n "$netrenamed" ] && [ -z "$(echo $network | grep $netrenamed)" ] && network="$network $netrenamed" 
    82  
    83 if [ "$type" == "atheros" -a "$vap" == 1 ]; then 
    84         [ -n "$netrenamed" ] && [ "$network" == "${network/${netrenamed}dhcp/}" ] && network="$network ${netrenamed}dhcp" 
    85 fi 
     42config_foreach handle_fwzone zone 
    8643 
    8744uci batch << EOF 
    88 set firewall.zone_freifunk="zone" 
    89 set firewall.zone_freifunk.name="freifunk" 
    90 set firewall.zone_freifunk.network="$network" 
    91 set firewall.zone_freifunk.input="$zone_freifunk_input" 
    92 set firewall.zone_freifunk.forward="$zone_freifunk_forward" 
    93 set firewall.zone_freifunk.output="$zone_freifunk_output" 
     45    set firewall.zone_freifunk="zone" 
     46    set firewall.zone_freifunk.name="freifunk" 
     47    set firewall.zone_freifunk.input="$zone_freifunk_input" 
     48    set firewall.zone_freifunk.forward="$zone_freifunk_forward" 
     49    set firewall.zone_freifunk.output="$zone_freifunk_output" 
    9450EOF 
    9551 
    96 echo "    network: $network 
    97     input: $zone_freifunk_input 
    98     forward: $zone_freifunk_forward 
    99     output: $zone_freifunk_output" 
     52uci_commitverbose "Setup firewall zones" firewall 
    10053 
    101 # Usually we need to setup masquerading for lan, except lan is an olsr interface or has an olsr hna 
    102  
    103 echo "    + Setup masquerading rules" 
     54# Usually we need to setup masquerading for lan, except lan is an olsr interface or has an olsr hna-entry 
    10455 
    10556handle_interface() { 
     
    11263config_foreach handle_interface Interface 
    11364 
    114 handle_hna() { 
    115         config_get netaddr "$1" netaddr 
    116         if [ "$NETWORK" == "$netaddr" ]; then 
    117                 no_masq_lan=1 
    118         fi 
    119 } 
    120 config_foreach handle_hna Hna4 
     65LANIP="$(uci -q get network.lan.ipaddr)" 
     66if [ -n "$LANIP" ]; then 
     67    handle_hna() { 
     68        config_get netaddr "$1" netaddr 
     69            if [ "$LANIP" == "$netaddr" ]; then 
     70            no_masq_lan=1 
     71        fi 
     72    } 
     73    config_foreach handle_hna Hna4 
     74fi 
    12175 
    12276currms=$(uci -q get firewall.zone_freifunk.masq_src) 
    123 if [ ! "$no_masq_lan" == "1" ]; then 
    124     uci set firewall.zone_freifunk.masq="1" && echo "    Enabled masquerading." || echo -e "\033[1mWarning:\033[0m: Could not enable masquerading." 
     77if [ ! "$no_masq_lan" == "1" ] && [ ! "$(uci -q get meshwizard.netconfig.lan_config)" == 1 ]; then 
     78    uci set firewall.zone_freifunk.masq="1" 
    12579    [ -z "$(echo $currms |grep lan)" ] && uci add_list firewall.zone_freifunk.masq_src="lan" 
    12680fi 
    12781 
    128 # If wifi-interfaces are outside of the mesh network they should be natted 
    129 for i in $networks; do 
    130         # Get dhcprange and meshnet 
    131         dhcprange=$(uci get meshwizard.netconfig.$i\_dhcprange) 
    132         meshnet="$(uci get profile_$community.profile.mesh_network)" 
    133         # check if the dhcprange is inside meshnet 
    134         dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)" 
    135         if [ ! "$dhcpinmesh" == 1 ]; then 
    136                 [ -z "$(echo $currms |grep ${netrenamed}dhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}dhcp" 
    137         fi 
    138 done 
    13982 
    14083# Rules, Forwardings, advanced config and includes 
    141 # Clear firewall configuration 
    142  
    143 echo "    + Setup rules, forwardings, advanced config and includes." 
    14484 
    14585for config in freifunk profile_$community; do 
     
    15898    done 
    15999done 
    160  
    161 uci commit 
     100uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh

    r7228 r7810  
    11# setup entry in /etc/config/network for a interface 
    22# Argument $1: network interface 
    3  
     3  
    44net="$1" 
    55. /etc/functions.sh 
    66. $dir/functions.sh 
    7  
    8 # Delete the network interface section for $net 
    9 if [ "$cleanup" == 1 ]; then 
    10     section_cleanup network.$netrenamed 
    11 fi 
    127 
    138# Setup a (new) interface section for $net 
     
    1611[ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr 
    1712 
    18 [ -z "$interface_netmask" ] && interface netmask="255.255.0.0" 
     13netmask=$(uci -q get meshwizard.netconfig.$net\_netmask) 
     14[ -z "$netmask" ] && netmask="$interface_netmask" 
     15[ -z "$netmask" ] && netmask="255.255.0.0" 
     16 
     17uci set network.$netrenamed="interface" 
     18set_defaults "interface_" network.$netrenamed 
    1919 
    2020uci batch << EOF 
    21 set network.$netrenamed="interface" 
    22 set network.$netrenamed.proto="static" 
    23 set network.$netrenamed.ipaddr="$ipaddr" 
    24 set network.$netrenamed.netmask="$interface_netmask" 
    25 set network.$netrenamed.dns="$interface_dns" 
     21    set network.$netrenamed.proto="static" 
     22    set network.$netrenamed.ipaddr="$ipaddr" 
     23    set network.$netrenamed.netmask="$netmask" 
    2624EOF 
    2725 
    28 echo "    IP address: $ipaddr" 
    29 echo "    Netmask   : $interface_netmask" 
     26uci_commitverbose "Setup interface $netrenamed" network 
    3027 
    3128# setup dhcp alias/interface 
     
    3936    vap=$(uci -q get meshwizard.netconfig.${net}_vap) 
    4037 
    41     # Clean/rename config 
     38    # Rename config 
    4239    handle_dhcpalias() { 
    4340            config_get interface "$1" interface 
    4441            if [ "$interface" == "$netrenamed" ]; then 
    45                 if [ "$cleanup" == 1 ]; then 
    46                     section_cleanup network.$1 
    47                 else 
    48                     if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    49                         section_rename network $1 ${netrenamed}dhcp 
    50                     fi 
     42                if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     43                    section_rename network $1 ${netrenamed}dhcp 
    5144                fi 
    5245            fi 
     
    6962 
    7063    if [ "$vap" == 1 ]; then 
    71         echo "    + Setup interface ${netrenamed}dhcp." 
    7264        uci set network.${netrenamed}dhcp=interface 
    7365    else 
    74         echo "    + Setup alias interface ${netrenamed}dhcp." 
    7566        uci set network.${netrenamed}dhcp=alias 
    7667        uci set network.${netrenamed}dhcp.interface="$netrenamed" 
    7768    fi 
    7869 
    79     uci batch << EOF 
    80 set network.${netrenamed}dhcp.proto=static 
    81 set network.${netrenamed}dhcp.ipaddr="$START" 
    82 set network.${netrenamed}dhcp.netmask="$NETMASK" 
    83 EOF 
    84  
    85     echo "    interface: $net 
    86     ipaddr: $START 
    87     netmask: $NETMASK" 
     70    uci batch <<- EOF 
     71        set network.${netrenamed}dhcp.proto=static 
     72        set network.${netrenamed}dhcp.ipaddr="$START" 
     73        set network.${netrenamed}dhcp.netmask="$NETMASK" 
     74    EOF 
     75    uci_commitverbose  "Setup interface for ${netrenamed}dhcp" network 
    8876 
    8977fi 
    90  
    91 uci commit 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh

    r7228 r7810  
    11#!/bin/sh 
    22# Sets up olsrd 
    3 # arg $1 = net 
    4  
    5 net=$1 
    63 
    74. /etc/functions.sh 
    8  
    95. $dir/functions.sh 
    106 
    11 # Clean or delete interface defaults 
     7# Rename interface defaults 
     8 
    129handle_interfacedefaults() { 
    13     if [ "$cleanup" == 1 ]; then 
    14         section_cleanup olsrd.$1 
    15     else 
    16         if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    17             section_rename olsrd $1 InterfaceDefaults 
    18          fi 
     10    if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     11        section_rename olsrd $1 InterfaceDefaults 
    1912    fi 
    2013} 
    21  
    2214config_load olsrd 
    2315config_foreach handle_interfacedefaults InterfaceDefaults 
    2416 
    2517# Setup new InterfaceDefaults 
    26  
    27 echo "    + Setup InterfaceDefaults" 
    2818uci set olsrd.InterfaceDefaults=InterfaceDefaults 
    2919set_defaults "olsr_interfacedefaults_" olsrd.InterfaceDefaults 
     20uci_commitverbose "Setup olsr interface defaults" olsrd 
    3021 
    31 # Delete old interface for $netrenamed 
    32 handle_interface() { 
    33     config_get interface "$1" Interface 
    34     if [ "$interface" == "$netrenamed" ]; then 
    35         if [ "$cleanup" == 1 ]; then 
    36             section_cleanup olsrd.$1 
    37         elif [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    38             section_rename olsrd $1 $netrenamed 
    39         fi 
    40     fi 
    41 } 
     22# Rename nameservice, dyngw and httpinfo plugins 
    4223 
    43 config_foreach handle_interface Interface 
    44  
    45 # Setup new interface for $netrenamed 
    46  
    47 echo "    + Setup Interface" 
    48  
    49 uci set olsrd.$netrenamed=Interface 
    50  
    51 set_defaults "olsr_interface_" olsrd.$net 
    52  
    53 uci set olsrd.$netrenamed.interface="$netrenamed" 
    54 echo "    interface: $netrenamed" 
    55  
    56 # If dhcp-network is inside the mesh_network then add HNA for it 
    57 dhcprange=$(uci get meshwizard.netconfig.$net\_dhcprange) 
    58 meshnet="$(uci get profile_$community.profile.mesh_network)" 
    59  
    60 uci -q delete olsrd.${netrenamed}clients 
    61  
    62 # check if the dhcprange is inside meshnet 
    63 dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)" 
    64  
    65 if [ "$dhcpinmesh" == 1 ]; then 
    66     echo "    + Setting up HNA" 
    67     uci set olsrd.${netrenamed}clients="Hna4" 
    68     eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange) 
    69     uci set olsrd.${netrenamed}clients.netaddr="$NETWORK" 
    70     uci set olsrd.${netrenamed}clients.netmask="$NETMASK" 
    71     echo "    netaddr: $NETWORK" 
    72     echo "    natmask: $NETMASK" 
    73 fi 
    74  
    75  
    76 # Delete nameservice, dyngw and httpinfo plugins 
    77  
    78 echo "    + Configure Plugins" 
    7924handle_plugin() { 
    80         config_get library "$1" library 
    81     if [ "$cleanup" == 1 ]; then 
    82         case library in 
    83             olsrd_*) 
    84                 section_cleanup olsrd.$1 
    85         esac 
    86     elif [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     25    config_get library "$1" library 
     26    if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    8727        new="$(echo $library | cut -d '.' -f 1)" 
    8828        section_rename olsrd $1 $new 
    89     fi       
     29    fi 
    9030} 
    9131config_foreach handle_plugin LoadPlugin 
     
    9838fi 
    9939uci batch << EOF 
    100 set olsrd.olsrd_nameservice=LoadPlugin 
    101 set olsrd.olsrd_nameservice.library="olsrd_nameservice.so.0.3" 
    102 set olsrd.olsrd_nameservice.latlon_file="/var/run/latlon.js" 
    103 set olsrd.olsrd_nameservice.hosts_file="/var/etc/hosts.olsr" 
    104 set olsrd.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid" 
    105 set olsrd.olsrd_nameservice.suffix="$suffix" 
     40    set olsrd.olsrd_nameservice=LoadPlugin 
     41    set olsrd.olsrd_nameservice.library="olsrd_nameservice.so.0.3" 
     42    set olsrd.olsrd_nameservice.latlon_file="/var/run/latlon.js" 
     43    set olsrd.olsrd_nameservice.hosts_file="/var/etc/hosts.olsr" 
     44    set olsrd.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid" 
     45    set olsrd.olsrd_nameservice.suffix="$suffix" 
    10646EOF 
    10747 
    108 echo "    Nameservice Plugin configured." 
     48uci_commitverbose "Setup olsr nameservice plugin" olsrd 
    10949 
    11050# Setup dyngw_plain 
     
    11353sharenet=$(uci -q get meshwizard.general.sharenet) 
    11454 
    115 if [ -n "$(uci -q get olsrd.dyngw_plain.library)" ]; then 
    116     section_cleanup olsrd.dyngw_plain 
    117 fi 
    118  
    11955if [ "$sharenet" == 1 ]; then 
    120     echo "    + Setup dyngw_plain" 
    12156    uci set olsrd.dyngw_plain=LoadPlugin 
    12257    uci set olsrd.dyngw_plain.ignore=0 
    12358    uci set olsrd.dyngw_plain.library="olsrd_dyn_gw_plain.so.0.4" 
     59 
     60    uci_commitverbose "Setup olsrd_dyngw_plain plugin" olsrd 
    12461fi 
    125  
    126 uci commit 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh

    r7291 r7810  
    77net=$1 
    88 
    9 handle_splash() { 
    10     config_get network "$1" network 
    11     if [ "$network" == "${netrenamed}dhcp" ]; then 
    12         if [ "$cleanup" == 1 ]; then 
    13             section_cleanup luci_splash.$1 
    14         else 
     9if [ ! "$has_luci_splash" == TRUE ]; then 
     10    echo "    Luci Splash is not installed, skipping setup of it." 
     11    exit 
     12fi 
     13 
     14dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange) 
     15 
     16if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange" ]; then 
     17    handle_splash() { 
     18        config_get network "$1" network 
     19        if [ "$network" == "${netrenamed}dhcp" ]; then 
    1520            if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    1621                section_rename luci_splash $1 ${netrenamed}dhcp 
    1722            fi 
    1823        fi 
    19     fi 
    20 } 
    21 config_load luci_splash 
    22 config_foreach handle_splash iface 
     24    } 
     25    config_load luci_splash 
     26    config_foreach handle_splash iface 
    2327 
    24 uci batch << EOF 
    25 set luci_splash.${netrenamed}dhcp="iface" 
    26 set luci_splash.${netrenamed}dhcp.network="${netrenamed}dhcp" 
    27 set luci_splash.${netrenamed}dhcp.zone="freifunk" 
    28 EOF 
     28    uci batch <<- EOF 
     29        set luci_splash.${netrenamed}dhcp="iface" 
     30        set luci_splash.${netrenamed}dhcp.network="${netrenamed}dhcp" 
     31        set luci_splash.${netrenamed}dhcp.zone="freifunk" 
     32    EOF 
    2933 
    30 echo "    network: ${netrenamed}dhcp" 
     34    uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash 
     35    /etc/init.d/luci_splash enable 
     36fi 
    3137 
    32 uci commit 
    33  
    34 /etc/init.d/luci_splash enable 
    35  
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh

    r7291 r7810  
    11#!/bin/sh 
    2 # Sets values from /etc/config/freifunk and/or the community profile in /etc/config/system 
    32 
    4 if [ -n "$(env | grep '^system_')" ]; then 
    5     echo "++++ Setup system" 
    6     env | grep "^system_" | sed "s/system_/uci set system.system./g" | while read line; do 
    7         eval $line 
    8         echo "    $line" 
    9     done 
    10 fi 
     3. $dir/functions.sh 
    114 
    12 uci commit system 
     5set_defaults "system_" system.system 
     6uci -q delete meshwizard.system && uci commit meshwizard 
     7uci_commitverbose "System config" system 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh

    r7228 r7810  
    99##### wifi-device ##### 
    1010 
    11 echo "    + Setup wifi-device" 
    12  
    1311# Get the type before we delete the wifi-device 
    1412config_load wireless 
    1513config_get type $net type 
    1614 
    17 # Delete old wifi-device for $net 
     15# Rename wifi-device for $net 
    1816 
    1917handle_wifidevice() { 
    20     if [ "$1" == "$net" -a "$cleanup" == 1 ]; then 
    21         section_cleanup wireless.${net} 
    22     else 
    23         if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    24             section_rename wireless $1 $net 
    25         fi 
     18    if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     19        section_rename wireless $1 $net 
    2620    fi 
    2721} 
     
    4236 
    4337uci batch << EOF 
    44 set wireless.${net}.type="$type" 
    45 set wireless.${net}.channel="$channel" 
     38    set wireless.${net}.type="$type" 
     39    set wireless.${net}.channel="$channel" 
    4640EOF 
    4741 
    48 echo "    Type: $type" 
    49 echo "    Channel: $channel" 
     42uci_commitverbose "Setup wifi device for $netrenamed" wireless 
    5043 
    5144##### wifi iface 
    5245 
    53 echo "    + Setup wifi-iface" 
    54  
    55 # Delete old wifi-iface for $net 
     46# Rename wifi-iface for $net 
    5647handle_interface() { 
    5748    config_get device "$1" device 
    5849    if [ "$device" == "$net" ]; then 
    59         if [ "$cleanup" == 1 ]; then 
    60             section_cleanup wireless.${net}_iface 
    61         else 
    62             if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
    63                 section_rename wireless $1 ${net}_iface 
    64             fi 
     50        if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then 
     51            section_rename wireless $1 ${net}_iface 
    6552        fi 
    6653    fi 
     
    7663# overwrite defaults 
    7764bssid="$($dir/helpers/gen_bssid.sh $channel $community)" 
     65 
     66ssid="$profile_ssid" 
     67if [ "$profile_ssid_scheme" == "addchannel" ]; then 
     68    ssid="$ssid - ch$channel" 
     69fi 
     70 
    7871uci batch << EOF 
    79 set wireless.$net\_iface.device="${net}" 
    80 set wireless.$net\_iface.network="$netrenamed" 
    81 set wireless.$net\_iface.ssid="$profile_ssid - ch$channel" 
    82 set wireless.$net\_iface.bssid="$bssid" 
     72    set wireless.$net\_iface.device="${net}" 
     73    set wireless.$net\_iface.network="$netrenamed" 
     74    set wireless.$net\_iface.ssid="$ssid" 
     75    set wireless.$net\_iface.bssid="$bssid" 
    8376EOF 
    8477 
    85 echo "    device: $net 
    86     network: $netrenamed 
    87     ssid: $profile_ssid - ch$channel 
    88     bssid: $bssid" 
     78uci_commitverbose "Setup wifi interface for $netrenamed" wireless 
    8979 
    9080## VAP 
    9181ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)" 
    9282if [ "$type" == "atheros" -a "$vap" == 1 ]; then 
    93     uci batch << EOF 
    94 set wireless.$net\_iface_dhcp="wifi-iface" 
    95 set wireless.$net\_iface_dhcp.device="$net" 
    96 set wireless.$net\_iface_dhcp.mode="ap" 
    97 set wireless.$net\_iface_dhcp.encryption="none" 
    98 set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp" 
    99 set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr" 
    100 EOF 
    101     echo "    + Setting up VAP interface for $net 
    102     device: $net 
    103     network: ${netrenamed}dhcp 
    104     ssid: AP-$profile_ssid-$ip4addr" 
     83    uci batch <<- EOF 
     84        set wireless.$net\_iface_dhcp="wifi-iface" 
     85        set wireless.$net\_iface_dhcp.device="$net" 
     86        set wireless.$net\_iface_dhcp.mode="ap" 
     87        set wireless.$net\_iface_dhcp.encryption="none" 
     88        set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp" 
     89        set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr" 
     90    EOF 
     91    uci_commitverbose "Setup VAP interface for $netrenamed" wireless 
    10592fi 
    10693 
    107 uci commit 
  • luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh

    r7291 r7810  
    11#!/bin/sh 
    2 # This script will take settings from /etc/config/meshwizard, /etc/config/freifunk and /etc/config/profile_<selected in freifunk> 
    3 # and setup the router to participate in wireless mesh networks 
     2 
     3# This collection of scripts will take settings from /etc/config/meshwizard, /etc/config/freifunk 
     4# and /etc/config/profile_<community> and setup the router to participate in wireless mesh networks 
     5 
     6# Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 
     7 
     8# Licensed under the Apache License, Version 2.0 (the "License") 
     9# You may not use this file except in compliance with the License. 
     10# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
    411 
    512. /etc/functions.sh 
     13 
     14echo " 
     15/* Meshwizard 0.0.4 */ 
     16" 
    617 
    718# config 
    819export dir="/usr/bin/meshwizard" 
    920. $dir/functions.sh 
    10 debug=1 
     21 
     22# Check which packages we have installed 
     23export has_luci=FALSE 
     24opkg list_installed |grep luci-mod-admin > /dev/null && export has_luci=TRUE 
     25export has_luci_splash=FALSE 
     26opkg list_installed |grep luci-app-splash > /dev/null && export has_luci_splash=TRUE 
     27 
     28# Check whether we want to cleanup/restore uci config before setting new options 
     29cleanup=$(uci -q get meshwizard.general.cleanup) 
     30[ "$cleanup" == 1 ] && $dir/helpers/restore_default_config.sh 
    1131 
    1232# Rename wifi interfaces 
    13     echo "++++ Renaming wifi-devices in /etc/config/meshwizard" 
    14     $dir/helpers/rename-wifi.sh 
    15  
    16 # Firstboot/initial config 
    17     echo "++++ Initial config" 
    18     $dir/helpers/initial_config.sh 
     33$dir/helpers/rename-wifi.sh 
    1934 
    2035# Get community 
    21 export community=$(uci get freifunk.community.name) 
     36community=$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name) 
    2237[ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1 
    23  
    24 # Check whether we want to cleanup uci config before setting new options or not 
    25 cleanup=$(uci -q get meshwizard.general.cleanup) 
    26  
    27 [ "$cleanup" == 1 ] && export cleanup=1 
     38export community="$community" 
     39echo $community 
    2840 
    2941# Get a list of networks we need to setup 
    3042networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq) 
    3143export networks 
    32  
    3344[ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1 
    3445 
    35 echo "+++ wizard 0.0.2 +++ 
    36 Community=$community 
    37 Network(s)=$networks" 
    38  
    39 # Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community, 
     46# Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community 
     47# then /etc/config/meshwizard 
    4048# last will overwrite first 
    41  
    4249 
    4350$dir/helpers/read_defaults.sh $community > /tmp/meshwizard.tmp 
     
    4653done < /tmp/meshwizard.tmp 
    4754 
    48 # dnsmasq 
    49     echo "++++ dnsmasq config" 
    50     $dir/helpers/setup_dnsmasq.sh 
     55# Do config 
     56$dir/helpers/initial_config.sh 
     57$dir/helpers/setup_dnsmasq.sh 
     58$dir/helpers/setup_system.sh 
     59$dir/helpers/setup_olsrd.sh 
     60$dir/helpers/setup_firewall.sh 
    5161 
    52 # system 
    53     $dir/helpers/setup_system.sh 
     62if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then 
     63    $dir/helpers/setup_wan_static.sh 
     64fi 
     65 
     66if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask" ]; then 
     67    $dir/helpers/setup_lan_static.sh 
     68fi 
    5469 
    5570# Configure found networks 
    5671for net in $networks; do 
    57  
     72    # radioX devices need to be renamed 
    5873    netrenamed="${net/radio/wireless}" 
    5974    export netrenamed 
    60  
    61     echo "++++ Configure interface $net" 
    62  
    63     config="network" 
    64     echo "$(msg_start $config)" 
    6575    $dir/helpers/setup_network.sh $net 
    66  
    67     config="wireless" 
    68     echo "$(msg_start $config)" 
    69     $dir/helpers/setup_wifi.sh $net 
    70  
    71     config="OLSRd" 
    72     echo "$(msg_start $config)" 
    73     $dir/helpers/setup_olsrd.sh $net 
     76    if [ ! "$net" == "wan" ] && [ ! "$net" == "lan" ]; then 
     77        $dir/helpers/setup_wifi.sh $net 
     78    fi 
     79    $dir/helpers/setup_olsrd_interface.sh $net 
    7480 
    7581    net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp) 
    7682    if [ "$net_dhcp" == 1 ]; then 
    77         config="DHCP" 
    78         echo "$(msg_start $config)" 
    7983        $dir/helpers/setup_dhcp.sh $net 
    8084    fi 
    8185 
    82     config="luci_splash" 
    83     echo "$(msg_start $config)" 
    8486    $dir/helpers/setup_splash.sh $net 
    85  
    86     config="firewall" 
    87     echo "$(msg_start $config)" 
    88     $dir/helpers/setup_firewall.sh $net 
    89  
    90     echo "  Configuration of $net finished." 
     87    $dir/helpers/setup_firewall_interface.sh $net 
    9188done 
    9289 
  • luci/branches/luci-0.10/contrib/package/meshwizard/Makefile

    r7228 r7810  
    55 
    66PKG_NAME:=meshwizard 
    7 PKG_RELEASE:=1 
     7PKG_RELEASE:=0.0.5 
    88 
    99PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 
     
    1414  SECTION:=luci 
    1515  CATEGORY:=LuCI 
    16   SUBMENU:=Freifunk 
     16  SUBMENU:=9. Freifunk 
    1717  TITLE:=Shell script based wizard for Mesh networks 
    1818  DEPENDS:=+firewall 
  • luci/branches/luci-0.10/contrib/package/remote-update/Makefile

    r5572 r7810  
    1717  SECTION:=luci 
    1818  CATEGORY:=LuCI 
    19   SUBMENU:=Freifunk 
     19  SUBMENU:=9. Freifunk 
    2020  TITLE:=Freifunk remote update utility. 
    2121  DEPENDS:=@TARGET_atheros||@TARGET_ar71xx||@TARGET_brcm_2_4