Skip to contentSkip to conversation

comment on [NET]: Delete support for old-style protocols, no longer necessary.

DISCUSSION Joe Perches 3 participants 4 messages Oct 7, 2003 – Oct 8, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

How about

netdevice.h

struct sock;

struct packet_type {
unsigned short type; /* This is really htons(ether_type). */
struct net_device *dev; /* NULL is wildcarded here */
int (*func) (struct sk_buff *, struct net_device *,
struct packet_type *);

-       void                    *af_packet_priv;
+       struct sock             *sk;	/* appropriate comment: socket copy? */
        struct list_head        list;

};

and s/af_packet_priv/sk/g in the rest of the files?

#1 lore raw

Review

Quoted 2 lines · On Tue, 07 Oct 2003 11:37:09 -0700 Joe Perches <[email protected]> wrote:
(quoted diff) +1 -1
-       void                    *af_packet_priv;
+       struct sock             *sk;	/* appropriate comment: socket copy? */

AF_PACKET is the only user of this private field, and I want people to be aware of this and not try to use it for other stuff.

Nobody else can use it for something different, the code in net/core/dev.c does specific things when it's non-NULL knowing that this non-NULL value means that it's an AF_PACKET packet_type being passed to it.

So we won't make your suggested change.

#2 lore raw
Quoted 10 lines · David S. Miller

Review

Quoted 2 lines · On Tue, 07 Oct 2003 11:37:09 -0700 Joe Perches <[email protected]> wrote:
(quoted diff) +1 -1
-       void                    *af_packet_priv;
+       struct sock             *sk;	/* appropriate comment: socket copy? */

AF_PACKET is the only user of this private field, and I want people to be aware of this and not try to use it for other stuff.

Quoted 6 lines

Nobody else can use it for something different, the code in net/core/dev.c does specific things when it's non-NULL knowing that this non-NULL value means that it's an AF_PACKET packet_type being passed to it.

So we won't make your suggested change.

Even so, why not call it a struct sock*?
It is after all and is used as one.

#3 lore raw
Quoted 12 lines · Joe Perches
Quoted 12 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-       void                    *af_packet_priv;
+       struct sock             *sk;	/* appropriate comment: socket copy? */

AF_PACKET is the only user of this private field, and I want people to be aware of this and not try to use it for other stuff.

Nobody else can use it for something different, the code in net/core/dev.c does specific things when it's non-NULL knowing that this non-NULL value means that it's an AF_PACKET packet_type being passed to it.

Quoted 4 lines
Quoted 1 line

So we won't make your suggested change.

Even so, why not call it a struct sock*?
It is after all and is used as one.

To discourage other modules from using it, and to keep programmers who aren't working on AF_PACKET from thinking about it. It's SOP to use opaque cookies when you want to make data private.
- Dan

Signature · 3 lines
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045