diff options
Diffstat (limited to 'lib/sockunion.c')
| -rw-r--r-- | lib/sockunion.c | 40 | 
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c index 10224a05..59770529 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -527,6 +527,46 @@ sockopt_ttl (int family, int sock, int ttl)  }  int +sockopt_cork (int sock, int onoff) +{ +#ifdef TCP_CORK +  return setsockopt (sock, IPPROTO_TCP, TCP_CORK, &onoff, sizeof(onoff)); +#else +  return 0; +#endif +} + +int +sockopt_minttl (int family, int sock, int minttl) +{ +#ifdef IP_MINTTL +  if (family == AF_INET) +    { +      int ret = setsockopt (sock, IPPROTO_IP, IP_MINTTL, &minttl, sizeof(minttl)); +      if (ret < 0) +	  zlog (NULL, LOG_WARNING, +		"can't set sockopt IP_MINTTL to %d on socket %d: %s", +		minttl, sock, safe_strerror (errno)); +      return ret; +    } +#endif /* IP_MINTTL */ +#ifdef IPV6_MINHOPCNT +  if (family == AF_INET6) +    { +      int ret = setsockopt (sock, IPPROTO_IPV6, IPV6_MINHOPCNT, &minttl, sizeof(minttl)); +      if (ret < 0) +	  zlog (NULL, LOG_WARNING, +		"can't set sockopt IPV6_MINHOPCNT to %d on socket %d: %s", +		minttl, sock, safe_strerror (errno)); +      return ret; +    } +#endif + +  errno = EOPNOTSUPP; +  return -1; +} + +int  sockopt_v6only (int family, int sock)  {    int ret, on = 1;  | 
