Mesh Debug: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
The wireless mesh interface contains functionality that makes it possible to debug school servers, even if there are a number of school servers in close proximity. This functionality is the ability to populate a blinding table with MAC addresses of mesh nodes with which the interface is either prohibited from or limited to exchanging packets.
The wireless mesh interface contains functionality that makes it possible to force mesh topologies for testing. Among other purposes, this is useful for testing school servers when there are a number of school servers in close proximity. This functionality is the ability to populate a blinding table with MAC addresses of mesh nodes with which the interface is either prohibited from or limited to exchanging packets.


=Changes to the Server=
=Changes to the Server=


You will need to know the MAC addresses of the mesh interfaces on any laptops you wish to whitelist. In the examples below, we use 00:17:c4:05:25:60 as the XO MAC address.
You will need to know the MAC addresses of the mesh interfaces on any laptops you wish to blind (or inverse blind). In the examples below, we use 00:17:c4:05:25:60 as the XO MAC address.


We recommend placing the whitelist information in the <tt>/etc/init.d/olpc-mesh-config</tt> startup script. In this way, the whitelist will survive reboots of the server.
We recommend placing the blinding information in the <tt>/etc/init.d/olpc-mesh-config</tt> startup script. In this way, your changes will survive reboots of the server.


Add the following lines to the start() function, right after the <tt>RETVAL=$?</tt> line:
Add the following lines to the start() function, right after the <tt>RETVAL=$?</tt> line:
Line 34: Line 34:
=Changes to the Laptop=
=Changes to the Laptop=


The changes to the laptop are similar. Place the following script into a new file called <tt>/etc/init.d/blinding</tt>:
The changes to the laptop are similar. Place the following script into a new file called <tt>/etc/init.d/blinding</tt> (also available at [http://xs-dev.laptop.org/wad/blinding http://xs-dev.laptop.org/wad/blinding]):


#!/bin/sh
#!/bin/sh
# chkconfig: 5 35 65
# whitelist
# description: Sets up a mesh blinding table
# This script, if run early in a laptop's boot process, will
#
# ensure that the laptop only talks to the mesh interfaces
# blinding
# listed here.
# This script, if run early in a laptop's boot process, will
# ensure that the laptop only talks to the mesh interfaces
# listed here.
IWPRIV=/sbin/iwpriv
IWPRIV=/sbin/iwpriv
MSH_IF=msh0
MSH_IF=msh0
case "$1" in
# Clear any pre-existing white or black list
start)
$IWPRIV $MSH_IF bt_reset
# Clear any blinding parameters
$IWPRIV $MSH_IF bt_reset
# Make sure that an inverse blinding table is being created
$IWPRIV $MSH_IF bt_set_invert 1
# Now add the interfaces we allow communication with:
$IWPRIV $MSH_IF bt_add 00:50:43:28:0b:6f
RETVAL=$?
# Make sure that a white list is being created
;;
$IWPRIV $MSH_IF bt_set_invert 1
stop)
# Clear any blinding parameters
# Now add the interface we allow communication with:
$IWPRIV $MSH_IF bt_reset
# 00:50:43:28:01:f2 is Active Antenna S/N 0037
RETVAL=$?
$IWPRIV $MSH_IF bt_add 00:50:43:28:01:f2
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL


Make this script executable and create a link to it in the appropriate directories:
And make this script executable:
chmod a+x /etc/init.d/blinding
chmod a+x /etc/init.d/blinding
ln -s /etc/init.d/blinding /etc/rc5.d/S35blinding


To temporarily enable the blinding (until the next reboot), type:
Now this laptop will only talk to the indicated school server (actually, the indicated Active Antenna) until it is updated. Please label the laptop accordingly!
service blinding start

To permanently enable the blinding (until the next update), type:
chkconfig --level 5 blinding on
service blinding start

Now this laptop will only talk to the indicated school server (actually, the indicated Active Antenna) until it is updated. <b>Please label the laptop accordingly!</b>

To temporarily disable the blindings, type:
service blinding stop
This doesn't actually seem to work right now! We recommend power cycling the laptop to ensure that the blinding table is cleared, otherwise things might not be as they appear.

To permanently disable the blindings, type:
chkconfig blinding off


=Blinding Table Commands=
=Blinding Table Commands=
Line 81: Line 111:
==bt_set_invert==
==bt_set_invert==


The default mode of the blinding table is to "blacklist". This means that mesh nodes listed in the blinding table will be ignored by the interface. This mode can be inverted, and the blinding table used to list the only mesh nodes which the interface is allowed to talk to.
The default mode of the blinding table is to ignore the mesh nodes listed in the blinding table. This mode can be inverted, and the blinding table used to list the only mesh nodes which the interface is allowed to talk to.


This command controls whether the mode is "blacklisting" or "whitelisting". If the invert bit is set to zero, the blinding table will be used for blacklisting:
This command controls whether the mode is normal or inverted. If the invert bit is set to zero, the blinding table will be used for 'blacklisting':
iwpriv msh0 bt_set_invert 0
iwpriv msh0 bt_set_invert 0
If the invert bit is set to 1, the blinding table will be used for whitelisting:
If the invert bit is set to 1, the blinding table will be used for 'whitelisting':
iwpriv msh0 bt_set_invert 1
iwpriv msh0 bt_set_invert 1


