forked from freifunk-franken/firmware
Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
Christian Dresel | 0fd522b207 | |
Christian Dresel | cc1ddd242c | |
Christian Dresel | a53e53f3c1 | |
Christian Dresel | 517ca5c7bc | |
Christian Dresel | 83b85e9d7a | |
Christian Dresel | a5b6355582 | |
Christian Dresel | 87e627ba29 | |
Fabian Bläse | 4dd56442ab | |
Adrian Schmutzler | 7fd1cfa888 | |
Adrian Schmutzler | 8a648af3e2 | |
Adrian Schmutzler | c376435686 | |
Adrian Schmutzler | 3d36158899 | |
Adrian Schmutzler | 1c0f869e5d | |
Christian Dresel | e50cb9d7d9 | |
Christian Dresel | 5f22c2131c | |
Christian Dresel | 8581bd76c4 | |
Christian Dresel | b94f2ee10e |
|
@ -21,8 +21,8 @@ define Package/fff-alfred-monitoring-proxy/description
|
|||
https://monitoring.freifunk-franken.de/
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-alfred-monitoring-proxy/install
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-alfred
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
This packages configures the Alfred on the device.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
uci batch <<EOF
|
||||
set alfred.alfred=alfred
|
||||
set alfred.alfred.interface='br-mesh'
|
||||
set alfred.alfred.interface='br-client'
|
||||
set alfred.alfred.mode='slave'
|
||||
set alfred.alfred.batmanif='none'
|
||||
set alfred.alfred.start_vis='0'
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-autoconfig
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-autoconfig
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-autoconfig
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 automatic ipv4 configuration
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-layer3-config
|
||||
|
||||
endef
|
||||
|
||||
define Package/fff-autoconfig/description
|
||||
This package load automatic ipv4 over mqtt
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-autoconfig/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-autoconfig))
|
|
@ -0,0 +1,6 @@
|
|||
if ! uci -q get fff.autol3 > /dev/null ; then
|
||||
uci set fff.autol3=autol3
|
||||
uci commit fff
|
||||
fi
|
||||
|
||||
exit 0;
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/sh
|
||||
|
||||
# first check is fff.autol3.ipv6 enabled
|
||||
if [ -z $(uci -q get fff.autol3.ipv6) ] ; then
|
||||
exit;
|
||||
fi
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
MACADDR=$(cat /sys/class/net/br-client/address | /bin/sed 's/://g')
|
||||
MQTTSERVER=$(uci -q get fff.mqtt.server)
|
||||
ASSIGNEROWN=$(uci -q get fff.autol3.ipv6assigner)
|
||||
IPOWN=$(uci -q get fff.autol3.ipv6address)
|
||||
|
||||
asknew() {
|
||||
# Load Blocklist
|
||||
ipv6assignerblock=$(uci get fff.autol3.ipv6assignerblock)
|
||||
for ipv6assignerblock in $ipv6assignerblock; do
|
||||
block="$block -T /ipv6/usethis/+/$ipv6assignerblock"
|
||||
done
|
||||
echo $block
|
||||
mosquitto_pub -h $MQTTSERVER -p 1883 -t '/ipv6/asknew' -m "$MACADDR"
|
||||
# use the first income message
|
||||
# cancel after 5 second, after this time we don't get any IP address
|
||||
autol3config=$(mosquitto_sub -h $MQTTSERVER -p 1883 -t '/ipv6/usethis/#' -C 1 $block)
|
||||
if [ -z "$autol3config" ] ; then
|
||||
echo "No IP get"
|
||||
exit 1;
|
||||
fi
|
||||
json_load "$autol3config"
|
||||
json_get_var assigner assigner
|
||||
json_get_var ip ip
|
||||
uci set fff.autol3.ipv6address=$ip
|
||||
uci set fff.autol3.ipv6assigner=$assigner
|
||||
uci commit fff
|
||||
uci del gateway.@client[0].ip6addr
|
||||
uci add_list gateway.@client[0].ip6addr=$ip
|
||||
uci commit gateway
|
||||
yes | configure-layer3 -c
|
||||
configure-layer3 -a
|
||||
exit;
|
||||
}
|
||||
|
||||
canusethis() {
|
||||
mosquitto_pub -h $MQTTSERVER -p 1883 -t /ipv6/canusethis/$ASSIGNEROWN -m "{ \"mac\":\"$MACADDR\", \"ip\":\"$IPOWN\" }"
|
||||
canusethisanswer=$(mosquitto_sub -h $MQTTSERVER -p 1883 -t /ipv6/canusethisanswer/$MACADDR -C 1 -W 5)
|
||||
# check if we get answer, if no load asknew again and get new ip address
|
||||
if [ -z $canusethisanswer ] ; then
|
||||
uci del fff.autol3.ipv6address
|
||||
uci del fff.autol3.ipv6assigner
|
||||
uci commit fff
|
||||
uci del gateway.@client[0].ip6addr
|
||||
uci commit gateway
|
||||
asknew
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n $(uci -q get fff.autol3) ] && [ -z $(uci -q get fff.autol3.ipv6address) ] ; then
|
||||
asknew
|
||||
fi
|
||||
|
||||
if [ -n $(uci -q get fff.autol3.ipv6address) ] ; then
|
||||
canusethis
|
||||
fi
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
|
||||
# first check is fff.autol3.ipv4 enabled
|
||||
if [ -z $(uci -q get fff.autol3.ipv4) ] ; then
|
||||
exit;
|
||||
fi
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
MACADDR=$(cat /sys/class/net/br-client/address | /bin/sed 's/://g')
|
||||
MQTTSERVER=$(uci -q get fff.mqtt.server)
|
||||
ASSIGNEROWN=$(uci -q get fff.autol3.ipv4assigner)
|
||||
IPOWN=$(uci -q get fff.autol3.ipv4address)
|
||||
|
||||
asknew() {
|
||||
# Load Blocklist
|
||||
ipv6assignerblock=$(uci get fff.autol3.ipv6assignerblock)
|
||||
for ipv6assignerblock in $ipv6assignerblock; do
|
||||
block="$block -T /ipv6/usethis/+/$ipv6assignerblock"
|
||||
done
|
||||
mosquitto_pub -h $MQTTSERVER -p 1883 -t '/ipv4/asknew' -m "$MACADDR"
|
||||
# use the first income message
|
||||
# cancel after 5 second, after this time we don't get any IP address
|
||||
autol3config=$(mosquitto_sub -h $MQTTSERVER -p 1883 -t '/ipv4/usethis/#' -C 1 $block)
|
||||
if [ -z "$autol3config" ] ; then
|
||||
echo "No IP get"
|
||||
exit 1;
|
||||
fi
|
||||
json_load "$autol3config"
|
||||
json_get_var assigner assigner
|
||||
json_get_var ip ip
|
||||
ip=$(echo $ip | sed 's/\/.*//')
|
||||
uci del gateway.meta.peer_ip
|
||||
uci del gateway.@client[0].nat
|
||||
uci del gateway.@client[0].ipaddr
|
||||
uci del gateway.@client[0].dhcp_start
|
||||
uci set gateway.meta.peer_ip=$ip
|
||||
uci set gateway.@client[0].nat='1'
|
||||
uci set gateway.@client[0].ipaddr='192.168.0.1/16'
|
||||
uci set gateway.@client[0].dhcp_start='192.168.1.1'
|
||||
uci commit gateway
|
||||
uci set fff.autol3.ipv4address=$ip
|
||||
uci set fff.autol3.ipv4assigner=$assigner
|
||||
uci set fff.autol3.autoconfigl3=1
|
||||
uci commit fff
|
||||
exit;
|
||||
}
|
||||
|
||||
canusethis() {
|
||||
mosquitto_pub -h $MQTTSERVER -p 1883 -t /ipv4/canusethis/$ASSIGNEROWN -m "{ \"mac\":\"$MACADDR\", \"ip\":\"$IPOWN/32\" }"
|
||||
canusethisanswer=$(mosquitto_sub -h $MQTTSERVER -p 1883 -t /ipv4/canusethisanswer/$MACADDR -C 1 -W 5)
|
||||
# check if we get answer, if no load asknew again and get new ip address
|
||||
if [ -z $canusethisanswer ] ; then
|
||||
uci del fff.autol3.ipv4address
|
||||
uci del fff.autol3.ipv4assigner
|
||||
uci set fff.autol3.autoconfigl3=1
|
||||
uci commit fff
|
||||
uci del gateway.meta.peer_ip
|
||||
uci del gateway.@client[0].nat
|
||||
uci del gateway.@client[0].ipaddr
|
||||
uci del gateway.@client[0].dhcp_start
|
||||
uci commit gateway
|
||||
asknew
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n $(uci -q get fff.autol3) ] && [ -z $(uci -q get fff.autol3.ipv4address) ] ; then
|
||||
asknew
|
||||
fi
|
||||
|
||||
if [ -n $(uci -q get fff.autol3.ipv4address) ] ; then
|
||||
canusethis
|
||||
fi
|
||||
|
|
@ -0,0 +1 @@
|
|||
2-57/5 * * * * /usr/sbin/autoconfigl3
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
for f in /usr/lib/autol3.d/*.sh; do
|
||||
. /usr/lib/autol3.d/$f
|
||||
if [ $? -ne 0 ]; then
|
||||
debug "Error when executing subscript $f, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$uci -q get fff.autol3.autoconfigl3" ] ; then
|
||||
if yes | configure-layer3 -c; then
|
||||
configure-layer3 -a
|
||||
else
|
||||
configure-layer3 -r
|
||||
fi
|
||||
uci del fff.autol3.autoconfigl3
|
||||
uci commit fff
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-babeld
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-babeld
|
||||
|
||||
|
@ -20,14 +20,6 @@ define Package/fff-babeld/description
|
|||
This package provides an example babeld configuration.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -19,7 +19,7 @@ uci batch <<EOF
|
|||
set network.@rule[3].priority='20'
|
||||
add network rule
|
||||
set network.@rule[4]=rule
|
||||
set network.@rule[4].in='mesh'
|
||||
set network.@rule[4].in='client'
|
||||
set network.@rule[4].lookup='10'
|
||||
set network.@rule[4].priority='31'
|
||||
add network rule6
|
||||
|
@ -34,7 +34,7 @@ uci batch <<EOF
|
|||
set network.@rule6[1].priority='20'
|
||||
add network rule6
|
||||
set network.@rule6[2]=rule6
|
||||
set network.@rule6[2].in='mesh'
|
||||
set network.@rule6[2].in='client'
|
||||
set network.@rule6[2].lookup='10'
|
||||
set network.@rule6[2].priority='31'
|
||||
add network rule6
|
||||
|
|
|
@ -23,14 +23,6 @@ define Package/$(PKG_NAME)/description
|
|||
It is used to configure batman-adv.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -19,14 +19,6 @@ define Package/$(PKG_NAME)/description
|
|||
This packages configures the boardname in the board config.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
This packages provides utilities for a central FFF config file.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-dhcp
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-dhcp
|
||||
|
||||
|
@ -20,14 +20,6 @@ define Package/fff-dhcp/description
|
|||
It is used to configure dnsmasq for use as gateway.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -24,9 +24,9 @@ uci batch <<EOF
|
|||
add_list dhcp.@dnsmasq[0].server='/ip6.arpa/10.50.252.11'
|
||||
add_list dhcp.@dnsmasq[0].server='/ip6.arpa/10.50.252.0'
|
||||
|
||||
set dhcp.mesh=dhcp
|
||||
set dhcp.mesh.interface='mesh'
|
||||
set dhcp.mesh.leasetime='1h'
|
||||
set dhcp.client=dhcp
|
||||
set dhcp.client.interface='client'
|
||||
set dhcp.client.leasetime='1h'
|
||||
EOF
|
||||
|
||||
uci commit dhcp
|
||||
|
|
|
@ -26,14 +26,6 @@ define Package/$(PKG_NAME)/description
|
|||
It is used to configure fastd.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -24,14 +24,6 @@ define Package/$(PKG_NAME)/description
|
|||
It is used to configure firewall.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-hoods
|
||||
PKG_RELEASE:=15
|
||||
PKG_RELEASE:=17
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -12,23 +12,24 @@ define Package/$(PKG_NAME)
|
|||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken hoods
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:=+fff-hoodutils +fff-macnock +fff-vpn-select +fff-firewall \
|
||||
+fff-timeserver +fff-network +fff-wireless +jshn \
|
||||
+@BUSYBOX_CONFIG_WGET +@BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT
|
||||
DEPENDS:= \
|
||||
+fff-firewall \
|
||||
+fff-hoodutils \
|
||||
+fff-macnock \
|
||||
+fff-network \
|
||||
+fff-timeserver \
|
||||
+fff-vpn-select \
|
||||
+fff-web-hood \
|
||||
+fff-wireless \
|
||||
+jshn \
|
||||
+@BUSYBOX_CONFIG_WGET \
|
||||
+@BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This package load and configures the current hood
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -77,7 +77,7 @@ getGatewayHoodfile() {
|
|||
|
||||
echo "Trying to get hoodfile from gateway..."
|
||||
|
||||
if /bin/busybox wget -T15 -O "$file" "http://[fe80::1%br-mesh]:2342/keyxchangev2data"; then
|
||||
if /bin/busybox wget -T15 -O "$file" "http://[fe80::1%br-client]:2342/keyxchangev2data"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
|
|
@ -184,36 +184,36 @@ if [ -s "$hoodfiletmp" ]; then
|
|||
/usr/sbin/vpn-stop
|
||||
fi
|
||||
|
||||
# now we load the prefix from the hoodfile and set this to br-mesh
|
||||
# now we load the prefix from the hoodfile and set this to br-client
|
||||
json_select network
|
||||
json_get_var prefix ula_prefix
|
||||
# Set $prefix::MAC as IP
|
||||
if [ -n "$prefix" ] ; then
|
||||
prefix="$(echo "$prefix" | sed -e 's,\\,,')"
|
||||
mac="$(cat "/sys/class/net/br-mesh/address")"
|
||||
mac="$(cat "/sys/class/net/br-client/address")"
|
||||
addr="$(ipMacAssemble "$prefix" "$mac")"
|
||||
addr="$(ipTidyColon "$addr")"
|
||||
addr_eui="$(ipEUIAssemble "$prefix" "$mac")"
|
||||
addr_eui="$(ipTidyColon "$addr_eui")"
|
||||
for ip in $(ip -6 addr show dev br-mesh | grep inet6 | grep -v -e " $addr" -e " $addr_eui" -e " fe80::" -e " fdff::" | cut -f6 -d " "); do
|
||||
ip -6 addr del "$ip" dev br-mesh
|
||||
for ip in $(ip -6 addr show dev br-client | grep inet6 | grep -v -e " $addr" -e " $addr_eui" -e " fe80::" -e " fdff::" | cut -f6 -d " "); do
|
||||
ip -6 addr del "$ip" dev br-client
|
||||
done
|
||||
if ! ( ip -6 addr show dev br-mesh | grep -q "$addr" ) ; then
|
||||
ip -6 addr add "$addr" dev br-mesh
|
||||
echo "Set ULA address to br-mesh: $addr"
|
||||
if ! ( ip -6 addr show dev br-client | grep -q "$addr" ) ; then
|
||||
ip -6 addr add "$addr" dev br-client
|
||||
echo "Set ULA address to br-client: $addr"
|
||||
else
|
||||
echo "Address already set."
|
||||
fi
|
||||
# Set $prefix::link-local as IP
|
||||
if ! ( ip -6 addr show dev br-mesh | grep -q "$addr_eui" ) ; then
|
||||
ip -6 addr add "$addr_eui" dev br-mesh
|
||||
echo "Set ULA EUI-64 address to br-mesh: $addr_eui"
|
||||
if ! ( ip -6 addr show dev br-client | grep -q "$addr_eui" ) ; then
|
||||
ip -6 addr add "$addr_eui" dev br-client
|
||||
echo "Set ULA EUI-64 address to br-client: $addr_eui"
|
||||
else
|
||||
echo "Address already set."
|
||||
fi
|
||||
if ! ( ip -6 route show dev br-mesh | grep -q "fc00::" ) ; then
|
||||
ip -6 route add fc00::/7 via fe80::1 dev br-mesh
|
||||
echo "Set ULA route to br-mesh."
|
||||
if ! ( ip -6 route show dev br-client | grep -q "fc00::" ) ; then
|
||||
ip -6 route add fc00::/7 via fe80::1 dev br-client
|
||||
echo "Set ULA route to br-client."
|
||||
else
|
||||
echo "Route already set."
|
||||
fi
|
||||
|
|
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
may be used outside of configurehood
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-ipv4snat
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-ipv4snat
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-ipv4snat
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 configuration with nat
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+iptables-mod-nat-extra \
|
||||
+fff-firewall \
|
||||
+fff-layer3-config
|
||||
|
||||
endef
|
||||
|
||||
define Package/fff-ipv4snat/description
|
||||
With this package it is possible to make NAT with IPv4 on the router
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-ipv4snat/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-ipv4snat))
|
|
@ -0,0 +1,53 @@
|
|||
# First read IP adresses
|
||||
if ! ipaddr=$(uci get gateway.@client[0].ipaddr); then
|
||||
echo "WARNING: No ipaddr set!"
|
||||
fi
|
||||
|
||||
# configure-layer3 -c do nothing
|
||||
|
||||
# Check if NAT is set
|
||||
# If NAT is set
|
||||
if uci -q get gateway.@client[0].nat; then
|
||||
if ! peer_ip=$(uci get gateway.meta.peer_ip); then
|
||||
echo "WARNING: No peer_ip set! For NAT you must set a peer_ip"
|
||||
fi
|
||||
# configure-layer3 -t - reload set the iptables rule not rebootsafe
|
||||
reload() {
|
||||
# first we flush the table
|
||||
iptables -t nat --flush
|
||||
# and load the new settings
|
||||
iptables -t nat -A POSTROUTING -s $ipaddr -j SNAT --to-source $peer_ip
|
||||
}
|
||||
|
||||
# configure-layer3 -a - apply write iptables rule to firewall and set rule again
|
||||
# because it is possible that the rule is not set here but we need it here
|
||||
apply() {
|
||||
echo "iptables -t nat -A POSTROUTING -s $ipaddr -j SNAT --to-source $peer_ip" > /usr/lib/firewall.d/30-NAT
|
||||
iptables -t nat --flush
|
||||
iptables -t nat -A POSTROUTING -s $ipaddr -j SNAT --to-source $peer_ip
|
||||
}
|
||||
# If NAT is not set
|
||||
else
|
||||
# configure-layer3 -t - reload flush the iptables
|
||||
reload() {
|
||||
# we only flush the table
|
||||
iptables -t nat --flush
|
||||
}
|
||||
|
||||
# configure-layer3 -a - apply flush iptables rule and delete firewall rule
|
||||
apply() {
|
||||
# we flush the table
|
||||
iptables -t nat --flush
|
||||
# and delete the firewall
|
||||
rm /usr/lib/firewall.d/30-NAT
|
||||
# nobody need NAT we win! \o/
|
||||
}
|
||||
fi
|
||||
|
||||
# revert is the same whether NAT set or not
|
||||
revert() {
|
||||
# first we flush the table
|
||||
iptables -t nat --flush
|
||||
# and load the old settings
|
||||
. /usr/lib/firewall.d/30-NAT
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3-config
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-layer3-config
|
||||
|
||||
|
@ -23,14 +23,6 @@ define Package/fff-layer3-config/description
|
|||
This package provides the means for configuring the gateway
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
boot() {
|
||||
# Reapply gateway settings, if configuration succeeds
|
||||
if yes | configure-layer3 -c; then
|
||||
configure-layer3 -a
|
||||
else
|
||||
configure-layer3 -r
|
||||
fi
|
||||
|
||||
# first we disable the init.d
|
||||
/etc/init.d/fff-layer3-update disable
|
||||
# we must delete the symlink manually
|
||||
rm -f /etc/rc.d/S99fff-layer3-update
|
||||
}
|
|
@ -6,55 +6,55 @@ BOARD="$(uci get board.model.name)"
|
|||
configure() {
|
||||
# ipaddr
|
||||
#remove old ipaddr
|
||||
uci -q del network.mesh.ipaddr
|
||||
uci -q del network.client.ipaddr
|
||||
#set new ipaddr
|
||||
if ipaddr=$(uci -q get gateway.@client[0].ipaddr); then
|
||||
for ip in $ipaddr; do
|
||||
uci add_list network.mesh.ipaddr=$ip
|
||||
uci add_list network.client.ipaddr=$ip
|
||||
done
|
||||
else
|
||||
echo "WARNING: No client ipaddr set!"
|
||||
fi
|
||||
#put interface routes from set addresses into fff table
|
||||
uci set network.mesh.ip4table='fff'
|
||||
uci set network.client.ip4table='fff'
|
||||
|
||||
# ip6addr
|
||||
#remove old ip6addr
|
||||
for ip in $(uci get network.mesh.ip6addr); do
|
||||
for ip in $(uci get network.client.ip6addr); do
|
||||
if echo "$ip" | grep -v -e "fdff:" -e "fe80::1/64" > /dev/null; then
|
||||
uci del_list network.mesh.ip6addr="$ip"
|
||||
uci del_list network.client.ip6addr="$ip"
|
||||
fi
|
||||
done
|
||||
#set new ip6addr
|
||||
if ip6addr=$(uci -q get gateway.@client[0].ip6addr); then
|
||||
for ip in $ip6addr; do
|
||||
uci add_list network.mesh.ip6addr=$ip
|
||||
uci add_list network.client.ip6addr=$ip
|
||||
done
|
||||
else
|
||||
echo "WARNING: No client ip6addr set!"
|
||||
fi
|
||||
#put interface routes from set addresses into fff table
|
||||
uci set network.mesh.ip6table='fff'
|
||||
uci set network.client.ip6table='fff'
|
||||
|
||||
# dhcp
|
||||
uci -q del dhcp.mesh.start
|
||||
uci -q del dhcp.mesh.limit
|
||||
uci -q del dhcp.client.start
|
||||
uci -q del dhcp.client.limit
|
||||
if dhcp_start=$(uci -q get gateway.@client[0].dhcp_start); then
|
||||
uci set dhcp.mesh=dhcp
|
||||
uci set dhcp.mesh.interface=mesh
|
||||
uci set dhcp.mesh.start=$dhcp_start
|
||||
uci set dhcp.mesh.limit=$(uci -q get gateway.@client[0].dhcp_limit)
|
||||
uci set dhcp.client=dhcp
|
||||
uci set dhcp.client.interface=client
|
||||
uci set dhcp.client.start=$dhcp_start
|
||||
uci set dhcp.client.limit=$(uci -q get gateway.@client[0].dhcp_limit)
|
||||
else
|
||||
echo "WARNING: No DHCP range start and/or limit set!"
|
||||
fi
|
||||
|
||||
# set interface
|
||||
#remove all eth interfaces
|
||||
ifaces=$(uci get network.mesh.ifname | sed 's/\beth[^ ]* *//g')
|
||||
ifaces=$(uci get network.client.ifname | sed 's/\beth[^ ]* *//g')
|
||||
if vlan=$(uci -q get gateway.@client[0].vlan); then
|
||||
uci set network.mesh.ifname="${SWITCHDEV}.$vlan $ifaces"
|
||||
uci set network.client.ifname="${SWITCHDEV}.$vlan $ifaces"
|
||||
elif iface=$(uci -q get gateway.@client[0].iface); then
|
||||
uci set network.mesh.ifname="$iface $ifaces"
|
||||
uci set network.client.ifname="$iface $ifaces"
|
||||
else
|
||||
echo "WARNING: No Interface for client specified"
|
||||
fi
|
||||
|
|
|
@ -66,15 +66,35 @@ revert_changes() {
|
|||
exit 0
|
||||
}
|
||||
|
||||
keep_changes() {
|
||||
if [ -f "/tmp/configure-layer3-pid" ]; then
|
||||
echo "Keep changes"
|
||||
kill -9 $(cat /tmp/configure-layer3-pid)
|
||||
rm /tmp/configure-layer3-pid
|
||||
# We need exit because trap in test_changes() will not stop
|
||||
# the script here and revert settings otherwise
|
||||
exit
|
||||
else
|
||||
echo "configure-layer3 -t is not running"
|
||||
fi
|
||||
}
|
||||
|
||||
test_changes() {
|
||||
echo $$ > /tmp/configure-layer3-pid
|
||||
trap keep_changes SIGINT SIGTERM
|
||||
|
||||
reload_services
|
||||
|
||||
sleep 5
|
||||
echo "Configuration reloaded. Changes will be reverted in 200s."
|
||||
echo "Kill this script to keep changes."
|
||||
sleep 200
|
||||
echo "Reverting changes.."
|
||||
|
||||
echo "Configuration reloaded. Changes will be reverted in 200s."
|
||||
echo "Kill this script or use configure-layer3 -k to keep changes."
|
||||
|
||||
sleep 200
|
||||
|
||||
echo "Reverting changes.."
|
||||
# on revert we must delete the pid-file
|
||||
rm /tmp/configure-layer3-pid
|
||||
revert_changes
|
||||
reload_services
|
||||
}
|
||||
|
@ -86,6 +106,7 @@ usage() {
|
|||
echo "Options:"
|
||||
echo " -c: configure. No commit, no restart!"
|
||||
echo " -t: test changes. Restarts services, waits up to 200s for SIGINT"
|
||||
echo " -k: keep changes from test mode"
|
||||
echo " -a: apply changes"
|
||||
echo " -r: revert changes"
|
||||
}
|
||||
|
@ -98,6 +119,7 @@ fi
|
|||
case "$1" in
|
||||
-c) configure ;;
|
||||
-t) test_changes ;;
|
||||
-k) keep_changes ;;
|
||||
-a) apply_changes ;;
|
||||
-r) revert_changes ;;
|
||||
*) usage; exit 1 ;;
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "This script removes all existing vlans and babelpeers and load a default vlan setup."
|
||||
read -r -p "Do you really want to continue? (y/n) " response
|
||||
|
||||
case $response in [!Yy]) exit 1 ;; esac
|
||||
|
||||
# load uci functions
|
||||
. /lib/functions.sh
|
||||
|
||||
# load board specific properties
|
||||
BOARD="$(uci get board.model.name)"
|
||||
. /etc/network.$BOARD
|
||||
|
||||
remove_vlan() {
|
||||
local name="$1"
|
||||
uci del gateway.$name
|
||||
}
|
||||
remove_babelpeer() {
|
||||
local name="$1"
|
||||
|
||||
# remove interface
|
||||
uci -q del gateway.$name
|
||||
}
|
||||
|
||||
ipaddr=$(uci get gateway.@client[0].ipaddr)
|
||||
ip6addr=$(uci get gateway.@client[0].ip6addr)
|
||||
dhcp_start=$(uci get gateway.@client[0].dhcp_start)
|
||||
essid=$(uci get gateway.@client[0].essid)
|
||||
chan2ghz=$(uci get gateway.@client[0].chan2ghz)
|
||||
chan5ghz=$(uci get gateway.@client[0].chan5ghz)
|
||||
|
||||
uci del gateway.@client[0]
|
||||
|
||||
config_load gateway
|
||||
config_foreach remove_vlan vlan
|
||||
|
||||
config_load gateway
|
||||
config_foreach remove_babelpeer babelpeer
|
||||
|
||||
uci batch <<EOF
|
||||
add gateway client
|
||||
set gateway.@client[0].vlan='1'
|
||||
set gateway.@client[0].ipaddr='$ipaddr'
|
||||
set gateway.@client[0].dhcp_start='$dhcp_start'
|
||||
set gateway.@client[0].essid='$essid'
|
||||
set gateway.@client[0].chan2ghz='$chan2ghz'
|
||||
set gateway.@client[0].chan5ghz='$chan5ghz'
|
||||
set gateway.1=vlan
|
||||
set gateway.1.comment='client'
|
||||
set gateway.1.ports='$CLIENT_PORTS'
|
||||
set gateway.2=vlan
|
||||
set gateway.2.comment='wan'
|
||||
set gateway.2.ports='$WAN_PORTS'
|
||||
set gateway.3=vlan
|
||||
set gateway.3.comment='babelpeer'
|
||||
set gateway.3.ports='$BATMAN_PORTS'
|
||||
set gateway.vlan3=babelpeer
|
||||
set gateway.vlan3.vlan='3'
|
||||
set gateway.vlan3.type='wired'
|
||||
set gateway.vlan3.rxcost='96'
|
||||
EOF
|
||||
|
||||
for ip in $ip6addr; do
|
||||
uci add_list gateway.@client[0].ip6addr=$ip
|
||||
done
|
||||
|
||||
uci commit gateway
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3
|
||||
PKG_RELEASE:=7
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-layer3
|
||||
|
||||
|
@ -16,9 +16,14 @@ define Package/fff-layer3
|
|||
+fff-babeld \
|
||||
+fff-boardname \
|
||||
+fff-dhcp \
|
||||
+fff-ipv4snat \
|
||||
+fff-layer3-config \
|
||||
+fff-mqtt-monitoring \
|
||||
+fff-network \
|
||||
+fff-ra \
|
||||
+fff-web-autol3 \
|
||||
+fff-web-mqtt \
|
||||
+fff-web-l3config \
|
||||
+fff-wireguard \
|
||||
+arptables \
|
||||
+bmon \
|
||||
|
@ -44,14 +49,6 @@ define Package/fff-layer3/description
|
|||
This package provides the packages and settings for the layer 3 firmware
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-macnock
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/FreifunkFranken/macnocker.git
|
||||
|
|
|
@ -11,7 +11,7 @@ validate_hood_section() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$(uci -q get system.@system[0].hood)" -o -n "$(uci -q get network.mesh.macaddr)" ]; then
|
||||
if [ -n "$(uci -q get system.@system[0].hood)" -o -n "$(uci -q get network.client.macaddr)" ]; then
|
||||
# true
|
||||
return 0
|
||||
fi
|
||||
|
@ -49,7 +49,7 @@ start_service() {
|
|||
local IFACE="$(uci -q get network.ethmesh.ifname)"
|
||||
local HOOD="$(uci -q get system.@system[0].hood)"
|
||||
if [ -z "$HOOD" ]; then
|
||||
HOOD="$(uci -q get network.mesh.macaddr)"
|
||||
HOOD="$(uci -q get network.client.macaddr)"
|
||||
fi
|
||||
|
||||
procd_open_instance macnock
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-mqtt-monitoring
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-mqtt-monitoring
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-mqtt-monitoring
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken mqtt configuration
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+alfred-json \
|
||||
+fff-mqtt \
|
||||
+micrond \
|
||||
+fff-alfred
|
||||
endef
|
||||
|
||||
define Package/fff-mqtt-monitoring/description
|
||||
This package send monitoring informations to
|
||||
the mqtt broker
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-mqtt-monitoring/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-mqtt-monitoring))
|
|
@ -0,0 +1 @@
|
|||
*/5 * * * * sleep $(/usr/bin/random 0 29); /usr/sbin/alfred-mqtt-proxy
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
MACADDR=$(cat /sys/class/net/br-client/address | /bin/sed 's/://g')
|
||||
|
||||
fetch_id="64"
|
||||
if [ -n "$(uci -q get fff.mqtt.server)" ] ; then
|
||||
mosquitto_pub -h "$(uci get fff.mqtt.server)" -p 1883 -t /monitoring/v1/$MACADDR -m "$(/bin/alfred-json -r "$fetch_id")"
|
||||
fi
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-mqtt
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-mqtt
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-mqtt
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken mqtt configuration
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-config \
|
||||
+libmosquitto-ssl \
|
||||
+mosquitto-client-ssl \
|
||||
+mosquitto-ssl
|
||||
endef
|
||||
|
||||
define Package/fff-mqtt/description
|
||||
This package provides mosquitto and settings
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-mqtt/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-mqtt))
|
|
@ -0,0 +1,3 @@
|
|||
uci set fff.mqtt=mqtt
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-network
|
||||
PKG_RELEASE:=25
|
||||
PKG_RELEASE:=26
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -19,14 +19,6 @@ define Package/$(PKG_NAME)/description
|
|||
This package configures the network interfaces
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -4,7 +4,7 @@ config interface 'loopback'
|
|||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'mesh'
|
||||
config interface 'client'
|
||||
option type 'bridge'
|
||||
option auto '1'
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
uci batch <<EOF
|
||||
add nodewatcher network
|
||||
set nodewatcher.@network[-1].mesh_interface='br-mesh'
|
||||
set nodewatcher.@network[-1].mesh_interface='br-client'
|
||||
set nodewatcher.@network[-1].iface_blacklist='lo ifb0'
|
||||
set nodewatcher.@network[-1].ip_whitelist='br-mesh'
|
||||
set nodewatcher.@network[-1].ip_whitelist='br-client'
|
||||
EOF
|
||||
uci commit nodewatcher
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
|
|||
uci set network.${SWITCHDEV}_3.vlan=3
|
||||
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
|
||||
|
||||
uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
|
||||
uci set network.client.ifname="$SWITCHDEV.1 bat0"
|
||||
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV.3"
|
||||
|
||||
|
@ -115,17 +115,17 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
|
|||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
if [ "$ETHMODE" = "WAN" ]; then
|
||||
uci set network.mesh.ifname="bat0"
|
||||
uci set network.client.ifname="bat0"
|
||||
uci set network.wan.ifname="$WANDEV"
|
||||
uci del network.ethmesh.ifname
|
||||
uci del network.eth0.macaddr
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
uci set network.client.ifname="bat0 $SWITCHDEV"
|
||||
uci set network.wan.ifname="eth2" #eth2 because it is default in config file
|
||||
uci del network.ethmesh.ifname
|
||||
uci del network.eth0.macaddr
|
||||
elif [ "$ETHMODE" = "BATMAN" ] ; then
|
||||
uci set network.mesh.ifname="bat0"
|
||||
uci set network.client.ifname="bat0"
|
||||
uci set network.wan.ifname="eth2" #eth2 because it is default in config file
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
ETH0MAC="w2ap"
|
||||
|
@ -154,19 +154,19 @@ if [ -n "$ETHMESHMAC" ]; then
|
|||
fi
|
||||
|
||||
if [ -n "$ROUTERMAC" ]; then
|
||||
if uci get network.mesh.macaddr
|
||||
if uci get network.client.macaddr
|
||||
then
|
||||
echo "MAC for mesh is set already"
|
||||
echo "MAC for client is set already"
|
||||
else
|
||||
echo "Fixing MAC on br-mesh (mesh)"
|
||||
echo "Fixing MAC on br-client"
|
||||
sleep 10
|
||||
|
||||
uci set network.mesh.macaddr=$ROUTERMAC
|
||||
uci set network.client.macaddr=$ROUTERMAC
|
||||
uci commit network
|
||||
|
||||
ifconfig br-mesh down
|
||||
ifconfig br-mesh hw ether $ROUTERMAC
|
||||
ifconfig br-mesh up
|
||||
ifconfig br-client down
|
||||
ifconfig br-client hw ether $ROUTERMAC
|
||||
ifconfig br-client up
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
fi
|
||||
|
@ -183,38 +183,38 @@ if [ -n "$ETH0MAC" ]; then
|
|||
/etc/init.d/network restart
|
||||
fi
|
||||
|
||||
if uci -q get "network.mesh.ip6addr" > /dev/null
|
||||
if uci -q get "network.client.ip6addr" > /dev/null
|
||||
then
|
||||
echo "IPv6 for mesh is set already"
|
||||
echo "IPv6 for client is set already"
|
||||
else
|
||||
echo "Setting IPv6 addresses"
|
||||
# Some time needed :(
|
||||
sleep 5
|
||||
|
||||
for ip in $(ip -6 addr show br-mesh | awk '/fdff/{ print $2 }'); do
|
||||
ip -6 addr del $ip dev br-mesh
|
||||
for ip in $(ip -6 addr show br-client | awk '/fdff/{ print $2 }'); do
|
||||
ip -6 addr del $ip dev br-client
|
||||
done
|
||||
|
||||
prefix="fdff:0::/64"
|
||||
# Set $prefix::MAC as IP
|
||||
addr="$(ipMacAssemble "$prefix" "$ROUTERMAC")"
|
||||
ip -6 addr add $addr dev br-mesh
|
||||
ip -6 addr add $addr dev br-client
|
||||
|
||||
uci -q del network.globals
|
||||
uci -q set network.globals=globals
|
||||
uci -q set network.globals.ula_prefix=$prefix
|
||||
uci -q add_list network.mesh.ip6addr=$addr
|
||||
uci -q set network.mesh.proto=static
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
uci -q set network.client.proto=static
|
||||
|
||||
# Set $prefix::1 as IP
|
||||
addr="$(ipAssemble "$prefix" "1")"
|
||||
ip -6 addr add $addr dev br-mesh
|
||||
uci -q add_list network.mesh.ip6addr=$addr
|
||||
ip -6 addr add $addr dev br-client
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
|
||||
# Set $prefix::link-local as IP
|
||||
addr="$(ipEUIAssemble "$prefix" "$ROUTERMAC")"
|
||||
ip -6 addr add $addr dev br-mesh
|
||||
uci -q add_list network.mesh.ip6addr=$addr
|
||||
ip -6 addr add $addr dev br-client
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
|
||||
uci -q commit network
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-node
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-node
|
||||
|
||||
|
@ -23,14 +23,6 @@ define Package/fff-node/description
|
|||
This package configures the node
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -3,14 +3,14 @@ ebtables -N IN_ONLY -P RETURN
|
|||
|
||||
# Daten aus dem BATMAN werden erlaubt
|
||||
# Alles ausser Daten von BATMAN werden DROP'ed
|
||||
ebtables -A IN_ONLY -i ! bat0 --logical-in br-mesh -j DROP
|
||||
ebtables -A IN_ONLY -i ! bat0 --logical-in br-client -j DROP
|
||||
|
||||
######## OUT_ONLY ############
|
||||
ebtables -N OUT_ONLY -P RETURN
|
||||
|
||||
# Daten ins BATMAN werden erlaubt
|
||||
# Alles ausser Daten ins BATMAN werden DROP'ed
|
||||
ebtables -A OUT_ONLY --logical-out br-mesh -o ! bat0 -j DROP
|
||||
ebtables -A OUT_ONLY --logical-out br-client -o ! bat0 -j DROP
|
||||
|
||||
######## MULTICAST_OUT ############
|
||||
ebtables -N MULTICAST_OUT -P DROP
|
||||
|
@ -19,16 +19,16 @@ ebtables -N MULTICAST_OUT -P DROP
|
|||
ebtables -P INPUT ACCEPT
|
||||
|
||||
# Regelt alles was an Multicast/Broadcast von CLIENT -> KNOTEN geht bei MULTICAST_OUT
|
||||
ebtables -A INPUT -d Multicast --logical-in br-mesh -i ! bat0 -j ACCEPT
|
||||
ebtables -A INPUT -d Multicast --logical-in br-client -i ! bat0 -j ACCEPT
|
||||
|
||||
######## FORWARD ############
|
||||
ebtables -P FORWARD ACCEPT
|
||||
|
||||
# Regelt alles was an Multicast/Broadcast von CLIENT -> BATMAN geht bei MULTICAST_OUT
|
||||
ebtables -A FORWARD -d Multicast --logical-out br-mesh -o bat0 -j MULTICAST_OUT
|
||||
ebtables -A FORWARD -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT
|
||||
|
||||
######## OUTPUT ############
|
||||
ebtables -P OUTPUT ACCEPT
|
||||
|
||||
# Regelt alles was an Multicast/Broadcast von KNOTEN -> BATMAN geht bei MULTICAST_OUT
|
||||
ebtables -A OUTPUT -d Multicast --logical-out br-mesh -o bat0 -j MULTICAST_OUT
|
||||
ebtables -A OUTPUT -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# No input from/to local node ip from batman
|
||||
ebtables -A INPUT --logical-in br-mesh -i bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
ebtables -A INPUT --logical-in br-mesh -i bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
ebtables -A INPUT --logical-in br-client -i bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
ebtables -A INPUT --logical-in br-client -i bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
|
||||
# Do not forward local node ip
|
||||
ebtables -A FORWARD --logical-out br-mesh -o bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
ebtables -A FORWARD --logical-out br-mesh -o bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
ebtables -A FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
ebtables -A FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
|
||||
# Do not output local node ip to batman
|
||||
ebtables -A OUTPUT --logical-out br-mesh -o bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
ebtables -A OUTPUT --logical-out br-mesh -o bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
ebtables -A OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination fdff::1/128 -j DROP
|
||||
ebtables -A OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source fdff::1/128 -j DROP
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-nodewatcher
|
||||
PKG_RELEASE:=59
|
||||
PKG_RELEASE:=60
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -22,14 +22,6 @@ define Package/$(PKG_NAME)/description
|
|||
netmon.freifunk-franken.de
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -14,7 +14,7 @@ debug "Collecting basic system status data"
|
|||
SYSTEM_DATA="<status>online</status>"
|
||||
|
||||
hostname="$(cat /proc/sys/kernel/hostname)"
|
||||
mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
|
||||
mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-client/address 2>/dev/null)
|
||||
[ "$hostname" = "OpenWrt" ] && hostname="$mac"
|
||||
[ "$hostname" = "FFF" ] && hostname="$mac"
|
||||
SYSTEM_DATA="$SYSTEM_DATA<hostname>$hostname</hostname>"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-ra
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-ra
|
||||
|
||||
|
@ -20,14 +20,6 @@ define Package/fff-ra/description
|
|||
It is used to configure odhcpd to send Router Advertisements for use as gateway.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
uci batch <<EOF
|
||||
set dhcp.mesh=dhcp
|
||||
set dhcp.mesh.interface='mesh'
|
||||
set dhcp.mesh.ra='server'
|
||||
set dhcp.mesh.ra_default='2'
|
||||
set dhcp.mesh.ra_management='0'
|
||||
set dhcp.client=dhcp
|
||||
set dhcp.client.interface='client'
|
||||
set dhcp.client.ra='server'
|
||||
set dhcp.client.ra_default='2'
|
||||
set dhcp.client.ra_management='0'
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -24,10 +24,6 @@ define Build/Prepare
|
|||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
CFLAGS="$(TARGET_CFLAGS)" CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
|
||||
endef
|
||||
|
|
|
@ -19,14 +19,6 @@ define Package/$(PKG_NAME)/description
|
|||
This meta-package configures simple-tc for FFF
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-support
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -21,14 +21,6 @@ define Package/$(PKG_NAME)/description
|
|||
not essential to the operation of the Firmware
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -93,7 +93,7 @@ echo ""
|
|||
echo "-> SYSTEM"
|
||||
echo "Name: ${HOSTNAME}"
|
||||
echo "Modell: $(cat /tmp/sysinfo/model 2>/dev/null)"
|
||||
echo "MAC-Adresse: $(cat /sys/class/net/br-mesh/address)"
|
||||
echo "MAC-Adresse: $(cat /sys/class/net/br-client/address)"
|
||||
echo "Bekannte Knoten: $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1))"
|
||||
echo "Nachbarknoten: $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)"
|
||||
echo "VPN via fastd: ${vpn_active}"
|
||||
|
@ -124,10 +124,10 @@ echo "Fastd Version: $(fastd --version 2> /dev/null | cut -d' ' -f 2)"
|
|||
echo ""
|
||||
echo "-> Netz: FREIFUNK"
|
||||
echo "Nutzer: $(batctl tl -H 2> /dev/null | grep -c 'W')"
|
||||
echo "Empfangen: $(cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null | human_bytes)"
|
||||
echo "Gesendet: $(cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null | human_bytes)"
|
||||
echo "IPv4 Adressen: $(addr 4 br-mesh)"
|
||||
echo "IPv6 Adressen: $(addr 6 br-mesh)"
|
||||
echo "Empfangen: $(cat /sys/class/net/br-client/statistics/rx_bytes 2> /dev/null | human_bytes)"
|
||||
echo "Gesendet: $(cat /sys/class/net/br-client/statistics/tx_bytes 2> /dev/null | human_bytes)"
|
||||
echo "IPv4 Adressen: $(addr 4 br-client)"
|
||||
echo "IPv6 Adressen: $(addr 6 br-client)"
|
||||
|
||||
echo ""
|
||||
if [ -d /etc/fastd/fff/peers ]; then
|
||||
|
|
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
This packages provides an semi automated sysupgrade script.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -19,14 +19,6 @@ define Package/$(PKG_NAME)/description
|
|||
This packages configures the timeserver on the device.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-uradvd
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
It is used to configure and start the uradvd daemon.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -16,5 +16,5 @@ service_triggers()
|
|||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$URADVD_BIN" -i br-mesh -p $(uci get network.globals.ula_prefix)
|
||||
procd_set_param command "$URADVD_BIN" -i br-client -p $(uci get network.globals.ula_prefix)
|
||||
}
|
||||
|
|
|
@ -20,14 +20,6 @@ define Package/$(PKG_NAME)/description
|
|||
(currently only via fastd)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-autol3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-web-autol3
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-web-autol3
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 autol3 webui
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-autol3 \
|
||||
+fff-web-ui
|
||||
|
||||
endef
|
||||
|
||||
define Package/fff-web-autol3/description
|
||||
Webui for autol3
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-web-autol3/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-web-autol3))
|
|
@ -0,0 +1 @@
|
|||
autol3,Automatische Layer 3 Einstellungen
|
|
@ -0,0 +1,128 @@
|
|||
#!/usr/bin/haserl
|
||||
|
||||
<%in /www/include/header %>
|
||||
<%in /www/include/helpers %>
|
||||
<% show_msg %>
|
||||
|
||||
<%
|
||||
|
||||
if [ -n "${POST_save}" ] ; then
|
||||
if [ -n "${POST_autol3v4}" ] ; then
|
||||
uci set fff.autol3.ipv4=1
|
||||
else
|
||||
uci del fff.autol3.ipv4
|
||||
fi
|
||||
if [ -n "${POST_autol3v6}" ] ; then
|
||||
uci set fff.autol3.ipv6=1
|
||||
else
|
||||
uci del fff.autol3.ipv6
|
||||
fi
|
||||
uci commit fff
|
||||
fi
|
||||
if [ $(uci -q get fff.autol3.ipv6) ] ; then
|
||||
autol3v6="checked"
|
||||
fi
|
||||
if [ $(uci -q get fff.autol3.ipv4) ] ; then
|
||||
autol3v4="checked"
|
||||
fi
|
||||
ASSIGNER6OWN=$(uci -q get fff.autol3.ipv6assigner)
|
||||
IP6OWN=$(uci -q get fff.autol3.ipv6address)
|
||||
ASSIGNER4OWN=$(uci -q get fff.autol3.ipv4assigner)
|
||||
IP4OWN=$(uci -q get fff.autol3.ipv4address)
|
||||
|
||||
if [ -n "${POST_blockv6}" ] ; then
|
||||
uci add_list fff.autol3.ipv6assignerblock=$ASSIGNER6OWN
|
||||
uci commit fff
|
||||
fi
|
||||
if [ -n "${POST_blockv4}" ] ; then
|
||||
uci add_list fff.autol3.ipv4assignerblock=$ASSIGNER6OWN
|
||||
uci commit fff
|
||||
fi
|
||||
|
||||
if [ -n "${POST_reloadv4}" ] ; then
|
||||
uci del fff.autol3.ipv4address
|
||||
uci del fff.autol3.ipv4assigner
|
||||
uci commit fff
|
||||
autov4
|
||||
fi
|
||||
if [ -n "${POST_reloadv6}" ] ; then
|
||||
uci del fff.autol3.ipv6address
|
||||
uci del fff.autol3.ipv6assigner
|
||||
uci commit fff
|
||||
autov6
|
||||
fi
|
||||
|
||||
if [ -n "${POST_removev6block}" ] ; then
|
||||
uci del_list fff.autol3.ipv6assignerblock=${POST_blockv6}
|
||||
uci commit fff
|
||||
fi
|
||||
if [ -n "${POST_removev4block}" ] ; then
|
||||
uci del_list fff.autol3.ipv4assignerblock=${POST_blockv4}
|
||||
uci commit fff
|
||||
fi
|
||||
%>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>AutoL3</legend>
|
||||
<table>
|
||||
<tr><th>IPv4 Adresse automatisch beziehen:</th><td><input type="checkbox" id="autol3v4" name="autol3v4" <%= $autol3v4 %>></td><td>Wenn du diesen Haken setzt, wird automatisch eine IPv4 Adresse bezogen und NAT aktiviert</td></tr>
|
||||
<tr><th>IPv6 Adresse automatisch beziehen:</th><td><input type="checkbox" id="autol3v6" name="autol3v6" <%= $autol3v6 %>></td><td>bla</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="submit" value="speichern" name="save" style="margin-top: 5px; margin-left: 3px;" />
|
||||
</form>
|
||||
<form method="post">
|
||||
<table>
|
||||
<tr><td>
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>IPv6 Konfiguration</legend>
|
||||
<table>
|
||||
<tr><th>Assigner:</th><td><td><%= $ASSIGNER6OWN %></td></tr>
|
||||
<tr><th>IP-Adresse:</th><td></td><td><%= $IP6OWN %></td></tr>
|
||||
</table>
|
||||
<input type="submit" value="Konfiguration neu laden" name="reloadv6" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<input type="submit" value="Aktuellen Assigner sperren" name="blockv6" style="margin-top: 5px; margin-left: 3px;" />
|
||||
</fieldset>
|
||||
</td><td>
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>IPv4 Konfiguration</legend>
|
||||
<table>
|
||||
<tr><th>Assigner:</th><td><td><%= $ASSIGNER4OWN %></td></tr>
|
||||
<tr><th>IP-Adresse:</th><td></td><td><%= $IP4OWN %></td></tr>
|
||||
</table>
|
||||
<input type="submit" value="Konfiguration neu laden" name="reloadv4" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<input type="submit" value="Aktuellen Assigner sperren" name="blockv4" style="margin-top: 5px; margin-left: 3px;" />
|
||||
</fieldset>
|
||||
</td></tr>
|
||||
</form>
|
||||
<form method="post">
|
||||
<tr><td>
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>IPv6 Blockliste</legend>
|
||||
<table>
|
||||
<%
|
||||
ipv6assignerblock=$(uci get fff.autol3.ipv6assignerblock)
|
||||
for ipv6assignerblock in $ipv6assignerblock; do
|
||||
echo "<tr><td>"$ipv6assignerblock":</td><td><input type=\"hidden\" name=\"blockv6\" value=\"$ipv6assignerblock\" /><input type=\"submit\" value=\"entfernen\" name=\"removev6block\" style=\"margin-top: 5px; margin-left: 3px;\" /></td></tr>"
|
||||
done
|
||||
%>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td><td>
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>IPv4 Blockliste</legend>
|
||||
<table>
|
||||
<%
|
||||
ipv4assignerblock=$(uci get fff.autol3.ipv4assignerblock)
|
||||
for ipv4assignerblock in $ipv4assignerblock; do
|
||||
echo "<tr><td>"$ipv4assignerblock":</td><td><input type=\"hidden\" name=\"blockv4\" value=\"$ipv4assignerblock\" /><input type=\"submit\" value=\"entfernen\" name=\"removev4block\" style=\"margin-top: 5px; margin-left: 3px;\" /></td></tr>"
|
||||
done
|
||||
%>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<%in /www/include/footer %>
|
|
@ -0,0 +1,32 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-hood
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-web-hood
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken web server for hood file
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:=+uhttpd
|
||||
endef
|
||||
|
||||
define Package/fff-web-hood/description
|
||||
This is a tiny web server to serve the hoodfile for
|
||||
other nodes
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-web-hood/install
|
||||
$(INSTALL_DIR) $(1)/www/hood
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-web-hood))
|
|
@ -0,0 +1,15 @@
|
|||
uci -q delete uhttpd.main
|
||||
|
||||
uci batch <<EOF
|
||||
set uhttpd.hood=uhttpd
|
||||
add_list uhttpd.hood.listen_http='2342'
|
||||
set uhttpd.hood.home='/www/hood'
|
||||
set uhttpd.hood.rfc1918_filter='1'
|
||||
set uhttpd.hood.network_timeout='30'
|
||||
set uhttpd.hood.tcp_keepalive='1'
|
||||
set uhttpd.hood.config='_'
|
||||
EOF
|
||||
|
||||
uci commit uhttpd
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,30 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-l3config
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-web-l3config
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 config webui
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-layer3-config \
|
||||
+fff-web-ui
|
||||
endef
|
||||
|
||||
define Package/fff-web-l3config/description
|
||||
Configure a layer3 router via a web UI
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-web-l3config/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-web-l3config))
|
|
@ -0,0 +1 @@
|
|||
l3settings,Layer 3
|
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/haserl
|
||||
|
||||
<%in /www/include/header %>
|
||||
<%in /www/include/helpers %>
|
||||
<% show_msg %>
|
||||
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>Status</legend>
|
||||
<table><tr><td>
|
||||
<textarea name="status" rows="7" cols="100" readonly>
|
||||
<%
|
||||
# write
|
||||
if [ "$REQUEST_METHOD" = "POST" ] && [ -n "${POST_writeconfig}" ] ; then
|
||||
echo "${POST_l3config}" > /etc/config/gateway
|
||||
echo "Konfiguration wurde gespeichert. Bitte nun Konfiguration schreiben"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_loadconfig}" ] ; then
|
||||
yes | configure-layer3 -c
|
||||
fi
|
||||
|
||||
if [ -n "${POST_testconfig}" ] ; then
|
||||
configure-layer3 -t &
|
||||
# we need a sleep, because configure-layer3 -t need some time
|
||||
sleep 1;
|
||||
echo "Konfigurationstest läuft, bitte innerhalb von 200 Sekunden abbrechen ansonsten wird die Konfiguration zurück gesetzt"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_testconfigcancel}" ] ; then
|
||||
configure-layer3 -k 1>&2
|
||||
echo "Testmodus abgebrochen, Konfiguration bleibt gespeichert. Zum endgültigen Übernehmen auf 'Konfiguration Übernehmen' klicken"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_applyconfig}" ] ; then
|
||||
configure-layer3 -a
|
||||
echo "Konfiguration wurde komplett gespeichert und ist nun rebootfest"
|
||||
fi
|
||||
|
||||
if [ -f /tmp/configure-layer3-pid ] ; then
|
||||
echo "Testmodus aktiv"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_loadvlandefault}" ] ; then
|
||||
yes | loadvlandefault 1>&2
|
||||
echo "VLAN Defaults wurden geladen"
|
||||
fi
|
||||
%>
|
||||
</textarea>
|
||||
<p>
|
||||
<form method="post"><input type="submit" name="loadconfig" value="Router konfigurieren" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<%
|
||||
if [ -f /tmp/configure-layer3-pid ] ; then
|
||||
echo "<input type=\"submit\" name=\"testconfigcancel\" value=\"Test beenden\" style=\"margin-top: 5px; margin-left: 3px;\" />"
|
||||
else
|
||||
echo "<input type=\"submit\" name=\"testconfig\" value=\"Konfiguration testen\" style=\"margin-top: 5px; margin-left: 3px;\" />"
|
||||
fi
|
||||
%>
|
||||
<input type="submit" name="applyconfig" value="Konfiguration übernehmen" style="margin-top: 5px; margin-left: 3px;" /></form>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
* Erstelle zuerst unten eine Konfiguration und speichere diese ab</br>
|
||||
* Klicke danach auf 'Router konfigurieren' um diese Konfiguration in die Routereinstellungen zu schreiben</br>
|
||||
* Danach kannst du mit Konfiguration testen, die Konfiguration testen. Sollte alles funktionieren musst du diesen Test mit Test beenden beenden ansonsten werden nach 200 Sekunden die Einstellungen zurüruck gesetzt. Sollte die Konfiguration fehlerhaft sein, warte einfach 200 Sekunden und du kommst auf den alten Weg wieder auf das Gerät. Ein manueller Neustart setzt auch die komplette Konfiguriation züruck</br>
|
||||
* Wenn die Einstellungen funktionieren klicke auf Konfiguration übernehmen, erst dann ist die Konfiguration auch rebootfest.</br>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<%
|
||||
# read
|
||||
l3config=$(cat /etc/config/gateway)
|
||||
%>
|
||||
|
||||
<form method="post">
|
||||
<table style="width: 100%;">
|
||||
<tr><td>
|
||||
<fieldset style="min-height: 13em;">
|
||||
<legend>Konfigurationsdatei</legend>
|
||||
<textarea name="l3config" rows="25" cols="100"><% echo "$l3config" %></textarea>
|
||||
</fieldset>
|
||||
<p><input type="submit" name="writeconfig" value="Konfigurationdatei speichern" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<input type="submit" onclick="return confirm('Achtung: Es werden alle VLAN Einstellungen zurück gesetzt und die Standarteinstellungen gelanden. Willst du dies wirklich?')" name="loadvlandefault" value="VLAN default laden" style="margin-top: 5px; margin-left: 3px;" /></p>
|
||||
</td><td>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
<%in /www/include/footer %>
|
|
@ -0,0 +1,32 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-mqtt
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-web-mqtt
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken mqtt config webui
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-mqtt \
|
||||
+fff-web-ui
|
||||
endef
|
||||
|
||||
define Package/fff-web-mqtt/description
|
||||
Configure mqtt via a web UI
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-web-mqtt/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-web-mqtt))
|
|
@ -0,0 +1 @@
|
|||
mqtt,MQTT-Einstellungen
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/haserl
|
||||
|
||||
<%in /www/include/header %>
|
||||
<%in /www/include/helpers %>
|
||||
<% show_msg %>
|
||||
|
||||
<%
|
||||
# write
|
||||
if [ "$REQUEST_METHOD" = "POST" ] ; then
|
||||
uci -q set "fff.mqtt.server=${POST_server}"
|
||||
uci commit fff
|
||||
fi
|
||||
%>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>MQTT</legend>
|
||||
<table>
|
||||
<tr><th>Server:</th><td><input type="text" name="server" value="<%= $(uci -q get fff.mqtt.server) %>" /></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
|
||||
</form>
|
||||
|
||||
<%in /www/include/footer %>
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web
|
||||
PKG_RELEASE:=13
|
||||
PKG_NAME:=fff-web-ui
|
||||
PKG_RELEASE:=16
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -18,15 +18,7 @@ define Package/$(PKG_NAME)
|
|||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This is the Webinterface for the Freifunk Franken Firmware
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
echo "all: " > $(PKG_BUILD_DIR)/Makefile
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# nothing
|
||||
This is the web-based user interface for the Freifunk Franken Firmware
|
||||
endef
|
||||
|
||||
define Build/Compile
|
|
@ -1,5 +1,6 @@
|
|||
uci -q delete uhttpd.main
|
||||
|
||||
uci batch <<EOF
|
||||
delete uhttpd.main
|
||||
delete uhttpd.public
|
||||
delete uhttpd.ssl
|
||||
delete uhttpd.px5g
|
||||
|
@ -29,14 +30,6 @@ uci batch <<EOF
|
|||
set uhttpd.px5g.days='1400'
|
||||
set uhttpd.px5g.bits='2048'
|
||||
set uhttpd.px5g.commonname='OpenWrt'
|
||||
|
||||
set uhttpd.hood=uhttpd
|
||||
add_list uhttpd.hood.listen_http='2342'
|
||||
set uhttpd.hood.home='/www/hood'
|
||||
set uhttpd.hood.rfc1918_filter='1'
|
||||
set uhttpd.hood.network_timeout='30'
|
||||
set uhttpd.hood.tcp_keepalive='1'
|
||||
set uhttpd.hood.config='_'
|
||||
EOF
|
||||
|
||||
uci commit uhttpd
|
|
@ -5,7 +5,7 @@ echo -en "Content-Type: text/html\r\n\r\n"
|
|||
HOSTNAME="$(uci -q get "fff.system.hostname")"
|
||||
hood="$(uci -q get "system.@system[0].hood")"
|
||||
|
||||
MAC="$(uci -q get network.mesh.macaddr)"
|
||||
MAC="$(uci -q get network.client.macaddr)"
|
||||
lat="$(uci -q get "fff.system.latitude")"
|
||||
lon="$(uci -q get "fff.system.longitude")"
|
||||
contact="$(uci -q get "fff.system.contact")"
|
|
@ -58,7 +58,7 @@ fi
|
|||
<table>
|
||||
<tr><th>Name:</th><td><%= ${HOSTNAME} %></td></tr>
|
||||
<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
|
||||
<tr><th>MAC-Adresse:</th><td><%= $(cat /sys/class/net/br-mesh/address) %></td></tr>
|
||||
<tr><th>MAC-Adresse:</th><td><%= $(cat /sys/class/net/br-client/address) %></td></tr>
|
||||
<tr><th>Bekannte Knoten:</th><td><%= $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1)) %></td></tr>
|
||||
<tr><th>Nachbarknoten:</th><td><%= $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null) %></td></tr>
|
||||
<tr><th>VPN via fastd:</th><td><%= ${vpn_active} %></td></tr>
|
||||
|
@ -72,10 +72,10 @@ fi
|
|||
<legend>Netz: Freifunk</legend>
|
||||
<table>
|
||||
<tr><th>Nutzer:</th><td><% batctl tl -H 2> /dev/null | grep -c 'W' %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>IPv4 Adressen:</th><td><% addr 4 br-mesh %></td></tr>
|
||||
<tr><th>IPv6 Adressen:</th><td><% addr 6 br-mesh %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/br-client/statistics/rx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/br-client/statistics/tx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>IPv4 Adressen:</th><td><% addr 4 br-client %></td></tr>
|
||||
<tr><th>IPv6 Adressen:</th><td><% addr 6 br-client %></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td><td>
|
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 846 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue