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>
This commit is contained in:
Sven Roederer
2019-02-03 14:13:35 +01:00
parent eda8f02dac
commit 4654ba92c3
249 changed files with 0 additions and 26719 deletions

View File

@@ -1,39 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=community-profiles
PKG_RELEASE:=2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/community-profiles
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Community profiles
DEPENDS:=freifunk-common
endef
define Package/community-profiles/description
These community profiles set defaults for various free network/freifunk communities and are used by wizards like ffwizard and meshwizard.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/community-profiles/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,community-profiles))

View File

@@ -1,10 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk'
option 'homepage' 'http://freifunk.net'
option 'ssid' 'www.freifunk.net'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '52.000'
option 'longitude' '10.000'
option 'splash_prefix' '28'
option 'mesh_network' '10.0.0.0/8'

View File

@@ -1,56 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Altmark'
option 'homepage' 'http://altmark.freifunk.net'
option 'ssid' 'altmark.freifunk.net'
option 'mesh_network' '10.59.0.0/16'
option 'latitude' '52.885'
option 'longitude' '11.15'
option 'suffix' 'olsr.altmark.freifunk.net'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ff'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssffl'
option enabled '1'
option max '10'
option cache '3600'
option width '100%'
option title 'Freifunk Blog'
option template 'iframe'
option url 'http://freifunk.net'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,22 +0,0 @@
config 'community' 'profile'
option 'name' 'arig Arad'
option 'homepage' 'http://arig.org.il'
option 'ssid' 'arig.org.il'
option 'latitude' '31.26'
option 'longitude' '35.21'
option 'splash_prefix' '28'
option 'suffix' 'arig'
option 'mesh_network' '10.81.8.0/22'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '13' '13:CA:FF:EE:BA:BE'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'country' 'IL'
option 'beacon_int' '5000'
option 'distance' '1500'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,22 +0,0 @@
config 'community' 'profile'
option 'name' 'arig Neot Semadar'
option 'homepage' 'http://www.neot-semadar.com'
option 'ssid' 'arig.org.il'
option 'latitude' '30.05'
option 'longitude' '35.02'
option 'splash_prefix' '272'
option 'suffix' 'arig'
option 'mesh_network' '10.81.12.0/22'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '13' '13:CA:FF:EE:BA:BE'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'country' 'IL'
option 'beacon_int' '5000'
option 'distance' '1500'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,22 +0,0 @@
config 'community' 'profile'
option 'name' 'arig Tel Aviv'
option 'homepage' 'http://arig.org.il'
option 'ssid' 'arig.org.il'
option 'latitude' '32.056'
option 'longitude' '34.772'
option 'splash_prefix' '28'
option 'suffix' 'arig'
option 'mesh_network' '10.81.0.0/21'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '13' '13:CA:FF:EE:BA:BE'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'country' 'IL'
option 'beacon_int' '5000'
option 'distance' '1500'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,64 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Augsburg'
option 'homepage' 'http://augsburg.freifunk.net'
option 'ssid' 'augsburg.freifunk.net'
option 'mesh_network' '10.11.0.0/18'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '48.37071'
option 'longitude' '10.89475'
option 'suffix' 'ffa'
option 'splash_prefix' '27'
option 'vap' '1'
option adhoc_dhcp_when_vap '1'
option 'ipv6' '1'
option 'ipv6_config' 'auto-ipv6-fromv4'
option 'ipv6_prefix' 'fdca:ffee:ffa::/48'
#option 'extrapackages' ''
config 'defaults' 'interface'
option 'netmask' '255.255.192.0'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
config 'defaults' 'luci_splash'
option 'limit_up' '40'
option 'limit_down' '120'
option 'leasetime' '8'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssffa'
option enabled '1'
option max '10'
option cache '3600'
option width '50%'
option title 'Freifunk Augsburg Blog'
option template 'rssfeed'
option url 'http://augsburg.freifunk.net/blog?type=100'
config widget 'rssaugsburg'
option cache '3600'
option width '50%'
option title 'Augsburger Blogs'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://wgaugsburg.de/augsburg/rss20.xml'
config widget 'search'
option template 'search'
option title 'Search'
option enabled '1'
option width '50%'
list engine 'Google|http://www.google.de/search?q='
list engine 'Freifunk&#160;Augsburg|http://www.google.de/search?q=site:augsburg.freifunk.net+'
list engine 'Freifunk&#160;Wiki|http://wiki.freifunk.net/index.php?search='
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,20 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Bayreuth'
option 'homepage' 'http://bayreuth.freifunk.net'
option 'ssid' 'bayreuth.freifunk.net'
option 'mesh_network' '10.195.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '49.945812'
option 'longitude' '11.575045'
option 'suffix' 'ffbt'
option 'splash_prefix' '28'
config 'defaults' 'interface'
option 'netmask' '255.255.192.0'
config 'defaults' 'wifi_device'
option 'channel' '4'
config 'defaults' 'wifi_iface'
option 'bssid' '42:CA:FF:EE:BA:BE'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Piratenfreifunk Bergisches Land'
option 'homepage' 'http://www.piraten-bergisches-land.de'
option 'ssid' 'PiratenfunkBL'
option 'mesh_network' '10.3.0.0/16'
option 'splash_network' '192.168.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '51.26849'
option 'longitude' '7.19476'
config 'defaults' 'wifi_device'
option 'channel' '11'
config 'defaults' 'wifi_iface'
option 'bssid' '02:40:00:42:42:42'

View File

@@ -1,39 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Berlin'
option 'homepage' 'http://berlin.freifunk.net'
option 'ssid' 'berlin.freifunk.net'
option 'ssid_scheme' 'addchannelbefore'
option 'mesh_network' '10.0.0.0/8'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '52.52075'
option 'longitude' '13.40948'
option 'owm_api' 'http://util.berlin.freifunk.net'
config 'defaults' 'wifi_device'
option 'channel' '13'
config 'defaults' 'wifi_device_5'
option 'channel' '36'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'wifi_iface_5'
option 'mcast_rate' '12000'
config 'defaults' 'bssidscheme'
option '10' '02:CA:FF:EE:BA:BE'
option '13' 'D2:CA:FF:EE:BA:BE'
option '36' '02:36:CA:FF:EE:EE'
config 'defaults' 'ssidscheme'
option '13' 'intern-ch13.freifunk.net'
option '36' 'intern-ch36.freifunk.net'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp'
option leasetime '5m'

View File

@@ -1,23 +0,0 @@
config 'community' 'profile'
option 'name' 'carbodebit'
option 'homepage' 'http://carbodebit.net'
option 'ssid' 'VHDCARBES'
option 'mesh_network' '10.72.1.0/24'
option 'latitude' '43.633683'
option 'longitude' '2.160894'
config 'defaults' 'wifi_iface'
option 'bssid' 'DE:78:70:E4:FA:B8'
config 'defaults' 'interface'
option 'netmask' '255.255.255.0'
option 'dns' '10.70.1.1 213.190.64.170 213.190.64.166'
config 'defaults' 'wifi_device'
option 'channel' '11'
option 'country' 'FR'
option 'distance' '2000'
config 'defaults' 'bssidscheme'
option 'all' 'DE:78:70:E4:FA:B8'

View File

@@ -1,37 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Cottbus'
option 'homepage' 'http://cottbus.freifunk.net'
option 'ssid' 'cottbus.freifunk.net'
option 'ssid_scheme' 'ssidonly'
option 'mesh_network' '10.35.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '51.757689'
option 'longitude' '13.40948'
config 'defaults' 'wifi_device'
option 'channel' '13'
config 'defaults' 'wifi_device_5'
option 'channel' '36'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'wifi_iface_5'
option 'mcast_rate' '12000'
config 'defaults' 'bssidscheme'
option '13' 'D2:CA:FF:EE:BA:BE'
option '36' '02:36:CA:FF:EE:EE'
config 'defaults' 'ssidscheme'
option '13' 'intern-ch13.cottbus.freifunk.net'
option '36' 'intern-ch36.cottbus.freifunk.net'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp'
option 'leasetime' '5m'

View File

@@ -1,21 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Demo'
option 'homepage' 'http://www.freifunk.net'
option 'ssid' 'demo.freifunk.net'
option 'mesh_network' '10.11.12.0/24'
option 'latitude' '51.163375'
option 'longitude' '10.447683'
option 'suffix' 'ff'
option 'vap' '1'
option adhoc_dhcp_when_vap '1'
option 'ipv6' '1'
option 'ipv6_config' 'auto-ipv6-fromv4'
option 'ipv6_prefix' 'fdca:ffff:ffff::/48'
#option 'extrapackages' ''
config 'defaults' 'interface'
option 'netmask' '255.255.255.0'
config 'defaults' 'luci_splash'
option 'limit_up' '50'
option 'limit_down' '200'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Duesseldorf'
option 'homepage' 'http://freifunk-duesseldorf.de'
option 'ssid' 'duesseldorf.freifunk.net'
option 'mesh_network' '10.40.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '51.217812'
option 'longitude' '6.761564'
config 'defaults' 'wifi_device'
option 'channel' '3'
config 'defaults' 'wifi_iface'
option 'bssid' '02:CA:FF:EE:BA:BE'

View File

@@ -1,48 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Erfurt'
option 'homepage' 'http://erfurt.freifunk.net'
option 'ssid' 'erfurt.freifunk.net'
option 'mesh_network' '10.99.0.0/16'
option 'latitude' '50.9768'
option 'longitude' '11.02367'
option 'suffix' 'olsr.erfurt.freifunk.net'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ff'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssffl'
option enabled '1'
option max '10'
option cache '3600'
option width '100%'
option title 'Freifunk Blog'
option template 'iframe'
option url 'http://freifunk.net'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,25 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Evernet eG'
option 'homepage' 'http://www.evernet-eg.de'
option 'ssid' 'evernet.freifunk.net'
option 'mesh_network' '10.0.0.0/8'
option 'latitude' '51.15692062509162'
option 'longitude' '10.716041922569275'
option 'suffix' 'evernet'
config 'defaults' 'interface'
option 'netmask' '255.0.0.0'
config 'defaults' 'bssidscheme'
option 'all' '02:CA:FF:EE:BA:BE'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'country' 'DE'
option 'txpower' '19'
option 'beacon_int' '5000'
option 'distance' '1500'
option 'noscan' '0'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,45 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Freiburg'
option 'homepage' 'http://freiburg.freifunk.net'
option 'ssid' '02:CA:FF:EE:BA:BE'
option 'mesh_network' '10.60.0.0/16'
option 'latitude' '47.994841'
option 'longitude' '7.849772'
option 'suffix' 'olsr.freiburg.freifunk.net'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ff'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,38 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Fürstenwalde'
option 'homepage' 'http://fuerstenwalde.freifunk.net'
option 'ssid' 'fuerstenwalde.freifunk.net'
option 'ssid_scheme' 'addchannelbefore'
option 'mesh_network' '10.0.0.0/8'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '52.35844'
option 'longitude' '14.063696'
option 'owm_api' 'http://util.berlin.freifunk.net'
config 'defaults' 'wifi_device'
option 'channel' '13'
config 'defaults' 'wifi_device_5'
option 'channel' '36'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'wifi_iface_5'
option 'mcast_rate' '12000'
config 'defaults' 'bssidscheme'
option '13' 'D2:CA:FF:EE:BA:BE'
option '36' '02:36:CA:FF:EE:EE'
config 'defaults' 'ssidscheme'
option '13' 'intern-ch13.freifunk.net'
option '36' 'intern-ch36.freifunk.net'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp'
option leasetime '5m'

View File

@@ -1,23 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Gadow'
option 'homepage' 'http://gadow.freifunk.net'
option 'ssid' 'gadow.freifunk.net'
option 'mesh_network' '10.61.0.0/16'
option 'latitude' '53.11'
option 'longitude' '12.61'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,19 +0,0 @@
config 'community' 'profile'
option 'name' 'Guifi Bages'
option 'homepage' 'http://guifi.net/PlaBages'
option 'ssid' 'guifibages'
option 'mesh_network' '10.224.3.0/16'
option 'splash_network' '10.104.0.0/16'
option 'theme' 'luci-theme-freifunk-generic'
option 'latitude' '41.718437'
option 'longitude' '1.826477'
option 'suffix' 'guifibages.cat'
option 'splash_prefix' '27'
option 'extrapackages' 'luci-app-olsr-viz luci-i18n-catalan'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'
config 'defaults' 'bssidscheme'
option 'all' '12:34:56:78:9a:bc'

View File

@@ -1,71 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Halle'
option 'homepage' 'http://freifunk-halle.org'
option 'ssid' 'halle.freifunk.net'
option 'mesh_network' '10.62.0.0/16'
option 'splash_network' '6.0.0.0/8'
option 'splash_prefix' '27'
option 'latitude' '51.47911'
option 'longitude' '11.96901'
option 'adhoc_dhcp_when_vap' '0'
option 'suffix' 'ffhal'
option 'vap' '1'
option 'batman' '1'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'country' 'DE'
config 'defaults' 'bssidscheme'
option 'all' '02:CA:FF:EE:BA:BE'
config 'defaults' 'luci_splash'
option 'redirect_url' 'http://freifunk-halle.org/willkommen.php'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'dhcp'
option 'leasetime' '5m'
config 'defaults' 'olsrd'
option 'AllowNoInt' 'yes'
option 'FIBMetric' 'flat'
option 'Pollrate' '0.025'
option 'TcRedundancy' '2'
option 'NatThreshold' '0.75'
option 'LinkQualityAlgorithm' 'etx_ff'
option 'LinkQualityFishEye' '1'
option 'Willingness' '3'
config 'defaults' 'olsr_interface'
option 'Ip4Broadcast' '255.255.255.255'
option 'HelloInterval' '5.0'
option 'HelloValidityTime' '125.0'
option 'TcInterval' '3.0'
option 'TcValidityTime' '375.0'
option 'MidInterval' '25.0'
option 'MidValidityTime' '375.0'
option 'HnaInterval' '25.0'
option 'HnaValidityTime' '375.0'
config widget 'rsshalle'
option cache '3600'
option width '50%'
option title 'neuste Foreneinträge in Halle'
option template 'rssfeed'
option enabled '1'
option max '5'
option url 'http://www.freifunk-halle.org/rss.php'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Hameln'
option 'homepage' 'http://freifunk-hameln.de'
option 'ssid' 'hameln.freifunk.net'
option 'suffix' 'ffhm'
option 'latitude' '52.1030706'
option 'longitude' '9.3514778'
option 'mesh_network' '10.31.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'vap' '1'
option adhoc_dhcp_when_vap '1'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'