Line 95: Line 125:
==bt_add==
==bt_add==


This adds a MAC address to the blinding table:
This adds a mesh node's MAC address to the blinding table:
iwpriv msh0 bt_add 00:17:c4:05:25:60
iwpriv msh0 bt_add 00:17:c4:05:25:60

Latest revision as of 05:16, 13 September 2007

The wireless mesh interface contains functionality that makes it possible to force mesh topologies for testing. Among other purposes, this is useful for testing school servers when there are a number of school servers in close proximity. This functionality is the ability to populate a blinding table with MAC addresses of mesh nodes with which the interface is either prohibited from or limited to exchanging packets.

Changes to the Server

You will need to know the MAC addresses of the mesh interfaces on any laptops you wish to blind (or inverse blind). In the examples below, we use 00:17:c4:05:25:60 as the XO MAC address.

We recommend placing the blinding information in the /etc/init.d/olpc-mesh-config startup script. In this way, your changes will survive reboots of the server.

Add the following lines to the start() function, right after the RETVAL=$? line:

if [ -d /sys/class/net/msh0 ] ; then
  /sbin/iwpriv msh0 bt_reset
  /sbin/iwpriv msh0 bt_set_invert 1
#  This adds the XO named Sofia to the whitelist
  /sbin/iwpriv msh0 bt_add 00:17:c4:05:25:60
fi
if [ -d /sys/class/net/msh1 ] ; then
  /sbin/iwpriv msh1 bt_reset
  /sbin/iwpriv msh1 bt_set_invert 1
#  This adds the XO named Sofia to the whitelist
  /sbin/iwpriv msh1 bt_add 00:17:c4:05:25:60
fi
if [ -d /sys/class/net/msh2 ] ; then
  /sbin/iwpriv msh2 bt_reset
  /sbin/iwpriv msh2 bt_set_invert 1
#  This adds the XO named Sofia to the whitelist
  /sbin/iwpriv msh2 bt_add 00:17:c4:05:25:60
fi

Now just start that service again to apply the blinding table:

sudo service olpc-mesh-config start

Changes to the Laptop

The changes to the laptop are similar. Place the following script into a new file called /etc/init.d/blinding (also available at http://xs-dev.laptop.org/wad/blinding):

#!/bin/sh                                                                       
# chkconfig: 5 35 65                                                            
# description:  Sets up a mesh blinding table                                   
#                                                                               
#  blinding                                                                     
#  This script, if run early in a laptop's boot process, will                   
#  ensure that the laptop only talks to the mesh interfaces                     
#  listed here.                                                                 

IWPRIV=/sbin/iwpriv
MSH_IF=msh0

case "$1" in
    start)
#  Clear any blinding parameters                                  
        $IWPRIV $MSH_IF bt_reset
#  Make sure that an inverse blinding table is being created                                 
        $IWPRIV $MSH_IF bt_set_invert 1
#  Now add the interfaces we allow communication with:
                          
        $IWPRIV $MSH_IF bt_add 00:50:43:28:0b:6f

        RETVAL=$?
        ;;
    stop)
#  Clear any blinding parameters                                   
        $IWPRIV $MSH_IF bt_reset
        RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        exit 1
        ;;
esac
exit $RETVAL

And make this script executable:

chmod a+x /etc/init.d/blinding

To temporarily enable the blinding (until the next reboot), type:

service blinding start

To permanently enable the blinding (until the next update), type:

chkconfig --level 5 blinding on
service blinding start

Now this laptop will only talk to the indicated school server (actually, the indicated Active Antenna) until it is updated. Please label the laptop accordingly!

To temporarily disable the blindings, type:

service blinding stop

This doesn't actually seem to work right now! We recommend power cycling the laptop to ensure that the blinding table is cleared, otherwise things might not be as they appear.

To permanently disable the blindings, type:

chkconfig blinding off

Blinding Table Commands

This section needs expanding!

bt_reset

This command resets (clears) the blinding table:

iwpriv msh0 bt_reset

bt_list

This command examines the blinding table:

iwpriv msh0 bt_list $i

where $i is a number between 0 and 127 representing an entry.

bt_set_invert

The default mode of the blinding table is to ignore the mesh nodes listed in the blinding table. This mode can be inverted, and the blinding table used to list the only mesh nodes which the interface is allowed to talk to.

This command controls whether the mode is normal or inverted. If the invert bit is set to zero, the blinding table will be used for 'blacklisting':

iwpriv msh0 bt_set_invert 0

If the invert bit is set to 1, the blinding table will be used for 'whitelisting':

iwpriv msh0 bt_set_invert 1

bt_get_invert

This command queries the mode of the blinding table (see bt_set_invert).

iwpriv msh0 bt_get_invert

bt_add

This adds a mesh node's MAC address to the blinding table:

iwpriv msh0 bt_add 00:17:c4:05:25:60