doc/gateway-server/WifiDogAndOlsr

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 the following script launched by cron on all the nodes.

  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("route -n"|getline) {
    if (/^[0-9]/) {
        if (0 < \$5) {
           if (\$3 == "255.255.255.255 <http://255.255.255.255>") {
             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

The original script from Bruce Simpson with minor modifications from Wifidog Thanks to the author !! And London Wireless !

Attachments