View File

@@ -1,22 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Hooge'
option 'homepage' 'http://hooge.freifunk.net'
option 'ssid' 'hooge.freifunk.net'
option 'mesh_network' '10.11.128.0/24'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '54.572161'
option 'longitude' '8.559551'
option 'suffix' 'hooge'
option 'splash_prefix' '27'
option 'vap' '1'
option 'extrapackages' ''
list 'owm_api' 'http://api.openwifimap.net'
list 'owm_api' 'http://owmapi.pberg.freifunk.net'
option 'mapserver' 'http://openwifimap.net/'
config 'defaults' 'interface'
option 'netmask' '255.255.255.0'
config 'defaults' 'luci_splash'
option 'limit_up' '20'
option 'limit_down' '50'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Kiberpipa.net'
option 'homepage' 'http://www.kiberpipa.net'
option 'ssid' 'open.kiberpipa.net'
option 'mesh_network' '10.14.0.0/16'
option 'splash_network' '10.14.128.0/17'
option 'splash_prefix' '27'
option 'latitude' '46.05063'
option 'longitude' '14.50402'
config 'defaults' 'wifi_device'
option 'channel' '8'
config 'defaults' 'interface'
option 'dns' '10.14.0.1 208.67.222.220 208.67.220.222'

View File

@@ -1,57 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Kyritz'
option 'homepage' 'http://kyritz.freifunk.net'
option 'ssid' 'mesh.freifunk.net'
option 'mesh_network' '104.59.0.0/16'
option 'latitude' '52.94'
option 'longitude' '12.4'
option 'suffix' 'olsr.kyritz.freifunk.net'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ff'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssffl'
option enabled '1'
option max '10'
option cache '3600'
option width '100%'
option title 'Freifunk Blog'
option template 'iframe'
option url 'http://freifunk.net'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,25 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk L59'
option 'homepage' 'http://freifunk.net'
option 'ssid' 'freifunk.net'
option 'mesh_network' '10.59.0.0/16'
option 'splash_network' '6.59.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '52.26337'
option 'longitude' '10.52103'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,55 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Leipzig'
option 'homepage' 'http://leipzig.freifunk.net'
option 'ssid' 'leipzig.freifunk.net'
option 'mesh_network' '10.61.0.0/16'
option 'latitude' '51.33348'
option 'longitude' '12.40297'
option 'suffix' 'olsr.leipzig.freifunk.net'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ff'
config widget 'customindex'
option enabled '1'
option width '50%'
option paddingright '5%'
option template 'html'
config widget 'rssffl'
option enabled '1'
option max '10'
option cache '3600'
option width '100%'
option title 'Freifunk Leipzig Blog'
option template 'iframe'
option url 'http://leipzig.freifunk.net'
config widget 'rssbundesweit'
option cache '3600'
option width '50%'
option title 'bundesweiter Freifunk Blog'
option template 'rssfeed'
option enabled '1'
option max '10'
option url 'http://blog.freifunk.net/rss.xml'
config widget 'clear1'
option template 'clear'
option enabled '1'

View File

@@ -1,12 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Marburg'
option 'homepage' ' http://marburg.freifunk.de'
option 'ssid' 'marburg.freifunk.net'
option 'mesh_network' '10.128.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '29'
option 'latitude' '49.63939'
option 'longitude' '8.633718'
config 'defaults' 'interface'
option 'dns' '8.8.8.8 212.204.49.83'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Oldenburg'
option 'homepage' 'http://oldenburg.freifunk.net'
option 'ssid' 'oldenburg.freifunk.net'
option 'mesh_network' '10.18.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '53.14083'
option 'longitude' '8.21314'
config 'defaults' 'wifi_device'
option 'channel' '6'
config 'defaults' 'wifi_iface'
option 'bssid' '02:CA:FF:EE:BA:BE'

View File

@@ -1,18 +0,0 @@
config 'community' 'profile'
option 'name' 'Openwireless Bern'
option 'homepage' 'http://bern.openwireless.ch/'
option 'ssid' 'www.openwireless.ch'
option 'mesh_network' '10.247.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '50.814788'
option 'longitude' '8.769239'
config 'defaults' 'interface'
option 'dns' '208.67.222.222 208.67.220.220'
config 'defaults' 'wifi_device'
option 'channel' '10'
option 'country' '756'

View File

@@ -1,12 +0,0 @@
config 'community' 'profile'
option 'name' 'Piratenfreifunk Dresden'
option 'homepage' 'http://www.piraten-sachsen.de/'
option 'ssid' 'dresden.freifunk.net'
option 'mesh_network' '10.12.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '51.05081'
option 'longitude' '13.73420'
config 'defaults' 'wifi_device'
option 'channel' '1'

View File

@@ -1,35 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Potsdam'
option 'homepage' 'http://potsdam.freifunk.net'
option 'ssid' 'freifunk-potsdam.de'
option 'mesh_network' '10.22.0.0/16'
option 'splash_network' '192.168.22.0/24'
option 'splash_prefix' '24'
option 'latitude' '52.39349'
option 'longitude' '13.06489'
option 'ipv6' '0'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'
option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168'
option 'delegate' '0'
config 'defaults' 'wifi_device'
option 'channel' '5'
config 'defaults' 'wifi_device_5'
option 'channel' '44'
config 'defaults' 'bssidscheme'
option '5' '02:CA:FF:EE:BA:BE'
option '44' '02:CA:FF:EE:BA:BE'
config 'defaults' 'ssidscheme'
option '5' 'Mesh23'
option '44' 'Mesh23'
config 'defaults' 'dhcp'
option 'leasetime' '15m'
config 'defaults' 'olsrd'
option 'LinkQualityAlgorithm' 'etx_ffeth'

View File

@@ -1,25 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Reihen'
option 'homepage' 'http://freifunk.reihen.de'
option 'ssid' 'freifunk.reihen.de'
option 'mesh_network' '172.23.0.0/16'
option 'splash_network' '172.23.26.0/29'
option 'latitude' '49.21'
option 'longitude' '8.91'
option 'splash_prefix' '29'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'
option 'dns' '172.23.25.204 172.23.31.237 141.1.1.1'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'bssid' '02:07:04:08:08:09'
config 'defaults' 'bssidscheme'
option '13' '02:07:04:08:08:09'
option '36' '02:36:CA:FF:EE:EE'
config 'defaults' 'ssidscheme'
option '13' 'ch13.freifunk.net'
option '36' 'ch36.freifunk.net'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Rosbach'
option 'homepage' 'freifunk-rosbach.de'
option 'ssid' 'rosbach.freifunk.net'
option 'mesh_network' '10.212.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '50.18'
option 'longitude' '8.42'
config 'defaults' 'wifi_device'
option 'channel' '13'
config 'defaults' 'wifi_iface'
option 'bssid' 'D2:CA:FF:EE:BA:BE'

View File

@@ -1,12 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Schwarzach'
option 'homepage' 'http://schwarzach.freifunk.net'
option 'ssid' 'schwarzach.freifunk.net'
option 'mesh_network' '10.81.0.0/20'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '49.373'
option 'longitude' '8.983'
option 'splash_prefix' '27'
config 'defaults' 'interface'
option 'netmask' '255.255.240.0'

View File

@@ -1,13 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Stuttgart'
option 'homepage' 'http://freifunk-stuttgart.de'
option 'ssid' 'Freifunk Stuttgart'
option 'mesh_network' '172.21.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'latitude' '48'
option 'longitude' '9'
option 'splash_prefix' '27'
config 'defaults' 'wifi_device'
option 'channel' '5'
option 'bssid' '52:CA:FF:EE:BA:BE'

View File

@@ -1,10 +0,0 @@
config 'community' 'profile'
option 'name' 'tulumlibre'
option 'ssid' 'tulumlibre'
option 'mesh_network' '10.39.128.0/18'
option 'latitude' '20.2106708'
option 'longitude' '-87.4629471'
option 'splash_prefix' '28'
config 'defaults' 'interface'
option 'dns' '80.67.169.40 216.87.84.211'

View File

@@ -1,23 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Vogtland'
option 'homepage' 'http://wiki.freifunk.net/Freifunk_Vogtland'
option 'ssid' 'vogtland.freifunk.net'
option 'mesh_network' '10.204.0.0/16'
option 'splash_network' '6.204.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '53.11'
option 'longitude' '12.61'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
config 'defaults' 'bssidscheme'
option '1' '02:CA:FF:EE:BA:BE'
option '40' '02:40:CA:FF:EE:EE'
config 'defaults' 'wifi_device'
option 'country' 'DE'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'

View File

@@ -1,23 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Weil am Rhein'
option 'homepage' 'http://weil-am-rhein.freifunk.net'
option 'ssid' 'mesh.freifunk.net'
option 'mesh_network' '10.119.0.0/18'
option 'latitude' '47.6056'
option 'longitude' '7.6083'
option 'suffix' 'ffwr'
option 'vap' '1'
option 'adhoc_dhcp_when_vap' '0'
list 'owm_api' 'http://api.openwifimap.net'
list 'owm_api' 'http://owmapi.pberg.freifunk.net'
option 'mapserver' 'http://openwifimap.net/'
config 'defaults' 'interface'
option 'netmask' '255.255.192.0'
config 'defaults' 'wifi_device'
option 'country' 'DE'
option 'channel' '10'
config 'defaults' 'luci_splash'
option 'leasetime' '24'

View File

@@ -1,10 +0,0 @@
config 'community' 'profile'
option 'name' 'Weimarnetz e.V.'
option 'homepage' 'http://www.weimarnetz.de'
option 'ssid' 'weimarnetz'
option 'mesh_network' '10.63.0.0/16'
option 'latitude' '50.989530'
option 'longitude' '11.338675'
config 'defaults' 'interface'
option 'dns' '217.11.48.200 217.11.49.200 8.8.8.8'

View File

@@ -1,19 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Weinstadt'
option 'homepage' 'http://freifunk-weinstadt.de'
option 'ssid' 'freifunk-weinstadt'
option 'mesh_network' '172.21.0.0/16'
option 'splash_network' '172.21.85.0/30'
option 'latitude' '48.81'
option 'longitude' '9.39'
option 'splash_prefix' '30'
config 'defaults' 'wifi_device'
option 'channel' '13'
option 'bssid' '02:07:01:03:08:04'
config 'defaults' 'bssidscheme'
option '13' '02:07:01:03:08:04'
config 'defaults' 'interface'
option 'dns' '172.21.77.4 172.21.84.235 141.1.1.1'

View File

@@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'wlan ljubljana'
option 'homepage' 'http://wlan-lj.net'
option 'ssid' 'open.wlan-lj.net'
option 'mesh_network' '10.254.0.0/16'
option 'splash_network' '10.254.120.0/21'
option 'splash_prefix' '27'
option 'latitude' '46.05063'
option 'longitude' '14.50402'
config 'defaults' 'wifi_device'
option 'channel' '8'
config 'defaults' 'interface'
option 'dns' '10.254.0.1 10.254.0.2'

View File

@@ -1,43 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-common
PKG_RELEASE:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-common
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Freifunk common files
DEPENDS:=+libuci-lua
endef
define Package/freifunk-common/description
Common files and scripts that are needed to run free wireless mesh networks.
endef
define Package/luci-mod-freifunk/conffiles
/etc/config/freifunk
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/freifunk-common/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,freifunk-common))

View File

@@ -1,120 +0,0 @@
package 'freifunk'
config 'public' 'contact'
option 'nickname' ''
option 'name' ''
option 'mail' ''
option 'phone' ''
option 'note' ''
config 'public' 'community'
option 'name' 'Freifunk'
option 'homepage' 'http://freifunk.net'
config 'fw_zone' 'zone_freifunk'
option 'name' 'freifunk'
option 'input' 'REJECT'
option 'forward' 'REJECT'
option 'output' 'ACCEPT'
config 'fw_rule' 'fficmp'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'icmp'
config 'fw_rule' 'ffhttp'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'tcp'
option 'dest_port' '80'
config 'fw_rule' 'ffhttps'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'tcp'
option 'dest_port' '443'
config 'fw_rule' 'ffssh'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'tcp'
option 'dest_port' '22'
config 'fw_rule' 'ffolsr'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'udp'
option 'dest_port' '698'
config 'fw_rule' 'ffwprobe'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'tcp'
option 'dest_port' '17990'
config 'fw_rule' 'ffdns'
option 'dest_port' '53'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'udp'
config 'fw_rule' 'ffdhcp'
option 'src_port' '68'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'dest_port' '67'
option 'proto' 'udp'
option 'leasetime' '30m'
config 'fw_rule' 'ffsplash'
option 'dest_port' '8082'
option 'src' 'freifunk'
option 'target' 'ACCEPT'
option 'proto' 'tcp'
config 'fw_forwarding' 'lanfffwd'
option 'src' 'lan'
option 'dest' 'freifunk'
config 'fw_forwarding' 'ffwanfwd'
option 'src' 'freifunk'
option 'dest' 'wan'
config 'fw_forwarding' 'fffwd'
option 'src' 'freifunk'
option 'dest' 'freifunk'
config 'include' 'freifunk'
option 'path' '/etc/firewall.freifunk'
config 'defaults' 'system'
option 'zonename' 'Europe/Berlin'
option 'timezone' 'CET-1CEST,M3.5.0,M10.5.0/3'
config 'defaults' 'wifi_device'
option 'channel' '1'
option 'diversity' '1'
option 'disabled' '0'
option 'country' 'DE'
option 'distance' '1000'
config 'defaults' 'wifi_iface'
option 'mode' 'adhoc'
option 'encryption' 'none'
option 'bssid' '12:CA:FF:EE:BA:BE'
option 'mcast_rate' '6000'
config 'defaults' 'interface'
option 'netmask' '255.255.0.0'
option 'dns' '8.8.8.8 212.204.49.83 141.1.1.1'
config 'defaults' 'alias'
option 'netmask' '255.255.255.0'
config 'defaults' 'dhcp'
option 'leasetime' '30m'
option 'start' '2'
option 'force' '1'
config 'defaults' 'olsr_interfacedefaults'
option 'Ip4Broadcast' '255.255.255.255'

View File

@@ -1,25 +0,0 @@
#!/bin/sh /etc/rc.common
# Freifunk Init
# $Id$
START=99
boot() {
test -f /etc/crontabs/root || touch /etc/crontabs/root
grep -q 'killall -HUP dnsmasq' /etc/crontabs/root || {
echo "*/5 * * * * killall -HUP dnsmasq" >> /etc/crontabs/root
}
grep -q '/usr/sbin/ff_olsr_watchdog' /etc/crontabs/root || {
echo "*/5 * * * * /usr/sbin/ff_olsr_watchdog" >> /etc/crontabs/root
}
[ -d /etc/rc.local.d ] && {
for file in /etc/rc.local.d/*; do
test -f "$file" && . "$file"
done
}
/etc/init.d/cron restart &
}

View File

@@ -1,51 +0,0 @@
# Fixup various configurations to remove quirks
# from former versions.
_log() {
logger -t "Config Migration" "$1"
}
_uci() {
uci ${2:+-c $2} get "$1" 2>/dev/null
}
# Splash redirector had a wrong virtual url match
# which resulted in "No such handler"
[ "$(_uci lucid.splashredir.virtual)" == "/" ] && {
_log "Fix splash redirector configuration"
uci set lucid.splashredir.virtual=''
uci commit lucid
/etc/init.d/lucid restart
}
# Newer OLSR versions have the MinTCVtime hack active,
# ensure proper timings or olsrd won't start
FIX=0
for i in 0 1 2 3 4; do
[ -z "$(_uci olsrd.@Interface[$i].TcInterval)" ] && \
[ -z "$(_uci olsrd.@Interface[$i].TcValidityTime)" ] || {
uci delete olsrd.@Interface[$i].TcInterval
uci delete olsrd.@Interface[$i].TcValidityTime
FIX=1
}
done
[ "$FIX" == 1 ] && {
_log "Fix olsrd configuration for MinTCVTime hack"
uci commit olsrd
/etc/init.d/olsrd restart
}
# Ensure that the community definitions are in the
# new format
[ -z "$(_uci freifunk.leipzig.mesh_network)" ] && \
[ -n "$(_uci freifunk.leipzig.mesh_network /rom/etc/config)" ] && {
_log "Converting freifunk configuration to new format"
cp /rom/etc/config/freifunk /etc/config/freifunk
}

View File

@@ -1,2 +0,0 @@
uci set uhttpd.main.rfc1918_filter=0
uci commit uhttpd

View File

@@ -1,10 +0,0 @@
#!/bin/sh
test "$1" = "-h" && echo -e "Usage:\n\t$0 -h\n\t$0 [ { ip | hostname } ]" >&2 && exit 1
host="${1:-leipzig.freifunk.net}"
wget -O /dev/null http://$host/cgi-bin-dev-zero.bin
test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/dev-zero.bin
test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/luci/freifunk/status/zeroes
test "$?" = "1" && echo "$host: no zero download found..." && exit 1

View File

@@ -1,103 +0,0 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
hostsfile_getname()
{
local config="$1"
local i=0
local value file
while value="$( uci -q get $config.@LoadPlugin[$i].library )"; do {
case "$value" in
'olsrd_nameservice'*)
file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )"
break
;;
esac
i=$(( i + 1 ))
} done
echo "${file:-/var/run/hosts_olsr}"
}
read_hostnames()
{
local file_list=" $( hostsfile_getname 'olsrd' ) $(hostsfile_getname 'olsrd6' ) "
local line ip hostname file file_list_uniq
for file in $file_list; do {
case " $file_list_uniq " in
*" $file "*)
;;
*)
file_list_uniq="$file_list_uniq $file"
;;
esac
} done
for file in $file_list_uniq; do {
[ -e "$file" ] || continue
while read -r line; do {
case "$line" in
[0-9]*)
# 2001:bf7:820:901::1 stuttgarter-core.olsr # myself
# 10.63.160.161 AlexLaterne # 10.63.160.161
set -f
set +f -- $line
ip="$1"
hostname="$2"
# global vars, e.g.
# IP_1_2_3_4='foo' or IP_2001_bf7_820_901__1='bar'
eval IP_${ip//[.:]/_}="$hostname"
;;
esac
} done <"$file"
} done
}
read_hostnames
VARS='localIP:Local remoteIP:Remote validityTime:vTime linkQuality:LQ'
VARS="$VARS neighborLinkQuality:NLQ linkCost:Cost remoteHostname:Host"
for HOST in '127.0.0.1' '::1';do
json_init
json_load "$( echo /links | nc $HOST 9090 | sed -n '/^[}{ ]/p' )" # remove header/non-json
if json_is_a links array;then
json_select links
for v in ${VARS};do
eval _${v%:*}=0
done
for j in 0 1;do
case ${j} in 1)
for v in ${VARS};do
eval printf \"%-\${_${v%:*}}s \" ${v#*:}
done
echo
;;esac
i=1;while json_is_a ${i} object;do
json_select ${i}
json_get_vars $(for v in ${VARS};do echo ${v%:*};done)
case ${j} in 0)
for v in ${VARS};do
eval "test \${_${v%:*}} -lt \${#${v%:*}} && _${v%:*}=\${#${v%:*}}"
done
;;*)
for v in ${VARS};do
eval printf \"%-\${_${v%:*}}s \" \$${v%:*}
eval remoteHostname="\$IP_${remoteIP//[.:]/_}"
done
echo
;;esac
json_select ..
i=$(( i + 1 ))
done
done
fi
echo
done

View File

@@ -1,11 +0,0 @@
#!/bin/sh
command="$1"
interval="$2"; [ -z "$interval" ] && interval=1
if [ -z $command ]; then
echo 'Usage: watch.sh "command [options]" [interval], e.g. watch "ifconfig ath0" 2'
echo 'interval is optional and defaults to 1'
exit 1
fi
while true; do clear; $command; sleep $interval; done

View File

@@ -1,38 +0,0 @@
#!/usr/bin/lua
require "os"
require "io"
require "uci"
local fs = require "nixio.fs"
if fs.access("/var/run/olsrd.pid") or fs.access("/var/run/olsrd4.pid") then
local stamp, intv
local x = uci.cursor()
x:foreach("olsrd", "LoadPlugin",
function(s)
if s.library == "olsrd_watchdog" then
intv = tonumber(s.interval)
stamp = s.file
end
end)
if intv and fs.access(stamp) then
local systime = os.time()
local wdgtime = tonumber(io.lines(stamp)())
if not wdgtime or ( systime - wdgtime ) > ( intv * 2 ) then
os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'")
local tnls = io.popen("ip tunnel show | cut -d : -f 1")
while true do
tnl = tnls:read("*line")
if tnl == nil then break end
if string.find(tnl, "tnl_") == 1 then
os.execute(string.format("logger -t 'OLSR watchdog' 'Deleting stale tunnel %s'", tnl))
os.execute(string.format("ip link del %s", tnl))
end
end
os.execute("/etc/init.d/olsrd restart")
end
end
end

View File

@@ -1,53 +0,0 @@
#
# Copyright (C) 2009 Jo-Philipp Wich <jow@openwrt.org>
#
# This is free software, licensed under the Apache 2.0 license.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-firewall
PKG_RELEASE:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-firewall
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. 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
[ -n "$${IPKG_INSTROOT}" ] || {
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))

View File

@@ -1,40 +0,0 @@
#!/bin/sh
# Freifunk Firewall addons
. /lib/functions.sh
#
# 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_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
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
[ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
( sleep 3; /etc/init.d/freifunk-p2pblock restart )&

View File

@@ -1,65 +0,0 @@
#!/bin/sh
clear_restricted_gw()
{
local state="$1"
local iface
local ifname
local subnet
config_get iface "$state" iface
if [ "$iface" = "$INTERFACE" ]; then
config_get ifname "$state" ifname
config_get subnet "$state" subnet
logger -t firewall.freifunk "removing local restriction to the network connected to $ifname ($iface)"
iptables -D forwarding_freifunk_rule -o $ifname -d $subnet -j REJECT --reject-with icmp-host-prohibited
uci_revert_state firewall "$state"
fi
}
get_enabled()
{
local name
config_get name "$1" name
if [ "$name" = "$ZONE" ]; then
config_get_bool local_restrict "$1" local_restrict
fi
}
if [ "$ACTION" = add ]; then
local enabled
local subnet
. /lib/functions/network.sh
network_find_wan wan
[ "$INTERFACE" = "$wan" ] || return 0
network_get_subnet subnet $INTERFACE
if [ -n "$subnet" ]; then
config_load firewall
local_restrict=0
config_foreach get_enabled zone
if [ "$local_restrict" = 1 ]; then
logger -t firewall.freifunk "restricting local access to the network connected to $INTERFACE ($DEVICE)"
iptables -I forwarding_freifunk_rule -o $DEVICE -d $subnet -j REJECT --reject-with icmp-host-prohibited
local state="restricted_gw_${INTERFACE}"
uci_set_state firewall "$state" "" restricted_gw_state
uci_set_state firewall "$state" iface "$INTERFACE"
uci_set_state firewall "$state" ifname "$DEVICE"
uci_set_state firewall "$state" subnet "$subnet"
fi
fi
elif [ "$ACTION" = remove ]; then
config_load firewall
config_foreach clear_restricted_gw restricted_gw_state
fi

View File

@@ -1,40 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-gwcheck
PKG_RELEASE:=4
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-gwcheck
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Freifunk gateway check script
DEPENDS:=firewall +ip +iptables-mod-ipopt +olsrd-mod-dyn-gw-plain
endef
define Package/freifunk-gwcheck/description
This script periodically checks if internet is available via your own gateway. If it detects that it is broken, then the defaultroute is removed from the main table and temporarilly placed in table gw-check until your internet works again. Config file is /etc/config/freifunk-gwcheck.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/freifunk-gwcheck/install
$(CP) ./files/* $(1)/
$(CP) ./root/* $(1)/
endef
$(eval $(call BuildPackage,freifunk-gwcheck))

View File

@@ -1,5 +0,0 @@
config 'gwcheck' 'hosts'
list 'host' 'augsburg.freifunk.net'
list 'host' 'vpn4.leipzig.freifunk.net'
list 'host' 'luci.subsignal.org'
list 'host' 'bbb-vpn.berlin.freifunk.net'

View File

@@ -1,132 +0,0 @@
#!/bin/sh
# Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
# Licensed under the GNU General Public License (GPL) v3
# This script monitors the local internet gateway
. /lib/functions.sh
. /lib/functions/network.sh
. /usr/share/libubox/jshn.sh
# exit if dyngw_plain is not enabled or RtTable is not (254 or unset)
config_load olsrd
check_dyngw_plain()
{
local cfg="$1"
config_get library "$cfg" library
if [ "${library#olsrd_dyn_gw_plain}" != "$library" ]; then
config_get ignore "$cfg" ignore
config_get RtTable "$cfg" RtTable
if [ "$ignore" != "1" ] && [ -z "$RtTable" -o "$RtTable" = "254" ]; then
exit=0
fi
fi
}
exit=1
config_foreach check_dyngw_plain LoadPlugin
[ "$exit" = "1" ] && exit 1
#Exit if this script is already running
pid="$(pidof ff_olsr_test_gw.sh)"
if [ ${#pid} -gt 5 ]; then
logger -p debug -t gwcheck "Gateway check script is already running, exit now"
exit 1
fi
# exit if there is no defaultroute with metric=0 in main or gw-check table.
defroutemain="$(ip route show |grep default |grep -v metric)"
defroutegwcheck="$(ip route show table gw-check |grep default |grep -v metric)"
if [ -z "$defroutegwcheck" -a -z "$defroutemain" ]; then
exit 1
fi
# get and shuffle list of testservers
testserver="$(uci -q get freifunk-gwcheck.hosts.host)"
[ -z "$testserver" ] && echo "No testservers found, exit" && exit
testserver="$(for t in $testserver; do echo $t; done | awk 'BEGIN {
srand();
}
{
l[NR] = $0;
}
END {
for (i = 1; i <= NR; i++) {
n = int(rand() * (NR - i + 1)) + i;
print l[n];
l[n] = l[i];
}
}')"
check_internet() {
for t in $testserver; do
local test
test=$(wget -q http://$t/conntest.html -O -| grep "Internet_works")
if [ "$test" == "Internet_works" ]; then
echo 0
break
else
logger -p debug -t gw-check "Could not fetch http://$t/conntest.html"
fi
done
}
resolve() {
echo "$(nslookup $1 2>/dev/null |grep 'Address' |grep -v '127.0.0.1' |awk '{ print $3 }')"
}
get_dnsservers() {
# this gets all dns servers for the interface which has the default route
dns=""
if [ ! -x /bin/ubus ]; then
# ubus not present (versions before Attitude): fallback to get these from /var/state/network.
# We always assume that wan is the default route interface here
dns="$(grep network.wan.resolv_dns /var/state/network | cut -d "=" -f 2)"
else
network_find_wan wan
network_get_dnsserver dns $wan
fi
}
iw=$(check_internet)
if [ "$iw" == 0 ]; then
# Internet available again, restore default route and remove ip rules
if [ -n "$defroutegwcheck" ]; then
ip route add $defroutegwcheck
ip route del $defroutegwcheck table gw-check
for host in $testserver; do
ips="$(resolve $host)"
for ip in $ips; do
[ -n "$(ip rule show | grep "to $ip lookup gw-check")" ] && ip rule del to $ip table gw-check
done
done
get_dnsservers
for d in $dns; do
[ -n "$(ip rule show | grep "to $d lookup gw-check")" ] && ip rule del to $d table gw-check
done
logger -p err -t gw-check "Internet is available again, default route restored ( $defroutegwcheck)"
fi
else
# Check failed. Move default route to table gw-check and setup ip rules.
if [ -z "$(ip rule show | grep gw-check)" -a -n "$defroutemain" ]; then
ip route add $defroutemain table gw-check
ip route del $defroutemain
logger -p err -t gw-check "Internet is not available, default route deactivated ( $defroutemain)"
fi
for host in $testserver; do
ips="$(resolve $host)"
for ip in $ips; do
[ -z "$(ip rule show | grep "to $ip lookup gw-check")" ] && ip rule add to $ip table gw-check
done
done
get_dnsservers
for d in $dns; do
[ -z "$(ip rule show | grep "to $d lookup gw-check")" ] && ip rule add to $d table gw-check
done
logger -p err -t gw-check "Check your internet connection!"
fi

View File

@@ -1,7 +0,0 @@
#!/bin/sh
tables="/etc/iproute2/rt_tables"
test -d /etc/iproute2/ || mkdir -p /etc/iproute2/
grep -q "gw-check" $tables || echo "200 gw-check" >> $tables
test -f /etc/crontabs/root || touch /etc/crontabs/root
grep -q "ff_olsr_test_gw.sh" /etc/crontabs/root || echo "* * * * * /usr/sbin/ff_olsr_test_gw.sh" >> /etc/crontabs/root
/etc/init.d/cron restart

View File

@@ -1,39 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-mapupdate
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-mapupdate
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Update script for freifunkmap
DEPENDS:=+olsrd-mod-nameservice
endef
define Package/freifunk-mapupdate/description
This script updates the freifunkmap (also known as the global map, see http://map.berlin.freifunk.net) every hour. Config file is /etc/config/freifunk-mapupdate.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/freifunk-mapupdate/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,freifunk-mapupdate))

View File

@@ -1,3 +0,0 @@
config 'mapupdate' 'mapupdate'
option 'enabled' '1'
option 'mapserver' 'http://map.berlin.freifunk.net/freifunkmap.php'

View File

@@ -1,59 +0,0 @@
#!/bin/sh
if [ ! "$(uci -q get freifunk-mapupdate.mapupdate.enabled)" == 1 ]; then
exit 1
fi
MAPSERVER="$(uci -q get freifunk-mapupdate.mapupdate.mapserver)"
[ -z "$MAPSERVER" ] && logger -t "freifunk-mapupdate:" "No mapserver configured" && exit 1
#check if nameservice plugin is installed and enabled, else exit
nslib=`uci show olsrd |grep olsrd_nameservice |awk {' FS="."; print $1"."$2 '}`
if [ -n "$nslib" ]; then
LATLONFILE="$(uci -q get $nslib.latlon_file)"
if [ -z "$LATLONFILE" ]; then
LATLONFILE="/var/run/latlon.js"
fi
if [ ! -p "$LATLONFILE" ]; then
logger -t "freifunk-mapupdate:" "latlon_file not found."; exit 1
fi
else
logger -t "freifunk-mapupdate:" "nameservice plugin not found in olsrd config."
exit 1
fi
HOSTNAME="$(uci show system |grep hostname |cut -d "=" -f 2)"
HF_INFO=""
# Get info for myself
SELF=$(cat $LATLONFILE |grep ^Self | sed -e 's/Self(//' -e 's/);//' -e "s/'//g")
OLSR_IP="$(echo $SELF |awk '{ FS=",";print $1 }')"
LOCATION="$(uci show system |grep .location |cut -d "=" -f 2)"
[ -n "$LOCATION" ] && NOTE="$LOCATION<br>"
FFNOTE="$(uci -q get freifunk.contact.note)"
[ -n "$FFNOTE" ] && NOTE="$NOTE $FFNOTE"
NOTE="<h3><a href='http://$OLSR_IP' target='_blank'>$HOSTNAME</a></h3><p>$NOTE"
NOTE=`echo -e "$NOTE" | sed -e 's/\ /%20/g' -e 's/&/%26/g' -e 's/"/%22/g'`
UPDATESTRING="$(echo $SELF |awk '{ FS=",";print $2 }'), $(echo $SELF |awk '{ FS=",";print $3 }')"
# write our coordinates to mygooglemapscoords.txt to make Freifunk Firmware happy
echo "$UPDATESTRING" > /tmp/mygooglemapscoords.txt
[ ! -L /www/mygooglemapscoords.txt ] && ln -s /tmp/mygooglemapscoords.txt /www/mygooglemapscoords.txt
# get neighbor Info (lat, lon, lq)
while read line; do
NEIGHUPD="$(echo $line |awk '{ FS=","; print $6 }'), $(echo $line |awk '{ FS=","; print $7 }'), $(echo $line |awk '{ FS=",";print $4 }')"
UPDATESTRING="${UPDATESTRING}, ${NEIGHUPD}"
done << EOF
`grep "PLink('$OLSR_IP" $LATLONFILE | sed -e 's/PLink(//' -e 's/);//' -e "s/'//g"`
EOF
# Send UPDATESTRING
UPDATE=`echo -e "$UPDATESTRING" | sed s/\ /%20/g`
result="$(wget "$MAPSERVER?update=$UPDATE&updateiv=3600&olsrip=$OLSR_IP&note=${NOTE}${HF_INFO}" -qO -)"
if [ ! "$result" == "success update" ]; then
logger -t "freifunk-mapupdate:" "Update failed: $result"
fi

View File

@@ -1,6 +0,0 @@
#!/bin/sh
test -f /etc/crontabs/root || touch /etc/crontabs/root
SEED="$( dd if=/dev/urandom bs=2 count=1 2>&- | hexdump | if read line; then echo 0x${line#* }; fi )"
MIN="$(( $SEED % 59 ))"
grep -q "ff_mapupdate.sh" /etc/crontabs/root || echo "$MIN * * * * /usr/sbin/ff_mapupdate.sh" >> /etc/crontabs/root
/etc/init.d/cron restart

View File

@@ -1,47 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-policyrouting
PKG_RELEASE:=6
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-policyrouting
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Freifunk policy routing addon
DEPENDS:=+ip
endef
define Package/freifunk-policyrouting/description
Allows you to send your own traffic via your own default gateway while sending traffic received from the mesh to a gateway in the mesh.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/freifunk-policyrouting/install
$(CP) ./files/* $(1)/
endef
define Package/freifunk-policyrouting/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
/etc/init.d/freifunk-policyrouting enabled || /etc/init.d/freifunk-policyrouting enable
exit 0
}
endef
$(eval $(call BuildPackage,freifunk-policyrouting))

View File

@@ -1,7 +0,0 @@
config 'settings' 'pr'
option 'enable' '0'
option 'strict' '1'
option 'fallback' '1'
option 'zones' ''

View File

@@ -1,104 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. /lib/functions/network.sh
proto="4"
[ -f /proc/net/ipv6_route ] && proto="4 6"
config_load freifunk-policyrouting
config_get enable pr enable
config_get fallback pr fallback
config_get strict pr strict
config_get zones pr zones
if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then
network_get_subnet net $INTERFACE
network_get_subnet6 net6 $INTERFACE
network_get_physdev dev $INTERFACE
if [ "$net" != "" -a -n "$dev" ]; then
eval $(/bin/ipcalc.sh $net)
if [ "$PREFIX" != "0" -a "$NETWORK" != "127.0.0.0" ]; then
if [ ! "$(ip r s t localnets |grep "$NETWORK/$PREFIX dev")" ]; then
cmd="ip r a $NETWORK/$PREFIX dev $dev table localnets"
$cmd
if [ "$?" = 0 ]; then
logger -s -t policyrouting "Add route: $cmd"
else
logger -s -t policyrouting "Error! Could not add route: $cmd"
fi
fi
fi
if [ -n "$net6" ]; then
cmd="ip -6 r a $net6 dev $dev table localnets"
$cmd 2>&1 > /dev/null
if [ "$?" = 0 ]; then
logger -s -t policyrouting "Add route: $cmd (IPv6)"
fi
fi
networks=""
for z in $zones; do
network_zone="$(uci -q get firewall.zone_${z}.network)"
if [ -z "$network_zone" ]; then
network_zone="$z"
fi
networks="$networks $network_zone"
done
for n in $networks; do
if [ "$INTERFACE" = "$n" ]; then
for p in $proto; do
if [ ! "$(ip -$p ru s | grep "from all iif $dev lookup olsr-default")" ]; then
ip -$p rule add dev "$dev" lookup olsr-default prio 20000
if [ "$strict" != 0 ]; then
ip -$p rule add dev "$dev" unreachable prio 20001
fi
if [ "$?" = 0 ]; then
logger -s -t policyrouting "Use mesh gateway for interface $dev (IPv$p)"
if [ -z "$(uci -P /var/state get freifunk-policyrouting.${INTERFACE})" ]; then
uci -P /var/state set freifunk-policyrouting.${INTERFACE}="state"
fi
uci -P /var/state set freifunk-policyrouting.${INTERFACE}.device="$dev"
else
logger -s -t policyrouting "Error: Could not add rule: dev "$dev" lookup olsr-default prio 20000 (IPv$p)"
fi
fi
done
fi
done
fi
fi
if [ "$ACTION" = "ifdown" ]; then
dev="$(uci -q -P /var/state get freifunk-policyrouting.${INTERFACE}.device)"
if [ -n "$dev" ]; then
networks=""
for z in $zones; do
network_zone="$(uci -q get firewall.zone_${z}.network)"
if [ -z "$network_zone" ]; then
network_zone="$z"
fi
networks="$networks $network_zone"
done
for n in $networks; do
if [ "$INTERFACE" = "$n" ]; then
for p in $proto; do
if [ "$(ip -$p ru s | grep "from all iif $dev lookup olsr-default")" ]; then
ip -$p rule del dev "$dev" lookup olsr-default prio 20000
ip -$p rule del dev "$dev" unreachable prio 20001
if [ "$?" = 0 ]; then
logger -s -t policyrouting "Remove rule: dev "$dev" lookup olsr-default prio 20000 (IPv$p)"
else
logger -s -t policyrouting "Error! Could not remove rule: dev "$dev" lookup olsr-default prio 20000 (IPv$p)"
fi
fi
done
fi
done
fi
fi

View File

@@ -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
}

View File

@@ -1,7 +0,0 @@
#!/bin/sh
uci batch <<-EOF
add ucitrack freifunk-policyrouting
add_list ucitrack.@freifunk-policyrouting[-1].exec="/etc/init.d/freifunk-policyrouting restart"
commit ucitrack
EOF

View File

@@ -1,55 +0,0 @@
#
# Copyright (C) 2009-2012 Jo-Philipp Wich <jow@openwrt.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-watchdog
PKG_RELEASE:=8
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_BUILD_DEPENDS := uci
include $(INCLUDE_DIR)/package.mk
define Package/freifunk-watchdog
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Freifunk Ad-Hoc watchdog daemon
DEPENDS:=libuci
endef
define Package/freifunk-watchdog/description
A watchdog daemon that monitors wireless interfaces to ensure the correct bssid and channel.
The process will initiate a wireless restart as soon as it detects a bssid or channel mismatch.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Configure
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef
define Package/freifunk-watchdog/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/freifunk-watchdog.init $(1)/etc/init.d/freifunk-watchdog
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/freifunk-watchdog.config $(1)/etc/config/freifunk-watchdog
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ffwatchd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,freifunk-watchdog))

View File

@@ -1,7 +0,0 @@
config process
option process 'dropbear'
option initscript '/etc/init.d/dropbear'
config process
option process 'crond'
option initscript '/etc/init.d/cron'

View File

@@ -1,39 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
PID=/var/run/ffwatchd.pid
BIN=/usr/sbin/ffwatchd
boot()
{
# If watchdog service is enabled, install cronjob, create device node and start daemon
if /etc/init.d/freifunk-watchdog enabled 2>/dev/null; then
if ! grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
echo "* * * * * $BIN running || /etc/init.d/freifunk-watchdog restart" >> /etc/crontabs/root
fi
mknod /dev/watchdog c 10 130
start
# If service is disabled, find and remove related cronjob
elif grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
sed -i -e "\\'$BIN'd" /etc/crontabs/root
fi
}
start()
{
start-stop-daemon -q -b -m -p $PID -x $BIN -S
}
stop()
{
start-stop-daemon -q -p $PID -x $BIN -K
if ! /etc/init.d/freifunk-watchdog enabled; then
if grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
sed -i -e "\\'$BIN'd" /etc/crontabs/root
fi
fi
}

View File

@@ -1,12 +0,0 @@
WD_BINARY:=ffwatchd
WD_CFLAGS:=$(CFLAGS) -c -DBINARY=\"$(WD_BINARY)\"
WD_LDFLAGS:=$(LDFLAGS) -lm -luci
watchdog:
$(CC) $(WD_CFLAGS) -o ucix.o ucix.c
$(CC) $(WD_CFLAGS) -o watchdog.o watchdog.c
$(CC) $(WD_LDFLAGS) -o $(WD_BINARY) watchdog.o ucix.o
clean:
rm -f *~ $(WD_BINARY) *.o

View File

@@ -1,102 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
*
* Changed by Jo-Philipp Wich <jow@openwrt.org>
*/
#include <string.h>
#include <stdlib.h>
#include <uci_config.h>
#include <uci.h>
#include "ucix.h"
static struct uci_ptr ptr;
static inline int ucix_get_ptr(struct uci_context *ctx, const char *p, const char *s, const char *o, const char *t)
{
memset(&ptr, 0, sizeof(ptr));
ptr.package = p;
ptr.section = s;
ptr.option = o;
ptr.value = t;
return uci_lookup_ptr(ctx, &ptr, NULL, true);
}
struct uci_context* ucix_init(const char *config_file)
{
struct uci_context *ctx = uci_alloc_context();
#ifdef uci_to_delta
uci_add_delta_path(ctx, "/var/state");
#else
uci_add_history_path(ctx, "/var/state");
#endif
if(uci_load(ctx, config_file, NULL) != UCI_OK)
{
return NULL;
}
return ctx;
}
void ucix_cleanup(struct uci_context *ctx)
{
uci_free_context(ctx);
}
const char* ucix_get_option(struct uci_context *ctx, const char *p, const char *s, const char *o)
{
struct uci_element *e = NULL;
const char *value = NULL;
if(ucix_get_ptr(ctx, p, s, o, NULL))
return NULL;
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
return NULL;
e = ptr.last;
switch (e->type)
{
case UCI_TYPE_SECTION:
value = uci_to_section(e)->type;
break;
case UCI_TYPE_OPTION:
switch(ptr.o->type) {
case UCI_TYPE_STRING:
value = ptr.o->v.string;
break;
default:
value = NULL;
break;
}
break;
default:
return 0;
}
return value;
}
void ucix_for_each_section_type(struct uci_context *ctx,
const char *p, const char *t,
void (*cb)(const char*, void*), void *priv)
{
struct uci_element *e;
if(ucix_get_ptr(ctx, p, NULL, NULL, NULL))
return;
uci_foreach_element(&ptr.p->sections, e)
if (!strcmp(t, uci_to_section(e)->type))
cb(e->name, priv);
}

View File

@@ -1,29 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
*/
#ifndef _UCI_H__
#define _UCI_H__
struct uci_context* ucix_init(const char *config_file);
void ucix_for_each_section_type(struct uci_context *ctx,
const char *p, const char *t,
void (*cb)(const char*, void*), void *priv);
const char* ucix_get_option(struct uci_context *ctx,
const char *p, const char *s, const char *o);
#endif

View File

@@ -1,527 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2009 Jo-Philipp Wich <jow@openwrt.org>
*/
#include "watchdog.h"
/* Global watchdog fd, required by signal handler */
int wdfd = -1;
/* Handle finished children */
static void sigchld_handler(int sig)
{
pid_t pid;
while( (pid = waitpid(-1, NULL, WNOHANG)) > 0 )
syslog(LOG_INFO, "Child returned (pid %d)", pid);
}
/* Watchdog shutdown helper */
static void shutdown_watchdog(int sig)
{
static const char wshutdown = WATCH_SHUTDOWN;
if( wdfd > -1 )
{
syslog(LOG_INFO, "Stopping watchdog timer");
write(wdfd, &wshutdown, 1);
close(wdfd);
wdfd = -1;
}
exit(0);
}
/* Get BSSID of given interface */
static int iw_get_bssid(int iwfd, const char *ifname, char *bssid)
{
struct iwreq iwrq;
if( iw_ioctl(iwfd, ifname, SIOCGIWAP, &iwrq) >= 0 )
{
unsigned char *addr = (unsigned char *)iwrq.u.ap_addr.sa_data;
sprintf(bssid, "%02X:%02X:%02X:%02X:%02X:%02X",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
return 0;
}
return -1;
}
/* Get channel of given interface */
static int iw_get_channel(int iwfd, const char *ifname, int *channel)
{
int i;
char buffer[sizeof(struct iw_range)];
double cur_freq, cmp_freq;
struct iwreq iwrq;
struct iw_range *range;
memset(buffer, 0, sizeof(buffer));
iwrq.u.data.pointer = (char *)buffer;
iwrq.u.data.length = sizeof(buffer);
iwrq.u.data.flags = 0;
if( iw_ioctl(iwfd, ifname, SIOCGIWRANGE, &iwrq) < 0)
{
*channel = -1;
return -1;
}
range = (struct iw_range *)buffer;
if( iw_ioctl(iwfd, ifname, SIOCGIWFREQ, &iwrq) >= 0 )
{
cur_freq = ((double)iwrq.u.freq.m) * pow(10, iwrq.u.freq.e);
if( cur_freq < 1000.00 )
{
*channel = (int)cur_freq;
return 0;
}
for(i = 0; i < range->num_frequency; i++)
{
cmp_freq = ((double)range->freq[i].m) * pow(10, range->freq[i].e);
if( cmp_freq == cur_freq )
{
*channel = (int)range->freq[i].i;
return 0;
}
}
}
*channel = -1;
return -1;
}
/* Get the (first) pid of given process name */
static int find_process(const char *name)
{
int pid = -1;
int file;
char buffer[128];
char cmpname[128];
DIR *dir;
struct dirent *entry;
if( (dir = opendir("/proc")) != NULL )
{
snprintf(cmpname, sizeof(cmpname), "Name:\t%s\n", name);
while( (entry = readdir(dir)) != NULL )
{
if( !strcmp(entry->d_name, "..") || !isdigit(*entry->d_name) )
continue;
sprintf(buffer, "/proc/%s/status", entry->d_name);
if( (file = open(buffer, O_RDONLY)) > -1 )
{
read(file, buffer, sizeof(buffer));
close(file);
if( strstr(buffer, cmpname) == buffer )
{
pid = atoi(entry->d_name);
/* Skip myself ... */
if( pid == getpid() )
pid = -1;
else
break;
}
}
}
closedir(dir);
return pid;
}
syslog(LOG_CRIT, "Unable to open /proc: %s",
strerror(errno));
return -1;
}
/* Get the 5 minute load average */
static double find_loadavg(void)
{
int fd;
char buffer[10];
double load = 0.00;
if( (fd = open("/proc/loadavg", O_RDONLY)) > -1 )
{
if( read(fd, buffer, sizeof(buffer)) == sizeof(buffer) )
load = atof(&buffer[5]);
close(fd);
}
return load;
}
/* Check if given uci file was updated */
static int check_uci_update(const char *config, time_t *mtime)
{
struct stat s;
char path[128];
snprintf(path, sizeof(path), "/var/state/%s", config);
if( stat(path, &s) > -1 )
{
if( (*mtime == 0) || (s.st_mtime > *mtime) )
{
*mtime = s.st_mtime;
return 1;
}
}
return 0;
}
/* Add tuple */
static void load_wifi_uci_add_iface(const char *section, struct uci_wifi_iface_itr_ctx *itr)
{
wifi_tuple_t *t;
const char *ucitmp;
int val = 0;
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "mode");
if( ucitmp && !strncmp(ucitmp, "adhoc", 5) )
{
if( (t = (wifi_tuple_t *)malloc(sizeof(wifi_tuple_t))) != NULL )
{
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "ifname");
if(ucitmp)
{
strncpy(t->ifname, ucitmp, sizeof(t->ifname));
val++;
}
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "bssid");
if(ucitmp)
{
strncpy(t->bssid, ucitmp, sizeof(t->bssid));
val++;
}
ucitmp = ucix_get_option(itr->ctx, "wireless", section, "device");
if(ucitmp)
{
ucitmp = ucix_get_option(itr->ctx, "wireless", ucitmp, "channel");
if(ucitmp)
{
t->channel = atoi(ucitmp);
val++;
}
}
if( val == 3 )
{
syslog(LOG_INFO, "Monitoring %s: bssid=%s channel=%d",
t->ifname, t->bssid, t->channel);
t->next = itr->list;
itr->list = t;
}
else
{
free(t);
}
}
}
}
/* Load config */
static wifi_tuple_t * load_wifi_uci(wifi_tuple_t *ifs, time_t *modtime)
{
struct uci_context *ctx;
struct uci_wifi_iface_itr_ctx itr;
wifi_tuple_t *cur, *next;
if( check_uci_update("wireless", modtime) )
{
syslog(LOG_INFO, "Wireless config changed, reloading");
if( (ctx = ucix_init("wireless")) != NULL )
{
if( ifs != NULL )
{
for(cur = ifs; cur; cur = next)
{
next = cur->next;
free(cur);
}
}
itr.list = NULL;
itr.ctx = ctx;
ucix_for_each_section_type(ctx, "wireless", "wifi-iface",
(void *)load_wifi_uci_add_iface, &itr);
return itr.list;
}
}
return ifs;
}
/* Add tuple */
static void load_watchdog_uci_add_process(const char *section, struct uci_process_itr_ctx *itr)
{
process_tuple_t *t;
const char *ucitmp;
int val = 0;
if( (t = (process_tuple_t *)malloc(sizeof(process_tuple_t))) != NULL )
{
t->restart = 0;
ucitmp = ucix_get_option(itr->ctx, "freifunk-watchdog", section, "process");
if(ucitmp)
{
strncpy(t->process, ucitmp, sizeof(t->process));
val++;
}
ucitmp = ucix_get_option(itr->ctx, "freifunk-watchdog", section, "initscript");
if(ucitmp)
{
strncpy(t->initscript, ucitmp, sizeof(t->initscript));
val++;
}
if( val == 2 )
{
syslog(LOG_INFO, "Monitoring %s: initscript=%s",
t->process, t->initscript);
t->next = itr->list;
itr->list = t;
}
else
{
free(t);
}
}
}
/* Load config */
static process_tuple_t * load_watchdog_uci(process_tuple_t *procs)
{
struct uci_context *ctx;
struct uci_process_itr_ctx itr;
process_tuple_t *cur, *next;
syslog(LOG_INFO, "Loading watchdog config");
if( (ctx = ucix_init("freifunk-watchdog")) != NULL )
{
if( procs != NULL )
{
for(cur = procs; cur; cur = next)
{
next = cur->next;
free(cur);
}
}
itr.list = NULL;
itr.ctx = ctx;
ucix_for_each_section_type(ctx, "freifunk-watchdog", "process",
(void *)load_watchdog_uci_add_process, &itr);
return itr.list;
}
return procs;
}
/* Daemon implementation */
static int do_daemon(void)
{
static int wdtrigger = 1;
static int wdtimeout = BASE_INTERVAL * 2;
static const char wdkeepalive = WATCH_KEEPALIVE;
int iwfd;
int channel;
char bssid[18];
struct sigaction sa;
wifi_tuple_t *ifs = NULL, *curr_if;
process_tuple_t *procs = NULL, *curr_proc;
time_t wireless_modtime = 0;
int action_intv = 0;
int restart_wifi = 0;
int loadavg_panic = 0;
openlog(SYSLOG_IDENT, 0, LOG_DAEMON);
memset(&sa, 0, sizeof(sa));
if( (iwfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1 )
{
syslog(LOG_ERR, "Can not open wireless control socket: %s",
strerror(errno));
return 1;
}
if( (wdfd = open(WATCH_DEVICE, O_WRONLY)) > -1 )
{
syslog(LOG_INFO, "Opened %s - polling every %i seconds",
WATCH_DEVICE, BASE_INTERVAL);
/* Install signal handler to halt watchdog on shutdown */
sa.sa_handler = shutdown_watchdog;
sa.sa_flags = SA_NOCLDWAIT | SA_RESTART;
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGUSR2, &sa, NULL);
/* Set watchdog timeout to twice the interval */
ioctl(wdfd, WDIOC_SETTIMEOUT, &wdtimeout);
}
/* Install signal handler to reap children */
sa.sa_handler = sigchld_handler;
sa.sa_flags = 0;
sigaction(SIGCHLD, &sa, NULL);
/* Load watchdog configuration only once */
procs = load_watchdog_uci(procs);
while( 1 )
{
/* Check/increment action interval */
if( ++action_intv >= ACTION_INTERVAL )
{
/* Reset action interval */
action_intv = 0;
/* Check average load */
if( find_loadavg() >= LOAD_TRESHOLD )
loadavg_panic++;
else
loadavg_panic = 0;
/* Check wireless interfaces */
ifs = load_wifi_uci(ifs, &wireless_modtime);
for( curr_if = ifs; curr_if; curr_if = curr_if->next )
{
/* Get current channel and bssid */
if( (iw_get_bssid(iwfd, curr_if->ifname, bssid) == 0) &&
(iw_get_channel(iwfd, curr_if->ifname, &channel) == 0) )
{
/* Check BSSID */
if( strcasecmp(bssid, curr_if->bssid) != 0 )
{
syslog(LOG_WARNING, "BSSID mismatch on %s: current=%s wanted=%s",
curr_if->ifname, bssid, curr_if->bssid);
restart_wifi++;
}
/* Check channel */
else if( channel != curr_if->channel )
{
syslog(LOG_WARNING, "Channel mismatch on %s: current=%d wanted=%d",
curr_if->ifname, channel, curr_if->channel);
restart_wifi++;
}
}
else
{
syslog(LOG_WARNING, "Requested interface %s not present", curr_if->ifname);
}
}
/* Check processes */
for( curr_proc = procs; curr_proc; curr_proc = curr_proc->next )
{
if( find_process(curr_proc->process) < 0 )
curr_proc->restart++;
else
curr_proc->restart = 0;
/* Process restart required? */
if( curr_proc->restart >= HYSTERESIS )
{
curr_proc->restart = 0;
syslog(LOG_WARNING, "The %s process died, restarting", curr_proc->process);
EXEC(PROC_ACTION);
}
}
/* Wifi restart required? */
if( restart_wifi >= HYSTERESIS )
{
restart_wifi = 0;
syslog(LOG_WARNING, "Channel or BSSID mismatch on wireless interface, restarting");
EXEC(WIFI_ACTION);
}
/* Is there a load problem? */
if( loadavg_panic >= HYSTERESIS )
{
syslog(LOG_EMERG, "Critical system load level, triggering reset!");
/* Try watchdog, fall back to reboot */
if( wdfd > -1 )
ioctl(wdfd, WDIOC_SETTIMEOUT, &wdtrigger);
else
EXEC(LOAD_ACTION);
}
}
/* Reset watchdog timer */
if( wdfd > -1 )
write(wdfd, &wdkeepalive, 1);
sleep(BASE_INTERVAL);
}
shutdown_watchdog(0);
closelog();
return 0;
}
int main(int argc, char *argv[])
{
/* Check if watchdog is running ... */
if( (argc > 1) && (strcmp(argv[1], "running") == 0) )
{
return (find_process(BINARY) == -1);
}
/* Start daemon */
return do_daemon();
}

