Support building without IPv6 enabled.
This commit is contained in:
parent
c8e1c44c0e
commit
758291693c
|
@ -46,10 +46,13 @@ void macstr (char *out, const uint8_t *mac);
|
|||
#define IP_STR_SZ (8*4+7+1)
|
||||
void ipstr (char *out, const ip_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 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);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,6 +41,22 @@ void macstr (char *str, const uint8_t *mac)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void ip4str (char *out, const ip4_addr_t *ip)
|
||||
{
|
||||
ip4addr_ntoa_r(ip, out, IP_STR_SZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ip4str_esp (char *out, const esp_ip4_addr_t *ip)
|
||||
{
|
||||
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)
|
||||
|
@ -49,19 +65,11 @@ void ipstr (char *out, const ip_addr_t *ip)
|
|||
ip6str (out, &ip->u_addr.ip6);
|
||||
}
|
||||
|
||||
|
||||
void ip4str (char *out, const ip4_addr_t *ip)
|
||||
{
|
||||
ip4addr_ntoa_r(ip, out, IP_STR_SZ);
|
||||
}
|
||||
|
||||
|
||||
void ip6str (char *out, const ip6_addr_t *ip)
|
||||
{
|
||||
ip6addr_ntoa_r(ip, out, IP_STR_SZ);
|
||||
}
|
||||
|
||||
|
||||
void ipstr_esp (char *out, const esp_ip_addr_t *ip)
|
||||
{
|
||||
if (ip->type == ESP_IPADDR_TYPE_V4)
|
||||
|
@ -70,14 +78,21 @@ void ipstr_esp (char *out, const esp_ip_addr_t *ip)
|
|||
ip6str (out, &ip->u_addr.ip6);
|
||||
}
|
||||
|
||||
|
||||
void ip4str_esp (char *out, const esp_ip4_addr_t *ip)
|
||||
{
|
||||
esp_ip4addr_ntoa(ip, out, IP_STR_SZ);
|
||||
}
|
||||
|
||||
|
||||
void ip6str_esp (char *out, const esp_ip6_addr_t *ip)
|
||||
{
|
||||
ip6addr_ntoa_r((ip6_addr_t *)ip, out, IP_STR_SZ);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void ipstr (char *out, const ip_addr_t *ip)
|
||||
{
|
||||
ip4str(out, ip);
|
||||
}
|
||||
|
||||
void ipstr_esp(char *out, const esp_ip_addr_t *ip)
|
||||
{
|
||||
ip4str_esp(out, ip);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue