mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 03:35:38 +00:00
Try to make gcc work without -Wno-address
This commit is contained in:
parent
10a5afeee7
commit
c094fcc086
@ -342,9 +342,9 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
||||
} else {
|
||||
/* service location specified, use loopback address */
|
||||
if ((hints != NULL) && (hints->ai_flags & AI_PASSIVE)) {
|
||||
ip_addr_set_any(ai_family == AF_INET6, &addr);
|
||||
ip_addr_set_any_val(ai_family == AF_INET6, addr);
|
||||
} else {
|
||||
ip_addr_set_loopback(ai_family == AF_INET6, &addr);
|
||||
ip_addr_set_loopback_val(ai_family == AF_INET6, addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ static void sockaddr_to_ipaddr_port(const struct sockaddr* sockaddr, ip_addr_t*
|
||||
((((name)->sa_family == AF_INET) && !(NETCONNTYPE_ISIPV6((sock)->conn->type))) || \
|
||||
(((name)->sa_family == AF_INET6) && (NETCONNTYPE_ISIPV6((sock)->conn->type))))
|
||||
#define IPADDR_PORT_TO_SOCKADDR(sockaddr, ipaddr, port) do { \
|
||||
if (((ipaddr) && IP_IS_ANY_TYPE_VAL(*ipaddr)) || IP_IS_V6(ipaddr)) { \
|
||||
if (IP_IS_ANY_TYPE_VAL(*ipaddr) || IP_IS_V6_VAL(*ipaddr)) { \
|
||||
IP6ADDR_PORT_TO_SOCKADDR((struct sockaddr_in6*)(void*)(sockaddr), ip_2_ip6(ipaddr), port); \
|
||||
} else { \
|
||||
IP4ADDR_PORT_TO_SOCKADDR((struct sockaddr_in*)(void*)(sockaddr), ip_2_ip4(ipaddr), port); \
|
||||
@ -947,6 +947,7 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
|
||||
|
||||
LWIP_UNUSED_ARG(conn);
|
||||
|
||||
LWIP_ASSERT("fromaddr != NULL", fromaddr != NULL);
|
||||
LWIP_ASSERT("from != NULL", from != NULL);
|
||||
LWIP_ASSERT("fromlen != NULL", fromlen != NULL);
|
||||
|
||||
|
@ -67,6 +67,49 @@ struct ip_globals ip_data;
|
||||
|
||||
const ip_addr_t ip_addr_any_type = IPADDR_ANY_TYPE_INIT;
|
||||
|
||||
/**
|
||||
* @ingroup ipaddr
|
||||
* Convert numeric IP address (both versions) into ASCII representation.
|
||||
* returns ptr to static buffer; not reentrant!
|
||||
*
|
||||
* @param addr ip address in network order to convert
|
||||
* @return pointer to a global static (!) buffer that holds the ASCII
|
||||
* representation of addr
|
||||
*/
|
||||
char *ipaddr_ntoa(const ip_addr_t *addr)
|
||||
{
|
||||
if (addr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (IP_IS_V6(addr)) {
|
||||
return ip6addr_ntoa(ip_2_ip6(addr));
|
||||
} else {
|
||||
return ip4addr_ntoa(ip_2_ip4(addr));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup ipaddr
|
||||
* Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
|
||||
*
|
||||
* @param addr ip address in network order to convert
|
||||
* @param buf target buffer where the string is stored
|
||||
* @param buflen length of buf
|
||||
* @return either pointer to buf which now holds the ASCII
|
||||
* representation of addr or NULL if buf was too small
|
||||
*/
|
||||
char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)
|
||||
{
|
||||
if (addr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (IP_IS_V6(addr)) {
|
||||
return ip6addr_ntoa_r(ip_2_ip6(addr), buf, buflen);
|
||||
} else {
|
||||
return ip4addr_ntoa_r(ip_2_ip4(addr), buf, buflen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup ipaddr
|
||||
* Convert IP address string (both versions) to numeric.
|
||||
|
@ -281,7 +281,7 @@ ip4addr_ntoa(const ip4_addr_t *addr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
|
||||
* Same as ip4addr_ntoa, but reentrant since a user-supplied buffer is used.
|
||||
*
|
||||
* @param addr ip address in network order to convert
|
||||
* @param buf target buffer where the string is stored
|
||||
|
@ -143,6 +143,9 @@ extern const ip_addr_t ip_addr_any_type;
|
||||
#define ip_addr_set_ip4_u32(ipaddr, val) do{if(ipaddr){ip4_addr_set_u32(ip_2_ip4(ipaddr), val); \
|
||||
IP_SET_TYPE(ipaddr, IPADDR_TYPE_V4); }}while(0)
|
||||
/** @ingroup ip4addr */
|
||||
#define ip_addr_set_ip4_u32_val(ipaddr, val) do{ ip4_addr_set_u32(ip_2_ip4(&(ipaddr)), val); \
|
||||
IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V4); }while(0)
|
||||
/** @ingroup ip4addr */
|
||||
#define ip_addr_get_ip4_u32(ipaddr) (((ipaddr) && IP_IS_V4(ipaddr)) ? \
|
||||
ip4_addr_get_u32(ip_2_ip4(ipaddr)) : 0)
|
||||
/** @ingroup ipaddr */
|
||||
@ -165,10 +168,18 @@ extern const ip_addr_t ip_addr_any_type;
|
||||
ip6_addr_set_any(ip_2_ip6(ipaddr)); IP_SET_TYPE(ipaddr, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set_any(ip_2_ip4(ipaddr)); IP_SET_TYPE(ipaddr, IPADDR_TYPE_V4); }}while(0)
|
||||
/** @ingroup ipaddr */
|
||||
#define ip_addr_set_any_val(is_ipv6, ipaddr) do{if(is_ipv6){ \
|
||||
ip6_addr_set_any(ip_2_ip6(&(ipaddr))); IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set_any(ip_2_ip4(&(ipaddr))); IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V4); }}while(0)
|
||||
/** @ingroup ipaddr */
|
||||
#define ip_addr_set_loopback(is_ipv6, ipaddr) do{if(is_ipv6){ \
|
||||
ip6_addr_set_loopback(ip_2_ip6(ipaddr)); IP_SET_TYPE(ipaddr, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set_loopback(ip_2_ip4(ipaddr)); IP_SET_TYPE(ipaddr, IPADDR_TYPE_V4); }}while(0)
|
||||
/** @ingroup ipaddr */
|
||||
#define ip_addr_set_loopback_val(is_ipv6, ipaddr) do{if(is_ipv6){ \
|
||||
ip6_addr_set_loopback(ip_2_ip6(&(ipaddr))); IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set_loopback(ip_2_ip4(&(ipaddr))); IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V4); }}while(0)
|
||||
/** @ingroup ipaddr */
|
||||
#define ip_addr_set_hton(dest, src) do{if(IP_IS_V6(src)){ \
|
||||
ip6_addr_set_hton(ip_2_ip6(ipaddr), (src)); IP_SET_TYPE(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set_hton(ip_2_ip4(ipaddr), (src)); IP_SET_TYPE(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
@ -214,12 +225,8 @@ extern const ip_addr_t ip_addr_any_type;
|
||||
#define ip_addr_debug_print_val(debug, ipaddr) do { if(IP_IS_V6_VAL(ipaddr)) { \
|
||||
ip6_addr_debug_print_val(debug, *ip_2_ip6(&(ipaddr))); } else { \
|
||||
ip4_addr_debug_print_val(debug, *ip_2_ip4(&(ipaddr))); }}while(0)
|
||||
/** @ingroup ipaddr */
|
||||
#define ipaddr_ntoa(addr) (((addr) == NULL) ? "NULL" : \
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa(ip_2_ip6(addr)) : ip4addr_ntoa(ip_2_ip4(addr))))
|
||||
/** @ingroup ipaddr */
|
||||
#define ipaddr_ntoa_r(addr, buf, buflen) (((addr) == NULL) ? "NULL" : \
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa_r(ip_2_ip6(addr), buf, buflen) : ip4addr_ntoa_r(ip_2_ip4(addr), buf, buflen)))
|
||||
char *ipaddr_ntoa(const ip_addr_t *addr);
|
||||
char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen);
|
||||
int ipaddr_aton(const char *cp, ip_addr_t *addr);
|
||||
|
||||
/** @ingroup ipaddr */
|
||||
|
@ -1101,9 +1101,9 @@ int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
|
||||
ip_addr_t ns;
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
|
||||
ip_addr_set_ip4_u32(&ns, ns1);
|
||||
ip_addr_set_ip4_u32_val(ns, ns1);
|
||||
dns_setserver(0, &ns);
|
||||
ip_addr_set_ip4_u32(&ns, ns2);
|
||||
ip_addr_set_ip4_u32_val(ns, ns2);
|
||||
dns_setserver(1, &ns);
|
||||
return 1;
|
||||
}
|
||||
@ -1118,12 +1118,12 @@ int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
|
||||
nsa = dns_getserver(0);
|
||||
ip_addr_set_ip4_u32(&nsb, ns1);
|
||||
ip_addr_set_ip4_u32_val(nsb, ns1);
|
||||
if (ip_addr_cmp(nsa, &nsb)) {
|
||||
dns_setserver(0, IP_ADDR_ANY);
|
||||
}
|
||||
nsa = dns_getserver(1);
|
||||
ip_addr_set_ip4_u32(&nsb, ns2);
|
||||
ip_addr_set_ip4_u32_val(nsb, ns2);
|
||||
if (ip_addr_cmp(nsa, &nsb)) {
|
||||
dns_setserver(1, IP_ADDR_ANY);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user