diff options
Diffstat (limited to 'osdep/NeighborDiscovery.cpp')
-rw-r--r-- | osdep/NeighborDiscovery.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/osdep/NeighborDiscovery.cpp b/osdep/NeighborDiscovery.cpp index ee4cb5b1..4f636310 100644 --- a/osdep/NeighborDiscovery.cpp +++ b/osdep/NeighborDiscovery.cpp @@ -28,7 +28,7 @@ namespace ZeroTier { uint16_t calc_checksum (uint16_t *addr, int len) { int count = len; - register uint32_t sum = 0; + uint32_t sum = 0; uint16_t answer = 0; // Sum up 2-byte values until none or only one byte left. @@ -83,6 +83,7 @@ struct _neighbor_solicitation { , checksum(0) , option(1) { + memset(&reserved, 0, sizeof(reserved)); memset(target, 0, sizeof(target)); } @@ -102,7 +103,7 @@ struct _neighbor_solicitation { memcpy(tmp, &ph, sizeof(_pseudo_header)); memcpy(tmp+sizeof(_pseudo_header), this, sizeof(_neighbor_solicitation)); - checksum = calc_checksum((uint16_t*)tmp, len); + checksum = calc_checksum((uint16_t*)tmp, (int)len); free(tmp); tmp = NULL; @@ -111,6 +112,7 @@ struct _neighbor_solicitation { uint8_t type; // 135 uint8_t code; // 0 uint16_t checksum; + uint32_t reserved; uint8_t target[16]; _option option; }; @@ -143,7 +145,7 @@ struct _neighbor_advertisement { memcpy(tmp, &ph, sizeof(_pseudo_header)); memcpy(tmp+sizeof(_pseudo_header), this, sizeof(_neighbor_advertisement)); - checksum = calc_checksum((uint16_t*)tmp, len); + checksum = calc_checksum((uint16_t*)tmp, (int)len); free(tmp); tmp = NULL; |