aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_basic.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:11 -0500
commitadd93b610a4e66d36d0cf0b2596c3d3bcfdaee39 (patch)
tree073873879eb3b87981ee015f0f1ca48da8f1c696 /net/sched/cls_basic.c
parent1e90474c377e92db7262a8968a45c1dd980ca9e5 (diff)
[NET_SCHED]: Convert classifiers 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/cls_basic.c')
-rw-r--r--net/sched/cls_basic.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index b31f9f971987..3953da33956f 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -130,27 +130,27 @@ static int basic_delete(struct tcf_proto *tp, unsigned long arg)
130} 130}
131 131
132static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f, 132static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
133 unsigned long base, struct rtattr **tb, 133 unsigned long base, struct nlattr **tb,
134 struct rtattr *est) 134 struct nlattr *est)
135{ 135{
136 int err = -EINVAL; 136 int err = -EINVAL;
137 struct tcf_exts e; 137 struct tcf_exts e;
138 struct tcf_ematch_tree t; 138 struct tcf_ematch_tree t;
139 139
140 if (tb[TCA_BASIC_CLASSID-1]) 140 if (tb[TCA_BASIC_CLASSID])
141 if (RTA_PAYLOAD(tb[TCA_BASIC_CLASSID-1]) < sizeof(u32)) 141 if (nla_len(tb[TCA_BASIC_CLASSID]) < sizeof(u32))
142 return err; 142 return err;
143 143
144 err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map); 144 err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map);
145 if (err < 0) 145 if (err < 0)
146 return err; 146 return err;
147 147
148 err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES-1], &t); 148 err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &t);
149 if (err < 0) 149 if (err < 0)
150 goto errout; 150 goto errout;
151 151
152 if (tb[TCA_BASIC_CLASSID-1]) { 152 if (tb[TCA_BASIC_CLASSID]) {
153 f->res.classid = *(u32*)RTA_DATA(tb[TCA_BASIC_CLASSID-1]); 153 f->res.classid = *(u32*)nla_data(tb[TCA_BASIC_CLASSID]);
154 tcf_bind_filter(tp, &f->res, base); 154 tcf_bind_filter(tp, &f->res, base);
155 } 155 }
156 156
@@ -164,23 +164,23 @@ errout:
164} 164}
165 165
166static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle, 166static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
167 struct rtattr **tca, unsigned long *arg) 167 struct nlattr **tca, unsigned long *arg)
168{ 168{
169 int err = -EINVAL; 169 int err = -EINVAL;
170 struct basic_head *head = (struct basic_head *) tp->root; 170 struct basic_head *head = (struct basic_head *) tp->root;
171 struct rtattr *tb[TCA_BASIC_MAX]; 171 struct nlattr *tb[TCA_BASIC_MAX + 1];
172 struct basic_filter *f = (struct basic_filter *) *arg; 172 struct basic_filter *f = (struct basic_filter *) *arg;
173 173
174 if (tca[TCA_OPTIONS-1] == NULL) 174 if (tca[TCA_OPTIONS] == NULL)
175 return -EINVAL; 175 return -EINVAL;
176 176
177 if (rtattr_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS-1]) < 0) 177 if (nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], NULL) < 0)
178 return -EINVAL; 178 return -EINVAL;
179 179
180 if (f != NULL) { 180 if (f != NULL) {
181 if (handle && f->handle != handle) 181 if (handle && f->handle != handle)
182 return -EINVAL; 182 return -EINVAL;
183 return basic_set_parms(tp, f, base, tb, tca[TCA_RATE-1]); 183 return basic_set_parms(tp, f, base, tb, tca[TCA_RATE]);
184 } 184 }
185 185
186 err = -ENOBUFS; 186 err = -ENOBUFS;
@@ -206,7 +206,7 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
206 f->handle = head->hgenerator; 206 f->handle = head->hgenerator;
207 } 207 }
208 208
209 err = basic_set_parms(tp, f, base, tb, tca[TCA_RATE-1]); 209 err = basic_set_parms(tp, f, base, tb, tca[TCA_RATE]);
210 if (err < 0) 210 if (err < 0)
211 goto errout; 211 goto errout;
212 212
@@ -246,27 +246,27 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
246{ 246{
247 struct basic_filter *f = (struct basic_filter *) fh; 247 struct basic_filter *f = (struct basic_filter *) fh;
248 unsigned char *b = skb_tail_pointer(skb); 248 unsigned char *b = skb_tail_pointer(skb);
249 struct rtattr *rta; 249 struct nlattr *nla;
250 250
251 if (f == NULL) 251 if (f == NULL)
252 return skb->len; 252 return skb->len;
253 253
254 t->tcm_handle = f->handle; 254 t->tcm_handle = f->handle;
255 255
256 rta = (struct rtattr *) b; 256 nla = (struct nlattr *) b;
257 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 257 NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
258 258
259 if (f->res.classid) 259 if (f->res.classid)
260 RTA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), &f->res.classid); 260 NLA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), &f->res.classid);
261 261
262 if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || 262 if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 ||
263 tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) 263 tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
264 goto rtattr_failure; 264 goto nla_put_failure;
265 265
266 rta->rta_len = skb_tail_pointer(skb) - b; 266 nla->nla_len = skb_tail_pointer(skb) - b;
267 return skb->len; 267 return skb->len;
268 268
269rtattr_failure: 269nla_put_failure:
270 nlmsg_trim(skb, b); 270 nlmsg_trim(skb, b);
271 return -1; 271 return -1;
272} 272}