From 2d80af1dcb5585c9ba548fd94917438dc9f965ec Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 3 Mar 2016 22:44:01 +0100 Subject: [PATCH] Minor code cleanup in udp.c --- src/core/udp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/core/udp.c b/src/core/udp.c index ec5d8bb4..37ae2c17 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -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 */ if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) { -#if IP_SOF_BROADCAST_RECV - if(broadcast && !ip_get_option(pcb, SOF_BROADCAST)) { +#if LWIP_IPV4 && IP_SOF_BROADCAST_RECV + if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) { return 0; } -#endif /* IP_SOF_BROADCAST_RECV */ +#endif /* LWIP_IPV4 && IP_SOF_BROADCAST_RECV */ return 1; } @@ -182,18 +182,16 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast) } } else #endif /* LWIP_IPV4 */ - { - /* Handle IPv4 and IPv6: all, multicast or exact match */ - if(ip_addr_isany(&pcb->local_ip) || + /* Handle IPv4 and IPv6: all, multicast or exact match */ + if(ip_addr_isany(&pcb->local_ip) || #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 */ #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 */ - ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { - return 1; - } + ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { + return 1; } } @@ -1123,7 +1121,7 @@ udp_new(void) /** * 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 * could not be allocated. *