diff options
author | teor <teor@torproject.org> | 2020-04-30 06:17:18 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-04-30 06:54:42 +1000 |
commit | cd7e2fc210349615c8e9cdb879f98cb0c9cac57b (patch) | |
tree | 60b9ddd3c3c1c60b64b1d643e7ef3dbfa8f8ec65 /src/lib/net/address.c | |
parent | f62b051e873aa4be564e9f83745902d4541f79f4 (diff) | |
download | tor-cd7e2fc210349615c8e9cdb879f98cb0c9cac57b.tar.gz tor-cd7e2fc210349615c8e9cdb879f98cb0c9cac57b.zip |
net: Make all address bytes functions take uint8_t *
Part of 33817.
Diffstat (limited to 'src/lib/net/address.c')
-rw-r--r-- | src/lib/net/address.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/net/address.c b/src/lib/net/address.c index af0e58fa4f..4193053ee1 100644 --- a/src/lib/net/address.c +++ b/src/lib/net/address.c @@ -608,7 +608,8 @@ tor_addr_parse_mask_ports(const char *s, family = AF_INET; tor_addr_from_ipv4h(addr_out, 0); } else if (flags & TAPMP_STAR_IPV6_ONLY) { - static char nil_bytes[16] = { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; + static uint8_t nil_bytes[16] = + { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; family = AF_INET6; tor_addr_from_ipv6_bytes(addr_out, nil_bytes); } else { @@ -629,7 +630,7 @@ tor_addr_parse_mask_ports(const char *s, tor_addr_from_ipv4h(addr_out, 0); any_flag = 1; } else if (!strcmp(address, "*6") && (flags & TAPMP_EXTENDED_STAR)) { - static char nil_bytes[16] = { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; + static uint8_t nil_bytes[16] = { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; family = AF_INET6; tor_addr_from_ipv6_bytes(addr_out, nil_bytes); any_flag = 1; @@ -887,7 +888,7 @@ tor_addr_from_ipv4n(tor_addr_t *dest, uint32_t v4addr) /** Set <b>dest</b> to equal the IPv6 address in the 16 bytes at * <b>ipv6_bytes</b>. */ void -tor_addr_from_ipv6_bytes(tor_addr_t *dest, const char *ipv6_bytes) +tor_addr_from_ipv6_bytes(tor_addr_t *dest, const uint8_t *ipv6_bytes) { tor_assert(dest); tor_assert(ipv6_bytes); @@ -900,14 +901,14 @@ tor_addr_from_ipv6_bytes(tor_addr_t *dest, const char *ipv6_bytes) void tor_addr_from_in6(tor_addr_t *dest, const struct in6_addr *in6) { - tor_addr_from_ipv6_bytes(dest, (const char*)in6->s6_addr); + tor_addr_from_ipv6_bytes(dest, in6->s6_addr); } /** Set the 16 bytes at <b>dest</b> to equal the IPv6 address <b>src</b>. * <b>src</b> must be an IPv6 address, if it is not, log a warning, and clear * <b>dest</b>. */ void -tor_addr_copy_ipv6_bytes(char *dest, const tor_addr_t *src) +tor_addr_copy_ipv6_bytes(uint8_t *dest, const tor_addr_t *src) { tor_assert(dest); tor_assert(src); @@ -1463,10 +1464,10 @@ ifconf_free_ifc_buf(struct ifconf *ifc) * into smartlist of <b>tor_addr_t</b> structures. */ STATIC smartlist_t * -ifreq_to_smartlist(char *buf, size_t buflen) +ifreq_to_smartlist(const uint8_t *buf, size_t buflen) { smartlist_t *result = smartlist_new(); - char *end = buf + buflen; + const uint8_t *end = buf + buflen; /* These acrobatics are due to alignment issues which trigger * undefined behaviour traps on OSX. */ @@ -1540,7 +1541,7 @@ get_interface_addresses_ioctl(int severity, sa_family_t family) /* Ensure we have least IFREQ_SIZE bytes unused at the end. Otherwise, we * don't know if we got everything during ioctl. */ } while (mult * IFREQ_SIZE - ifc.ifc_len <= IFREQ_SIZE); - result = ifreq_to_smartlist(ifc.ifc_buf, ifc.ifc_len); + result = ifreq_to_smartlist((const uint8_t *)ifc.ifc_buf, ifc.ifc_len); done: if (fd >= 0) |