https://svnweb.freebsd.org/base/head/sys/netinet/tcp_var.h?revision=313330&view=markup#l279

I was just looking to try and add a field in struct tcpcb, and I was quite
unhappy that it has recently turned into a mess of ifdefs:

#if defined(_KERNEL) && defined(TCP_RFC7413)
        uint32_t t_ispare[6];           /* 5 UTO, 1 TBD */
        uint64_t t_tfo_cookie;          /* TCP Fast Open cookie */
#else
        uint32_t t_ispare[8];           /* 5 UTO, 3 TBD */
#endif
        struct tcp_function_block *t_fb;/* TCP function call block */
        void    *t_fb_ptr;              /* Pointer to t_fb specific data */
#if defined(_KERNEL) && defined(TCP_RFC7413)
        unsigned int *t_tfo_pending;    /* TCP Fast Open pending counter */
        void    *t_pspare2[1];          /* 1 TCP_SIGNATURE */
#else
        void    *t_pspare2[2];          /* 1 TCP_SIGNATURE, 1 TBD */
#endif
#if defined(_KERNEL) && defined(TCPPCAP)
        struct mbufq t_inpkts;          /* List of saved input packets. */
        struct mbufq t_outpkts;         /* List of saved output packets. */
#ifdef _LP64
        uint64_t _pad[0];               /* all used! */
#else
        uint64_t _pad[2];               /* 2 are available */
#endif /* _LP64 */
#else
        uint64_t _pad[6];
#endif /* defined(_KERNEL) && defined(TCPPCAP) */

This is unmaintainable,, unreadable unextendable and completely
unnecessary.  I don't see value in leaving spare fields spare if the
corresponding kernel feature is unused;
it isn't as though we can reuse the field for anything else.  If
nobody has any objections, I'll prepare a patch to eliminate the ifdef
soup (with the lamentable exception
of the _LP64 ifdef, which is necessary)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-transport
To unsubscribe, send any mail to "[email protected]"

Reply via email to