tree-wide: add helper for IPv4/IPv6 sockopts

A variety of sockopts exist both for IPv4 and IPv6 but require a
different pair of sockopt level/option number. Let's add helpers for
these that internally determine the right sockopt to call.

This should shorten code that generically wants to support both ipv4 +
ipv6 and for the first time adds correct support for some cases where we
only called the ipv4 versions, and not the ipv6 options.
This commit is contained in:
Lennart Poettering
2020-09-11 10:33:13 +02:00
parent 00df39a56a
commit 5d0fe4233b
8 changed files with 202 additions and 90 deletions
+5
View File
@@ -6,6 +6,11 @@
#define IPV6_UNICAST_IF 76
#endif
/* linux/in6.h or netinet/in.h */
#ifndef IPV6_TRANSPARENT
#define IPV6_TRANSPARENT 75
#endif
/* Not exposed but defined at include/net/ip.h */
#ifndef IPV4_MIN_MTU
#define IPV4_MIN_MTU 68