Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions features/net/FEATURE_IPV4/lwip-interface/lwip_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "lwip/dhcp.h"
#include "lwip/tcpip.h"
#include "lwip/tcp.h"
#include "lwip/ip.h"


/* Static arena of sockets */
Expand Down Expand Up @@ -415,6 +416,18 @@ static int lwip_setsockopt(nsapi_stack_t *stack, nsapi_socket_t handle, int leve
s->conn->pcb.tcp->keep_intvl = *(int*)optval;
return 0;

case NSAPI_REUSEADDR:
if (optlen != sizeof(int)) {
return NSAPI_ERROR_UNSUPPORTED;
}

if (*(int *)optval) {
s->conn->pcb.tcp->so_options |= SOF_REUSEADDR;
} else {
s->conn->pcb.tcp->so_options &= ~SOF_REUSEADDR;
}
return 0;

default:
return NSAPI_ERROR_UNSUPPORTED;
}
Expand Down
2 changes: 2 additions & 0 deletions features/net/FEATURE_IPV4/lwip-interface/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
#define LWIP_DHCP 1
#define LWIP_DNS 1

#define SO_REUSE 1

// Support Multicast
#include "stdlib.h"
#define LWIP_IGMP 1
Expand Down