mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-09-27 03:03:45 +08:00
Added some macros with extension "_val" that work on actual instances and leave away the "if != NULL" check to get rid of gcc "-Waddress" warnings in the core code at least (I might not have caught all of them, yet)
This commit is contained in:
@@ -1037,7 +1037,7 @@ dhcp_bind(struct netif *netif)
|
||||
|
||||
ip4_addr_copy(gw_addr, dhcp->offered_gw_addr);
|
||||
/* gateway address not given? */
|
||||
if (ip4_addr_isany(&gw_addr)) {
|
||||
if (ip4_addr_isany_val(gw_addr)) {
|
||||
/* copy network address */
|
||||
ip4_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
|
||||
/* use first host address on network as gateway */
|
||||
|
||||
@@ -308,9 +308,9 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
|
||||
|
||||
iphdr = (struct ip_hdr *)p->payload;
|
||||
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
|
||||
ip4_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
|
||||
ip4_addr_debug_print_val(ICMP_DEBUG, iphdr->src);
|
||||
LWIP_DEBUGF(ICMP_DEBUG, (" to "));
|
||||
ip4_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
|
||||
ip4_addr_debug_print_val(ICMP_DEBUG, iphdr->dest);
|
||||
LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
|
||||
|
||||
icmphdr = (struct icmp_echo_hdr *)q->payload;
|
||||
|
||||
@@ -1421,7 +1421,7 @@ void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni)
|
||||
/* route to the network address */
|
||||
ip4_addr_get_network(&dst, &ni->ip_addr, &ni->netmask);
|
||||
/* exclude 0.0.0.0 network (reserved for default rte) */
|
||||
if (!ip4_addr_isany(&dst)) {
|
||||
if (!ip4_addr_isany_val(dst)) {
|
||||
insert = 1;
|
||||
}
|
||||
}
|
||||
@@ -1498,7 +1498,7 @@ void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni)
|
||||
/* route to the network address */
|
||||
ip4_addr_get_network(&dst, &ni->ip_addr, &ni->netmask);
|
||||
/* exclude 0.0.0.0 network (reserved for default rte) */
|
||||
if (!ip4_addr_isany(&dst)) {
|
||||
if (!ip4_addr_isany_val(dst)) {
|
||||
del = 1;
|
||||
}
|
||||
}
|
||||
@@ -3219,7 +3219,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
ident = od->id_inst_ptr;
|
||||
snmp_oidtoip(&ident[1], &dest);
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* ip_route() uses default netif for default route */
|
||||
netif = netif_default;
|
||||
@@ -3244,7 +3244,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
ip4_addr_t *dst = (ip4_addr_t*)value;
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* default rte has 0.0.0.0 dest */
|
||||
ip4_addr_set_zero(dst);
|
||||
@@ -3267,7 +3267,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
s32_t *sint_ptr = (s32_t*)value;
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* default rte has metric 1 */
|
||||
*sint_ptr = 1;
|
||||
@@ -3293,7 +3293,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
ip4_addr_t *dst = (ip4_addr_t*)value;
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* default rte: gateway */
|
||||
*dst = netif->gw;
|
||||
@@ -3309,7 +3309,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
s32_t *sint_ptr = (s32_t*)value;
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* default rte is indirect */
|
||||
*sint_ptr = 4;
|
||||
@@ -3340,7 +3340,7 @@ ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
ip4_addr_t *dst = (ip4_addr_t*)value;
|
||||
|
||||
if (ip4_addr_isany(&dest))
|
||||
if (ip4_addr_isany_val(dest))
|
||||
{
|
||||
/* default rte use 0.0.0.0 mask */
|
||||
ip4_addr_set_zero(dst);
|
||||
|
||||
@@ -244,7 +244,7 @@ snmp_send_trap(s8_t generic_trap, const struct snmp_obj_id *eoid, s32_t specific
|
||||
ip_route_get_local_ip(PCB_ISIPV6(trap_msg.pcb), &trap_msg.pcb->local_ip,
|
||||
&td->dip, dst_if, dst_ip, &dst_ip_storage);
|
||||
if ((dst_if != NULL) && (dst_ip != NULL)) {
|
||||
trap_msg.sip_raw_len = (IP_IS_V6_L(dst_ip) ? 16 : 4);
|
||||
trap_msg.sip_raw_len = (IP_IS_V6_VAL(dst_ip) ? 16 : 4);
|
||||
memcpy(trap_msg.sip_raw, dst_ip, trap_msg.sip_raw_len);
|
||||
trap_msg.gen_trap = generic_trap;
|
||||
trap_msg.spc_trap = specific_trap;
|
||||
|
||||
@@ -1845,7 +1845,7 @@ tcp_netif_ipv4_addr_changed_pcblist(const ip4_addr_t* old_addr, struct tcp_pcb*
|
||||
pcb = pcb_list;
|
||||
while (pcb != NULL) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (!IP_IS_V6_L(&pcb->local_ip) && ip4_addr_cmp(ip_2_ip4(&pcb->local_ip), old_addr)
|
||||
if (!IP_IS_V6_VAL(&pcb->local_ip) && ip4_addr_cmp(ip_2_ip4(&pcb->local_ip), old_addr)
|
||||
#if LWIP_AUTOIP
|
||||
/* connections to link-local addresses must persist (RFC3927 ch. 1.9) */
|
||||
&& !ip4_addr_islinklocal(ip_2_ip4(&pcb->local_ip))
|
||||
@@ -1879,7 +1879,7 @@ void tcp_netif_ipv4_addr_changed(const ip4_addr_t* old_addr, const ip4_addr_t* n
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = next) {
|
||||
next = lpcb->next;
|
||||
/* Is this an IPv4 pcb? */
|
||||
if (!IP_IS_V6_L(&lpcb->local_ip)) {
|
||||
if (!IP_IS_V6_VAL(&lpcb->local_ip)) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if ((!(ip4_addr_isany(ip_2_ip4(&lpcb->local_ip)))) &&
|
||||
(ip4_addr_cmp(ip_2_ip4(&lpcb->local_ip), old_addr))) {
|
||||
|
||||
@@ -1161,7 +1161,7 @@ void udp_netif_ipv4_addr_changed(const ip4_addr_t* old_addr, const ip4_addr_t* n
|
||||
if (!ip4_addr_isany(new_addr)) {
|
||||
for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
|
||||
/* Is this an IPv4 pcb? */
|
||||
if (!IP_IS_V6_L(&upcb->local_ip)) {
|
||||
if (!IP_IS_V6_VAL(&upcb->local_ip)) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (!ip4_addr_isany(ip_2_ip4(&upcb->local_ip)) &&
|
||||
ip4_addr_cmp(ip_2_ip4(&upcb->local_ip), old_addr)) {
|
||||
|
||||
Reference in New Issue
Block a user