SO_REUSEADDR / SO_REUSE is implemented and safe to use

This commit is contained in:
goldsimon 2010-05-12 22:34:06 +00:00
parent d0348e0c60
commit baeb41f5f4
2 changed files with 25 additions and 7 deletions

View File

@ -206,11 +206,6 @@
#ifdef ETHARP_ALWAYS_INSERT
#error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h."
#endif
#if SO_REUSE
/* I removed the lot since this was an ugly hack. It broke the raw-API.
It also came with many ugly goto's, Christiaan Simons. */
#error "SO_REUSE currently unavailable, this was a hack"
#endif
#ifdef LWIP_DEBUG
static void
@ -237,6 +232,29 @@ lwip_sanity_check(void)
if (TCP_WND < TCP_MSS)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is smaller than MSS\n"));
#endif /* LWIP_TCP */
#if LWIP_SOCKET
/* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
if (SO_DEBUG != SOF_DEBUG)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_DEBUG != SOF_DEBUG\n"));
if (SO_ACCEPTCONN != SOF_ACCEPTCONN)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_ACCEPTCONN != SOF_ACCEPTCONN\n"));
if (SO_REUSEADDR != SOF_REUSEADDR)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_REUSEADDR != SOF_REUSEADDR\n"));
if (SO_KEEPALIVE != SOF_KEEPALIVE)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_KEEPALIVE != SOF_KEEPALIVE\n"));
if (SO_DONTROUTE != SOF_DONTROUTE)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_DONTROUTE != SOF_DONTROUTE\n"));
if (SO_BROADCAST != SOF_BROADCAST)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_BROADCAST != SOF_BROADCAST\n"));
/*if (SO_USELOOPBACK != SOF_USELOOPBACK)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_USELOOPBACK != SOF_USELOOPBACK\n"));*/
if (SO_LINGER != SOF_LINGER)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_LINGER != SOF_LINGER\n"));
if (SO_OOBINLINE != SOF_OOBINLINE)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_OOBINLINE != SOF_OOBINLINE\n"));
/*if (SO_REUSEPORT != SOF_REUSEPORT)
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_REUSEPORT != SOF_REUSEPORT\n"));*/
#endif /* LWIP_SOCKET */
}
#else /* LWIP_DEBUG */
#define lwip_sanity_check()

View File

@ -72,11 +72,11 @@ struct sockaddr {
#define SOCK_RAW 3
/*
* Option flags per-socket. These must match the SOF_ flags in ip.h!
* Option flags per-socket. These must match the SOF_ flags in ip.h (checked in init.c)
*/
#define SO_DEBUG 0x0001 /* Unimplemented: turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* Unimplemented: allow local address reuse */
#define SO_REUSEADDR 0x0004 /* Allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* Unimplemented: just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */