diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-07-17 17:58:03 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-07-17 17:58:03 +0200 |
commit | a9c8d4d92492313d62a995fd948db623ae85076f (patch) | |
tree | b3b164bf2e2e094f84ae3b18d4f83d0f85e430ab /ndp.c | |
parent | 4667226bb08b06c70df9e4508d8304ffb4ba0e2d (diff) | |
download | passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar.gz passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar.bz2 passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar.lz passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar.xz passt-a9c8d4d92492313d62a995fd948db623ae85076f.tar.zst passt-a9c8d4d92492313d62a995fd948db623ae85076f.zip |
ndp: Fix calculation of length for DNS Search List option (31)
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'ndp.c')
-rw-r--r-- | ndp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -127,7 +127,7 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len) len += strlen(c->dns_search[n].n) + 2; if (len) { *p++ = 31; /* DNSSL */ - *p++ = 2 + (len + 8 - 1) / 8; /* length */ + *p++ = (len + 8 - 1) / 8 + 1; /* length */ p += 2; /* reserved */ *(uint32_t *)p = htonl(60); /* lifetime */ p += 4; @@ -148,8 +148,8 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len) *(p++) = 0; } - memset(p, 0, len % 8); /* padding */ - p += len % 8; + memset(p, 0, 8 - len % 8); /* padding */ + p += 8 - len % 8; } *p++ = 1; /* source ll */ |