From 531ea170887394b6694e927913d52d4534d7e848 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 17 Jun 2007 19:18:59 +0000 Subject: [PATCH] Forgot to implement getsockopt for SO_NO_CHECK --- src/api/sockets.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index 232bad12..6ce39a0f 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -1034,6 +1034,17 @@ int lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optl } break; + case SO_NO_CHECK: + if (*optlen < sizeof(int)) { + err = EINVAL; + } + if ((sock->conn->type != NETCONN_UDP) || + ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { + /* this flag is only available for UDP, not for UDP lite */ + err = EAFNOSUPPORT; + } + break; + default: LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", s, optname)); @@ -1221,6 +1232,9 @@ static void lwip_getsockopt_internal(void *arg) *(int *)optval = sock->conn->recv_timeout; break; #endif /* LWIP_SO_RCVTIMEO */ + case SO_NO_CHECK: + *(int*)optval = (udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_NOCHKSUM) ? 1 : 0; + break; } /* switch (optname) */ break; @@ -1346,7 +1360,7 @@ int lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t err = EINVAL; } if ((sock->conn->type != NETCONN_UDP) || - ((sock->conn->pcb.udp->flags & UDP_FLAGS_UDPLITE) == 1)) { + ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { /* this flag is only available for UDP, not for UDP lite */ err = EAFNOSUPPORT; }