diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index 8ce9e2d1..dcbac36a 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -587,6 +587,9 @@ lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port, { err_t err; struct tcp_pcb* pcb; + if(local_addr == NULL) { + return NULL; + } lwiperf_state_tcp_t* s = (lwiperf_state_tcp_t*)LWIPERF_ALLOC(lwiperf_state_tcp_t); if (s == NULL) { return NULL; @@ -597,7 +600,11 @@ lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port, s->report_fn = report_fn; s->report_arg = report_arg; - pcb = tcp_new(); + if(IP_IS_ANY_TYPE_VAL(*local_addr)) { + pcb = tcp_new_ip_type(IPADDR_TYPE_ANY); + } else { + pcb = tcp_new(); + } if (pcb != NULL) { err = tcp_bind(pcb, local_addr, local_port); if (err == ERR_OK) { diff --git a/src/apps/netbiosns/netbiosns.c b/src/apps/netbiosns/netbiosns.c index 1de41255..5048a32f 100644 --- a/src/apps/netbiosns/netbiosns.c +++ b/src/apps/netbiosns/netbiosns.c @@ -315,11 +315,11 @@ netbiosns_init(void) LWIP_ASSERT("NetBIOS name is too long!", strlen(NETBIOS_LWIP_NAME) < NETBIOS_NAME_LEN); #endif - netbiosns_pcb = udp_new(); + netbiosns_pcb = udp_new_ip_type(IPADDR_TYPE_ANY); if (netbiosns_pcb != NULL) { /* we have to be allowed to send broadcast packets! */ netbiosns_pcb->so_options |= SOF_BROADCAST; - udp_bind(netbiosns_pcb, IP_ADDR_ANY, NETBIOS_PORT); + udp_bind(netbiosns_pcb, IP_ANY_TYPE, NETBIOS_PORT); udp_recv(netbiosns_pcb, netbiosns_recv, netbiosns_pcb); } } diff --git a/src/apps/sntp/sntp.c b/src/apps/sntp/sntp.c index 4578162d..fd819f5f 100644 --- a/src/apps/sntp/sntp.c +++ b/src/apps/sntp/sntp.c @@ -538,7 +538,7 @@ sntp_init(void) #endif /* SNTP_SERVER_ADDRESS */ if (sntp_pcb == NULL) { - sntp_pcb = udp_new(); + sntp_pcb = udp_new_ip_type(IPADDR_TYPE_ANY); LWIP_ASSERT("Failed to allocate udp pcb for sntp client", sntp_pcb != NULL); if (sntp_pcb != NULL) { udp_recv(sntp_pcb, sntp_recv, NULL); @@ -552,7 +552,7 @@ sntp_init(void) #endif } else if (sntp_opmode == SNTP_OPMODE_LISTENONLY) { ip_set_option(sntp_pcb, SOF_BROADCAST); - udp_bind(sntp_pcb, IP_ADDR_ANY, SNTP_PORT); + udp_bind(sntp_pcb, IP_ANY_TYPE, SNTP_PORT); } } }