aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_pedit.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:11 -0500
commit7ba699c604ab811972eee2e041fd6b07659a2e6e (patch)
tree4f76f69a25ce27ee0dd0c417df75acf00b1a36a0 /net/sched/act_pedit.c
parentadd93b610a4e66d36d0cf0b2596c3d3bcfdaee39 (diff)
[NET_SCHED]: Convert actions from rtnetlink to new netlink API
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_pedit.c')
-rw-r--r--net/sched/act_pedit.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index b46fab5fb323..88d8a15a1921 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -33,10 +33,10 @@ static struct tcf_hashinfo pedit_hash_info = {
33 .lock = &pedit_lock, 33 .lock = &pedit_lock,
34}; 34};
35 35
36static int tcf_pedit_init(struct rtattr *rta, struct rtattr *est, 36static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
37 struct tc_action *a, int ovr, int bind) 37 struct tc_action *a, int ovr, int bind)
38{ 38{
39 struct rtattr *tb[TCA_PEDIT_MAX]; 39 struct nlattr *tb[TCA_PEDIT_MAX + 1];
40 struct tc_pedit *parm; 40 struct tc_pedit *parm;
41 int ret = 0; 41 int ret = 0;
42 struct tcf_pedit *p; 42 struct tcf_pedit *p;
@@ -44,15 +44,15 @@ static int tcf_pedit_init(struct rtattr *rta, struct rtattr *est,
44 struct tc_pedit_key *keys = NULL; 44 struct tc_pedit_key *keys = NULL;
45 int ksize; 45 int ksize;
46 46
47 if (rta == NULL || rtattr_parse_nested(tb, TCA_PEDIT_MAX, rta) < 0) 47 if (nla == NULL || nla_parse_nested(tb, TCA_PEDIT_MAX, nla, NULL) < 0)
48 return -EINVAL; 48 return -EINVAL;
49 49
50 if (tb[TCA_PEDIT_PARMS - 1] == NULL || 50 if (tb[TCA_PEDIT_PARMS] == NULL ||
51 RTA_PAYLOAD(tb[TCA_PEDIT_PARMS-1]) < sizeof(*parm)) 51 nla_len(tb[TCA_PEDIT_PARMS]) < sizeof(*parm))
52 return -EINVAL; 52 return -EINVAL;
53 parm = RTA_DATA(tb[TCA_PEDIT_PARMS-1]); 53 parm = nla_data(tb[TCA_PEDIT_PARMS]);
54 ksize = parm->nkeys * sizeof(struct tc_pedit_key); 54 ksize = parm->nkeys * sizeof(struct tc_pedit_key);
55 if (RTA_PAYLOAD(tb[TCA_PEDIT_PARMS-1]) < sizeof(*parm) + ksize) 55 if (nla_len(tb[TCA_PEDIT_PARMS]) < sizeof(*parm) + ksize)
56 return -EINVAL; 56 return -EINVAL;
57 57
58 pc = tcf_hash_check(parm->index, a, bind, &pedit_hash_info); 58 pc = tcf_hash_check(parm->index, a, bind, &pedit_hash_info);
@@ -206,15 +206,15 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
206 opt->refcnt = p->tcf_refcnt - ref; 206 opt->refcnt = p->tcf_refcnt - ref;
207 opt->bindcnt = p->tcf_bindcnt - bind; 207 opt->bindcnt = p->tcf_bindcnt - bind;
208 208
209 RTA_PUT(skb, TCA_PEDIT_PARMS, s, opt); 209 NLA_PUT(skb, TCA_PEDIT_PARMS, s, opt);
210 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); 210 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
211 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); 211 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
212 t.expires = jiffies_to_clock_t(p->tcf_tm.expires); 212 t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
213 RTA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t); 213 NLA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t);
214 kfree(opt); 214 kfree(opt);
215 return skb->len; 215 return skb->len;
216 216
217rtattr_failure: 217nla_put_failure:
218 nlmsg_trim(skb, b); 218 nlmsg_trim(skb, b);
219 kfree(opt); 219 kfree(opt);
220 return -1; 220 return -1;