Thread (40 messages) 40 messages, 6 authors, 2011-01-24

Re: Flow Control and Port Mirroring Revisited

From: Simon Horman <horms@verge.net.au>
Date: 2011-01-06 22:50:50
Also in: kvm, virtualization

On Thu, Jan 06, 2011 at 02:28:18PM +0100, Eric Dumazet wrote:
Le jeudi 06 janvier 2011 à 21:44 +0900, Simon Horman a écrit :
quoted
Hi Eric !

Thanks for the advice. I had thought about the socket buffer but at some
point it slipped my mind.

In any case the following patch seems to implement the change that I had in
mind. However my discussions Michael Tsirkin elsewhere in this thread are
beginning to make me think that think that perhaps this change isn't the
best solution.
diff --git a/datapath/actions.c b/datapath/actions.c
index 5e16143..505f13f 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -384,7 +384,12 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
 
 	for (a = actions, rem = actions_len; rem > 0; a = nla_next(a, &rem)) {
 		if (prev_port != -1) {
-			do_output(dp, skb_clone(skb, GFP_ATOMIC), prev_port);
+			struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+			if (nskb) {
+				if (skb->sk)
+					skb_set_owner_w(nskb, skb->sk);
+				do_output(dp, nskb, prev_port);
+			}
 			prev_port = -1;
 		}
I got a rather nasty panic without the if (skb->sk),
I guess some skbs don't have a socket.
Indeed, some packets are not linked to a socket.

(ARP packets for example)

Sorry, I should have mentioned it :)
Not at all, the occasional panic during hacking is good for the soul.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help