Skip to content

Commit

Permalink
Add the AODVv2 Routing Protocol
Browse files Browse the repository at this point in the history
This PR depends on RIOT-OS#1766.

It contains a minimal implementation of the AODVv2 routing protocol.
*Not* implemented are:

	- AckReqs
	- alternate metrics
	- multiple interfaces
	- clients and Client Networks
	- buffering
	- all addresses, TLVs, and features that are marked as optional

An example application can be found at https:/Lotterleben/RIOT-AODVv2/tree/master/aodvv2_demo.

The implementation relies heavily on a functioning Neighbor Discovery Protocol.
It might be necessary to fill the neighbor cache manually with the current state
of RIOTs NDP implementation.

The value of AODVV2_MAX_UNREACHABLE_NODES has been chosen arbitrarily and will be subject to
future improvement.

Please note that based on my experience, with the default transceiver
buffer size (3) of the native port, about 2/3 of the route discoveries
will fail. This has been addressed in issue RIOT-OS#1747. It is advised to increase
the transceiver buffer size when using AODVv2 as a routing protocol.
  • Loading branch information
Lotterleben committed Nov 27, 2014
1 parent bd74f3a commit 743b0af
Show file tree
Hide file tree
Showing 19 changed files with 3,066 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ ifneq (,$(filter sixlowpan,$(USEMODULE)))
USEMODULE += vtimer
endif

ifneq (,$(filter aodvv2,$(USEMODULE)))
USEMODULE += vtimer
USEMODULE += sixlowpan
USEMODULE += oonf_common
USEMODULE += oonf_rfc5444
endif

ifneq (,$(filter uart0,$(USEMODULE)))
USEMODULE += posix
endif
Expand Down
3 changes: 3 additions & 0 deletions sys/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ endif
ifneq (,$(filter routing,$(USEMODULE)))
DIRS += net/routing
endif
ifneq (,$(filter aodvv2,$(USEMODULE)))
DIRS += net/routing/aodvv2
endif
ifneq (,$(filter ieee802154,$(USEMODULE)))
DIRS += net/link_layer/ieee802154
endif
Expand Down
52 changes: 52 additions & 0 deletions sys/net/include/aodvv2/aodvv2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014 Lotte Steenbrink <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup aodvv2 AODVv2
* @brief The Ad-hoc On-demand Distance Vector routing protocol, version 2
* @ingroup net
* @{
*
* @file aodvv2/aodvv2.h
* @brief Interface for the AODVv2 routing protocol
*
* @author Lotte Steenbrink <[email protected]>
*/

#ifndef AODVV2_H_
#define AODVV2_H_

#include "common/netaddr.h"
#include "rfc5444/rfc5444_print.h"

#include "aodvv2/types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Initialize the AODVv2 routing protocol.
*/
void aodv_init(void);

/**
* @brief Set the metric type. If metric_type does not match any known metric
* types, no changes will be made.
*
* @param[in] metric_type type of new metric
*/
void aodv_set_metric_type(aodvv2_metric_t metric_type);

#ifdef __cplusplus
}
#endif

#endif /* AODVV2_H_ */
/** @} */
102 changes: 102 additions & 0 deletions sys/net/include/aodvv2/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014 Lotte Steenbrink <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup aodvv2
* @{
*
* @file aodvv2/types.h
* @brief data types for the aodvv2 routing protocol
*
* @author Lotte Steenbrink <[email protected]>
*/

#ifndef AODVV2_TYPES_H
#define AODVV2_TYPES_H

#include "common/netaddr.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief AODVv2 metric types. Extend to include alternate metrics.
*/
typedef enum {
HOP_COUNT = 3, /**< see RFC6551*/
} aodvv2_metric_t;

typedef uint16_t aodvv2_seqnum_t;

#define AODVV2_DEFAULT_METRIC_TYPE HOP_COUNT

/**
* @brief AODVv2 message types
*/
enum rfc5444_msg_type
{
RFC5444_MSGTYPE_RREQ = 10,
RFC5444_MSGTYPE_RREP = 11,
RFC5444_MSGTYPE_RERR = 12,
};

/**
* @brief AODVv2 TLV types
*/
enum rfc5444_tlv_type
{
RFC5444_MSGTLV_ORIGSEQNUM,
RFC5444_MSGTLV_TARGSEQNUM,
RFC5444_MSGTLV_UNREACHABLE_NODE_SEQNUM,
RFC5444_MSGTLV_METRIC,
};

/**
* @brief Data about an OrigNode or TargNode, typically embedded in an
* aodvv2_packet_data struct.
*/
struct node_data
{
struct netaddr addr; /**< IP address of the node */
uint8_t metric; /**< Metric value */
aodvv2_seqnum_t seqnum; /**< Sequence Number */
};

/**
* @brief all data contained in a RREQ or RREP.
*/
struct aodvv2_packet_data
{
uint8_t hoplimit; /**< Hop limit */
struct netaddr sender; /**< IP address of the neighboring router
* which sent the RREQ/RREP*/
aodvv2_metric_t metricType; /**< Metric type */
struct node_data origNode; /**< Data about the originating node */
struct node_data targNode; /**< Data about the originating node */
timex_t timestamp; /**< point at which the packet was (roughly)
* received. Note that this timestamp
* will be set after the packet has been
* successfully parsed. */
};

/**
* @brief Data about an unreachable node to be embedded in a RERR.
*/
struct unreachable_node
{
struct netaddr addr; /**< IP address */
aodvv2_seqnum_t seqnum; /**< Sequence Number */
};

#ifdef __cplusplus
}
#endif

#endif /* AODVV2_TYPES_H */
1 change: 1 addition & 0 deletions sys/net/routing/aodvv2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBASE)/Makefile.base
Loading

0 comments on commit 743b0af

Please sign in to comment.