Patchwork tun: Use netif_receive_skb instead of netif_rx

login
register
mail settings
Submitter Herbert Xu
Date May 21, 2010, 1:16 a.m.
Message ID <20100521011632.GA23849@gondor.apana.org.au>
Download mbox | patch
Permalink /patch/53111/
State Accepted
Delegated to: David Miller
Headers show

Comments

Herbert Xu - May 21, 2010, 1:16 a.m.
On Fri, May 21, 2010 at 11:02:11AM +1000, Herbert Xu wrote:
> 
> That's what I meant above.  My patch will make tun.c to the
> classid update every time it sends out a packet.

Here it is:

tun: Update classid on packet injection

This patch makes tun update its socket classid every time we
inject a packet into the network stack.  This is so that any
updates made by the admin to the process writing packets to
tun is effected.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


Cheers,
David Miller - May 24, 2010, 6:44 a.m.
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 21 May 2010 11:16:32 +1000

> tun: Update classid on packet injection
> 
> This patch makes tun update its socket classid every time we
> inject a packet into the network stack.  This is so that any
> updates made by the admin to the process writing packets to
> tun is effected.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 4326520..a8a9aa8 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -525,6 +525,8 @@  static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
 	struct sk_buff *skb;
 	int err;
 
+	sock_update_classid(sk);
+
 	/* Under a page?  Don't bother with paged skb. */
 	if (prepad + len < PAGE_SIZE || !linear)
 		linear = len;
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f7fdf8..4969bd1 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1055,6 +1055,7 @@  void sock_update_classid(struct sock *sk)
 	if (classid && classid != sk->sk_classid)
 		sk->classid = classid;
 }
+EXPORT_SYMBOL(sock_update_classid);
 #endif
 
 /**