From ca758c85d216baa6c88b50a3170958d86deb05e0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 21 Mar 2013 19:56:49 +0100 Subject: Handle node ID TLVs --- src/tlv_types.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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; -- cgit v1.2.3