Skip to contentSkip to conversation

remove unused netlink NL_EMULATE_DEV code

PATCH In review Chris Wright 4 participants 6 messages Mar 18, 2005 – Mar 23, 2005

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

PATCH 1/1 remove unused netlink NL_EMULATE_DEV code

Now that netlink_attach() has been removed, the NL_EMULATE_DEV handler functions can't ever be set. So let's rip them out too, because what's left behind can't be used at all.

 net/netlink/af_netlink.c |   24 +-----------------------
 1 files changed, 1 insertion(+), 23 deletions(-)

===== net/netlink/af_netlink.c 1.71 vs edited =====

net/netlink/af_netlink.c +1 -23
@@ -55,10 +55,6 @@
 
 #define Nprintk(a...)
 
-#if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
-#define NL_EMULATE_DEV
-#endif
-
 struct netlink_sock {
 	/* struct sock has to be the first member of netlink_sock */
 	struct sock		sk;
@@ -67,7 +63,6 @@ struct netlink_sock {
 	u32			dst_pid;
 	unsigned int		dst_groups;
 	unsigned long		state;
-	int			(*handler)(int unit, struct sk_buff *skb);
 	wait_queue_head_t	wait;
 	struct netlink_callback	*cb;
 	spinlock_t		cb_lock;
@@ -593,10 +588,6 @@ int netlink_attachskb(struct sock *sk, s
 
 	nlk = nlk_sk(sk);
 
-#ifdef NL_EMULATE_DEV
-	if (nlk->handler)
-		return 0;
-#endif
 	if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
 	    test_bit(0, &nlk->state)) {
 		DECLARE_WAITQUEUE(wait, current);
@@ -636,14 +627,6 @@ int netlink_sendskb(struct sock *sk, str
 	int len = skb->len;
 
 	nlk = nlk_sk(sk);
-#ifdef NL_EMULATE_DEV
-	if (nlk->handler) {
-		skb_orphan(skb);
-		len = nlk->handler(protocol, skb);
-		sock_put(sk);
-		return len;
-	}
-#endif
 
 	skb_queue_tail(&sk->sk_receive_queue, skb);
 	sk->sk_data_ready(sk, len);
@@ -708,12 +691,7 @@ retry:
 static __inline__ int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
 {
 	struct netlink_sock *nlk = nlk_sk(sk);
-#ifdef NL_EMULATE_DEV
-	if (nlk->handler) {
-		nlk->handler(sk->sk_protocol, skb);
-		return 0;
-	} else
-#endif
+
 	if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
 	    !test_bit(0, &nlk->state)) {
 		skb_set_owner_r(skb, sk);
#1 lore raw

Hi Chris,

Why don't you kill Ethertap completely while you're at it. Ethertap needs "Netlink device emulation" stuff. And this whole thing has been marked OBSOLETE for more than two years now. Most projects seem to have switched to TUN/TAP long time ago.

Max

#2 lore raw
Quoted 5 lines · * Max Krasnyansky ([email protected]) wrote:

Why don't you kill Ethertap completely while you're at it. Ethertap needs "Netlink device emulation"
stuff. And this whole thing has been marked OBSOLETE for more than two years now.
Most projects seem to have switched to TUN/TAP long time ago.

I'd prefer that too. What about the netlink_dev implementation itself? Should it be marked obsolete?

thanks,
-chris

#3 lore raw

1

Quoted 3 lines · Chris Wright

I'd prefer that too. What about the netlink_dev implementation itself? Should it be marked obsolete?

It should die - pieces of it have already been slowly disapearing.

cheers,
jamal

#4 lore raw
Quoted 9 lines · jamal

1

Quoted 3 lines · Chris Wright

I'd prefer that too. What about the netlink_dev implementation itself? Should it be marked obsolete?

It should die - pieces of it have already been slowly disapearing.

Totally agree. Even for Ethertap it was easy to use Netlink sockets directly.

Max

maintainer
#5 lore raw
Quoted 5 lines · On Mon, 21 Mar 2005 10:26:11 -0800 Max Krasnyansky <[email protected]> wrote:
Quoted 4 lines · jamal

1
On Fri, 2005-03-18 at 20:02, Chris Wright wrote:

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I'd prefer that too. What about the netlink_dev implementation itself? Should it be marked obsolete?

It should die - pieces of it have already been slowly disapearing.

Totally agree. Even for Ethertap it was easy to use Netlink sockets directly.

I've applied Chris's original patch, then killed ethertap and netlink_dev from my tree.

It's very telling that CONFIG_ETHERTAP was still marked EXPERIMENTAL :-)