doc/gateway-server/WifiDogAndOlsr

Version 1 (modified by Prospere, 14 years ago)

--

The problem :

If you chose to install only one Wifidog gateway server, all the clients MAC addresses will be masqued by the nearest OLSR router.

The solution :

Install Wifidog on all the OLSR nodes. Allow HTTP flow between OLSR nodes with a script launched by cron.

  ipkg install ip
#!/bin/sh
#
# Script to bypass HTTP interception for traffic forwarded by OLSR
# bms 9-Aug-2005
# Licensed under GPL
#

rm -f /tmp/get_neighbors.awk
cat > /tmp/get_neighbors.awk <<__HERE1__
BEGIN {
  while("ip route"|getline) {
      if (\$6 == "metric") {
        if (\$7 > 0) {
          printf "%s\n", \$1;
        }
    }
  }
}
__HERE1__


iptables -t nat -D WiFiDog_Unknown -j OlsrNeighbors 2>&1 >/dev/null
iptables -t nat -F OlsrNeighbors 2>&1 >/dev/null
iptables -t nat -X OlsrNeighbors 2>&1 >/dev/null
iptables -t nat -N OlsrNeighbors

neighbors=$(awk -f /tmp/get_neighbors.awk)

for _neighbor in ${neighbors} ; do

   _mac=$(grep "^${_neighbor}" /proc/net/arp | awk '{print $4}')
   echo ${_mac}
   iptables -t nat -A OlsrNeighbors -m mac --mac-source ${_mac} \
          -p tcp --dport 80 -j ACCEPT
          
done

iptables -t nat -I WiFiDog_Unknown -j OlsrNeighbors

I modify the original script from Bruce Simpson. I replace the orginal "route -n" with an "ip route". Thanks to the author !! And London Wireless !

Attachments