public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@aristanetworks.com>,
	Pavel Emelyanov <xemul@openvz.org>
Subject: [PATCH] mac80211_hwsim: clean up the skb before passing it back
Date: Thu, 18 Jun 2009 14:51:12 +0200	[thread overview]
Message-ID: <1245329472.13790.33.camel@johannes.local> (raw)

We need to clean up the skb before we can copy it, this
is required for proper operation since the socket it is
still attached to could potentially live in a different
network namespace or so.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
I stole this code from veth, maybe there should be a function somewhere?

 drivers/net/wireless/mac80211_hwsim.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- wireless-testing.orig/drivers/net/wireless/mac80211_hwsim.c	2009-06-18 14:42:01.000000000 +0200
+++ wireless-testing/drivers/net/wireless/mac80211_hwsim.c	2009-06-18 14:44:27.000000000 +0200
@@ -15,6 +15,8 @@
 
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <net/dst.h>
+#include <net/xfrm.h>
 #include <net/mac80211.h>
 #include <net/ieee80211_radiotap.h>
 #include <linux/if_arp.h>
@@ -409,6 +411,14 @@ static bool mac80211_hwsim_tx_frame(stru
 	if (data->ps != PS_DISABLED)
 		hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
 
+	/* release the skb's source info */
+	skb_orphan(skb);
+	dst_release(skb->dst);
+	skb->dst = NULL;
+	skb->mark = 0;
+	secpath_reset(skb);
+	nf_reset(skb);
+
 	/* Copy skb to all enabled radios that are on the current frequency */
 	spin_lock(&hwsim_radio_lock);
 	list_for_each_entry(data2, &hwsim_radios, list) {



                 reply	other threads:[~2009-06-18 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245329472.13790.33.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=ebiederm@aristanetworks.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox