From 902cb4152d98be0132cd85ffd758e202d327c906 Mon Sep 17 00:00:00 2001 From: Christian Giese Date: Thu, 18 Mar 2021 19:56:38 +0100 Subject: [PATCH] Fix ICMPv6 ND --- src/bbl_protocols.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bbl_protocols.c b/src/bbl_protocols.c index 72c3886f..5fbf56d0 100644 --- a/src/bbl_protocols.c +++ b/src/bbl_protocols.c @@ -284,25 +284,27 @@ encode_icmpv6(uint8_t *buf, uint16_t *len, BUMP_WRITE_BUFFER(buf, len, sizeof(uint32_t)); break; case IPV6_ICMPV6_NEIGHBOR_SOLICITATION: - *(uint32_t*)buf = 0; + *(uint32_t*)buf = 0; /* Reserved */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint32_t)); + /* Target address */ memcpy(buf, icmp->prefix.address, IPV6_ADDR_LEN); BUMP_WRITE_BUFFER(buf, len, IPV6_ADDR_LEN); - *(uint8_t*)buf = 1; + *(uint8_t*)buf = 1; /* Source link-layer address */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t)); - *(uint8_t*)buf = 1; + *(uint8_t*)buf = 1; /* Length (1 = 8 byte) */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t)); memcpy(buf, icmp->mac, ETH_ADDR_LEN); BUMP_WRITE_BUFFER(buf, len, ETH_ADDR_LEN); break; case IPV6_ICMPV6_NEIGHBOR_ADVERTISEMENT: - *buf = 0x60; + *buf = 0x60; /* Flags */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint32_t)); + /* Target address */ memcpy(buf, icmp->prefix.address, IPV6_ADDR_LEN); BUMP_WRITE_BUFFER(buf, len, IPV6_ADDR_LEN); - *(uint8_t*)buf = 1; + *(uint8_t*)buf = 2; /* Target link-layer address */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t)); - *(uint8_t*)buf = 1; + *(uint8_t*)buf = 1; /* Length (1 = 8 byte) */ BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t)); memcpy(buf, icmp->mac, ETH_ADDR_LEN); BUMP_WRITE_BUFFER(buf, len, ETH_ADDR_LEN);