[PKT_SCHED]: Convert tc action functions to single skb pointers

tcf_action_exec only gets a single skb pointer and doesn't own the skb,
but passes double skb pointers (to a local variable) to the action
functions. Change to use single skb pointers everywhere.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit c69c8677ae026b0a9c84c4dd0384ad3bcfc11fc8
tree fd2db81ea53cd361afa2d06fe7078231a0f1be3a
parent 763b3dea377647e2eb0d7638143b9a22d32fb989
author Patrick McHardy <[EMAIL PROTECTED]> Sat, 07 Jan 2006 23:44:55 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Sat, 07 Jan 2006 23:44:55 +0100

 include/net/act_api.h |    2 +-
 net/sched/act_api.c   |    2 +-
 net/sched/gact.c      |    3 +--
 net/sched/ipt.c       |    6 ++++--
 net/sched/mirred.c    |    3 +--
 net/sched/pedit.c     |    3 +--
 net/sched/police.c    |    3 +--
 net/sched/simple.c    |    3 +--
 8 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index b55eb7c..11e9eaf 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -63,7 +63,7 @@ struct tc_action_ops
 	__u32   type; /* TBD to match kind */
 	__u32 	capab;  /* capabilities includes 4 bit version */
 	struct module		*owner;
-	int     (*act)(struct sk_buff **, struct tc_action *, struct tcf_result *);
+	int     (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);
 	int     (*get_stats)(struct sk_buff *, struct tc_action *);
 	int     (*dump)(struct sk_buff *, struct tc_action *,int , int);
 	int     (*cleanup)(struct tc_action *, int bind);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 2ce1cb2..bd651a4 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -165,7 +165,7 @@ int tcf_action_exec(struct sk_buff *skb,
 	while ((a = act) != NULL) {
 repeat:
 		if (a->ops && a->ops->act) {
-			ret = a->ops->act(&skb, a, res);
+			ret = a->ops->act(skb, a, res);
 			if (TC_MUNGED & skb->tc_verd) {
 				/* copied already, allow trampling */
 				skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
diff --git a/net/sched/gact.c b/net/sched/gact.c
index d1c6d54..a1e68f7 100644
--- a/net/sched/gact.c
+++ b/net/sched/gact.c
@@ -135,10 +135,9 @@ tcf_gact_cleanup(struct tc_action *a, in
 }
 
 static int
-tcf_gact(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
+tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
 {
 	struct tcf_gact *p = PRIV(a, gact);
-	struct sk_buff *skb = *pskb;
 	int action = TC_ACT_SHOT;
 
 	spin_lock(&p->lock);
diff --git a/net/sched/ipt.c b/net/sched/ipt.c
index f50136e..b500193 100644
--- a/net/sched/ipt.c
+++ b/net/sched/ipt.c
@@ -201,11 +201,10 @@ tcf_ipt_cleanup(struct tc_action *a, int
 }
 
 static int
-tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
+tcf_ipt(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
 {
 	int ret = 0, result = 0;
 	struct tcf_ipt *p = PRIV(a, ipt);
-	struct sk_buff *skb = *pskb;
 
 	if (skb_cloned(skb)) {
 		if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
@@ -222,6 +221,9 @@ tcf_ipt(struct sk_buff **pskb, struct tc
 	 worry later - danger - this API seems to have changed
 	 from earlier kernels */
 
+	/* iptables targets take a double skb pointer in case the skb
+	 * needs to be replaced. We don't own the skb, so this must not
+	 * happen. The pskb_expand_head above should make sure of this */
 	ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,
 					    p->hook, p->t->data, NULL);
 	switch (ret) {
diff --git a/net/sched/mirred.c b/net/sched/mirred.c
index 20d0691..4fcccbd 100644
--- a/net/sched/mirred.c
+++ b/net/sched/mirred.c
@@ -158,12 +158,11 @@ tcf_mirred_cleanup(struct tc_action *a, 
 }
 
 static int
-tcf_mirred(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
+tcf_mirred(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
 {
 	struct tcf_mirred *p = PRIV(a, mirred);
 	struct net_device *dev;
 	struct sk_buff *skb2 = NULL;
-	struct sk_buff *skb = *pskb;
 	u32 at = G_TC_AT(skb->tc_verd);
 
 	spin_lock(&p->lock);
diff --git a/net/sched/pedit.c b/net/sched/pedit.c
index 767d24f..b5167af 100644
--- a/net/sched/pedit.c
+++ b/net/sched/pedit.c
@@ -130,10 +130,9 @@ tcf_pedit_cleanup(struct tc_action *a, i
 }
 
 static int
-tcf_pedit(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
+tcf_pedit(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
 {
 	struct tcf_pedit *p = PRIV(a, pedit);
-	struct sk_buff *skb = *pskb;
 	int i, munged = 0;
 	u8 *pptr;
 
diff --git a/net/sched/police.c b/net/sched/police.c
index eb39fb2..a834516 100644
--- a/net/sched/police.c
+++ b/net/sched/police.c
@@ -284,11 +284,10 @@ static int tcf_act_police_cleanup(struct
 	return 0;
 }
 
-static int tcf_act_police(struct sk_buff **pskb, struct tc_action *a,
+static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
                           struct tcf_result *res)
 {
 	psched_time_t now;
-	struct sk_buff *skb = *pskb;
 	struct tcf_police *p = PRIV(a);
 	long toks;
 	long ptoks = 0;
diff --git a/net/sched/simple.c b/net/sched/simple.c
index 8a6ae4f..e5f2e1f 100644
--- a/net/sched/simple.c
+++ b/net/sched/simple.c
@@ -44,9 +44,8 @@ static DEFINE_RWLOCK(simp_lock);
 #include <net/pkt_act.h>
 #include <net/act_generic.h>
 
-static int tcf_simp(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
+static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
 {
-	struct sk_buff *skb = *pskb;
 	struct tcf_defact *p = PRIV(a, defact);
 
 	spin_lock(&p->lock);

Reply via email to