summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;