summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/icmp6-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network/icmp6-util.c')
-rw-r--r--src/libsystemd-network/icmp6-util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/icmp6-util.c
index d81e9ebd88..c2e4b0e9e3 100644
--- a/src/libsystemd-network/icmp6-util.c
+++ b/src/libsystemd-network/icmp6-util.c
@@ -49,7 +49,8 @@ int icmp6_bind_router_solicitation(int index) {
};
_cleanup_close_ int s = -1;
char ifname[IF_NAMESIZE] = "";
- int r, zero = 0, one = 1, hops = 255;
+ static const int zero = 0, one = 1, hops = 255;
+ int r;
s = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_ICMPV6);
if (s < 0)
@@ -85,6 +86,10 @@ int icmp6_bind_router_solicitation(int index) {
if (r < 0)
return -errno;
+ r = setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one));
+ if (r < 0)
+ return -errno;
+
if (if_indextoname(index, ifname) == 0)
return -errno;