summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-policyrouting/files/etc/init.d
diff options
context:
space:
mode:
authorSven Roederer <freifunk@it-solutions.geroedel.de>2019-02-03 14:13:35 +0100
committerSven Roederer <freifunk@it-solutions.geroedel.de>2019-02-13 21:23:34 +0100
commit4654ba92c3999d84b08211f05d2ccb5ea9da731b (patch)
tree06cedf8e8badc0ce584d8bd5e97fab7476c81549 /contrib/package/freifunk-policyrouting/files/etc/init.d
parenteda8f02dac3caa4d0f52cd1e860d7a392c295df3 (diff)
treewide: move freifunk-related packages to separate repo
Even Freifunk was one of the major factory to create the LuCI-system, it's now only a very small part of LuCI. LuCI has become a much bigger thing and it seems that it's time to move the packages only relating to Freifunk into it's own feed. On the mailinglist it was discussed [1] and a repo below the general Freifunk team on github was created. This commit removes all packages that will be hosted in the new repo [2] 1 - http://lists.freifunk.net/pipermail/wlannews-freifunk.net/2019-February/004818.html 2 - https://github.com/freifunk/openwrt-packages Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
Diffstat (limited to 'contrib/package/freifunk-policyrouting/files/etc/init.d')
-rwxr-xr-xcontrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting172
1 files changed, 0 insertions, 172 deletions
diff --git a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting b/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting
deleted file mode 100755
index 4c9172427c..0000000000
--- a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-START=15
-. /lib/functions/network.sh
-. /lib/functions.sh
-
-proto="4"
-[ -f /proc/net/ipv6_route ] && proto="4 6"
-[ -f /etc/config/olsrd ] && cfgs="olsrd"
-[ -f /etc/config/olsrd6 ] && cfgs="$cfgs olsrd6"
-
-config_load freifunk-policyrouting
-config_get enable pr enable
-config_get fallback pr fallback
-config_get zones pr zones
-
-
-olsrd_rmtables() {
- for cfg in $cfgs; do
- # Remove custom routing tables from olsrd
- if [ "`uci -q get $cfg.@olsrd[0].RtTable`" == "111" ] || [ "`uci -q get $cfg.@olsrd[0].RtTableDefault`" == "112" ]; then
- uci delete $cfg.@olsrd[0].RtTable
- uci delete $cfg.@olsrd[0].RtTableDefault
- uci commit
- fi
- done
-}
-
-olsrd_intalltables() {
- for cfg in $cfgs; do
- if [ ! "`uci -q get $cfg.@olsrd[0].RtTable`" == "111" ] || [ ! "`uci -q get $cfg.@olsrd[0].RtTableDefault`" == "112" ]; then
- uci set $cfg.@olsrd[0].RtTable='111'
- uci set $cfg.@olsrd[0].RtTableDefault='112'
- uci commit $cfg
- /etc/init.d/$cfg restart 2&> /dev/null
- fi
- done
-}
-
-rt_tables() {
- tables="/etc/iproute2/rt_tables"
- if [ -z "`grep "110" $tables`" ]; then
- echo "110 localnets" >> $tables
- fi
- if [ -z "`grep "111" $tables`" ]; then
- echo "111 olsr" >> $tables
- fi
- if [ -z "`grep "112" $tables`" ]; then
- echo "112 olsr-default" >> $tables
- fi
-
-}
-
-handle_disable_dyngw() {
- local cfg="$1"
- local olsrd_cfg="$2"
- config_get library "$cfg" library
- case "$library" in
- olsrd_dyn_gw_plain*)
- config_get RtTable "$cfg" RtTable
- if [ -z "$RtTable" ] || [ "$RtTable" = "254" ]; then
- config_set "$cfg" ignore '1'
- uci set $olsrd_cfg.$cfg.ignore="1"
- uci commit $olsrd_cfg
- logger -s -t policyrouting -p info "dyngw_plain plugin disabled."
- fi
- ;;
- olsrd_dyn_gw.so*)
- logger -s -t policyrouting -p info "$cfg"
- uci set $olsrd_cfg.$cfg.ignore="1"
- uci commit $olsrd_cfg
- logger -s -t policyrouting -p info "dyngw plugin disabled."
- ;;
- esac
-}
-
-disable_dyngw() {
- for olsrd_cfg in $cfgs; do
- config_load $olsrd_cfg
- config_foreach handle_disable_dyngw LoadPlugin $olsrd_cfg
- done
-}
-
-restart_services() {
- logger -s -t policyrouting -p info "Restarting services"
- /etc/init.d/network restart 2&> /dev/null
- for cfg in $cfgs; do
- /etc/init.d/$cfg restart 2&> /dev/null
- done
-}
-
-boot() {
- if [ "$enable" = "1" ]; then
- [ -d /var/state ] || mkdir -p /var/state
- touch /var/state/freifunk-policyrouting
- start noservicerestart
- else
- olsrd_rmtables
- fi
-}
-
-add_lookup_rule() {
- name=${1/-/_}
- lookup=$2
- prio=$3
-
- if [ -z "$name" -o -z "$lookup" -o -z "$prio" ]; then
- logger -s -t policyrouting "Missing parameters for add_rule!"
- else
- for p in $proto; do
- if [ "$p" = "6" ]; then
- rule="rule6"
- else
- rule="rule"
- fi
-
- uci batch <<- EOF
- set network.${name}ipv${p}="$rule"
- set network.${name}ipv${p}.lookup="$lookup"
- set network.${name}ipv${p}.priority="$prio"
- EOF
- done
- fi
-}
-
-del_lookup_rule() {
- name=${1/-/_}
- for p in $proto; do
- uci -q delete network.${name}ipv${p}
- done
-}
-
-start() {
- if [ $enable = "1" ]; then
- logger -s -t policyrouting "Starting policy routing."
- rt_tables
- olsrd_intalltables
- disable_dyngw
-
- add_lookup_rule olsr olsr 1000
- add_lookup_rule localnets localnets 2000
-
- if [ "$fallback" = 1 ]; then
- add_lookup_rule olsr-default olsr-default 100000
- fi
- fi
- uci commit network
- if [ ! "$1" = "noservicerestart" ]; then
- restart_services
- fi
-}
-
-stop() {
- logger -s -t policyrouting "Stopping policy routing"
- olsrd_rmtables
- del_lookup_rule olsr-default
- del_lookup_rule olsr
- del_lookup_rule localnets
- uci commit network
- restart_services
- echo "Hint: To completely disable freifunk-policyrouting set enable=0 in /etc/config/freifunk-policyrouting."
-}
-
-restart() {
- logger -s -t policyrouting "Restarting policy routing"
- olsrd_rmtables
- del_lookup_rule olsr-default
- del_lookup_rule olsr
- del_lookup_rule localnets
- uci commit network
- start
-}