Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2728bcd4
Commit
2728bcd4
authored
Jan 11, 2005
by
Patrick McHardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PKT_SCHED]: Use rtattr_parse_nested where appropriate
Signed-off-by:
Patrick McHardy
<
kaber@trash.net
>
parent
0526ab77
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
27 additions
and
42 deletions
+27
-42
net/sched/act_api.c
net/sched/act_api.c
+5
-8
net/sched/gact.c
net/sched/gact.c
+1
-2
net/sched/ipt.c
net/sched/ipt.c
+1
-2
net/sched/mirred.c
net/sched/mirred.c
+1
-2
net/sched/pedit.c
net/sched/pedit.c
+1
-2
net/sched/police.c
net/sched/police.c
+2
-4
net/sched/sch_atm.c
net/sched/sch_atm.c
+2
-2
net/sched/sch_cbq.c
net/sched/sch_cbq.c
+2
-3
net/sched/sch_dsmark.c
net/sched/sch_dsmark.c
+1
-2
net/sched/sch_gred.c
net/sched/sch_gred.c
+6
-9
net/sched/sch_hfsc.c
net/sched/sch_hfsc.c
+1
-2
net/sched/sch_htb.c
net/sched/sch_htb.c
+2
-2
net/sched/sch_red.c
net/sched/sch_red.c
+1
-1
net/sched/sch_tbf.c
net/sched/sch_tbf.c
+1
-1
No files found.
net/sched/act_api.c
View file @
2728bcd4
...
...
@@ -279,8 +279,7 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
*
err
=
-
EINVAL
;
if
(
name
==
NULL
)
{
if
(
rtattr_parse
(
tb
,
TCA_ACT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rtattr_parse_nested
(
tb
,
TCA_ACT_MAX
,
rta
)
<
0
)
goto
err_out
;
kind
=
tb
[
TCA_ACT_KIND
-
1
];
if
(
kind
==
NULL
)
...
...
@@ -344,8 +343,7 @@ struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est,
struct
tc_action
*
head
=
NULL
,
*
act
,
*
act_prev
=
NULL
;
int
i
;
if
(
rtattr_parse
(
tb
,
TCA_ACT_MAX_PRIO
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
{
if
(
rtattr_parse_nested
(
tb
,
TCA_ACT_MAX_PRIO
,
rta
)
<
0
)
{
*
err
=
-
EINVAL
;
return
head
;
}
...
...
@@ -467,7 +465,7 @@ tcf_action_get_1(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int *err)
int
index
;
*
err
=
-
EINVAL
;
if
(
rtattr_parse
(
tb
,
TCA_ACT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
)
)
<
0
)
if
(
rtattr_parse
_nested
(
tb
,
TCA_ACT_MAX
,
rta
)
<
0
)
return
NULL
;
if
(
tb
[
TCA_ACT_INDEX
-
1
]
==
NULL
||
...
...
@@ -552,7 +550,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
b
=
(
unsigned
char
*
)
skb
->
tail
;
if
(
rtattr_parse
(
tb
,
TCA_ACT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
)
)
<
0
)
if
(
rtattr_parse
_nested
(
tb
,
TCA_ACT_MAX
,
rta
)
<
0
)
goto
err_out
;
kind
=
tb
[
TCA_ACT_KIND
-
1
];
...
...
@@ -599,8 +597,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
struct
rtattr
*
tb
[
TCA_ACT_MAX_PRIO
+
1
];
struct
tc_action
*
head
=
NULL
,
*
act
,
*
act_prev
=
NULL
;
if
(
rtattr_parse
(
tb
,
TCA_ACT_MAX_PRIO
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rtattr_parse_nested
(
tb
,
TCA_ACT_MAX_PRIO
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
event
==
RTM_DELACTION
&&
n
->
nlmsg_flags
&
NLM_F_ROOT
)
{
...
...
net/sched/gact.c
View file @
2728bcd4
...
...
@@ -79,8 +79,7 @@ static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
struct
tcf_gact
*
p
;
int
ret
=
0
;
if
(
rta
==
NULL
||
rtattr_parse
(
tb
,
TCA_GACT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rta
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_GACT_MAX
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
tb
[
TCA_GACT_PARMS
-
1
]
==
NULL
||
...
...
net/sched/ipt.c
View file @
2728bcd4
...
...
@@ -122,8 +122,7 @@ tcf_ipt_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
u32
hook
=
0
;
u32
index
=
0
;
if
(
rta
==
NULL
||
rtattr_parse
(
tb
,
TCA_IPT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rta
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_IPT_MAX
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
tb
[
TCA_IPT_HOOK
-
1
]
==
NULL
||
...
...
net/sched/mirred.c
View file @
2728bcd4
...
...
@@ -84,8 +84,7 @@ tcf_mirred_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
int
ret
=
0
;
int
ok_push
=
0
;
if
(
rta
==
NULL
||
rtattr_parse
(
tb
,
TCA_MIRRED_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rta
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_MIRRED_MAX
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
tb
[
TCA_MIRRED_PARMS
-
1
]
==
NULL
||
...
...
net/sched/pedit.c
View file @
2728bcd4
...
...
@@ -63,8 +63,7 @@ tcf_pedit_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
struct
tc_pedit_key
*
keys
=
NULL
;
int
ksize
;
if
(
rta
==
NULL
||
rtattr_parse
(
tb
,
TCA_PEDIT_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rta
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_PEDIT_MAX
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
tb
[
TCA_PEDIT_PARMS
-
1
]
==
NULL
||
...
...
net/sched/police.c
View file @
2728bcd4
...
...
@@ -171,8 +171,7 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
struct
tcf_police
*
p
;
struct
qdisc_rate_table
*
R_tab
=
NULL
,
*
P_tab
=
NULL
;
if
(
rta
==
NULL
||
rtattr_parse
(
tb
,
TCA_POLICE_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rta
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_POLICE_MAX
,
rta
)
<
0
)
return
-
EINVAL
;
if
(
tb
[
TCA_POLICE_TBF
-
1
]
==
NULL
||
...
...
@@ -417,8 +416,7 @@ struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est)
struct
rtattr
*
tb
[
TCA_POLICE_MAX
];
struct
tc_police
*
parm
;
if
(
rtattr_parse
(
tb
,
TCA_POLICE_MAX
,
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
))
<
0
)
if
(
rtattr_parse_nested
(
tb
,
TCA_POLICE_MAX
,
rta
)
<
0
)
return
NULL
;
if
(
tb
[
TCA_POLICE_TBF
-
1
]
==
NULL
||
...
...
net/sched/sch_atm.c
View file @
2728bcd4
...
...
@@ -255,8 +255,8 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
* later.)
*/
if
(
flow
)
return
-
EBUSY
;
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_ATM_MAX
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)))
return
-
EINVAL
;
if
(
opt
==
NULL
||
rtattr_parse
_nested
(
tb
,
TCA_ATM_MAX
,
opt
))
return
-
EINVAL
;
if
(
!
tb
[
TCA_ATM_FD
-
1
]
||
RTA_PAYLOAD
(
tb
[
TCA_ATM_FD
-
1
])
<
sizeof
(
fd
))
return
-
EINVAL
;
fd
=
*
(
int
*
)
RTA_DATA
(
tb
[
TCA_ATM_FD
-
1
]);
...
...
net/sched/sch_cbq.c
View file @
2728bcd4
...
...
@@ -1439,7 +1439,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
struct
rtattr
*
tb
[
TCA_CBQ_MAX
];
struct
tc_ratespec
*
r
;
if
(
rtattr_parse
(
tb
,
TCA_CBQ_MAX
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
)
<
0
||
if
(
rtattr_parse
_nested
(
tb
,
TCA_CBQ_MAX
,
opt
)
<
0
||
tb
[
TCA_CBQ_RTAB
-
1
]
==
NULL
||
tb
[
TCA_CBQ_RATE
-
1
]
==
NULL
||
RTA_PAYLOAD
(
tb
[
TCA_CBQ_RATE
-
1
])
<
sizeof
(
struct
tc_ratespec
))
return
-
EINVAL
;
...
...
@@ -1824,8 +1824,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
struct
cbq_class
*
parent
;
struct
qdisc_rate_table
*
rtab
=
NULL
;
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_CBQ_MAX
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)))
if
(
opt
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_CBQ_MAX
,
opt
))
return
-
EINVAL
;
if
(
tb
[
TCA_CBQ_OVL_STRATEGY
-
1
]
&&
...
...
net/sched/sch_dsmark.c
View file @
2728bcd4
...
...
@@ -125,8 +125,7 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
"arg 0x%lx
\n
"
,
sch
,
p
,
classid
,
parent
,
*
arg
);
if
(
*
arg
>
p
->
indices
)
return
-
ENOENT
;
if
(
!
opt
||
rtattr_parse
(
tb
,
TCA_DSMARK_MAX
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)))
if
(
!
opt
||
rtattr_parse_nested
(
tb
,
TCA_DSMARK_MAX
,
opt
))
return
-
EINVAL
;
if
(
tb
[
TCA_DSMARK_MASK
-
1
])
{
if
(
!
RTA_PAYLOAD
(
tb
[
TCA_DSMARK_MASK
-
1
]))
...
...
net/sched/sch_gred.c
View file @
2728bcd4
...
...
@@ -332,13 +332,11 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
struct
rtattr
*
tb2
[
TCA_GRED_DPS
];
int
i
;
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_GRED_STAB
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
))
)
return
-
EINVAL
;
if
(
opt
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_GRED_STAB
,
opt
))
return
-
EINVAL
;
if
(
tb
[
TCA_GRED_PARMS
-
1
]
==
0
&&
tb
[
TCA_GRED_STAB
-
1
]
==
0
)
{
rtattr_parse
(
tb2
,
TCA_GRED_DPS
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
));
rtattr_parse_nested
(
tb2
,
TCA_GRED_DPS
,
opt
);
if
(
tb2
[
TCA_GRED_DPS
-
1
]
==
0
)
return
-
EINVAL
;
...
...
@@ -475,12 +473,11 @@ static int gred_init(struct Qdisc *sch, struct rtattr *opt)
struct
rtattr
*
tb
[
TCA_GRED_STAB
];
struct
rtattr
*
tb2
[
TCA_GRED_DPS
];
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_GRED_STAB
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
))
)
return
-
EINVAL
;
if
(
opt
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_GRED_STAB
,
opt
))
return
-
EINVAL
;
if
(
tb
[
TCA_GRED_PARMS
-
1
]
==
0
&&
tb
[
TCA_GRED_STAB
-
1
]
==
0
)
{
rtattr_parse
(
tb2
,
TCA_GRED_DPS
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
);
rtattr_parse
_nested
(
tb2
,
TCA_GRED_DPS
,
opt
);
if
(
tb2
[
TCA_GRED_DPS
-
1
]
==
0
)
return
-
EINVAL
;
...
...
net/sched/sch_hfsc.c
View file @
2728bcd4
...
...
@@ -1046,8 +1046,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
struct
tc_service_curve
*
rsc
=
NULL
,
*
fsc
=
NULL
,
*
usc
=
NULL
;
u64
cur_time
;
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_HFSC_MAX
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)))
if
(
opt
==
NULL
||
rtattr_parse_nested
(
tb
,
TCA_HFSC_MAX
,
opt
))
return
-
EINVAL
;
if
(
tb
[
TCA_HFSC_RSC
-
1
])
{
...
...
net/sched/sch_htb.c
View file @
2728bcd4
...
...
@@ -1267,7 +1267,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt)
printk
(
KERN_INFO
"HTB init, kernel part version %d.%d
\n
"
,
HTB_VER
>>
16
,
HTB_VER
&
0xffff
);
#endif
if
(
!
opt
||
rtattr_parse
(
tb
,
TCA_HTB_INIT
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
)
||
if
(
!
opt
||
rtattr_parse
_nested
(
tb
,
TCA_HTB_INIT
,
opt
)
||
tb
[
TCA_HTB_INIT
-
1
]
==
NULL
||
RTA_PAYLOAD
(
tb
[
TCA_HTB_INIT
-
1
])
<
sizeof
(
*
gopt
))
{
printk
(
KERN_ERR
"HTB: hey probably you have bad tc tool ?
\n
"
);
...
...
@@ -1559,7 +1559,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
struct
tc_htb_opt
*
hopt
;
/* extract all subattrs from opt attr */
if
(
!
opt
||
rtattr_parse
(
tb
,
TCA_HTB_RTAB
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
)
||
if
(
!
opt
||
rtattr_parse
_nested
(
tb
,
TCA_HTB_RTAB
,
opt
)
||
tb
[
TCA_HTB_PARMS
-
1
]
==
NULL
||
RTA_PAYLOAD
(
tb
[
TCA_HTB_PARMS
-
1
])
<
sizeof
(
*
hopt
))
goto
failure
;
...
...
net/sched/sch_red.c
View file @
2728bcd4
...
...
@@ -364,7 +364,7 @@ static int red_change(struct Qdisc *sch, struct rtattr *opt)
struct
tc_red_qopt
*
ctl
;
if
(
opt
==
NULL
||
rtattr_parse
(
tb
,
TCA_RED_STAB
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
)
||
rtattr_parse
_nested
(
tb
,
TCA_RED_STAB
,
opt
)
||
tb
[
TCA_RED_PARMS
-
1
]
==
0
||
tb
[
TCA_RED_STAB
-
1
]
==
0
||
RTA_PAYLOAD
(
tb
[
TCA_RED_PARMS
-
1
])
<
sizeof
(
*
ctl
)
||
RTA_PAYLOAD
(
tb
[
TCA_RED_STAB
-
1
])
<
256
)
...
...
net/sched/sch_tbf.c
View file @
2728bcd4
...
...
@@ -310,7 +310,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
struct
Qdisc
*
child
=
NULL
;
int
max_size
,
n
;
if
(
rtattr_parse
(
tb
,
TCA_TBF_PTAB
,
RTA_DATA
(
opt
),
RTA_PAYLOAD
(
opt
)
)
||
if
(
rtattr_parse
_nested
(
tb
,
TCA_TBF_PTAB
,
opt
)
||
tb
[
TCA_TBF_PARMS
-
1
]
==
NULL
||
RTA_PAYLOAD
(
tb
[
TCA_TBF_PARMS
-
1
])
<
sizeof
(
*
qopt
))
goto
done
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment