lib: add TCP_CORK wrapper
* sockunion.{c,h}: (sockopt_cork) wrapper for TCP_CORK socket option for
those platforms that provide it. For other platforms, it is just a nop.
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 6a40f33..f6c060f 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -527,6 +527,16 @@
return 0;
}
+int
+sockopt_cork (int sock, int onoff)
+{
+#ifdef TCP_CORK
+ return setsockopt (sock, IPPROTO_TCP, TCP_CORK, &onoff, sizeof(onoff));
+#else
+ return 0;
+#endif
+}
+
/* If same family and same prefix return 1. */
int
sockunion_same (union sockunion *su1, union sockunion *su2)