summaryrefslogtreecommitdiff
path: root/files/common/etc/fsm/inetable/trans/robinson.enter
blob: e54c6ba7882bed37ce0d0acf8058224d368e24d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh -e
. ../common.sh

# setup random ip
gen_randnet () {
    randnet=21.$(($RANDOM % 256)).$(($RANDOM % 256))
}

gen_randnet
while ! arping -I br-mesh -D -c 5 -q $randnet.1; do
    gen_randnet
done

mesh_add_ipv4 $randnet.1 255.0.0.0

# setup dhcp
echo "
set dhcp.mesh=dhcp
set dhcp.mesh.start=2
set dhcp.mesh.limit=254
set dhcp.mesh.leasetime=60
set dhcp.mesh.interface=mesh
" | uci batch
/etc/init.d/dnsmasq restart

# disable batman-adv-mangling with DHCP packets
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
contact: Jan Huwald // Impressum