Commit 75829169 authored by Johny Mattsson's avatar Johny Mattsson
Browse files

Support building without IPv6 enabled.

parent c8e1c44c
...@@ -46,10 +46,13 @@ void macstr (char *out, const uint8_t *mac); ...@@ -46,10 +46,13 @@ void macstr (char *out, const uint8_t *mac);
#define IP_STR_SZ (8*4+7+1) #define IP_STR_SZ (8*4+7+1)
void ipstr (char *out, const ip_addr_t *ip); void ipstr (char *out, const ip_addr_t *ip);
void ip4str (char *out, const ip4_addr_t *ip); void ip4str (char *out, const ip4_addr_t *ip);
void ip6str (char *out, const ip6_addr_t *ip);
void ipstr_esp (char *out, const esp_ip_addr_t *ip); void ipstr_esp (char *out, const esp_ip_addr_t *ip);
void ip4str_esp (char *out, const esp_ip4_addr_t *ip); void ip4str_esp (char *out, const esp_ip4_addr_t *ip);
#ifdef CONFIG_LWIP_IPV6
void ip6str (char *out, const ip6_addr_t *ip);
void ip6str_esp (char *out, const esp_ip6_addr_t *ip); void ip6str_esp (char *out, const esp_ip6_addr_t *ip);
#endif
#endif #endif
...@@ -41,27 +41,35 @@ void macstr (char *str, const uint8_t *mac) ...@@ -41,27 +41,35 @@ void macstr (char *str, const uint8_t *mac)
} }
void ipstr (char *out, const ip_addr_t *ip)
void ip4str (char *out, const ip4_addr_t *ip)
{ {
if (ip->type == IPADDR_TYPE_V4) ip4addr_ntoa_r(ip, out, IP_STR_SZ);
ip4str (out, &ip->u_addr.ip4);
else if (ip->type == IPADDR_TYPE_V6)
ip6str (out, &ip->u_addr.ip6);
} }
void ip4str (char *out, const ip4_addr_t *ip)
void ip4str_esp (char *out, const esp_ip4_addr_t *ip)
{ {
ip4addr_ntoa_r(ip, out, IP_STR_SZ); esp_ip4addr_ntoa(ip, out, IP_STR_SZ);
} }
#ifdef CONFIG_LWIP_IPV6
void ipstr (char *out, const ip_addr_t *ip)
{
if (ip->type == IPADDR_TYPE_V4)
ip4str (out, &ip->u_addr.ip4);
else if (ip->type == IPADDR_TYPE_V6)
ip6str (out, &ip->u_addr.ip6);
}
void ip6str (char *out, const ip6_addr_t *ip) void ip6str (char *out, const ip6_addr_t *ip)
{ {
ip6addr_ntoa_r(ip, out, IP_STR_SZ); ip6addr_ntoa_r(ip, out, IP_STR_SZ);
} }
void ipstr_esp (char *out, const esp_ip_addr_t *ip) void ipstr_esp (char *out, const esp_ip_addr_t *ip)
{ {
if (ip->type == ESP_IPADDR_TYPE_V4) if (ip->type == ESP_IPADDR_TYPE_V4)
...@@ -70,14 +78,21 @@ void ipstr_esp (char *out, const esp_ip_addr_t *ip) ...@@ -70,14 +78,21 @@ void ipstr_esp (char *out, const esp_ip_addr_t *ip)
ip6str (out, &ip->u_addr.ip6); ip6str (out, &ip->u_addr.ip6);
} }
void ip6str_esp (char *out, const esp_ip6_addr_t *ip)
void ip4str_esp (char *out, const esp_ip4_addr_t *ip)
{ {
esp_ip4addr_ntoa(ip, out, IP_STR_SZ); ip6addr_ntoa_r((ip6_addr_t *)ip, out, IP_STR_SZ);
} }
#else
void ip6str_esp (char *out, const esp_ip6_addr_t *ip) void ipstr (char *out, const ip_addr_t *ip)
{ {
ip6addr_ntoa_r((ip6_addr_t *)ip, out, IP_STR_SZ); ip4str(out, ip);
} }
void ipstr_esp(char *out, const esp_ip_addr_t *ip)
{
ip4str_esp(out, ip);
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment