RE: [PATCH 08/31] net/tcp: Introduce TCP_AO setsockopt()s
From: David Laight
Date: Thu Aug 25 2022 - 14:22:03 EST
From: David Ahern
> Sent: 25 August 2022 16:32
>
> On 8/18/22 9:59 AM, Dmitry Safonov wrote:
> > diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
> > index 849bbf2d3c38..5369458ae89f 100644
> > --- a/include/uapi/linux/tcp.h
> > +++ b/include/uapi/linux/tcp.h
> > @@ -129,6 +129,9 @@ enum {
> >
> > #define TCP_TX_DELAY 37 /* delay outgoing packets by XX usec */
> >
> > +#define TCP_AO 38 /* (Add/Set MKT) */
> > +#define TCP_AO_DEL 39 /* (Delete MKT) */
> > +#define TCP_AO_MOD 40 /* (Modify MKT) */
> >
> > #define TCP_REPAIR_ON 1
> > #define TCP_REPAIR_OFF 0
> > @@ -344,6 +347,38 @@ struct tcp_diag_md5sig {
> >
> > #define TCP_AO_MAXKEYLEN 80
> >
> > +#define TCP_AO_CMDF_CURR (1 << 0) /* Only checks field sndid */
> > +#define TCP_AO_CMDF_NEXT (1 << 1) /* Only checks field rcvid */
> > +
> > +struct tcp_ao { /* setsockopt(TCP_AO) */
> > + struct __kernel_sockaddr_storage tcpa_addr;
> > + char tcpa_alg_name[64];
> > + __u16 tcpa_flags;
> > + __u8 tcpa_prefix;
> > + __u8 tcpa_sndid;
> > + __u8 tcpa_rcvid;
> > + __u8 tcpa_maclen;
> > + __u8 tcpa_keyflags;
> > + __u8 tcpa_keylen;
> > + __u8 tcpa_key[TCP_AO_MAXKEYLEN];
> > +} __attribute__((aligned(8)));
> > +
> > +struct tcp_ao_del { /* setsockopt(TCP_AO_DEL) */
> > + struct __kernel_sockaddr_storage tcpa_addr;
> > + __u16 tcpa_flags;
> > + __u8 tcpa_prefix;
> > + __u8 tcpa_sndid;
> > + __u8 tcpa_rcvid;
> > + __u8 tcpa_current;
> > + __u8 tcpa_rnext;
> > +} __attribute__((aligned(8)));
> > +
> > +struct tcp_ao_mod { /* setsockopt(TCP_AO_MOD) */
> > + __u16 tcpa_flags;
> > + __u8 tcpa_current;
> > + __u8 tcpa_rnext;
> > +} __attribute__((aligned(8)));
> > +
> > /* setsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) */
> >
> > #define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
>
>
> I do not see anything in the uapi that would specify the VRF for the
> address.
(Having not spotted the original...)
You've also got implicit padding in the API structures.
That is generally a recipe for disaster.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)