netdev
[Top] [All Lists]

sk->user_data

To: netdev@xxxxxxxxxxx
Subject: sk->user_data
From: Henner Eisen <eis@xxxxxxxxxxxxx>
Date: Tue, 21 Nov 2000 23:22:58 +0100
Sender: owner-netdev@xxxxxxxxxxx
Hi,

2.4.0 struct sock contains a member

        void                    *user_data;

which is currently only used for pointing to an in-kernel RPC layer
control block.

Is it o.k. to use this pointer for alternative upper layer or would that
be a bad idea?

Rationale:

I have implemented a framework that allows tunneling of PPP and IP over
PF_X25 socket connections. For this I need a pointer to a socket tunnel
structure which I currently maintain in the private x25 protocol block.
As this code is generic (it is not x25 specific and aims at being
re-usable for tunneling over other linux network protocol stacks), it
makes sense to maintain the pointer in a protocol-independent area of
struct sock.
RPC already uses the sk->user_data field to point to an upper layer
control structure. My tunnel scenario is similar: it is also an alternative
(not a struct socket) in-kernel upper layer.

As the type is void*, it seems to me that it was intended for such use.
And there won't be any conflicts with RPC because a socket attached to
in-kernel RPC won't be simultaneously used for tunneling.
Thus, if it's o.k to re-use sk->user_data, I'd like to document this in
the source by means of the following patch.

Henner

--- sktn/include/net/sock.h.old Mon Nov 20 22:45:24 2000
+++ sktn/include/net/sock.h     Tue Nov 21 22:38:14 2000
@@ -651,7 +651,7 @@
        /* Identd and reporting IO signals */
        struct socket           *socket;
 
-       /* RPC layer private data */
+       /* Private data for non-socket upper layer (e.g. in-kernel RPC) */
        void                    *user_data;
   
        /* Callbacks */



<Prev in Thread] Current Thread [Next in Thread>