Changeset 295

Show
Ignore:
Timestamp:
13/08/2007 11:12:04 (1 year ago)
Author:
nextime
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wrt/whiterussian/packages/coova-chilli-mdx/trunk/MDXBUILD

    r289 r295  
    1 
     1
  • wrt/whiterussian/packages/coova-chilli-mdx/trunk/Makefile

    r292 r295  
    1010PKG_NAME:=coova-chilli-mdx 
    1111PKG_VERSION:=1.0.svn20070811 
    12 PKG_RELEASE:=1 
     12PKG_RELEASE:=3 
    1313 
    1414#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
     
    4444define Package/coova-chilli-mdx/conffiles 
    4545/etc/chilli.conf 
     46/etc/chilli/ipup 
     47/etc/chilli/ipdown 
    4648endef 
    4749 
     
    9193define Package/coova-chilli-mdx/install 
    9294        install -m0755 -d $(1)/etc $(1)/etc/init.d $(1)/etc/chilli 
    93         install -m0755 $(PKG_BUILD_DIR)/conf/functions  $(1)/etc/chilli/functions 
    94         install -m0755 ./files/up.sh                  $(1)/etc/chilli/ 
    95         install -m0755 ./files/down.sh                 $(1)/etc/chilli
    96         install -m0755 ./files/chilli.init              $(1)/etc/init.d/S90chilli 
     95        install -m0755 ./files/ipup                    $(1)/etc/chilli/ 
     96        install -m0755 ./files/ipdown         $(1)/etc/chilli/ 
     97        install -m0755 ./files/chilli.conf    $(1)/etc
     98        install -m0755 ./files/chilli.init              $(1)/etc/init.d/S70chilli 
    9799        install -m0755 ./files/chilli.firewall          $(1)/etc/chilli/firewall 
    98         install -m0755 ./files/chilli.conf              $(1)/etc/chilli.conf 
    99100        install -m0755 -d $(1)/usr/sbin 
    100         install -m0755 -d $(1)/etc/chilli/www 
    101         install -m0755 ./files/*.html   $(1)/etc/chilli/www/ 
    102         install -m0755 ./files/*.jpg    $(1)/etc/chilli/www/ 
    103         install -m0755 ./files/*.png    $(1)/etc/chilli/www/ 
    104101        $(CP) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/ 
    105102endef 
  • wrt/whiterussian/packages/coova-chilli-mdx/trunk/files/chilli.conf

    r270 r295  
    1  
    2 include /etc/chilli/main.conf 
    3 include /etc/chilli/hs.conf 
    4 include /etc/chilli/local.conf 
    5  
    6 ipup    /etc/chilli/up.sh 
    7 ipdown  /etc/chilli/down.sh 
    8  
     1uamallowed www.unixmedia.it 
     2ipup /etc/chilli/ipup 
     3radiusnasid defaultname 
     4coanoipcheck 
     5dhcpif br0 
     6ipdown /etc/chilli/ipdown 
     7coaport 3779 
  • wrt/whiterussian/packages/coova-chilli-mdx/trunk/files/chilli.firewall

    r270 r295  
    11 
    2 # nothing to be done here, see [up|down].sh 
     2# nothing to be done here, see ip[up|down] 
    33 
  • wrt/whiterussian/packages/coova-chilli-mdx/trunk/files/chilli.init

    r284 r295  
    1 #!/bin/sh 
    2 
    3 # Copyright (c) 2006 David Bird <david@coova.com> 
    4 # Licensed under GPL. See http://coova.org/ 
    5 
     1#!/bin/sh /etc/rc.common 
     2# Copyright (C) 2007 Unixmedia S.r.l. 
    63 
    7 . /etc/hs/functions.sh 
    8 . /etc/chilli/functions 
     4RUN_D=/var/run 
     5PID_F=$RUN_D/chilli.pid 
    96 
    10 NVRAM_BK=/etc/hs/nvram.bk 
    11 AUTHMODE=$(nvram get wl0_akm) 
    12 AUTHwWPA=$(echo "$AUTHMODE" | grep wpa) 
    13 LISTEN_IP=127.0.0.1 
     7START_CHILLI=$(nvram get start_chilli) 
    148 
    15 check_required 
     9start() { 
     10       
     11      if [ "$START_CHILLI" != "1" ] ; then 
     12         echo "Chilli not to be started ( look at start_chilli nvram variable )" 
     13         exit 0 
     14      fi 
     15      nvram show 2>/dev/null | sed '/^chilli_/!d; s/^chilli_//;' | awk -F '=' ' 
     16      sub(/debug.1/, "debug") 
     17      sub(/debug.0/, "") 
     18      sub(/macauth.1/, "macauth") 
     19      sub(/macauth.0/, "") 
     20      sub(/uamanydns.1/, "uamanydns") 
     21      sub(/uamanydns.0/, "") 
     22      BEGIN { 
     23        print "# this file is automatically generated" 
     24      } 
     25      { 
     26        print $1 " " $2 
     27      }' > /etc/chilli.conf 
    1628 
    17 restart_nas() { 
    18     killall nas  2>&1 >/dev/null 
    19     b1=$(nvram get wl0_radius_ipaddr) 
    20     b2=$(nvram get wl0_radius_key) 
    21     nvram set wl0_radius_ipaddr="$LISTEN_IP" 
    22     nvram set wl0_radius_key="$HS_RADSECRET" 
    23     /etc/init.d/S??wpa start 2>&1 >/dev/null 
    24     nvram set wl0_radius_ipaddr="$b1" 
    25     nvram set wl0_radius_key="$b2" 
     29        /sbin/insmod tun >/dev/null 2>&1 
     30        [ -d $RUN_D ] || mkdir -p $RUN_D 
     31        /usr/sbin/chilli 
    2632} 
    2733 
    28 case "$1" in 
    29     start) 
    30         internal= 
    31         case "$HS_TYPE" in 
    32             internal)  
    33                 internal=1 
    34                 ;; 
    35             coova-chilli|chillispot)     
    36                 ;; 
    37             *)  bailout "not running chillispot" ;; 
    38         esac 
     34stop() { 
     35        [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1 
     36
    3937 
    40         case "$HS_MODE" in 
    41             wireless) 
    42                 split_wireless 
    43                 ;; 
    44             combined) 
    45                 # run chilli on both wired and wireless 
    46                 LANIF=$(nvram get lan_ifname) 
    47                 LANIF=${LANIF:-br0} 
    48                 ifconfig $LANIF inet 0.0.0.0 
    49                 set_nvram dhcp_onboot "off" 
    50                 resetdns 
    51                 ;; 
    52             *) 
    53                 bailout "unrecognized hotspot mode of $HS_MODE!" 
    54                 ;; 
    55         esac 
    56  
    57         [ -n "$AUTHMODE" -a "$AUTHwWPA" = "$AUTHMODE" ] && { 
    58             echo "configuring RADIUS server for WPA" 
    59             addconfig1 "proxylisten $LISTEN_IP" 
    60             addconfig1 "proxyclient $LISTEN_IP" 
    61             addconfig1 "proxyport 1812" 
    62             addconfig1 "proxysecret $HS_RADSECRET" 
    63             restart_nas 
    64         } 
    65  
    66         [ -x "/etc/chilli/wwwsh" ] && { 
    67             addconfig1 "wwwbin  /etc/chilli/wwwsh" 
    68             addconfig1 "uamuiport 3442" 
    69         } 
    70  
    71         for n in $override; do  
    72             eval "nvram set $n=\"\$bk_$n\"" 
    73         done 
    74  
    75         case "$HS_PROXY_TYPE" in 
    76             paproxy) 
    77                 [ -n "$HS_PAPROXY_SERVER" -a -n "$HS_PAPROXY_PORT" ] && { 
    78                     transparent_proxy 0.0.0.0 8888 $HS_PAPROXY_SERVER $HS_PAPROXY_PORT 
    79                     addconfig1 "postauthproxy $HS_UAMLISTEN" 
    80                     addconfig1 "postauthproxyport 8888" 
    81                 } 
    82                 ;; 
    83             cframe) 
    84                 # it has it's own init file 
    85                 ;; 
    86         esac 
    87          
    88         writeconfig 
    89         radiusconfig 
    90  
    91         (crontab -l 2>&- | grep -v $0 
    92             echo "*/10 * * * * $0 checkrunning" 
    93             test ${HS_ADMINTERVAL:-0} -gt 0 && echo "*/$HS_ADMINTERVAL * * * * $0 radconfig" 
    94             test ${HS_CHECKARP:-0} -gt 0 && echo "*/$HS_CHECKARP  * * * * $0 arping" 
    95         ) | crontab - 2>&- 
    96  
    97         [ -d $RUN_D ] || mkdir -p $RUN_D 
    98         touch $LKFILE 
    99  
    100         /sbin/insmod tun >&- 2>&- 
    101         /usr/sbin/chilli 
    102         sleep 1  
    103  
    104         [ -f $PIDFILE ] || { 
    105             resetnet 
    106             (  sleep 1; $0 checkrunning ) & 
    107         } 
    108         ;; 
    109  
    110     checkrunning) 
    111         if [ -e $LKFILE -a ! -e $PIDFILE ]; then 
    112             $0 start 
    113         elif [ -n "$AUTHMODE" -a "$AUTHwWPA" = "$AUTHMODE" ]; then 
    114             # check for running nas (it dies sometimes) 
    115             pid=$(cat /var/run/nas.lan.pid 2>/dev/null) 
    116             [ "$pid" = "" -o ! -e "/proc/$pid/cmdline" ] && restart_nas 
    117         fi 
    118         ;; 
    119   
    120     arping) 
    121         if [ -e $ARPCHECK ]; then 
    122             while read entry; do 
    123                 mac=$(echo $entry | cut -d' ' -f1) 
    124                 ip=$(echo $entry | cut -d' ' -f2) 
    125                 arping -q -c 1 -I $HS_TAPIF $ip || chilli_query $CMDSOCK dhcp-release $mac 
    126             done < $ARPCHECK 
    127         fi 
    128         rm -f $ARPCHECK 
    129         ARPTMP=$RUN_D/chilli.arp.$$ 
    130         chilli_query $CMDSOCK dhcp-list > $ARPTMP 
    131         while read entry; do 
    132             mac=$(echo $entry | cut -d' ' -f1) 
    133             ip=$(echo $entry | cut -d' ' -f2) 
    134             arping -q -c 1 -I $HS_TAPIF $ip || echo $entry >> $ARPCHECK 
    135         done < $ARPTMP 
    136         rm -f $ARPTMP 
    137         ;; 
    138  
    139     radconfig) 
    140         [ -e $MAIN_CONF ] || writeconfig 
    141         radiusconfig 
    142         ;; 
    143      
    144     reload) 
    145         killall -HUP chilli 
    146         ;; 
    147      
    148     stop) 
    149         [ -f $PIDFILE ] && kill $(cat $PIDFILE) 2>&- >&- 
    150         crontab -l 2>&- | grep -v $0 | crontab - 
    151         rm -f $PIDFILE $LKFILE $CMDSOCK 2>&- 
    152         resetnet 
    153         ;; 
    154      
    155     *) 
    156         echo "usage: $0 (start|stop)" 
    157         exit 1 
    158 esac 
    159  
    160 exit $? 
     38reload() { 
     39      nvram show 2>/dev/null | sed '/^chilli_/!d; s/^chilli_//;' | awk -F '=' ' 
     40      sub(/debug.1/, "debug") 
     41      sub(/debug.0/, "") 
     42      sub(/macauth.1/, "macauth") 
     43      sub(/macauth.0/, "") 
     44      sub(/uamanydns.1/, "uamanydns") 
     45      sub(/uamanydns.0/, "") 
     46      BEGIN { 
     47        print "# this file is automatically generated" 
     48      } 
     49      { 
     50        print $1 " " $2 
     51      }' > /etc/chilli.conf 
     52      [ -f $PID_F ] && kill -HUP $(cat $PID_F) >/dev/null 2>&1 
     53