aboutgitcodebugslistschat
path: root/ndp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-07-21 10:04:17 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-07-21 10:04:17 +0200
commit7fa3e90290d1966e25f3f8882ee25f14808e8e48 (patch)
tree468d9d7d2752144007b9f9cbecf21585a39b178d /ndp.c
parent5ec9ad7e9d27277e614ff107578466216be01de6 (diff)
downloadpasst-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar.gz
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar.bz2
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar.lz
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar.xz
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.tar.zst
passt-7fa3e90290d1966e25f3f8882ee25f14808e8e48.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'ndp.c')
-rw-r--r--ndp.c5
1 files changed, 5 insertions, 0 deletions
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);