Giter Site home page Giter Site logo

rpld's Introduction

This is rpld, as it currently is a dirty hack between radvd (log handling, socket, etc) and unstrung (rpl.h).

As radvd requires only libc dependencies, we have more fancy stuff to make high level handling easier, so we need:

  • lua (version >= XXX) for config parsing
  • ev (version >= XXX) for high level timer, loop handling
  • mnl (version >= XXX) for high level netlink handling

As this version is a hack and shows my experiments... it will do something to have a routable thing afterwards in a Linux IEEE 802.15.4 6LoWPAN network.

I have 1001 ideas to make the handling better, but this comes all afterwards.

Build:

$ mkdir build

$ meson build

$ ninja -C build

Testing:

If you want to test the implementation just invoke tests/start script.

Topology (default example, can be changed by changing the script):

         0
        / \
       2   1
         \ | \
           3  |
           | /
           4
           |
           5

The numbers are the corresponding namespace ns#.

RPL ranks and resulting DODAG is:

         1 <--- root
        / \
       2   2
           | \
           3  |
             /
           3
           |
           4

OR (depends on first come first serve)

         1 <--- root
        / \
       2   2
         \   \
           3  |
             /
           3
           |
           4

I did here mostly the same behaviour as unstrung implementation by Michael Richardson https://github.com/AnimaGUS-minerva/unstrung

However you can do a:

$ ip -n ns5 a

remember the IPv6 address of lowpan interface.

Then try a:

$ ip netns exec ns0 traceroute -6 $IPV6_ADDRESS

Then you see some hops to reach the node of ns4 from the root.

HOW IT WORKS?

It uses link-local address for as nexthop addresses. It setups a prefix carried by DIO and setups necessary routing tables.

TODO

This stuff is all early state, it has no clever logic of avoiding netlink messages. I have 1001 ideas to make some timeout handling so repairing will work, but that's all future stuff. Sorry, this implementation was only made to figure out how this routing protocol works...

Several memory leaks and some bufferoverflows, the RPL messages need to be very tight and setting the right flags with the right additional data otherwise it will not work. Everything can be added but this works for now.

Parent Acknowledge? I tried to implement it, I stopped working because it begun to finally working... sure there is a lot of security stuff it's one of these routing protocol implementation which just blindly accept router discovery messages.

The fact that we only use stateless configuration we could use stateful compression for the used global prefix, but this will only work for Linux to Linux (not sure about that ... this implementation is only tested between Linux systems so... maybe future work but needs a netlink interface for stateful compression inside the Linux kernel)

rpld's People

Contributors

alexaring avatar stefan-schmidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rpld's Issues

Non-Storing mode: number of hops

When the number of hops is >=2 nodes cannot ping to each other with non storing mode. Nodes directly connected cannot ping either but link local address.

sudo ip netns exec ns0 ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: lowpan0@wpan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/6lowpan e6:ce:89:62:93:cd:d9:67 brd ff:ff:ff:ff:ff:ff:ff:ff
    inet6 fd3c:be8a:173f:8e80:e4ce:8962:93cd:d967/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::e4ce:8962:93cd:d967/64 scope link 
       valid_lft forever preferred_lft forever
4: wpan0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 123 qdisc fq_codel state UNKNOWN group default qlen 300
    link/ieee802.15.4 e6:ce:89:62:93:cd:d9:67 brd ff:ff:ff:ff:ff:ff:ff:ff
sudo ip netns exec ns2 ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: lowpan2@wpan2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/6lowpan 22:3e:ce:ce:df:3a:25:52 brd ff:ff:ff:ff:ff:ff:ff:ff
    inet6 fd3c:be8a:173f:8e80:203e:cece:df3a:2552/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::203e:cece:df3a:2552/64 scope link 
       valid_lft forever preferred_lft forever
6: wpan2: <BROADCAST,NOARP,UP,LOWER_UP> mtu 123 qdisc fq_codel state UNKNOWN group default qlen 300
    link/ieee802.15.4 22:3e:ce:ce:df:3a:25:52 brd ff:ff:ff:ff:ff:ff:ff:ff
sudo ip netns exec ns3 ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: lowpan3@wpan3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/6lowpan a2:8d:10:e9:2f:68:e3:ad brd ff:ff:ff:ff:ff:ff:ff:ff
    inet6 fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::a08d:10e9:2f68:e3ad/64 scope link 
       valid_lft forever preferred_lft forever
7: wpan3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 123 qdisc fq_codel state UNKNOWN group default qlen 300
    link/ieee802.15.4 a2:8d:10:e9:2f:68:e3:ad brd ff:ff:ff:ff:ff:ff:ff:ff

0 to 2:

