[7.0] 258471a36 vca: Remove the tcp_opt::iponly field

Nils Goroll nils.goroll at uplex.de
Wed Nov 17 11:44:06 UTC 2021


commit 258471a366bccbd58fee3ae2d6766bda21f71354
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Sep 27 07:18:29 2021 +0200

    vca: Remove the tcp_opt::iponly field
    
    It is a 1:1 mapping with IPPROTO_TCP, so TCP_NODELAY was moved down to
    be with the other IPPROTO_TCP options.
    
    Conflicts:
            bin/varnishd/cache/cache_acceptor.c

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 33dc99130..e55a262fd 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -87,26 +87,23 @@ static struct tcp_opt {
 	socklen_t	sz;
 	void		*ptr;
 	int		need;
-	int		iponly;
 } tcp_opts[] = {
-#define TCPO(lvl, nam, sz, ip) { lvl, nam, #nam, sizeof(sz), 0, 0, ip},
-
-	TCPO(SOL_SOCKET, SO_LINGER, struct linger, 0)
-	TCPO(SOL_SOCKET, SO_KEEPALIVE, int, 0)
-	TCPO(IPPROTO_TCP, TCP_NODELAY, int, 1)
+#define TCPO(lvl, nam, typ) { lvl, nam, #nam, sizeof(typ), NULL, 0 },
 
+	TCPO(SOL_SOCKET, SO_LINGER, struct linger)
+	TCPO(SOL_SOCKET, SO_KEEPALIVE, int)
 #ifdef SO_SNDTIMEO_WORKS
-	TCPO(SOL_SOCKET, SO_SNDTIMEO, struct timeval, 0)
+	TCPO(SOL_SOCKET, SO_SNDTIMEO, struct timeval)
 #endif
-
 #ifdef SO_RCVTIMEO_WORKS
-	TCPO(SOL_SOCKET, SO_RCVTIMEO, struct timeval, 0)
+	TCPO(SOL_SOCKET, SO_RCVTIMEO, struct timeval)
 #endif
 
+	TCPO(IPPROTO_TCP, TCP_NODELAY, int)
 #ifdef HAVE_TCP_KEEP
-	TCPO(IPPROTO_TCP, TCP_KEEPIDLE, int, 1)
-	TCPO(IPPROTO_TCP, TCP_KEEPCNT, int, 1)
-	TCPO(IPPROTO_TCP, TCP_KEEPINTVL, int, 1)
+	TCPO(IPPROTO_TCP, TCP_KEEPIDLE, int)
+	TCPO(IPPROTO_TCP, TCP_KEEPCNT, int)
+	TCPO(IPPROTO_TCP, TCP_KEEPINTVL, int)
 #endif
 
 #undef TCPO
@@ -229,7 +226,7 @@ vca_tcp_opt_test(const int sock, const unsigned uds)
 
 	for (n = 0; n < n_tcp_opts; n++) {
 		to = &tcp_opts[n];
-		if (to->iponly && uds)
+		if (to->level == IPPROTO_TCP && uds)
 			continue;
 		to->need = 1;
 		ptr = calloc(1, to->sz);
@@ -252,7 +249,7 @@ vca_tcp_opt_set(const int sock, const unsigned uds, const int force)
 
 	for (n = 0; n < n_tcp_opts; n++) {
 		to = &tcp_opts[n];
-		if (to->iponly && uds)
+		if (to->level == IPPROTO_TCP && uds)
 			continue;
 		if (to->need || force) {
 			VTCP_Assert(setsockopt(sock,


More information about the varnish-commit mailing list