}
- #ifdef IP_MINTTL
-#ifndef IPV6
--
-static int
+static inline char *
sk_set_min_ttl4(sock *s, int ttl)
{
if (setsockopt(s->fd, IPPROTO_IP, IP_MINTTL, &ttl, sizeof(ttl)) < 0)
- {
- if (errno == ENOPROTOOPT)
- log(L_ERR "Kernel does not support IPv4 TTL security");
- else
- log(L_ERR "sk_set_min_ttl4: setsockopt: %m");
-
- return -1;
- }
+ return "IP_MINTTL";
- return 0;
+ return NULL;
}
- #else /* no IP_MINTTL */
-
- static inline char *
- sk_set_min_ttl4(sock *s, int ttl)
- {
- errno = ENOPROTOOPT;
- return "IP_MINTTL";
- }
-
- #endif
-#else /* IPv6 */
--
-static int
+static inline char *
sk_set_min_ttl6(sock *s, int ttl)
{
- log(L_ERR "IPv6 TTL security not supported");
- return -1;
+ errno = ENOPROTOOPT;
+ return "IP_MINTTL";
}
-#endif
-
int sk_priority_control = -1;