Skip to content

lwIP: fix some IPv6 errors, eg TCP keepalive #6416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2018
Merged
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
10 changes: 5 additions & 5 deletions features/FEATURE_LWIP/lwip-interface/lwip_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,9 +1125,9 @@ static nsapi_error_t mbed_lwip_socket_bind(nsapi_stack_t *stack, nsapi_socket_t

if (
#if LWIP_TCP
(s->conn->type == NETCONN_TCP && s->conn->pcb.tcp->local_port != 0) ||
(NETCONNTYPE_GROUP(s->conn->type) == NETCONN_TCP && s->conn->pcb.tcp->local_port != 0) ||
#endif
(s->conn->type == NETCONN_UDP && s->conn->pcb.udp->local_port != 0)) {
(NETCONNTYPE_GROUP(s->conn->type) == NETCONN_UDP && s->conn->pcb.udp->local_port != 0)) {
return NSAPI_ERROR_PARAMETER;
}

Expand Down Expand Up @@ -1307,23 +1307,23 @@ static nsapi_error_t mbed_lwip_setsockopt(nsapi_stack_t *stack, nsapi_socket_t h
switch (optname) {
#if LWIP_TCP
case NSAPI_KEEPALIVE:
if (optlen != sizeof(int) || s->conn->type != NETCONN_TCP) {
if (optlen != sizeof(int) || NETCONNTYPE_GROUP(s->conn->type) != NETCONN_TCP) {
return NSAPI_ERROR_UNSUPPORTED;
}

s->conn->pcb.tcp->so_options |= SOF_KEEPALIVE;
return 0;

case NSAPI_KEEPIDLE:
if (optlen != sizeof(int) || s->conn->type != NETCONN_TCP) {
if (optlen != sizeof(int) || NETCONNTYPE_GROUP(s->conn->type) != NETCONN_TCP) {
return NSAPI_ERROR_UNSUPPORTED;
}

s->conn->pcb.tcp->keep_idle = *(int*)optval;
return 0;

case NSAPI_KEEPINTVL:
if (optlen != sizeof(int) || s->conn->type != NETCONN_TCP) {
if (optlen != sizeof(int) || NETCONNTYPE_GROUP(s->conn->type) != NETCONN_TCP) {
return NSAPI_ERROR_UNSUPPORTED;
}

Expand Down