Minor code cleanup in udp.c

This commit is contained in:
Dirk Ziegelmeier 2016-03-03 22:44:01 +01:00
parent b5cd90a342
commit 2d80af1dcb

View File

@ -154,11 +154,11 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
/* Dual-stack: PCBs listening to any IP type also listen to any IP address */ /* Dual-stack: PCBs listening to any IP type also listen to any IP address */
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) { if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
#if IP_SOF_BROADCAST_RECV #if LWIP_IPV4 && IP_SOF_BROADCAST_RECV
if(broadcast && !ip_get_option(pcb, SOF_BROADCAST)) { if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
return 0; return 0;
} }
#endif /* IP_SOF_BROADCAST_RECV */ #endif /* LWIP_IPV4 && IP_SOF_BROADCAST_RECV */
return 1; return 1;
} }
@ -182,18 +182,16 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
} }
} else } else
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */
{ /* Handle IPv4 and IPv6: all, multicast or exact match */
/* Handle IPv4 and IPv6: all, multicast or exact match */ if(ip_addr_isany(&pcb->local_ip) ||
if(ip_addr_isany(&pcb->local_ip) ||
#if LWIP_IPV6_MLD #if LWIP_IPV6_MLD
(ip_current_is_v6() && ip6_addr_ismulticast(ip6_current_dest_addr())) || (ip_current_is_v6() && ip6_addr_ismulticast(ip6_current_dest_addr())) ||
#endif /* LWIP_IPV6_MLD */ #endif /* LWIP_IPV6_MLD */
#if LWIP_IGMP #if LWIP_IGMP
(!ip_current_is_v6() && ip4_addr_ismulticast(ip4_current_dest_addr())) || (!ip_current_is_v6() && ip4_addr_ismulticast(ip4_current_dest_addr())) ||
#endif /* LWIP_IGMP */ #endif /* LWIP_IGMP */
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
return 1; return 1;
}
} }
} }
@ -1123,7 +1121,7 @@ udp_new(void)
/** /**
* Create a UDP PCB for specific IP type. * Create a UDP PCB for specific IP type.
* *
* @param IP address type, see IPADDR_TYPE_XX definitions. * @param type IP address type, see IPADDR_TYPE_XX definitions.
* @return The UDP PCB which was created. NULL if the PCB data structure * @return The UDP PCB which was created. NULL if the PCB data structure
* could not be allocated. * could not be allocated.
* *