]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sock: add interface and namespace length to xfer_sock_list
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Aug 2020 14:35:06 +0000 (16:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Aug 2020 16:51:36 +0000 (18:51 +0200)
This will ease and speed up comparisons in FD lookups.

include/haproxy/sock-t.h
src/haproxy.c

index 999c16f1d4dbd7fe0cb503964111a1106972887d..ee803abbdbc1dce59513e37669d34b61116befd3 100644 (file)
@@ -33,6 +33,8 @@ struct xfer_sock_list {
        int options; /* socket options as LI_O_* */
        char *iface;
        char *namespace;
+       int if_namelen;
+       int ns_namelen;
        struct xfer_sock_list *prev;
        struct xfer_sock_list *next;
        struct sockaddr_storage addr;
index 83812695e7056faa58988f2a558686a38b6904a7..7eb5c0e9a46f142778308c63c51d3126360dec00 100644 (file)
@@ -1275,6 +1275,7 @@ static int get_old_sockets(const char *unixsocket)
                        }
                        memcpy(xfer_sock->namespace, &tmpbuf[curoff], len);
                        xfer_sock->namespace[len] = 0;
+                       xfer_sock->ns_namelen = len;
                        curoff += len;
                }
                if (curoff >= maxoff) {
@@ -1295,6 +1296,7 @@ static int get_old_sockets(const char *unixsocket)
                        }
                        memcpy(xfer_sock->iface, &tmpbuf[curoff], len);
                        xfer_sock->iface[len] = 0;
+                       xfer_sock->if_namelen = len;
                        curoff += len;
                }
                if (curoff + sizeof(int) > maxoff) {