socket: on ipv6 try to use IPV6_UNICAST_HOPS sockopt

This commit is contained in:
Lennart Poettering 2010-07-01 15:27:30 +02:00
parent 01b1b079c1
commit 46925ac5a8
1 changed files with 9 additions and 3 deletions

View File

@ -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) if (setsockopt(fd, IPPROTO_IP, IP_TOS, &s->ip_tos, sizeof(s->ip_tos)) < 0)
log_warning("IP_TOS failed: %m"); log_warning("IP_TOS failed: %m");
if (s->ip_ttl >= 0) if (s->ip_ttl >= 0) {
if (setsockopt(fd, IPPROTO_IP, IP_TTL, &s->ip_ttl, sizeof(s->ip_ttl)) < 0) int r, x;
log_warning("IP_TTL failed: %m");
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) { static void socket_apply_pipe_options(Socket *s, int fd) {