From 7fa3e90290d1966e25f3f8882ee25f14808e8e48 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 21 Jul 2021 10:04:17 +0200 Subject: [PATCH] ndp: Store link-local or global address on any NDP message received The guest might not send other types of traffic before we try to communicate to it, so take also this chance to store its configured addresses. Signed-off-by: Stefano Brivio --- ndp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ndp.c b/ndp.c index 8f69a64..acc0473 100644 --- a/ndp.c +++ b/ndp.c @@ -162,6 +162,11 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len) len = (uintptr_t)p - (uintptr_t)ihr - sizeof(*ihr); + if (IN6_IS_ADDR_LINKLOCAL(&ip6h->saddr)) + c->addr6_ll_seen = ip6h->saddr; + else + c->addr6_seen = ip6h->saddr; + ip6hr->daddr = ip6h->saddr; ip6hr->saddr = c->gw6; ip6hr->payload_len = htons(sizeof(*ihr) + len);