diff options
| author | Roy Marples <roy@marples.name> | 2019-01-22 14:51:42 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-01-22 14:51:42 +0000 |
| commit | 3250805123f455a7aa1477ccf5d69598dd9f0935 (patch) | |
| tree | 67ecbc6db3f33341e86a4bb7b4750cbe68c46cc5 /src/if.c | |
| parent | 57d586821dd9ffcccce8adb3b6302eaf5efd70e6 (diff) | |
| download | dhcpcd-3250805123f455a7aa1477ccf5d69598dd9f0935.tar.xz | |
BSD: Turn on SO_RERROR for all sockets
So we can detect IPv6ND or DHCPv6 overflow as well as route(4)
overflow.
Diffstat (limited to 'src/if.c')
| -rw-r--r-- | src/if.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -790,6 +790,9 @@ xsocket(int domain, int type, int protocol) #if !defined(HAVE_SOCK_CLOEXEC) || !defined(HAVE_SOCK_NONBLOCK) int xflags, xtype = type; #endif +#ifdef SO_RERROR + int on; +#endif #ifndef HAVE_SOCK_CLOEXEC if (xtype & SOCK_CLOEXEC) @@ -814,6 +817,13 @@ xsocket(int domain, int type, int protocol) goto out; #endif +#ifdef SO_RERROR + /* Tell recvmsg(2) to return ENOBUFS if the receiving socket overflows. */ + on = 1; + if (setsockopt(s, SOL_SOCKET, SO_RERROR, &on, sizeof(on)) == -1) + logerr("%s: SO_RERROR", __func__); +#endif + return s; #if !defined(HAVE_SOCK_CLOEXEC) || !defined(HAVE_SOCK_NONBLOCK) |
