From: Roy Marples Date: Tue, 25 Apr 2017 19:47:53 +0000 (+0100) Subject: Because dhcpcd now binds to the interfaces LL address when not X-Git-Tag: v7.0.0-rc1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b79f15cc295e44aae58a76e0f5397e2494f8f3b;p=thirdparty%2Fdhcpcd.git Because dhcpcd now binds to the interfaces LL address when not running in master mode, the socket options SO_REUSEADDR and SO_REUSEPORT can be dropped. If there is a problem binding the socket, log an error. --- diff --git a/src/dhcp6.c b/src/dhcp6.c index dfa8d91d..3b304f38 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -3213,11 +3213,6 @@ dhcp6_open(struct dhcpcd_ctx *ctx) ctx->dhcp6_fd = xsocket(PF_INET6, SOCK_DGRAM | SOCK_FLAGS, IPPROTO_UDP); #undef SOCK_FLAGS if (ctx->dhcp6_fd == -1) - return -1; - - n = 1; - if (setsockopt(ctx->dhcp6_fd, SOL_SOCKET, SO_REUSEADDR, - &n, sizeof(n)) == -1) goto errexit; n = 1; @@ -3225,13 +3220,6 @@ dhcp6_open(struct dhcpcd_ctx *ctx) &n, sizeof(n)) == -1) goto errexit; -#ifdef SO_REUSEPORT - n = 1; - if (setsockopt(ctx->dhcp6_fd, SOL_SOCKET, SO_REUSEPORT, - &n, sizeof(n)) == -1) - logerr("SO_REUSEPORT"); -#endif - if (!(ctx->options & DHCPCD_MASTER)) { /* Bind to the link-local address to allow more than one * DHCPv6 client to work. */ @@ -3260,8 +3248,11 @@ dhcp6_open(struct dhcpcd_ctx *ctx) return 0; errexit: - close(ctx->dhcp6_fd); - ctx->dhcp6_fd = -1; + logerr(__func__); + if (ctx->dhcp6_fd != -1) { + close(ctx->dhcp6_fd); + ctx->dhcp6_fd = -1; + } return -1; }