aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_simple.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_simple.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_simple.c')
-rw-r--r--net/sched/act_simple.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index fb84ef33d14f..d3226e24070b 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -84,10 +84,10 @@ static int realloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata)
84 return alloc_defdata(d, datalen, defdata); 84 return alloc_defdata(d, datalen, defdata);
85} 85}
86 86
87static int tcf_simp_init(struct rtattr *rta, struct rtattr *est, 87static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
88 struct tc_action *a, int ovr, int bind) 88 struct tc_action *a, int ovr, int bind)
89{ 89{
90 struct rtattr *tb[TCA_DEF_MAX]; 90 struct nlattr *tb[TCA_DEF_MAX + 1];
91 struct tc_defact *parm; 91 struct tc_defact *parm;
92 struct tcf_defact *d; 92 struct tcf_defact *d;
93 struct tcf_common *pc; 93 struct tcf_common *pc;
@@ -95,19 +95,19 @@ static int tcf_simp_init(struct rtattr *rta, struct rtattr *est,
95 u32 datalen = 0; 95 u32 datalen = 0;
96 int ret = 0; 96 int ret = 0;
97 97
98 if (rta == NULL || rtattr_parse_nested(tb, TCA_DEF_MAX, rta) < 0) 98 if (nla == NULL || nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL) < 0)
99 return -EINVAL; 99 return -EINVAL;
100 100
101 if (tb[TCA_DEF_PARMS - 1] == NULL || 101 if (tb[TCA_DEF_PARMS] == NULL ||
102 RTA_PAYLOAD(tb[TCA_DEF_PARMS - 1]) < sizeof(*parm)) 102 nla_len(tb[TCA_DEF_PARMS]) < sizeof(*parm))
103 return -EINVAL; 103 return -EINVAL;
104 104
105 parm = RTA_DATA(tb[TCA_DEF_PARMS - 1]); 105 parm = nla_data(tb[TCA_DEF_PARMS]);
106 defdata = RTA_DATA(tb[TCA_DEF_DATA - 1]); 106 defdata = nla_data(tb[TCA_DEF_DATA]);
107 if (defdata == NULL) 107 if (defdata == NULL)
108 return -EINVAL; 108 return -EINVAL;
109 109
110 datalen = RTA_PAYLOAD(tb[TCA_DEF_DATA - 1]); 110 datalen = nla_len(tb[TCA_DEF_DATA]);
111 if (datalen <= 0) 111 if (datalen <= 0)
112 return -EINVAL; 112 return -EINVAL;
113 113
@@ -164,15 +164,15 @@ static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
164 opt.refcnt = d->tcf_refcnt - ref; 164 opt.refcnt = d->tcf_refcnt - ref;
165 opt.bindcnt = d->tcf_bindcnt - bind; 165 opt.bindcnt = d->tcf_bindcnt - bind;
166 opt.action = d->tcf_action; 166 opt.action = d->tcf_action;
167 RTA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); 167 NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt);
168 RTA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata); 168 NLA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata);
169 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); 169 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
170 t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); 170 t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
171 t.expires = jiffies_to_clock_t(d->tcf_tm.expires); 171 t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
172 RTA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); 172 NLA_PUT(skb, TCA_DEF_TM, sizeof(t), &t);
173 return skb->len; 173 return skb->len;
174 174
175rtattr_failure: 175nla_put_failure:
176 nlmsg_trim(skb, b); 176 nlmsg_trim(skb, b);
177 return -1; 177 return -1;
178} 178}