summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-21 19:56:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-21 19:56:49 +0100
commitca758c85d216baa6c88b50a3170958d86deb05e0 (patch)
tree0f58942e508b03f3baa2f0b912edac0dbc9b4038 /src
parent4f7bd1e439847d1db35b0bfd28372bbd98830477 (diff)
downloadbabel-ca758c85d216baa6c88b50a3170958d86deb05e0.tar
babel-ca758c85d216baa6c88b50a3170958d86deb05e0.zip
Handle node ID TLVs
Diffstat (limited to 'src')
-rw-r--r--src/tlv_types.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tlv_types.c b/src/tlv_types.c
index 9c485f2..3ff8bf9 100644
--- a/src/tlv_types.c
+++ b/src/tlv_types.c
@@ -136,6 +136,15 @@ static void handle_tlv_ihu(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_tlv
gmrf_logf(gmrf, LOG_DEBUG, "accepted IHU, txcost is %u, cost is %u now.", gp_babel_neigh_get_txcost(gmrf, neigh), gp_babel_neigh_get_cost(gmrf, neigh));
}
+static void handle_tlv_node_id(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_tlv_node_id_t *tlv_node_id, size_t len, handle_tlv_arg_t *arg) {
+ if (len < sizeof(gp_babel_tlv_node_id_t)) {
+ gmrf_logf(gmrf, LOG_WARNING, "received short node id TLV.");
+ return;
+ }
+
+ arg->node_id = tlv_node_id->id;
+}
+
static void handle_tlv(gmrf_t *gmrf, gmrf_context_t *ctx, gp_babel_tlv_type_t type, const void *data, size_t len, void *arg) {
handle_tlv_arg_t *tlv_arg = arg;
@@ -156,6 +165,10 @@ static void handle_tlv(gmrf_t *gmrf, gmrf_context_t *ctx, gp_babel_tlv_type_t ty
handle_tlv_ihu(gmrf, ctx, data, len, tlv_arg);
return;
+ case TLV_NODE_ID:
+ handle_tlv_node_id(gmrf, ctx, data, len, tlv_arg);
+ return;
+
default:
gmrf_logf(gmrf, LOG_DEBUG, "received unknown TLV %u on %s.", type, gmrf_iface_get_name(gmrf, tlv_arg->iface->gmrf_iface));
return;