summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-01 15:27:30 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-01 15:27:30 +0200
commit46925ac5a8fb5162a07aabe21536af500a49d3ae (patch)
tree06c3ba9db965c3da5f7c12ec68df9d97bfd4b8b5 /src
parent01b1b079c1de830dcd4a7b42675864ce7d6d84f3 (diff)
socket: on ipv6 try to use IPV6_UNICAST_HOPS sockopt
Diffstat (limited to 'src')
-rw-r--r--src/socket.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c
index 7e62dbce96..00fb568b02 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -577,9 +577,15 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (setsockopt(fd, IPPROTO_IP, IP_TOS, &s->ip_tos, sizeof(s->ip_tos)) < 0)
log_warning("IP_TOS failed: %m");
- if (s->ip_ttl >= 0)
- if (setsockopt(fd, IPPROTO_IP, IP_TTL, &s->ip_ttl, sizeof(s->ip_ttl)) < 0)
- log_warning("IP_TTL failed: %m");
+ if (s->ip_ttl >= 0) {
+ int r, x;
+
+ r = setsockopt(fd, IPPROTO_IP, IP_TTL, &s->ip_ttl, sizeof(s->ip_ttl));
+ x = setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &s->ip_ttl, sizeof(s->ip_ttl));
+
+ if (r < 0 && x < 0)
+ log_warning("IP_TTL/IPV6_UNICAST_HOPS failed: %m");
+ }
}
static void socket_apply_pipe_options(Socket *s, int fd) {