sudo ip netns exec ns0 ping -c1 fd3c:be8a:173f:8e80:203e:cece:df3a:2552
PING fd3c:be8a:173f:8e80:203e:cece:df3a:2552(fd3c:be8a:173f:8e80:203e:cece:df3a:2552) 56 data bytes
64 bytes from fd3c:be8a:173f:8e80:203e:cece:df3a:2552: icmp_seq=1 ttl=64 time=0.081 ms

--- fd3c:be8a:173f:8e80:203e:cece:df3a:2552 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.081/0.081/0.081/0.000 ms

0 to 2 (link local):

sudo ip netns exec ns0 ping -c1 fe80::203e:cece:df3a:2552
PING fe80::203e:cece:df3a:2552(fe80::203e:cece:df3a:2552) 56 data bytes
64 bytes from fe80::203e:cece:df3a:2552%lowpan0: icmp_seq=1 ttl=64 time=0.574 ms

--- fe80::203e:cece:df3a:2552 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.574/0.574/0.574/0.000 ms

0 to 3:

sudo ip netns exec ns0 ping -c1 fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad
PING fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad(fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad) 56 data bytes
^C
--- fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

0 to 3 (link local):

sudo ip netns exec ns0 ping -c1 fe80::a08d:10e9:2f68:e3ad
PING fe80::a08d:10e9:2f68:e3ad(fe80::a08d:10e9:2f68:e3ad) 56 data bytes
^C
--- fe80::a08d:10e9:2f68:e3ad ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

2 to 3:

sudo ip netns exec ns2 ping -c1 fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad
PING fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad(fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad) 56 data bytes
From fd3c:be8a:173f:8e80:e4ce:8962:93cd:d967 icmp_seq=1 Destination unreachable: Address unreachable

--- fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

2 to 3 (link local):

sudo ip netns exec ns2 ping -c1 fe80::a08d:10e9:2f68:e3ad
PING fe80::a08d:10e9:2f68:e3ad(fe80::a08d:10e9:2f68:e3ad) 56 data bytes
64 bytes from fe80::a08d:10e9:2f68:e3ad%lowpan2: icmp_seq=1 ttl=64 time=0.069 ms

--- fe80::a08d:10e9:2f68:e3ad ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.069/0.069/0.069/0.000 ms

Routing table from ns0:

sudo ip netns exec ns0 ip -6 n
fe80::a08d:10e9:2f68:e3ad dev lowpan0  FAILED
fd3c:be8a:173f:8e80:203e:cece:df3a:2552 dev lowpan0 lladdr 22:3e:ce:ce:df:3a:25:52 router STALE
fe80::54c6:b332:bd69:c10c dev lowpan0  INCOMPLETE
fd3c:be8a:173f:8e80:a08d:10e9:2f68:e3ad dev lowpan0  FAILED
fe80::203e:cece:df3a:2552 dev lowpan0 lladdr 22:3e:ce:ce:df:3a:25:52 router REACHABLE
fe80::6cb6:420a:d0be:cbf6 dev lowpan0  FAILED
fe80::48fa:e45b:341f:f1de dev lowpan0 lladdr 4a:fa:e4:5b:34:1f:f1:de router REACHABLE

Any hints as to why this behavior is?

Add Support to EUI-48 in gen_stateless_addr() of helpers.c

I'm experimenting using raspberry pis and the gen_stateless_addr() prohibits any MAC other then EUI-64.

I've hacked it up to move forward:

diff --git a/helpers.c b/helpers.c
index 57156e4..a98261e 100644
--- a/helpers.c
+++ b/helpers.c
@@ -30,19 +30,26 @@ int gen_stateless_addr(const struct in6_prefix *prefix,
 
        memset(dst, 0, sizeof(*dst));
 
+       dlog(LOG_DEBUG, 5, "prefix->len = %d; llinfo->addr_len = %d", prefix->len, llinfo->addr_len );
+
        /* TODO only supported right now, gets tricky with bluetooth */
-       if (prefix->len != 64 || llinfo->addr_len != 8)
-               return -1;
+       if (prefix->len != 64 || ( llinfo->addr_len != 8
+                       // Handle Ethernet/Wi-Fi
+                       && llinfo->addr_len != 6 ) )
+               return( -1 );
 
        memcpy(dst, &prefix->prefix, len);
 
+       if ( 6 == llinfo->addr_len ) // if eth/wifi; skip 2 bytes
+               len+=2;
+
        for (i = 0; i < llinfo->addr_len; i++)
                dst->s6_addr[len + i] = llinfo->addr[i];
 
        /* U/L */
        dst->s6_addr[8] ^= 0x02;
 
-       return 0;
+       return( 0 );
 }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.