View File

@@ -1,142 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2009 Jo-Philipp Wich <jow@openwrt.org>
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include <syslog.h>
#include <ctype.h>
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
#include <math.h>
#include <time.h>
#include <signal.h>
#include <limits.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/watchdog.h>
#include "ucix.h"
#include "wireless.22.h"
/* Watchdog poll interval */
#define BASE_INTERVAL 5
/* Action interval (N * BASE_INTERVAL) */
#define ACTION_INTERVAL 6
/* Hysteresis */
#define HYSTERESIS 3
/* How to call myself in the logs */
#define SYSLOG_IDENT "Freifunk Watchdog"
/* Process error action */
#define PROC_ACTION curr_proc->initscript, curr_proc->initscript, "restart"
/* Wifi error action */
#define WIFI_ACTION "/sbin/wifi", "/sbin/wifi"
/* Watchdog device */
#define WATCH_DEVICE "/dev/watchdog"
#define WATCH_SHUTDOWN 'V'
#define WATCH_KEEPALIVE '\0'
/* System load error action and threshold */
#define LOAD_TRESHOLD 15.00
#define LOAD_ACTION "/sbin/reboot", "/sbin/reboot"
/* Fallback binary name (passed by makefile) */
#ifndef BINARY
#define BINARY "ffwatchd"
#endif
/* ifname/bssid/channel tuples */
struct wifi_tuple {
char ifname[16];
char bssid[18];
int channel;
struct wifi_tuple *next;
};
/* structure to hold tuple-list and uci context during iteration */
struct uci_wifi_iface_itr_ctx {
struct wifi_tuple *list;
struct uci_context *ctx;
};
typedef struct wifi_tuple wifi_tuple_t;
/* process name/exec tuples */
struct process_tuple {
char process[PATH_MAX + 1];
char initscript[PATH_MAX + 1];
int restart;
struct process_tuple *next;
};
/* structure to hold tuple-list and uci context during iteration */
struct uci_process_itr_ctx {
struct process_tuple *list;
struct uci_context *ctx;
};
typedef struct process_tuple process_tuple_t;
/* ioctl() helper (stolen from iwlib) */
static inline int
iw_ioctl(int skfd, /* Socket to the kernel */
const char * ifname, /* Device name */
int request, /* WE ID */
struct iwreq * pwrq) /* Fixed part of the request */
{
/* Set device name */
strncpy(pwrq->ifr_ifrn.ifrn_name, ifname, 16);
/* Do the request */
return(ioctl(skfd, request, pwrq));
}
/* fork() & execl() helper */
#define EXEC(x) \
do { \
switch(fork()) \
{ \
case -1: \
syslog(LOG_CRIT, "Unable to fork child: %s", \
strerror(errno)); \
break; \
\
case 0: \
execl(x, NULL); \
syslog(LOG_CRIT, "Unable to execute action: %s", \
strerror(errno)); \
return 1; \
} \
} while(0)

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +0,0 @@
# Copyright (C) 2011 Manuel Munz <freifunk at somakoma de>
# This is free software, licensed under the Apache 2.0 license.
include $(TOPDIR)/rules.mk
PKG_NAME:=meshwizard
PKG_RELEASE:=0.3.3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/meshwizard
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=9. Freifunk
TITLE:=Shell script based wizard for Mesh networks
DEPENDS:=+firewall
endef
define Package/meshwizard/description
A shellscript based wizard to simplify the setup of a typical mesh node (e.g. for Freifunk.net)
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/meshwizard/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,meshwizard))

