]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add socket address length to the protocols
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 11:09:45 +0000 (12:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 11:09:45 +0000 (12:09 +0100)
The protocol struct can be more useful if it also provides
address lengths. Add sock_addrlen, as used by bind(), as
well as l3_addrlen for hashes.

include/types/protocols.h
src/proto_uxst.c

index a21f9a4a6ccd8f3757ac595c87ae781bb7d1ce48..a2b522239deb46945e4ef095f482b62d4501e230 100644 (file)
@@ -78,6 +78,8 @@ struct protocol {
        int sock_type;                                  /* socket type, as passed to socket()     */
        int sock_prot;                                  /* socket protocol, as passed to socket() */
        sa_family_t sock_family;                        /* socket family, for sockaddr */
+       socklen_t sock_addrlen;                         /* socket address length, used by bind() */
+       int l3_addrlen;                                 /* layer3 address length, used by hashes */
        int (*read)(int fd);                            /* generic read function */
        int (*write)(int fd);                           /* generic write function */
        int (*bind_all)(struct protocol *proto);        /* bind all unbound listeners */
index 307d7ef8e705ee24a03073c9137bfee198938e7c..1a093263c34767f9fe1327b50d34fbc6a8d7c121 100644 (file)
@@ -1407,6 +1407,8 @@ static struct protocol proto_unix = {
        .sock_type = SOCK_STREAM,
        .sock_prot = 0,
        .sock_family = AF_UNIX,
+       .sock_addrlen = sizeof(struct sockaddr_un),
+       .l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),/* path len */
        .read = &stream_sock_read,
        .write = &stream_sock_write,
        .bind_all = uxst_bind_listeners,