summaryrefslogtreecommitdiff
path: root/files/common/etc
diff options
context:
space:
mode:
Diffstat (limited to 'files/common/etc')
-rw-r--r--files/common/etc/crontabs/root1
-rwxr-xr-xfiles/common/etc/fsm/inetable/trans/queen.enter19
-rwxr-xr-xfiles/common/etc/fsm/inetable/trans/queen.leave3
3 files changed, 18 insertions, 5 deletions
diff --git a/files/common/etc/crontabs/root b/files/common/etc/crontabs/root
index 3892b07..178f6e3 100644
--- a/files/common/etc/crontabs/root
+++ b/files/common/etc/crontabs/root
@@ -2,3 +2,4 @@
* * * * * /sbin/p2ptbl gossip /tmp/p2ptbl/update 500 br-mesh
* * * * * /sbin/fsm watch inetable
* * * * * /sbin/fsm watch update
+* * * * * /sbin/splash_sync
diff --git a/files/common/etc/fsm/inetable/trans/queen.enter b/files/common/etc/fsm/inetable/trans/queen.enter
index c8ec801..5d266a0 100755
--- a/files/common/etc/fsm/inetable/trans/queen.enter
+++ b/files/common/etc/fsm/inetable/trans/queen.enter
@@ -4,6 +4,7 @@
gwiptbl=/tmp/p2ptbl/gwip
NodeId="$(cat /etc/nodeid)"
+## setup gateway IPv4
# determine gw IP from p2ptable
getoct () {
p2ptbl show $gwiptbl \
@@ -34,9 +35,7 @@ batctl gw server
# set up gw IP
mesh_add_ipv4 $gwip 255.255.0.0
-# TODO: load splash status
-
-# setup DHCP
+## setup DHCP
echo "
set dhcp.mesh=dhcp
set dhcp.mesh.start=2
@@ -46,9 +45,19 @@ set dhcp.mesh.interface=mesh
" | uci batch
/etc/init.d/dnsmasq restart
+## set splash
# start redirection httpd (for splash), add GW IP to the addrs service
# httpd listens on
echo "http://$gwip/cgi-bin/splash? /sbin/urlencode" > /tmp/redirection_target
-enable_httpd redirection $randnet.1:81
-change_service_httpd_listen $gwip:80
+enable_httpd redirection $gwip:81
+change_service_httpd_listen $gwip:80
/etc/init.d/uhttpd restart
+
+# fill splash table
+splash_sync "$1"
+
+# redirect tcp to local httpd, dns to local ns
+iptables -t nat -F prerouting_inet_unsplashed
+iptables -t nat -A prerouting_inet_unsplashed -p tcp -j DNAT --to $gwip:81
+iptables -t nat -A prerouting_inet_unsplashed -p udp --dport 53 -j DNAT --to $gwip:53
+# TODO: discard any other UDP traffic
diff --git a/files/common/etc/fsm/inetable/trans/queen.leave b/files/common/etc/fsm/inetable/trans/queen.leave
index 306c2f8..3f10d3c 100755
--- a/files/common/etc/fsm/inetable/trans/queen.leave
+++ b/files/common/etc/fsm/inetable/trans/queen.leave
@@ -18,6 +18,9 @@ uci delete dhcp.mesh
/etc/init.d/dnsmasq restart
# TODO remove splash iptable
+for mode in splashed unsplashed; do
+ iptables -t nat -F prerouting_inet_$mode
+done
# stop redirection httpd, remove GW IP from the addrs service httpd
# listens on
contact: Jan Huwald // Impressum