|
Line 0
Link Here
|
|
|
1 |
--- dhcp6c.c.orig 2008-06-15 07:48:41 UTC |
| 2 |
+++ dhcp6c.c |
| 3 |
@@ -67,6 +67,7 @@ |
| 4 |
#include <string.h> |
| 5 |
#include <err.h> |
| 6 |
#include <ifaddrs.h> |
| 7 |
+#include <fcntl.h> |
| 8 |
|
| 9 |
#include <dhcp6.h> |
| 10 |
#include <config.h> |
| 11 |
@@ -257,7 +258,7 @@ client6_init() |
| 12 |
{ |
| 13 |
struct addrinfo hints, *res; |
| 14 |
static struct sockaddr_in6 sa6_allagent_storage; |
| 15 |
- int error, on = 1; |
| 16 |
+ int error, on = 0; |
| 17 |
|
| 18 |
/* get our DUID */ |
| 19 |
if (get_duid(DUID_FILE, &client_duid)) { |
| 20 |
@@ -287,6 +288,20 @@ client6_init() |
| 21 |
dprintf(LOG_ERR, FNAME, "socket"); |
| 22 |
exit(1); |
| 23 |
} |
| 24 |
+ |
| 25 |
+ if ((on = fcntl(sock, F_GETFL, 0)) == -1) { |
| 26 |
+ dprintf(LOG_ERR, FNAME, "fctnl getflags"); |
| 27 |
+ exit(1); |
| 28 |
+ } |
| 29 |
+ |
| 30 |
+ on |= FD_CLOEXEC; |
| 31 |
+ |
| 32 |
+ if ((on = fcntl(sock, F_SETFL, on)) == -1) { |
| 33 |
+ dprintf(LOG_ERR, FNAME, "fctnl setflags"); |
| 34 |
+ exit(1); |
| 35 |
+ } |
| 36 |
+ |
| 37 |
+ on = 1; |
| 38 |
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, |
| 39 |
&on, sizeof(on)) < 0) { |
| 40 |
dprintf(LOG_ERR, FNAME, |
| 41 |
@@ -1828,15 +1843,6 @@ client6_recvreply(ifp, dh6, len, optinfo |
| 42 |
} |
| 43 |
|
| 44 |
/* |
| 45 |
- * Call the configuration script, if specified, to handle various |
| 46 |
- * configuration parameters. |
| 47 |
- */ |
| 48 |
- if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) { |
| 49 |
- dprintf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath); |
| 50 |
- client6_script(ifp->scriptpath, state, optinfo); |
| 51 |
- } |
| 52 |
- |
| 53 |
- /* |
| 54 |
* Set refresh timer for configuration information specified in |
| 55 |
* information-request. If the timer value is specified by the server |
| 56 |
* in an information refresh time option, use it; use the protocol |
| 57 |
@@ -1888,6 +1894,15 @@ client6_recvreply(ifp, dh6, len, optinfo |
| 58 |
&optinfo->serverID, ev->authparam); |
| 59 |
} |
| 60 |
|
| 61 |
+ /* |
| 62 |
+ * Call the configuration script, if specified, to handle various |
| 63 |
+ * configuration parameters. |
| 64 |
+ */ |
| 65 |
+ if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) { |
| 66 |
+ dprintf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath); |
| 67 |
+ client6_script(ifp->scriptpath, state, optinfo); |
| 68 |
+ } |
| 69 |
+ |
| 70 |
dhcp6_remove_event(ev); |
| 71 |
|
| 72 |
if (state == DHCP6S_RELEASE) { |