Thursday, June 30, 2011

Strange olsrd behaviour running on 2 FreeBSD vms

So, the same code, same exec file, same config file for both vms running IPv6 mode; I used scp to be sure I have the same thing on both.
No packetloss script used, so I get more routes for one destination.
The output for the first one (used the most for testing):


Nothing wrong so far, but the netstat -rn output looks like this:

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::1                                      ::1                                 UH          lo0
fd00::/8                             link#1                           U             re0
fd00::3                              link#1                           UHS        lo0
fe80::%lo0/64                   link#4                           U             lo0
fe80::1%lo0                      link#4                           UHS        lo0
ff01:1::/32                        fd00::3                           U             re0
ff01:4::/32                        fe80::1%lo0                   U             lo0
ff02::%re0/32                   fd00::3                          U             re0
ff02::%lo0/32                   fe80::1%lo0                   U            lo0

re0 is the interface on which olsrd runs.
No IPv6 route added to the kernel routing table.

The output for the second vm:


The output for netstat -rn for this vm is:

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                                    ::1                                 UGRS        lo0
::1                                       ::1                                 UH            lo0
::ffff:0.0.0.0/96                   ::1                                 UGRS        lo0
fd00::/8                              link#1                           U               re0
fd00::1/0                            fe80::1%re0                  U               re0
fd00::2/0                            fe80::2%re0                  U               re0
fd00::3/0                            fe80::3%re0                  U               re0
fd00::4                               link#1                           UHS          lo0
fe80::/10                            ::1                                 UGRS         lo0
fe80::%re0/64                    link#1                          U                re0
fe80::201:ff:fe00:4%re0     link#1                          UHS          lo0
fe80::%re1/64                    link#2                          U                re1
fe80::201:ff:fe00:d%re1     link#2                          UHS          lo0
fe80::%lo0/64                     link#4                          U               lo0
fe80::1%lo0                        link#4                          UHS          lo0
ff01:1::/32                        fe80::201:ff:fe00:4%re0   U             re0
ff01:2::/32                        fe80::201:ff:fe00:d%re1   U             re1
ff01:4::/32                         ::1                                  U              lo0
ff02::/16                            ::1                                  UGRS       lo0
ff02::%re0/32                  fe80::201:ff:fe00:4%re0    U            re0
ff02::%re1/32                  fe80::201:ff:fe00:d%re1    U            re1
ff02::%lo0/32                    ::1                                  U              lo0

So, you can see the output is very different, this one is better, but not the best.

Sunday, June 26, 2011

FreeBSD vm configure

Since I had some trouble in configuring the FreeBSD vm, here are some basic steps into making a vm work for development:
1. install a package using
pkg_add -r {pkg-name}
portsnap fetch update - similar to apt-get update
portsnap extract
portsnap update
2. enable root ssh login:
edit /etc/ssh/sshd_config by adding PermitRootLogin option, and running /etc/rc.d/sshd reload to activate the change;
3. adding ipv6 net address using
# ifconfig {interface-name} inet6 {IPv6-Address} prefixlen {routed-bit}
4. for internet access configure dns, in /etc/resolv.conf, and gateway to be the same as for your host;
route add default {gw_ip_addr}
5. to run olsrd, the olsrd.conf must be edited and copied into /usr/local/etc;

Wednesday, May 18, 2011

Topology routing table view

On 10.0.0.1:

Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.1    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.2:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.2    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.3:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.3    10.0.0.5    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.1    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.2    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.4    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.4    YES    NO    YES    3    0
10.0.0.5    YES    NO    YES    3    0
10.0.0.1    YES    NO    YES    3    0
10.0.0.2    YES    NO    YES    3    0

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.1    1    1.000    if02   
10.0.0.2/32    10.0.0.2    1    1.000    if02   
10.0.0.4/32    10.0.0.4    1    1.000    if02   
10.0.0.5/32    10.0.0.5    1    1.000    if02   

On 10.0.0.4:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.4    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.5:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.5    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02   

Tuesday, May 17, 2011

Ebtables Script for 5 vm topology

#!/bin/bash

ebtables -t filter -P FORWARD DROP  #set policy
ebtables -t filter -F FORWARD       #remove all commands

sudo ebtables -t filter -A FORWARD -i tap1 -o tap3 -j ACCEPT
sudo ebtables -t filter -A FORWARD -i tap3 -o tap1 -j ACCEPT

sudo ebtables -t filter -A FORWARD -i tap2 -o tap3 -j ACCEPT
sudo ebtables -t filter -A FORWARD -i tap3 -o tap2 -j ACCEPT

sudo ebtables -t filter -A FORWARD -i tap4 -o tap3 -j ACCEPT
sudo ebtables -t filter -A FORWARD -i tap3 -o tap4 -j ACCEPT

sudo ebtables -t filter -A FORWARD -i tap5 -o tap3 -j ACCEPT
sudo ebtables -t filter -A FORWARD -i tap3 -o tap5 -j ACCEPT

Thursday, May 5, 2011

Bugfix deleted routes win32

The bug was not really a new bug, it had to do with win32 exit.
A long sleep(1000) in main.c caused the delay between the given command ctrl+c and the closing of olsrd.exe. Also, a break in scheduler.c was not a solution for a quick exit, because it caused that the kernel routes not to be realeased after exit.
I tested the bugfix between 2 instances of olsrd.exe: one running the one with the bug, and one running the fixed one, and the routes were deleted on the fixed one, while they remained on the "bugged" one. I also tested what happens if the fixed one got a new neighbour after it received ctrl+c command, but didn't manage to close.
The route would be added again, even after the ctrl+c command in the kernel routes, but would still be deleted after the exit. Or, it didn't actually close anymore, and it started again.
A next test would be with more than 2 instances, with at least one running the bug one, and the other two running the fixed one, in order to find out what happens after the ctrl+c command is send and a new neighbor appears and the routing table has multiple routes.

Tuesday, May 3, 2011

Include txtinfo plugin to olsrd.exe

Edit olsrd.conf: (no comments between LoadPlugin and bracket)

LoadPlugin "olsrd_txtinfo.dll"
{
    # port number the txtinfo plugin will be listening, default 2006
    #   PlParam     "port"   "81"
    # ip address that can access the plugin, use "0.0.0.0"
    # to allow everyone
    PlParam     "Accept"   "0.0.0.0"
}

Run make txtinfo to create the .dll file, which olsrd.exe links to itself on startup.
Add the .dll file into the same directory as olsrd.exe in order to run it.
Run wget -O http://{ip_vm}:2006/all or /links /neighbours /routes or /config (which is not in /all ) in your terminal to get the output from the vm on your running system.