From 046dcd514de5bc0bb493e7ebbd4dc7ed360fc530 Mon Sep 17 00:00:00 2001 From: Hannes Gredler Date: Tue, 12 Sep 2023 14:13:12 +0000 Subject: [PATCH] Use correct json tag on blaster socket. Omit the IP header on the blaster socket. --- code/lspgen/src/lspgen_ctrl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/lspgen/src/lspgen_ctrl.c b/code/lspgen/src/lspgen_ctrl.c index ab6fd6c3..f3daf6eb 100644 --- a/code/lspgen/src/lspgen_ctrl.c +++ b/code/lspgen/src/lspgen_ctrl.c @@ -175,7 +175,17 @@ lspgen_ctrl_encode_packet(lsdb_ctx_t *ctx, lsdb_packet_t *packet) push_be_uint(buf, 1, '\n'); } push_be_uint(buf, 1, '"'); - for (idx = 0; idx < packet->buf.idx; idx++) { + + idx = 0; + if (ctx->protocol_id == PROTO_OSPF2) { + + /* + * Omit the IP header (=the first 20 bytes). + */ + idx = 20; + } + + for (; idx < packet->buf.idx; idx++) { hi_byte = packet->buf.data[idx] >> 4; lo_byte = packet->buf.data[idx] & 0xf; @@ -254,7 +264,7 @@ lspgen_ctrl_write_cb(timer_s *timer) json_header = "{\n\"command\": \"isis-lsp-update\",\n" "\"arguments\": {\n\"instance\": 1,\n\"pdu\": ["; } else if (ctx->protocol_id == PROTO_OSPF2 || ctx->protocol_id == PROTO_OSPF3) { - json_header = "{\n\"command\": \"ospf-ls-update\",\n" + json_header = "{\n\"command\": \"ospf-pdu-update\",\n" "\"arguments\": {\n\"instance\": 1,\n\"pdu\": ["; } if (!json_header) {