Other than modifying ICSK_CA_PRIV_SIZE, any way to add more info to a tcp socket?

Shiyao Ma i at introo.me
Sun Apr 30 10:01:56 EDT 2017


Hi,

When defining my own TCP congestion control,  I encountered this:

BUILD_BUG_ON(sizeof(struct mytcp) > ICSK_CA_PRIV_SIZE);

Every socket using my own congestion control has an instance of the
struct mytcp, which stores per-socket information.  The above bug
means the size of struct mytcp exceeds the limit of kernel's
predefined per-socket struct size.

Provided the struct mytcp cannot be trimmed down any more, and
meanwhile ICSK_CA_PRIV_SIZE can not be increased, is there any way to
add more info to a socket ?

I am thinking about making a certain filed of the struct mytcp be a
pointer, so that when the socket gets created, a hook function is
invoked to kmalloc some memory to store extra information.  And when
the socket is destroyed, that memory is also destroyed by some hook
function.   But this idea seems a little bit messy, and I dunno what
the exact hook functions are.

Any other remedies?


Best,



More information about the Kernelnewbies mailing list