View File

@@ -1,7 +0,0 @@
config 'netconfig' 'netconfig'
config 'general' 'general'
option 'sharenet' '0'
option 'local_restrict' '1'
option 'cleanup' '1'

View File

@@ -1,118 +0,0 @@
uci_remove_list_element() {
local option="$1"
local value="$2"
local list="$(uci get $option)"
local elem
uci delete $option
for elem in $list; do
if [ "$elem" != "$value" ]; then
uci add_list $option=$elem
fi
done
}
# string_contains(string, substring)
#
# Returns 0 if the specified string contains the specified substring,
# otherwise returns 1.
string_contains() {
string="$1"
substring="$2"
if test "${string#*$substring}" != "$string"
then
return 0 # $substring is in $string
else
return 1 # $substring is not in $string
fi
}
# Takes 2 arguments
# $1 = text to be displayed in the output for this section
# $2 = section (optional)
uci_commitverbose() {
echo "+ $1"
uci changes $2 | while read line; do
echo " $line"
done
uci commit $2
}
set_defaults() {
for def in $(env |grep "^$1" | sed 's/ /_/g'); do
option="${def/$1/}"
a="$(echo $option |cut -d '=' -f1)"
b="$(echo $option |cut -d '=' -f2-)"
b="${b//_/ }"
string_contains "$a" "_LENGTH" && continue
string_contains "$a" "_ITEM" && {
# special treatment for lists. use add_list and remove the
# item index (_ITEMx).
uci add_list $2.${a//_ITEM[0-9]*/}="$b"
} || {
uci set $2.$a="$b"
}
done
}
# 3 arguments: 1=config name 2=oldname 3=newname
section_rename() {
uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.$2 $1.$3
}
msg_missing_value() {
echo -e " \033[1mWarning:\033[0m Configuration option for $2 is missing in $1."
}
msg_success() {
echo " Finished."
}
msg_error() {
echo " \033[1mError: \033[0mThere was a problem."
}
msg_rename() {
echo " Renamed unnamed section $1 to $2."
}
msg_rename_error() {
echo " \033[1mWarning:\033[0m Could not rename $1 to $2."
}
restore_factory_defaults() {
echo "+ Restore default config as requested with cleanup=1"
cp -f /rom/etc/config/* /etc/config/
rm /etc/config/wireless
wifi detect > /etc/config/wireless
rm /etc/config/network
if [ -f /etc/init.d/defconfig ]; then
# legacy (AA)
/etc/init.d/defconfig start
[ -f /rom/etc/uci-defaults/network ] && sh /rom/etc/uci-defaults/network
else
sh /rom/etc/uci-defaults/02_network
fi
}
is_in_list() {
# checks if an item is in a list
local list="$1"
local item="$2"
for word in $list; do
[ $word = "$item" ] && return 0
done
return 1
}
add_to_list() {
local list="$1"
local item="$2"
is_in_list "$list" "$item" && echo $list
if [ -z "$list" ]; then
echo "$item"
else
echo "$list $item"
fi
}

View File

@@ -1,31 +0,0 @@
#!/bin/sh
# Checks whether a netrange is inside another netrange, returns 1 if true
# Takes two arguments: $1: net from which we want to know if it is inside $2
# nets need to be given in CIDR notation
dir=$(dirname $0)
awk -f $dir/common.awk -f - $* <<EOF
BEGIN {
slpos=index(ARGV[1],"/")
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
netmask=compl(2**(32-int(substr(ARGV[1],slpos+1)))-1)
network=and(ipaddr,netmask)
broadcast=or(network,compl(netmask))
slpos2=index(ARGV[2],"/")
ipaddr2=ip2int(substr(ARGV[2],0,slpos2-1))
netmask2=compl(2**(32-int(substr(ARGV[2],slpos2+1)))-1)
network2=and(ipaddr2,netmask2)
broadcast2=or(network2,compl(netmask2))
if (network >= network2) {
if (network <= broadcast2) {
if (broadcast <= broadcast2) {
print "1"
}
}
}
}
EOF

View File

@@ -1,20 +0,0 @@
function bitcount(c) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
return c
}
function ip2int(ip) {
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
return ret
}
function int2ip(ip,ret,x) {
ret=and(ip,255)
ip=rshift(ip,8)
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
return ret
}

View File

@@ -1,16 +0,0 @@
#!/bin/sh
netrenamed=$1
PREFIX="$(echo $ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
# Get the devices mac address
device="$(uci -p/var/state -q get network.$1.ifname)"
if [ -n "$device" ]; then
MAC="$(ifconfig $netrenamed |grep HWaddr | awk '{ print $5 '})"
else
MAC="$(cat /sys/class/net/$1/address)"
IPV6_UNIQ="$(echo $MAC | awk -F: '{ print $1$2":"$3$4":"$5$6 }')"
fi
echo "${PREFIX}${IPV6_UNIQ}:1"

View File

@@ -1,36 +0,0 @@
#!/bin/sh
# create essid from channel, takes two args:
# $1 = channel (integer)
# $2 = community (optional)
channel=$1
community=$2
. /lib/functions.sh
# Try to get BSSID from profile first
config_load profile_$community
config_get bssid bssidscheme $channel
if [ -z "$bssid" ]; then
config_get bssid bssidscheme "all"
fi
if [ -z "$bssid" ]; then
case $channel in
[1-9])
bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
;;
1[0-4])
bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
;;
[3-9][0-9])
bssid="02:$channel:CA:FF:EE:EE"
;;
1[0-9][0-9])
bssid="${channel/1/12:}:CA:FF:EE:EE"
;;
*) bssid="02:CA:FF:EE:BA:BE"
;;
esac
fi
echo $bssid

View File

@@ -1,6 +0,0 @@
#!/bin/sh
# generates a dhcp-ip and netrange from a given ip/subnet
# takes 2 arguments:
# $1: Ip Address (of the Interface for which we want to generate an ip)
echo "$1" | awk 'BEGIN { FS = "." } ; { print "6."$3"."$4".1" }'

View File

@@ -1,42 +0,0 @@
#!/bin/sh
# This is only run once (usually after flashing an image from the imagebuilder)
# It sets up the initial config for this node.
. /lib/functions.sh
. $dir/functions.sh
config_load system
# Rename system config
handle_system() {
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename system $1 system
fi
}
config_foreach handle_system system
if [ -n "$(uci -q get meshwizard.community)" ]; then
set_defaults "community_" freifunk.community
uci -q delete meshwizard.community
fi
[ -n "$profile_homepage" ] && uci set freifunk.community.homepage="$profile_homepage"
[ -n "$profile_mapserver" ] && {
uci -q delete freifunk.community.mapserver
for m in $profile_mapserver; do
uci add_list freifunk.community.mapserver="$m"
done
}
uci_commitverbose "Setup community" freifunk
if [ -n "$(uci -q get meshwizard.contact)" ]; then
set_defaults "contact_" freifunk.contact
uci -q delete meshwizard.contact && uci_commitverbose "Setup contact" freifunk
fi
if [ "$has_luci" == TRUE ]; then
set_defaults "luci_main_" luci.main
uci -q delete meshwizard.luci_main && uci_commitverbose "Setup luci" luci
fi

View File

@@ -1,42 +0,0 @@
#!/bin/sh
dir=$(dirname $0)
awk -f $dir/common.awk -f - $* <<EOF
BEGIN {
slpos=index(ARGV[1],"/")
if (slpos == 0) {
ipaddr=ip2int(ARGV[1])
netmask=ip2int(ARGV[2])
} else {
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
netmask=compl(2**(32-int(substr(ARGV[1],slpos+1)))-1)
ARGV[4]=ARGV[3]
ARGV[3]=ARGV[2]
}
network=and(ipaddr,netmask)
broadcast=or(network,compl(netmask))
start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
limit=network+1
if (start<limit) start=limit
end=start+ARGV[4]
limit=or(network,compl(netmask))-1
if (end>limit) end=limit
print "IP="int2ip(ipaddr)
print "NETMASK="int2ip(netmask)
print "BROADCAST="int2ip(broadcast)
print "NETWORK="int2ip(network)
print "NEXTNET="int2ip(broadcast + 1)
print "PREFIX="32-bitcount(compl(netmask))
# range calculations:
# ipcalc <ip> <netmask> <start> <num>
if (ARGC > 3) {
print "START="int2ip(start)
print "END="int2ip(end)
}
}
EOF

View File

@@ -1,61 +0,0 @@
#!/bin/sh
# These functions read the settings we need for configuration of the router
read_defaults() {
# read default values from the 3 relevant config files and export them
# into the environment. Later loaded configs overwrite earlier ones. The
# The ordering here is from most generic to most specific:
# freifunk (most generic defaults)
# profile_* (community defaults)
# nodes custom config from meshwizard config file
local community="$1"
config_cb() {
local type="$1"
local name="$2"
local allowed_section_types="widget"
local allowed_section_names="
system
wifi_device
wifi_iface
interface
alias
dhcp
olsr_interface
olsr_interfacedefaults
profile
zone_freifunk
include
luci_splash
ipv6
luci_main
contact
community
wan
lan
general
ipv6
qos
"
if [ "$type" = "widget" ]; then
widgets=$(add_to_list "$widgets" "$name")
fi
if ([ -n "$name" ] && is_in_list "$allowed_section_names" $name) \
|| is_in_list "$allowed_section_types" $type ; then
option_cb() {
local option="$1"
local value="$2"
export "${CONFIG_SECTION}_${option}"="$value"
}
else
option_cb() { return; }
fi
}
config_load freifunk
config_load profile_${community}
config_load meshwizard
export widgets="$widgets"
}

View File

@@ -1,46 +0,0 @@
#!/bin/sh
# This script renames IB_wifi_ interface names into real interface names used on this system.
# E.g. wireless.IB_wifi0 would become wireless.radio0 on mac80211
. $dir/functions.sh
posIB=-1
IBwifis="$(uci show meshwizard.netconfig | grep 'IB_' | sed 's/meshwizard.netconfig\.\(IB_wifi.*\)_.*/\1/' |uniq)"
[ -z "$(echo $IBwifis |grep IB_wifi)" ] && exit
for w in $IBwifis; do
posIB=$(( $posIB + 1 ))
export IB_wifi$posIB="$w"
done
pos=0
syswifis="$(uci show wireless |grep wifi-device | sed 's/wireless\.\(.*\)=.*/\1/' |uniq)"
for s in $syswifis; do
export syswifi$pos="$s"
pos=$(( $pos + 1 ))
done
for i in `seq 0 $posIB`; do
IBwifi=$(eval echo \$IB_wifi$i)
syswifi=$(eval echo \$syswifi$i)
if [ -n "$syswifi" ]; then
case $IBwifi in
IB_wifi* )
# replace IB_wifi_* with actual wifi interface names, delete old ones first
uci show meshwizard.netconfig | grep $IBwifi | while read line; do
oldline=$(echo $line | cut -d "=" -f 1)
uci set $oldline=""
newline=$(echo $line |sed -e "s/$IBwifi/$syswifi/g" -e "s/'//g")
uci set $newline
done
;;
esac
unset IBwifi
unset syswifi
fi
done
uci_commitverbose "Renaming wifi-devices in /etc/config/meshwizard" meshwizard

View File

@@ -1,12 +0,0 @@
#!/bin/sh
net=$1
. $dir/functions.sh
ra="$(uci -q get meshwizard.netconfig.${net}_ipv6ra)"
uci set autoipv6.${netrenamed}="interface"
if [ -n "$ra" ]; then
uci set autoipv6.${netrenamed}.ra=1
fi
uci_commitverbose "Setup auto-ipv6 for interface $netrenamed" autoipv6

View File

@@ -1,17 +0,0 @@
#!/bin/sh
. $dir/functions.sh
if [ "$ipv6_config" = "auto-ipv6-fromv4" ]; then
mode="fromv4"
else
mode="random"
fi
uci set autoipv6.olsr_node.enabled=1
uci set autoipv6.olsr_node.mode="$mode"
uci_commitverbose "Setup auto-ipv6" autoipv6
uci set network.wan.accept_ra=0
uci_commitverbose "Do not accept ra's on wan when using auto-ipv6" network

View File

@@ -1,46 +0,0 @@
#!/bin/sh
# Sets up the dhcp part of dnsmasq
. /lib/functions.sh
. $dir/functions.sh
net="$1"
vap="$(uci -q get meshwizard.netconfig.${net}_vap)"
handle_dnsmasq() {
config_get interface "$1" interface
if [ "$interface" == "${netrenamed}dhcp" ]; then
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename dhcp $1 ${netrenamed}dhcp
fi
fi
}
config_load dhcp
config_foreach handle_dnsmasq dhcp
[ "$net" == "lan" ] && uci -q delete dhcp.lan
if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
uci batch <<- EOF
set dhcp.${netrenamed}dhcp="dhcp"
set dhcp.${netrenamed}dhcp.ignore="0"
set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
EOF
set_defaults "dhcp_" dhcp.${netrenamed}dhcp
fi
ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
if [ "$supports_vap" = 0 ] || \
[ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
[ "$lan_is_olsr" = "1" -a "$lan_dhcp" = 1 ]; then
uci batch <<- EOF
set dhcp.${netrenamed}ahdhcp="dhcp"
set dhcp.${netrenamed}ahdhcp.ignore="0"
set dhcp.${netrenamed}ahdhcp.interface="${netrenamed}ahdhcp"
EOF
fi
set_defaults "dhcp_" dhcp.${netrenamed}ahdhcp
uci_commitverbose "Setup DHCP for $netrenamed" dhcp

View File

@@ -1,29 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. $dir/functions.sh
# Set dnsmasq config
handle_dhcp() {
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename dhcp $1 dnsmasq
fi
}
config_load dhcp
config_foreach handle_dhcp dnsmasq
uci batch << EOF
set dhcp.dnsmasq.local="/$profile_suffix/"
set dhcp.dnsmasq.domain="$profile_suffix"
EOF
config_get addnhosts dnsmasq addnhosts
if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr"
if [ "$ipv6_enabled" = 1 ]; then
uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr.ipv6"
fi
fi
uci_commitverbose "Setup dnsmasq" dhcp

View File

@@ -1,145 +0,0 @@
#!/bin/sh
# Add "freifunk" firewall zone
# If wan/lan is used for olsr then remove these networks from wan/lan zones
# Also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community>
. /lib/functions.sh
. $dir/functions.sh
wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config)
config_load firewall
# Rename firewall zone for freifunk if unnamed
# 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
# If lan is used for olsr then set network for the firewall zone lan to ' ' to remove the lan interface from it
handle_fwzone() {
config_get name "$1" name
config_get network "$1" network
if [ "$name" == "freifunk" ]; then
# rename section if unnamed
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename firewall $1 zone_freifunk
fi
fi
if [ "$name" == "wan" ]; then
if [ "$wan_is_olsr" == 1 ]; then
uci set firewall.$1.network=' ' && uci_commitverbose "WAN is used for olsr, removed the wan interface from zone wan" firewall
else
uci set firewall.$1.local_restrict=1 && uci_commitverbose "Enable local_restrict for zone wan" firewall
fi
fi
if [ "$name" == "lan" ] && [ "$lan_is_olsr" == "1" ]; then
uci set firewall.$1.network=' ' && uci_commitverbose "LAN is used for olsr, removed the lan interface from zone lan" firewall
fi
}
config_foreach handle_fwzone zone
uci batch << EOF
set firewall.zone_freifunk="zone"
set firewall.zone_freifunk.name="freifunk"
set firewall.zone_freifunk.input="$zone_freifunk_input"
set firewall.zone_freifunk.forward="$zone_freifunk_forward"
set firewall.zone_freifunk.output="$zone_freifunk_output"
EOF
uci_commitverbose "Setup firewall zones" firewall
# Usually we need to setup masquerading for lan, except lan is an olsr interface or has an olsr hna-entry
handle_interface() {
config_get interface "$1" interface
if [ "$interface" == "lan" ]; then
no_masq_lan=1
fi
}
config_load olsrd
config_foreach handle_interface Interface
LANIP="$(uci -q get network.lan.ipaddr)"
if [ -n "$LANIP" ]; then
handle_hna() {
config_get netaddr "$1" netaddr
if [ "$LANIP" == "$netaddr" ]; then
no_masq_lan=1
fi
}
config_foreach handle_hna Hna4
fi
currms=$(uci -q get firewall.zone_freifunk.masq_src)
if [ ! "$no_masq_lan" == "1" ] && [ ! "$(uci -q get meshwizard.netconfig.lan_config)" == 1 ]; then
uci set firewall.zone_freifunk.masq="1"
[ -z "$(echo $currms |grep lan)" ] && uci add_list firewall.zone_freifunk.masq_src="lan"
fi
# Rules, Forwardings, advanced config and includes from freifunk and
# profile_$community config files.
add_fw_rules() {
config_cb() {
local type="$1"
local name="$2"
local allowed_section_types="advanced include fw_rule fw_forwarding"
if is_in_list "$allowed_section_types" $type ; then
uci set firewall.${name}="${type/fw_/}"
option_cb() {
local option="$1"
local value="$2"
uci set firewall.${CONFIG_SECTION}.${option}="$value"
}
else
option_cb() { return; }
fi
}
config_load freifunk
config_load profile_${community}
}
add_fw_rules
# If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone
if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
uci batch <<- EOF
set firewall.dhcpv6=rule
set firewall.dhcpv6.src=freifunk
set firewall.dhcpv6.target=ACCEPT
set firewall.dhcpv6.dest_port=547
set firewall.dhcpv6.proto=udp
EOF
fi
# Firewall rules to allow incoming ssh and web if enabled
if [ "$wan_allowssh" == 1 ]; then
uci batch <<- EOF
set firewall.wanssh=rule
set firewall.wanssh.src=wan
set firewall.wanssh.target=ACCEPT
set firewall.wanssh.proto=tcp
set firewall.wanssh.dest_port=22
EOF
fi
if [ "$wan_allowweb" == 1 ]; then
uci batch <<- EOF
set firewall.wanweb=rule
set firewall.wanweb.src=wan
set firewall.wanweb.target=ACCEPT
set firewall.wanweb.proto=tcp
set firewall.wanweb.dest_port=80
set firewall.wanwebhttps=rule
set firewall.wanwebhttps.src=wan
set firewall.wanwebhttps.target=ACCEPT
set firewall.wanwebhttps.proto=tcp
set firewall.wanwebhttps.dest_port=443
EOF
fi
uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall

View File

@@ -1,111 +0,0 @@
#!/bin/sh
# This will add $net to the zone firewall (and remove it from other zones where it is referenced)
# It will also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community>
# Arg $1 = $net
net=$1
. /lib/functions.sh
. $dir/functions.sh
config_load firewall
# Get some variables
type="$(uci -q get wireless.$net.type)"
vap="$(uci -q get meshwizard.netconfig.$net\_vap)"
wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config)
# Delete old firewall zone for freifunk
handle_fwzone() {
config_get name "$1" name
config_get network "$1" network
if [ "$2" == "zoneconf" ]; then
if [ "$name" == "freifunk" ]; then
# rename section if unnamed
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename firewall $1 zone_freifunk
fi
else
if [ ! "$name" == "freifunk" ] && [ -n "$netrenamed" -a -n "$(echo $network | grep $netrenamed)" ]; then
echo " Removed $netrenamed from firewall zone $name."
network_new=$(echo $network | sed -e 's/'$netrenamed'//' -e 's/^ //' -e 's/ / /' -e 's/ $//')
uci set firewall.$1.network="$network_new"
fi
fi
fi
}
config_foreach handle_fwzone zone zoneconf
# Add $netrenamed and if needed ${netrenamed}dhcp to the "freifunk" zone
config_get network zone_freifunk network
# remove ${netrenamed}dhcp from networks list
[ -n "$network" -a -n "$net" ] && network="${network/${netrenamed}dhcp/}"
network=$(echo $network) # Removes leading and trailing whitespaces
[ -n "$netrenamed" ] && [ -z "$(echo $network | grep $netrenamed)" ] && network="$network $netrenamed"
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
[ -n "$netrenamed" ] && [ "$network" == "${network/${netrenamed}dhcp/}" ] && network="$network ${netrenamed}dhcp"
fi
uci set firewall.zone_freifunk.network="$network"
uci_commitverbose "Add '$netrenamed' to freifunk firewall zone" firewall
currms=$(uci -q get firewall.zone_freifunk.masq_src)
# If interfaces are outside of the mesh network they should be natted
if [ "$vap" == 1 ]; then
# Get dhcprange and meshnet for the dhcp interface
if_ip="$(uci -q get network.${netrenamed}dhcp.ipaddr)"
if_mask="$(uci -q get network.${netrenamed}dhcp.netmask)"
[ -n "$if_ip" -a "$if_mask" ] && export $(ipcalc.sh $if_ip $if_mask)
[ -n "$NETWORK" -a "$PREFIX" ] && dhcprange="$NETWORK/$PREFIX"
if [ -n "$dhcprange" ]; then
meshnet="$(uci get profile_$community.profile.mesh_network)"
# check if the dhcprange is inside meshnet
dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
if [ "$dhcpinmesh" == 1 ]; then
# needed or splash will not work
if [ "$has_luci_splash" == TRUE ]; then
uci set firewall.zone_freifunk.contrack="1"
fi
else
uci set firewall.zone_freifunk.masq=1
[ -z "$(echo $currms |grep ${netrenamed}dhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}dhcp"
fi
fi
fi
# Get dhcprange and meshnet for the adhoc dhcp interface
if_ip="$(uci -q get network.${netrenamed}ahdhcp.ipaddr)"
if_mask="$(uci -q get network.${netrenamed}ahdhcp.netmask)"
[ -n "$if_ip" -a "$if_mask" ] && export $(ipcalc.sh $if_ip $if_mask)
[ -n "$NETWORK" -a "$PREFIX" ] && dhcprangeah="$NETWORK/$PREFIX"
if [ -n "$dhcprangeah" ]; then
meshnet="$(uci get profile_$community.profile.mesh_network)"
# check if the dhcprange is inside meshnet
dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprangeah $meshnet)"
if [ "$dhcpinmesh" == 1 ]; then
# needed or splash will not work
if [ "$has_luci_splash" == TRUE ]; then
uci set firewall.zone_freifunk.contrack="1"
fi
else
uci set firewall.zone_freifunk.masq=1
[ -z "$(echo $currms |grep ${netrenamed}ahdhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}ahdhcp"
fi
fi
for i in IP NETMASK BROADCAST NETWORK PREFIX; do
unset $i
done
uci_commitverbose "Setup masquerading rules for '$netrenamed'" firewall

View File

@@ -1,20 +0,0 @@
#!/bin/sh
[ ! "$(uci -q get network.lan)" == "interface" ] && exit
. /lib/functions.sh
. $dir/functions.sh
# Setup IPv6 for the lan interface
ip6addr=""
if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
# get lan mac
device="$(uci -p/var/state -q get network.lan.ifname)"
if [ -n "device" ]; then
ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
fi
uci set network.lan.ip6addr="${ip6addr}/112"
fi
uci_commitverbose "Setup ipv6 address for lan" network

View File

@@ -1,17 +0,0 @@
#!/bin/sh
# Setup static interface settings for lan if lan is not an olsr interface
[ ! "$(uci -q get network.lan)" == "interface" ] && exit
. /lib/functions.sh
. $dir/functions.sh
uci batch << EOF
set network.lan.proto='$lan_proto'
set network.lan.ipaddr='$lan_ip4addr'
set network.lan.netmask='$lan_netmask'
EOF
uci_commitverbose "Setup static ip settings for lan" network
uci delete meshwizard.lan && uci commit meshwizard

View File

@@ -1,142 +0,0 @@
# setup entry in /etc/config/network for a interface
# Argument $1: network interface
net="$1"
. /lib/functions.sh
. $dir/functions.sh
# Setup a (new) interface section for $net
ipaddr=$(uci -q get meshwizard.netconfig.$net\_ip4addr)
ip6addr=$(uci -q get meshwizard.netconfig.$net\_ip6addr)
[ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr
netmask=$(uci -q get meshwizard.netconfig.$net\_netmask)
[ -z "$netmask" ] && netmask="$interface_netmask"
[ -z "$netmask" ] && netmask="255.255.0.0"
uci set network.$netrenamed="interface"
set_defaults "interface_" network.$netrenamed
uci batch << EOF
set network.$netrenamed.proto="static"
set network.$netrenamed.ipaddr="$ipaddr"
set network.$netrenamed.netmask="$netmask"
EOF
if [ "$netrenamed" = "lan" ]; then
# remove the bridge if the interface is used for olsr
# since this script is only run in this case, no need
# to check for lan_proto = "olsr" currently.
uci -q delete network.lan.type
fi
# Setup IPv6 for the interface
if [ "$ipv6_enabled" = 1 ]; then
if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $netrenamed)"
uci set network.$netrenamed.ip6addr="${ip6addr}/112"
fi
if [ "$ipv6_config" = "static" ] && [ -n "$ip6addr" ]; then
uci set network.$netrenamed.ip6addr="$ip6addr"
fi
fi
uci_commitverbose "Setup interface $netrenamed" network
# setup dhcp alias/interface
net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
if [ "$net_dhcp" == 1 ]; then
# Load meshwizard_settings
dhcprange="$(uci -q get meshwizard.netconfig.${net}_dhcprange)"
interface_ip="$(uci -q get meshwizard.netconfig.${net}_ip4addr)"
vap=$(uci -q get meshwizard.netconfig.${net}_vap)
# Rename config
handle_dhcpalias() {
config_get interface "$1" interface
if [ "$interface" == "$netrenamed" ]; then
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename network $1 ${netrenamed}dhcp
fi
fi
}
config_load network
config_foreach handle_dhcpalias interface
# Get IP/netmask and start-ip for $net dhcp
# If no dhcprange is given in /etc/config/meshwizard we autogenerate one
if [ -z "$dhcprange" ]; then
dhcprange="$($dir/helpers/gen_dhcp_ip.sh $interface_ip)/24"
uci set meshwizard.netconfig.${net}_dhcprange="$dhcprange"
fi
# If we use VAP and also offer dhcp on the adhoc interface then cut the dhcp
# range in two halves. one for the adhoc, one for the managed VAP interface
ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
if [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
# VAPs are enabled for this interface, supported and we want to
# also use DHCP on the adhoc interface
network=${dhcprange%%/*}
mask=${dhcprange##*/}
# Divide network size by adding 1 to the netmask
mask=$(($mask + 1))
# Get first ip and netmask for the adhoc dhcp network
eval $(sh $dir/helpers/ipcalc-cidr.sh ${network}/${mask} 1 0)
STARTADHOC=$START
NETMASKADHOC=$NETMASK
# Get first ip and netmask for the managed dhcp network
eval $(sh $dir/helpers/ipcalc-cidr.sh ${NEXTNET}/${mask} 1 0)
STARTVAP=$START
NETMASKVAP=$NETMASK
# Add dhcp interface
uci batch <<- EOF
set network.${netrenamed}dhcp=interface
set network.${netrenamed}dhcp.proto=static
set network.${netrenamed}dhcp.ipaddr="$STARTVAP"
set network.${netrenamed}dhcp.netmask="$NETMASKVAP"
EOF
uci_commitverbose "Setup interface for ${netrenamed}dhcp" network
else
eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange 1 0)
STARTADHOC=$START
NETMASKADHOC=$NETMASK
fi
if [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" != 1 ]; then
# vaps are enabled and supported and we do not use DHCP on adhoc
# Add dhcp interface
uci batch <<- EOF
set network.${netrenamed}dhcp=interface
set network.${netrenamed}dhcp.proto=static
set network.${netrenamed}dhcp.ipaddr="$STARTADHOC"
set network.${netrenamed}dhcp.netmask="$NETMASKADHOC"
EOF
uci_commitverbose "Setup interface for ${netrenamed}dhcp" network
fi
# Setup alias for $net adhoc interface
if [ "$supports_vap" = 0 ] || \
[ "$vap" = 0 ] || \
[ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
[ "$lan_is_olsr" = "1" ]; then
# setup an alias interface for the main interface to use as a network for clients
# when one of the following conditions is met
# * vaps are not supported
# * or not enabled
# * or they are supported and enabled but we also want to use DHCP on the adhoc interface
# * or this is the lan interface and it is used for olsrd (and dhcp is enabled)
uci batch <<- EOF
set network.${netrenamed}ahdhcp=interface
set network.${netrenamed}ahdhcp.ifname="@${netrenamed}"
set network.${netrenamed}ahdhcp.proto=static
set network.${netrenamed}ahdhcp.ipaddr="$STARTADHOC"
set network.${netrenamed}ahdhcp.netmask="$NETMASKADHOC"
EOF
uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network
fi
fi

View File

@@ -1,160 +0,0 @@
#!/bin/sh
# Sets up olsrd
. /lib/functions.sh
. $dir/functions.sh
protocols="4"
if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
protocols="4 6"
fi
clean_config() {
# Clean the config, remove interface wlan
handle_interface() {
config_get interface "$1" interface
if [ "$interface" = "wlan" ]; then
uci delete $cfg.$1
fi
}
config_foreach handle_interface Interface
}
rename_olsrd() {
#Rename olsrd basic settings
handle_olsrd() {
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename $cfg $1 olsrd
fi
}
config_foreach handle_olsrd olsrd
}
rename_interface_defaults() {
# Rename interface defaults
handle_interfacedefaults() {
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename $cfg $1 InterfaceDefaults
fi
}
config_foreach handle_interfacedefaults InterfaceDefaults
}
cleanup_plugins() {
# Rename nameservice, dyngw and httpinfo plugins
handle_plugin() {
config_get library "$1" library
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
new="$(echo $library | cut -d '.' -f 1)"
section_rename $cfg "$1" "$new"
fi
}
config_foreach handle_plugin LoadPlugin
uci -q delete $cfg.olsrd_httpinfo
uci -q delete $cfg.olsrd_dyn_gw
}
setup_nameservice() {
# Setup nameservice plugin
if [ -n "$profile_suffix" ]; then
suffix=".$profile_suffix"
else
suffix=".olsr"
fi
local llfile="/var/run/latlon.js"
local hosts="/var/etc/hosts.olsr"
local services="/var/run/services_olsr"
if [ "$proto" = "6" ]; then
local llfile="/var/run/latlon.js.ipv6"
local hosts="/var/etc/hosts.olsr.ipv6"
local services="/var/run/services_olsr.ipv6"
fi
uci batch <<- EOF
set $cfg.olsrd_nameservice=LoadPlugin
set $cfg.olsrd_nameservice.library="olsrd_nameservice"
set $cfg.olsrd_nameservice.latlon_file="$llfile"
set $cfg.olsrd_nameservice.hosts_file="$hosts"
set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
set $cfg.olsrd_nameservice.services_file="$services"
set $cfg.olsrd_nameservice.suffix="$suffix"
EOF
uci_commitverbose "Setup olsr nameservice plugin" $cfg
}
setup_dyngw_plain() {
# Setup dyngw_plain
# If Sharing of Internet is enabled then enable dyngw_plain plugin
if [ "$general_sharenet" == 1 ]; then
uci set $cfg.dyngw_plain=LoadPlugin
uci set $cfg.dyngw_plain.ignore=0
uci set $cfg.dyngw_plain.library="olsrd_dyn_gw_plain"
uci_commitverbose "Setup olsrd_dyngw_plain plugin" $cfg
fi
}
setup_watchdog() {
# Setup watchdog
local watchdogfile="/var/run/olsrd.watchdog"
if [ "$proto" = "6" ]; then
watchdogfile="/var/run/olsrd.watchdog.ipv6"
fi
uci batch <<- EOF
set $cfg.olsrd_watchdog=LoadPlugin
set $cfg.olsrd_watchdog.library="olsrd_watchdog"
set $cfg.olsrd_watchdog.file="$watchdogfile"
set $cfg.olsrd_watchdog.interval=30
EOF
uci_commitverbose "Setup olsr watchdog plugin" $cfg
}
setup_jsoninfo() {
proto="$1"
uci batch <<- EOF
set $cfg.olsrd_jsoninfo=LoadPlugin
set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo"
EOF
if [ "$proto" = "6" ]; then
uci set $cfg.olsrd_jsoninfo.ipv6only='1'
fi
uci_commitverbose "Setup olsr jsoninfo plugin" $cfg
}
setup_txtinfo() {
proto="$1"
uci batch <<- EOF
set $cfg.olsrd_txtinfo=LoadPlugin
set $cfg.olsrd_txtinfo.library="olsrd_txtinfo"
EOF
if [ "$proto" = "6" ]; then
uci set $cfg.olsrd_txtinfo.ipv6only='1'
fi
uci_commitverbose "Setup olsr txtinfo plugin" $cfg
}
for proto in $protocols; do
cfg="olsrd"
[ "$proto" == "6" ] && cfg="olsrd6"
config_load $cfg
clean_config
rename_olsrd
cleanup_plugins
uci set $cfg.olsrd.IpVersion="$proto"
uci set $cfg.InterfaceDefaults=InterfaceDefaults
set_defaults "olsr_interfacedefaults_" $cfg.InterfaceDefaults
uci_commitverbose "Cleanup olsrd config" $cfg
setup_nameservice
setup_dyngw_plain
setup_watchdog
setup_jsoninfo $proto
setup_txtinfo $proto
done

View File

@@ -1,76 +0,0 @@
#!/bin/sh
# Sets up olsrd interfaces
# arg $1 = net
net=$1
. /lib/functions.sh
. $dir/functions.sh
protocols="4"
if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
protocols="4 6"
fi
for proto in $protocols; do
cfg="olsrd"
[ "$proto" == "6" ] && cfg="olsrd6"
# Rename interface for $netrenamed
handle_interface() {
config_get interface "$1" Interface
if [ "$interface" == "$netrenamed" ]; then
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename $cfg $1 $netrenamed
fi
fi
}
config_foreach handle_interface Interface
# Setup new interface for $netrenamed
uci set $cfg.$netrenamed=Interface
set_defaults "olsr_interface_" $cfg.$net
uci set $cfg.$netrenamed.interface="$netrenamed"
uci_commitverbose "Setup olsr interface for $netrenamed." $cfg
if [ "$proto" = "4" ]; then
# If dhcp-network is inside the mesh_network then add HNA for it
dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange)
uci -q delete $cfg.${netrenamed}clients
if [ -n "$dhcprange" ]; then
meshnet="$(uci get profile_$community.profile.mesh_network)"
dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
if [ "$dhcpinmesh" == 1 ] && [ -n "$meshnet" ]; then
uci set $cfg.${netrenamed}clients="Hna4"
eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange)
uci set $cfg.${netrenamed}clients.netaddr="$NETWORK"
uci set $cfg.${netrenamed}clients.netmask="$NETMASK"
uci_commitverbose "Setup HNA for network $dhcprange" $cfg
fi
fi
fi
if [ "$proto" = "6" ]; then
# Set Hna entry for ipv6 net for static ipv6 config
uci -q delete $cfg.${netrenamed}static
if [ "$ipv6_config" = "static" ]; then
v6range="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
v6net="$(echo $v6range | cut -d '/' -f 1)"
v6mask="$(echo $v6range | cut -d '/' -f 2)"
if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
uci set $cfg.${netrenamed}static="Hna6"
uci set $cfg.${netrenamed}static.netaddr="$v6net"
uci set $cfg.${netrenamed}static.prefix="$v6mask"
uci_commitverbose "Setup HNA for network $v6range" $cfg
fi
fi
fi
done

View File

@@ -1,11 +0,0 @@
#!/bin/sh
. $dir/functions.sh
uci batch << EOF
set freifunk-policyrouting.pr.enable=1
set freifunk-policyrouting.pr.strict=1
set freifunk-policyrouting.pr.zones="freifunk"
EOF
uci_commitverbose "Setup policyrouting" freifunk-policyrouting

Some files were not shown because too many files have changed in this diff Show More