webif : - add support for wl0_wdstimeout, wl0_antdiv (request by french Wireless...
authorFlorian Fainelli <florian@openwrt.org>
Sat, 20 May 2006 19:06:26 +0000 (19:06 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sat, 20 May 2006 19:06:26 +0000 (19:06 +0000)
ntpclient: fix process running detection, closes #505
base-files:
- clean up per interface static_route code,restore old behaviour (with metric, gateway ...), closes #484
- add ifup_interfaces variable, can be used as order to bring interfaces, closes #309

SVN-Revision: 3809

openwrt/package/base-files/default/etc/functions.sh
openwrt/package/base-files/default/etc/init.d/S05nvram
openwrt/package/base-files/default/etc/init.d/S40network
openwrt/package/ntpclient/files/ntpclient.init
openwrt/package/openvpn/Config.in
openwrt/package/openvpn/Makefile
openwrt/package/webif/files/usr/lib/webif/lang/fr/common.txt
openwrt/package/webif/files/www/cgi-bin/webif/firewall.sh
openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh

index 4af6dceaabfbbbf381fb0c822bcc11ad608e9b9c..8072c9ac621cb4ed138e97620493dcd9cd76b6d2 100755 (executable)
@@ -43,14 +43,13 @@ do_ifup() {
                ${gateway:+$DEBUG route add default gw $gateway}
 
                [ -n "$static_route" ] && {
-                       for route in $static_route; do
-                               if [ "$(echo $route | cut -d \/ -f2)" != "32" ];
-                               then
-                                       route add -net $(echo $route | cut -d \/ -f1) netmask $(echo $route | cut -d \/ -f1) dev $if
-                               else
-                                       route add -host $(echo $route | cut -d \/ -f1) dev $if
+                       for route in $static_route; do {
+                       eval "set $(echo $route | sed 's/:/ /g')"
+                               if [ "$2" = "255.255.255.255" ]; then
+                                       opt="-host"
                                fi
-                       done
+                               $DEBUG route add ${opt:-"-net"} $1 netmask $2 gw $3 metric $4 
+                       } done
                }
 
                [ -f /etc/resolv.conf ] || {
index 2e6f2b9357e01e39088bf0b1d399270b667e7fc2..add4ef2722e3cfb7de7e64c4d9a985846138d871 100755 (executable)
@@ -132,6 +132,8 @@ nvram set lan_proto="static"
        debug "### wla2-g54l hacks ###"
        nvram_default wan_ifname "none"
        fixup_lan "vlan0" "vlan0 eth1"
+       nvram_default vlan0ports "1 2 5t"
+       nvram_default vlan1ports "3 4 5t"
 }
 
 # wrtsl54gs vlan defaults
index d8b4e4125ea7f5812a74189f8457b3098c5031f8..8c17167d4f59817db091702c668a2df23b0a1062 100755 (executable)
@@ -1,14 +1,13 @@
 #!/bin/sh
 case "$1" in
   start|restart)
-    ifup lan
-    ifup wan
-    ifup wifi
-    wifi up
-
-    for route in $(nvram get static_route); do {
-      eval "set $(echo $route | sed 's/:/ /g')"
-      $DEBUG route add -net $1 netmask $2 gw $3 metric $4 dev $5
-    } done
-    ;;
+  ifup_interfaces=$(nvram get ifup_interfaces)
+  ifup_interfaces=${ifup_interfaces:-"wan lan wifi"}
+  for iface in $ifup_interfaces; do
+       ifup $iface
+       if [ "$iface" = "wifi" ]; then
+               $iface up
+       fi
+  done
+  ;;
 esac
index c8505c5caddd7be9dcabe426fc086ab434a78171..116e9fe58f0ca0cd07d11a8f314d7a776f0c31e2 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 server=$(nvram get ntp_server)
-case "$ACTION" in
+case "${ACTION:-ifup}" in
        ifup)
-               ps x | grep '[n]tpclient' >&- || {
+               ps x | grep 'bin/[n]tpclient' >&- || {
                        route -n 2>&- | grep '^0.0.0.0' >&- && /usr/sbin/ntpclient -c 1 -s -h ${server:-pool.ntp.org} &
                }
                ;;
index 65a1bf8dc8ed48f371d0ce5d0bb1d945526504e6..d1ec8566ed06e841d6e0777146ade63c8bdc8bcb 100644 (file)
@@ -16,6 +16,15 @@ config BR2_PACKAGE_OPENVPN_EASY_RSA
        depends BR2_PACKAGE_OPENVPN
        select BR2_PACKAGE_OPENSSL_UTIL
 
+config BR2_PACKAGE_OPENVPN_WEBIF
+       tristate "openvpn-webif - web interface module to configure OpenVPN (client mode)"
+       default m
+       depends BR2_PACKAGE_OPENVPN
+       select BR2_PACKAGE_WEBIF
+       help
+         Web interface module to configure and report status of OpenVPN (client
+         mode only)
+
 config BR2_PACKAGE_OPENVPN_SERVER
        bool "Enable server support"
        default y
@@ -43,6 +52,11 @@ config BR2_PACKAGE_OPENVPN_PASSWORD_SAVE
        default y
        depends BR2_PACKAGE_OPENPVN
 
+config BR2_PACKAG_OPENVPN_MANAGEMENT
+       bool "Enable PKCS12 management features"
+       default n
+       depends BR2_PACKAGE_OPENVPN
+
 config BR2_PACKAGE_OPENVPN_SMALL
        bool "Enable smaller executable size (disable OCC, usage message, and verb 4 parm list)"
        default n
index ab92fedbdde1de345886dea1ad8a1a2fe0bfa99f..371ffbbbe21cc09c180d43b4713607f94d4266b8 100644 (file)
@@ -18,6 +18,7 @@ include $(TOPDIR)/package/rules.mk
 
 $(eval $(call PKG_template,OPENVPN,openvpn,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,OPENVPN_EASY_RSA,openvpn-easy-rsa,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENVPN_WEBIF,openvpn-webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 
 PKG_DEPEND:="kmod-tun"
 ifneq ($(BR2_PACKAGE_OPENVPN_OPENSSL),y)
@@ -42,6 +43,9 @@ endif
 ifeq ($(BR2_PACKAGE_OPENVPN_SMALL),y)
 ENABLE_SMALL:=--enable-small
 endif
+ifneq ($(BR2_PACKAGE_OPENVPN_MANAGEMENT),y)
+DISABLE_SMALL:=--disable-management
+endif
 
 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
        (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
@@ -82,6 +86,7 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
                  $(DISABLE_HTTP) \
                  $(ENABLE_PASSWORD_SAVE) \
                  $(ENABLE_SMALL) \
+                 $(DISABLE_MANAGEMENT) \
        );
        touch $(PKG_BUILD_DIR)/.configured
 
@@ -106,3 +111,9 @@ $(IPKG_OPENVPN_EASY_RSA):
        install -m 0644 $(PKG_BUILD_DIR)/easy-rsa/2.0/openssl.cnf $(IDIR_OPENVPN_EASY_RSA)/etc/easy-rsa/openssl.cnf
        install -m 0644 $(PKG_BUILD_DIR)/easy-rsa/2.0/vars $(IDIR_OPENVPN_EASY_RSA)/etc/easy-rsa/vars
        $(IPKG_BUILD) $(IDIR_OPENVPN_EASY_RSA) $(PACKAGE_DIR)
+
+$(IPKG_OPENVPN_WEBIF):
+       install -d -m0755 $(IDIR_OPENVPN_WEBIF)/etc/init.d $(IDIR_OPENVPN_WEBIF)/www/cgi-bin/webif
+       install -m0755 ./files/S50openvpn $(IDIR_OPENVPN_WEBIF)/etc/init.d/S50openvpn
+       cp -fpR .files/openvpn{,-status}.sh $(IDIR_OPENVPN_WEBIF)/www/cgi-bin/webif/
+       $(IPKG_BUILD) $(IDIR_OPENVPN_WEBIF) $(PACKAGE_DIR)
index 398755264f6f45ac94f6681d31694213b910e66b..94ea6d4dc399504579deb3db7333f46c92afdb29 100644 (file)
@@ -182,6 +182,8 @@ Deny => Refuser
 Set => Param&egrave;trer
 Settings => Param&egrave;tres
 Automatic WDS => WDS automatique
+WDS watchdog timeout => D&eacute;lai d'inactivit&eacute; WDS
+Antenna selection => S&eacute;lection de l'antenne
 
 # "Hosts" page
 
index 0fd84f884bd38438fb2f95ce31ad430d232217c0..e9228dcdb4eb271605c2310087f9506156a138e1 100755 (executable)
@@ -8,8 +8,23 @@ exists "$FW_FILE" || touch "$FW_FILE" >&- 2>&-
 FW_FILE_NEW="/tmp/.webif/file-firewall-new"
 
 empty "$FORM_cancel" || {
+       empty "$FORM_delete_on_cancel" || {
+               awk \
+                       -f - "$FW_FILE" > "$FW_FILE_NEW" <<EOF
+BEGIN {
+       first=1
+}
+{
+       if (first != 1) print old
+       old = \$0
+       first = 0
+}
+EOF
+               mv "$FW_FILE_NEW" "$FW_FILE"
+       }
        FORM_save=""
        FORM_edit=""
+       FORM_cancel=""
 }
 
 empty "$FORM_save" || {
@@ -169,6 +184,7 @@ awk \
        -v del_layer7="$FORM_del_layer7" \
        -v data_submit="$FORM_data_submit" \
        -v new_match="$FORM_new_match" \
+       -v delete_on_cancel="$FORM_delete_on_cancel" \
        -f /usr/lib/webif/common.awk \
        -f /usr/lib/common.awk \
        -f - "$FW_FILE" <<EOF
@@ -296,8 +312,10 @@ BEGIN {
 
 (\$1 == "drop") || (\$1 == "accept") || (\$1 == "forward" ) {
        if (n == edit) {
-               printf "<tr><td>&nbsp;</td><td>" button("save", "Save") button("cancel", "Cancel") "</td></tr>"
-               
+               printf "<tr><td>&nbsp;</td><td>" button("save", "Save")
+               if( delete_on_cancel != "" ) print hidden("delete_on_cancel", 1);
+               print button("cancel", "Cancel")
+               print "</td></tr>"
                print "</table>"
                print "</td></tr>"
                print "</form>"
@@ -318,6 +336,7 @@ END {
        print "<form method=\\"POST\\" action=\\"$SCRIPT_NAME\\" enctype=\\"multipart/form-data\\">"
        print hidden("edit", n + 1);
        print "<select name=\\"new_target\\">"
+       print hidden("delete_on_cancel", 1);
        print sel_option("forward", "Forward")
        print sel_option("accept", "Accept")
        print sel_option("drop", "Drop")
index f8e4a3613dd8691de45872bf0189ad7e0405473b..123baae43aee2c7c0cef706196b389a38e546fa9 100755 (executable)
@@ -26,15 +26,30 @@ if empty "$FORM_submit"; then
                1|on|enabled) FORM_lazywds=1;;
                *) FORM_lazywds=0;;
        esac
+       FORM_wdstimeout=${wl0_wdstimeout:-$(nvram get wl0_wdstimeout)}
+       FORM_antdiv="${wl0_antdiv:-$(nvram get wl0_antdiv)}"
+       case "$FORM_antdiv" in
+               -1|auto) FORM_antdiv=-1;;
+               0|main|left) FORM_antdiv=0;;
+               1|aux|right) FORM_antdiv=1;;
+               3|diversity) FORM_antdiv=3;;
+               *) FORM_antdiv=-1;;
+       esac
+       FORM_distance="${wl0_distance:-$(nvram get wl0_distance)}"
 else
        SAVED=1
 
        validate <<EOF
 int|FORM_lazywds|Lazy WDS On/Off|required min=0 max=1|$FORM_lazywds
+int|FORM_wdstimeout|WDS watchdog timeout|optional min=0 max=3600|$FORM_wdstimeout
+int|FORM_distance|Distance|optional min=0 max=256|$FORM_distance
 EOF
        equal "$?" 0 && {
                save_setting wireless wl0_lazywds "$FORM_lazywds"
+               save_setting wireless wl0_wdstimeout "$FORM_wdstimeout"
                save_setting wireless wl0_macmode "$FORM_macmode"
+               save_setting wireless wl0_antdiv "$FORM_antdiv"
+               save_setting wireless wl0_distance "$FORM_distance"
        }
 fi
 
@@ -65,11 +80,21 @@ field|@TR<<Automatic WDS>>
 select|lazywds|$FORM_lazywds
 option|1|@TR<<Enabled>>
 option|0|@TR<<Disabled>>
+field|@TR<<WDS watchdog timeout>>
+text|wdstimeout|$FORM_wdstimeout
 field|@TR<<Filter Mode>>:
 select|macmode|$FORM_macmode
 option|disabled|@TR<<Disabled>>
 option|allow|@TR<<Allow>>
 option|deny|@TR<<Deny>>
+field|@TR<<Antenna selection>>:
+select|antdiv|$FORM_antdiv
+option|-1|@TR<<Automatic>>
+option|0|@TR<<Left>>
+option|1|@TR<<Right>>
+option|3|@TR<<Diversity>>
+field|@TR<<Distance>>
+text|distance|$FORM_distance
 end_form
 EOF