aboutsummaryrefslogtreecommitdiffstats
path: root/lib/src/util/ip_address.c
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2020-03-26 12:02:23 +0100
committerAngelo Mantellini <angelo.mantellini@cisco.com>2020-03-31 11:35:33 +0200
commit3718e549ee31ac764b327bbf3d6e51dd7e224b46 (patch)
tree5bfc2147e348a5fd4b0291ad458dacf3feececc0 /lib/src/util/ip_address.c
parent4b36dc3d5dd3ec206aa24d49557c61ae5886be2b (diff)
[HICN-581] update hicn stack to support windows, again
Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com> Change-Id: Ic5cfeae600fde8140a076807fa1e411da1933a02
Diffstat (limited to 'lib/src/util/ip_address.c')
-rw-r--r--lib/src/util/ip_address.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c
index 805b0b261..49916547d 100644
--- a/lib/src/util/ip_address.c
+++ b/lib/src/util/ip_address.c
@@ -33,19 +33,19 @@
/* No htonl() with const */
-const ip_address_t IPV4_LOOPBACK = (ip_address_t) {
+const ip_address_t IPV4_LOOPBACK = {
.v4.as_inaddr.s_addr = SWAP(INADDR_LOOPBACK),
};
-const ip_address_t IPV6_LOOPBACK = (ip_address_t) {
+const ip_address_t IPV6_LOOPBACK ={
.v6.as_in6addr = IN6ADDR_LOOPBACK_INIT,
};
-const ip_address_t IPV4_ANY = (ip_address_t) {
+const ip_address_t IPV4_ANY = {
.v4.as_inaddr.s_addr = INADDR_ANY,
};
-const ip_address_t IPV6_ANY = (ip_address_t) {
+const ip_address_t IPV6_ANY = {
.v6.as_in6addr = IN6ADDR_ANY_INIT,
};
@@ -86,7 +86,7 @@ ip_address_len (int family)
int
ip_address_ntop (const ip_address_t * ip_address, char *dst, const size_t len,
- int family)
+ int family)
{
const char * s;
switch(family) {
@@ -161,7 +161,7 @@ ip_address_snprintf(char * s, size_t size, const ip_address_t * ip_address, int
int
ip_address_to_sockaddr(const ip_address_t * ip_address,
- struct sockaddr *sa, int family)
+ struct sockaddr *sa, int family)
{
struct sockaddr_in6 *tmp6 = (struct sockaddr_in6 *) sa;
struct sockaddr_in *tmp4 = (struct sockaddr_in *) sa;
@@ -222,9 +222,9 @@ ip_prefix_pton (const char *ip_address_str, ip_prefix_t * ip_prefix)
p = strchr (addr, '/');
if (!p) {
- ip_prefix->len = ~0; // until we get the ip address family
+ ip_prefix->len = ~0; // until we get the ip address family
} else {
- ip_prefix->len = strtoul (p + 1, &eptr, 10);
+ ip_prefix->len = (u8)strtoul (p + 1, &eptr, 10);
*p = 0;
}
@@ -236,14 +236,14 @@ ip_prefix_pton (const char *ip_address_str, ip_prefix_t * ip_prefix)
if (ip_prefix->len == (u8)~0)
ip_prefix->len = IPV6_ADDR_LEN_BITS;
if (ip_prefix->len > IPV6_ADDR_LEN_BITS)
- goto ERR;
+ goto ERR;
pton_fd = inet_pton (AF_INET6, addr, &ip_prefix->address.v6.buffer);
break;
case AF_INET:
if (ip_prefix->len == (u8)~0)
ip_prefix->len = IPV4_ADDR_LEN_BITS;
if (ip_prefix->len > IPV4_ADDR_LEN_BITS)
- goto ERR;
+ goto ERR;
pton_fd = inet_pton (AF_INET, addr, &ip_prefix->address.v4.buffer);
break;
default: