luci-0.9: merge r4856-r4859
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Jun 2009 22:45:06 +0000 (22:45 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Jun 2009 22:45:06 +0000 (22:45 +0000)
contrib/package/cyassl-luci/Makefile
contrib/package/freifunk-firewall/Makefile [new file with mode: 0644]
contrib/package/freifunk-firewall/files/etc/firewall.freifunk [new file with mode: 0644]
contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix [new file with mode: 0644]
contrib/package/freifunk-p2pblock/Makefile
contrib/package/freifunk-watchdog/Makefile
contrib/package/luci/Makefile
contrib/package/olsrd-luci/Makefile
contrib/package/zoneinfo/Makefile
modules/freifunk/root/etc/firewall.freifunk [deleted file]
modules/freifunk/root/etc/hotplug.d/iface/22-firewall-nat-fix [deleted file]

index 6d1b6a655bdb72136a8678e425a48e164e9e2a03..7c23eb4b79df35e684dcf32e4de9cc667137b1a9 100644 (file)
@@ -27,9 +27,9 @@ endef
 
 define Package/libcyassl-luci
   $(call Package/cyassl-luci/Default)
-  SECTION:=libs
-  SUBMENU:=SSL
-  CATEGORY:=Libraries
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Libraries
   TITLE+= (library)
 endef
 
diff --git a/contrib/package/freifunk-firewall/Makefile b/contrib/package/freifunk-firewall/Makefile
new file mode 100644 (file)
index 0000000..d2ae075
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
+#
+# This is free software, licensed under the Apache 2.0 license.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=freifunk-firewall
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/freifunk-firewall
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Freifunk
+  TITLE:=Freifunk Firewall Addon
+  DEPENDS:=+firewall
+endef
+
+define Package/freifunk-firewall/description
+  Various firewall extensions for Freifunk. Includes NAT fixes and advanced settings.
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/freifunk-firewall/postinst
+#!/bin/sh
+
+if ! grep -q /etc/firewall.freifunk /etc/config/firewall; then
+  uci add firewall include >/dev/null
+  uci set firewall.@include[-1].path=/etc/firewall.freifunk
+  uci commit firewall
+fi
+endef
+
+define Package/freifunk-firewall/install
+       $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,freifunk-firewall))
diff --git a/contrib/package/freifunk-firewall/files/etc/firewall.freifunk b/contrib/package/freifunk-firewall/files/etc/firewall.freifunk
new file mode 100644 (file)
index 0000000..b27957b
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Freifunk Firewall addons
+# $Id$
+
+
+#
+# Apply advanced settings
+#
+apply_advanced() {
+       local tcp_ecn
+       local tcp_window_scaling
+       local accept_redirects
+       local accept_source_route
+
+       config_get_bool tcp_ecn $1 tcp_ecn 1
+       config_get ip_conntrack_max $1 ip_conntrack_max
+       config_get_bool tcp_westwood $1 tcp_westwood 0
+       config_get_bool tcp_window_scaling $1 tcp_window_scaling 1
+       config_get_bool accept_redirects $1 accept_redirects 0
+       config_get_bool accept_source_route $1 accept_source_route 0
+
+       logger -t firewall.freifunk "tcp_ecn is $tcp_ecn"
+       logger -t firewall.freifunk "tcp_window_scaling is $tcp_window_scaling"
+       logger -t firewall.freifunk "accept_redirects is $accept_redirects"
+       logger -t firewall.freifunk "accept_source_route is $accept_source_route"
+
+       sysctl -w net.ipv4.tcp_ecn=$tcp_ecn >/dev/null
+       sysctl -w net.ipv4.tcp_window_scaling=$tcp_window_scaling >/dev/null
+       sysctl -w net.ipv4.tcp_westwood=$tcp_westwood >/dev/null
+       sysctl -w net.ipv4.ip_conntrack_max=$ip_conntrack_max >/dev/null
+
+       for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
+               echo $accept_redirects > $f
+       done
+
+       for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
+               echo $accept_source_route > $f
+       done
+}
+
+config_foreach apply_advanced advanced
+
+
+#
+# Apply fixes for masquerading rules
+#
+apply_nat_fix() {
+       local up
+       local ifname
+       config_get up $1 up
+       [ -n "$up" ] || return 0
+       (ACTION="ifup" INTERFACE="$1" . /etc/hotplug.d/iface/22-firewall-nat-fix )
+}
+
+uci_set_state firewall core loaded 1
+config_foreach fw_addif interface
+config_foreach apply_nat_fix interface
+
+[ -x /etc/init.d/luci_splash ] && ( sleep 3; /etc/init.d/luci_splash restart )&
+
+[ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
+       ( sleep 3; /etc/init.d/freifunk-p2pblock restart )&
diff --git a/contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix b/contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix
new file mode 100644 (file)
index 0000000..634f432
--- /dev/null
@@ -0,0 +1,61 @@
+. /lib/firewall/uci_firewall.sh
+unset ZONE
+config_get ifname $INTERFACE ifname
+[ "$ifname" == "lo" ] && exit 0
+
+load_zones() {
+       local name
+       local network
+       config_get name $1 name
+       config_get network $1 network
+       [ -z "$network" ] && network=$name
+       for n in $network; do
+               [ "$n" = "$INTERFACE" ] && ZONE="$ZONE $name"
+       done
+}
+
+config_foreach load_zones zone
+
+[ -z "$ZONE" ] && exit 0
+
+natfix_addr_add() {
+       local network=$1
+       local iface=$2
+
+       config_get parent "$1" interface
+       [ "$network" != "$INTERFACE" -a "$parent" != "$INTERFACE" ] && return 0
+
+       config_get ipaddr "$network" ipaddr
+       [ -n "$ipaddr" ] || return 0
+       config_get netmask "$network" netmask
+       [ -n "$netmask" ] || return 0
+       eval "$(ipcalc.sh $ipaddr $netmask)"
+
+       logger -t firewall.freifunk "adding nat rule for $iface($NETWORK/$PREFIX)"
+       iptables -t nat -A "natfix_$iface" -s "$NETWORK/$PREFIX" -d "$NETWORK/$PREFIX" -j ACCEPT
+}
+
+[ ifup = "$ACTION" ] && {
+       iptables -t nat -N "natfix_$ifname"
+       natfix_addr_add "$INTERFACE" "$ifname"
+       config_foreach natfix_addr_add alias "$ifname"
+
+       for z in $ZONE; do
+               local loaded
+               config_get loaded core loaded
+               [ -n "$loaded" ] && {
+                       logger -t firewall.freifunk "applying nat rules on zone $z"
+                       iptables -t nat -I "zone_${z}_nat" 1 -o "$ifname" -j "natfix_$ifname"
+               }
+       done
+}
+
+[ ifdown = "$ACTION" ] && {
+       for z in $ZONE; do
+               local up
+               config_get up $z up
+               iptables -t nat -D "zone_${z}_nat" -o "$ifname" -j "natfix_$ifname" 2>/dev/null
+       done
+       iptables -t nat -F "natfix_$ifname" 2>/dev/null
+       iptables -t nat -X "natfix_$ifname" 2>/dev/null
+}
index 0da9a32ffa881e49cc097810f12132f48fef0731..3189f0c8994d1d82441ac976122270690bc06493 100644 (file)
@@ -15,8 +15,9 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 include $(INCLUDE_DIR)/package.mk
 
 define Package/freifunk-p2pblock
-  SECTION:=net
-  CATEGORY:=Network
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Freifunk
   TITLE:=Freifunk p2pblock Addon
   DEPENDS:=+iptables-mod-filter +l7-protocols +iptables-mod-conntrack-extra
 endef
index e4cb550f6cca7858713ac4352f352a54dc5e4bc8..4876a94de13077942436e04d0257d54915133d8d 100644 (file)
@@ -16,8 +16,9 @@ PKG_BUILD_DEPENDS := uci
 include $(INCLUDE_DIR)/package.mk
 
 define Package/freifunk-watchdog
-  SECTION:=utils
-  CATEGORY:=Utilities
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=Freifunk
   TITLE:=Freifunk Ad-Hoc watchdog daemon
   DEPENDS:=libuci
 endef
index 4cc734a0e53cc6dd52853f63ac62d72c2f4aefba..e942353dcd4118c2dd4de43d24a0bdd2c494a399 100644 (file)
@@ -50,36 +50,36 @@ endef
 ### Templates ###
 
 define Package/luci/libtemplate
-  SECTION:=admin
-  CATEGORY:=Administration
+  SECTION:=luci
+  CATEGORY:=LuCI
   TITLE:=LuCI - Lua Configuration Interface
   URL:=http://luci.freifunk-halle.net/
   MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
-  SUBMENU:=LuCI Libraries
+  SUBMENU:=Libraries
   DEPENDS:=+luci-core
 endef
 
 define Package/luci/fftemplate
   $(call Package/luci/libtemplate)
-  SUBMENU:=LuCI Freifunk Support
+  SUBMENU:=Freifunk
   DEPENDS:=+luci-mod-freifunk
 endef
 
 define Package/luci/i18ntemplate
   $(call Package/luci/libtemplate)
-  SUBMENU:=LuCI Translations
+  SUBMENU:=Translations
   DEPENDS:=+luci-web
 endef
 
 define Package/luci/thtemplate
   $(call Package/luci/libtemplate)
-  SUBMENU:=LuCI Themes
+  SUBMENU:=Themes
   DEPENDS:=+luci-web
 endef
 
 define Package/luci/webtemplate
   $(call Package/luci/libtemplate)
-  SUBMENU:=LuCI Components
+  SUBMENU:=Components
 endef
 
 
@@ -402,7 +402,7 @@ endef
 
 define Package/luci-mod-freifunk
   $(call Package/luci/fftemplate)
-  DEPENDS:=+luci-admin-full +luci-json
+  DEPENDS:=+luci-admin-full +luci-json +PACKAGE_luci-mod-freifunk:freifunk-firewall
   TITLE:=LuCI Freifunk module
 endef
 
index 29c0740aa6a77914bdc358404c9ebe51debc1b05..5928dfe02ebb200e82ebc97316b088e2ebcb2629 100644 (file)
@@ -33,8 +33,9 @@ include $(INCLUDE_DIR)/package.mk
 
 
 define Package/olsrd-luci/common_info
-       SECTION:=net
-       CATEGORY:=Network
+       SECTION:=luci
+       CATEGORY:=LuCI
+       SUBMENU:=Freifunk
        TITLE:=OLSR - Optimized Link State Routing Daemon
        URL:=http://www.olsr.org/
        MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
index ee0ac13d89b34016b9b03043bfb872dfa6bea94e..82beeb82e488222a15ef9586d6ce9b4aaf818ec9 100644 (file)
@@ -30,10 +30,10 @@ endef
 $(eval $(call Download,tzcode))
 
 define Package/zoneinfo/default
-  SUBMENU:=Zones (ZoneInfo)
+  SUBMENU:=ZoneInfo
   TITLE:=Zone Information
-  SECTION:=net
-  CATEGORY:=Network
+  SECTION:=luci
+  CATEGORY:=LuCI
 endef
 
 define Package/zoneinfo-core
diff --git a/modules/freifunk/root/etc/firewall.freifunk b/modules/freifunk/root/etc/firewall.freifunk
deleted file mode 100644 (file)
index b27957b..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-# Freifunk Firewall addons
-# $Id$
-
-
-#
-# Apply advanced settings
-#
-apply_advanced() {
-       local tcp_ecn
-       local tcp_window_scaling
-       local accept_redirects
-       local accept_source_route
-
-       config_get_bool tcp_ecn $1 tcp_ecn 1
-       config_get ip_conntrack_max $1 ip_conntrack_max
-       config_get_bool tcp_westwood $1 tcp_westwood 0
-       config_get_bool tcp_window_scaling $1 tcp_window_scaling 1
-       config_get_bool accept_redirects $1 accept_redirects 0
-       config_get_bool accept_source_route $1 accept_source_route 0
-
-       logger -t firewall.freifunk "tcp_ecn is $tcp_ecn"
-       logger -t firewall.freifunk "tcp_window_scaling is $tcp_window_scaling"
-       logger -t firewall.freifunk "accept_redirects is $accept_redirects"
-       logger -t firewall.freifunk "accept_source_route is $accept_source_route"
-
-       sysctl -w net.ipv4.tcp_ecn=$tcp_ecn >/dev/null
-       sysctl -w net.ipv4.tcp_window_scaling=$tcp_window_scaling >/dev/null
-       sysctl -w net.ipv4.tcp_westwood=$tcp_westwood >/dev/null
-       sysctl -w net.ipv4.ip_conntrack_max=$ip_conntrack_max >/dev/null
-
-       for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
-               echo $accept_redirects > $f
-       done
-
-       for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
-               echo $accept_source_route > $f
-       done
-}
-
-config_foreach apply_advanced advanced
-
-
-#
-# Apply fixes for masquerading rules
-#
-apply_nat_fix() {
-       local up
-       local ifname
-       config_get up $1 up
-       [ -n "$up" ] || return 0
-       (ACTION="ifup" INTERFACE="$1" . /etc/hotplug.d/iface/22-firewall-nat-fix )
-}
-
-uci_set_state firewall core loaded 1
-config_foreach fw_addif interface
-config_foreach apply_nat_fix interface
-
-[ -x /etc/init.d/luci_splash ] && ( sleep 3; /etc/init.d/luci_splash restart )&
-
-[ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
-       ( sleep 3; /etc/init.d/freifunk-p2pblock restart )&
diff --git a/modules/freifunk/root/etc/hotplug.d/iface/22-firewall-nat-fix b/modules/freifunk/root/etc/hotplug.d/iface/22-firewall-nat-fix
deleted file mode 100644 (file)
index 634f432..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-. /lib/firewall/uci_firewall.sh
-unset ZONE
-config_get ifname $INTERFACE ifname
-[ "$ifname" == "lo" ] && exit 0
-
-load_zones() {
-       local name
-       local network
-       config_get name $1 name
-       config_get network $1 network
-       [ -z "$network" ] && network=$name
-       for n in $network; do
-               [ "$n" = "$INTERFACE" ] && ZONE="$ZONE $name"
-       done
-}
-
-config_foreach load_zones zone
-
-[ -z "$ZONE" ] && exit 0
-
-natfix_addr_add() {
-       local network=$1
-       local iface=$2
-
-       config_get parent "$1" interface
-       [ "$network" != "$INTERFACE" -a "$parent" != "$INTERFACE" ] && return 0
-
-       config_get ipaddr "$network" ipaddr
-       [ -n "$ipaddr" ] || return 0
-       config_get netmask "$network" netmask
-       [ -n "$netmask" ] || return 0
-       eval "$(ipcalc.sh $ipaddr $netmask)"
-
-       logger -t firewall.freifunk "adding nat rule for $iface($NETWORK/$PREFIX)"
-       iptables -t nat -A "natfix_$iface" -s "$NETWORK/$PREFIX" -d "$NETWORK/$PREFIX" -j ACCEPT
-}
-
-[ ifup = "$ACTION" ] && {
-       iptables -t nat -N "natfix_$ifname"
-       natfix_addr_add "$INTERFACE" "$ifname"
-       config_foreach natfix_addr_add alias "$ifname"
-
-       for z in $ZONE; do
-               local loaded
-               config_get loaded core loaded
-               [ -n "$loaded" ] && {
-                       logger -t firewall.freifunk "applying nat rules on zone $z"
-                       iptables -t nat -I "zone_${z}_nat" 1 -o "$ifname" -j "natfix_$ifname"
-               }
-       done
-}
-
-[ ifdown = "$ACTION" ] && {
-       for z in $ZONE; do
-               local up
-               config_get up $z up
-               iptables -t nat -D "zone_${z}_nat" -o "$ifname" -j "natfix_$ifname" 2>/dev/null
-       done
-       iptables -t nat -F "natfix_$ifname" 2>/dev/null
-       iptables -t nat -X "natfix_$ifname" 2>/dev/null
-}