mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-12 04:13:55 +00:00
Implement dual-stack in lwiperf, netbiosns and sntp
This commit is contained in:
parent
b0d4386744
commit
24ebf6bd6f
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user