diff options
Diffstat (limited to 'files/common/etc')
-rw-r--r-- | files/common/etc/config/uhttpd | 6 | ||||
-rw-r--r-- | files/common/etc/fsm/inetable/common_queen.sh | 1 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/queen.enter | 14 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/queen.leave | 7 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/robinson.enter | 6 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/robinson.leave | 7 |
6 files changed, 34 insertions, 7 deletions
diff --git a/files/common/etc/config/uhttpd b/files/common/etc/config/uhttpd index 857a7c1..d1e2eb0 100644 --- a/files/common/etc/config/uhttpd +++ b/files/common/etc/config/uhttpd @@ -37,12 +37,12 @@ config disabled service # redirection instance config disabled redirection option home /www/redirection - option error_page /cgi-bin/redirect - option index_page cgi-bin/redirect + option error_page /redirect + option index_page redirect + option cgi_prefix / # default options option rfc1918_filter 1 - option cgi_prefix /cgi-bin option script_timeout 10 option network_timeout 30 option tcp_keepalive 10 diff --git a/files/common/etc/fsm/inetable/common_queen.sh b/files/common/etc/fsm/inetable/common_queen.sh index 8107cd2..86b3aba 100644 --- a/files/common/etc/fsm/inetable/common_queen.sh +++ b/files/common/etc/fsm/inetable/common_queen.sh @@ -7,6 +7,7 @@ DHCPLeaseTime=$((12 * 3600)) NodeId="$(cat /etc/nodeid)" oct3=$(ifconfig br-mesh | egrep -o 'inet addr:[0-9.]*'|cut -f3 -d.) [ -n "$oct3" ] +gwip=10.17.$oct3.1 we_own_our_ip () { [ "$(p2ptbl get $gwiptbl $oct3 | cut -sf2)" == "$NodeId" ] diff --git a/files/common/etc/fsm/inetable/trans/queen.enter b/files/common/etc/fsm/inetable/trans/queen.enter index fe0799e..c8ec801 100755 --- a/files/common/etc/fsm/inetable/trans/queen.enter +++ b/files/common/etc/fsm/inetable/trans/queen.enter @@ -25,13 +25,14 @@ if [ -z "$oct3" ]; then # TODO: log warning about IPv4 addr space exhaustion fi [ -n "$oct3" ] +gwip=10.17.$oct3.1 p2ptbl update $gwiptbl $oct3 "queen\t$NodeId" br-mesh # activate gw mode batctl gw server # set up gw IP -mesh_add_ipv4 10.17.$oct3.1 255.255.0.0 +mesh_add_ipv4 $gwip 255.255.0.0 # TODO: load splash status @@ -42,7 +43,12 @@ set dhcp.mesh.start=2 set dhcp.mesh.limit=254 set dhcp.mesh.leasetime=$DHCPLeaseTime set dhcp.mesh.interface=mesh -set dhcp.mesh.start_ip=10.17.$oct3.2 -set dhcp.mesh.end_ip=10.17.$oct3.254 " | uci batch -/etc/init.d/dnsmasq restart
\ No newline at end of file +/etc/init.d/dnsmasq restart + +# 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 +/etc/init.d/uhttpd restart diff --git a/files/common/etc/fsm/inetable/trans/queen.leave b/files/common/etc/fsm/inetable/trans/queen.leave index 502e972..306c2f8 100755 --- a/files/common/etc/fsm/inetable/trans/queen.leave +++ b/files/common/etc/fsm/inetable/trans/queen.leave @@ -18,3 +18,10 @@ uci delete dhcp.mesh /etc/init.d/dnsmasq restart # TODO remove splash iptable + +# stop redirection httpd, remove GW IP from the addrs service httpd +# listens on +disable_httpd redirection +rm /tmp/redirection_target +change_service_httpd_listen +/etc/init.d/uhttpd restart diff --git a/files/common/etc/fsm/inetable/trans/robinson.enter b/files/common/etc/fsm/inetable/trans/robinson.enter index 163f155..e54c6ba 100755 --- a/files/common/etc/fsm/inetable/trans/robinson.enter +++ b/files/common/etc/fsm/inetable/trans/robinson.enter @@ -28,4 +28,10 @@ batctl gw off # TODO: start fake dns +# start redirection httpd, add robinson IP to service httpd +echo "http://$randnet.1/robinson.html" > /tmp/redirection_target +enable_httpd redirection $randnet.1:81 +change_service_httpd_listen $randnet.1:80 +/etc/init.d/uhttpd restart + # TODO: redirect all inet traffic to local httpd diff --git a/files/common/etc/fsm/inetable/trans/robinson.leave b/files/common/etc/fsm/inetable/trans/robinson.leave index cdc5461..1797e2f 100755 --- a/files/common/etc/fsm/inetable/trans/robinson.leave +++ b/files/common/etc/fsm/inetable/trans/robinson.leave @@ -9,4 +9,11 @@ uci delete dhcp.mesh # TODO: stop fake dns +# stop redirection httpd, remove robinson IP from service httpd +disable_httpd redirection +rm /tmp/redirection_target +change_service_httpd_listen +/etc/init.d/uhttpd restart + + # TODO: stop redirecting all inet traffic to local httpd |