Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
iproute2
Commits
4a86fe19
Commit
4a86fe19
authored
Jan 18, 2005
by
8!tgraf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use NLMSG_TAIL
(Logical change 1.127)
parent
1b52a762
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
34 deletions
+21
-34
tc/f_u32.c
tc/f_u32.c
+2
-2
tc/m_action.c
tc/m_action.c
+17
-30
tc/q_hfsc.c
tc/q_hfsc.c
+2
-2
No files found.
tc/f_u32.c
View file @
4a86fe19
...
...
@@ -794,7 +794,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
if
(
argc
==
0
)
return
0
;
tail
=
(
struct
rtattr
*
)(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
)
);
tail
=
NLMSG_TAIL
(
n
);
addattr_l
(
n
,
MAX_MSG
,
TCA_OPTIONS
,
NULL
,
0
);
while
(
argc
>
0
)
{
...
...
@@ -943,7 +943,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
addattr_l
(
n
,
MAX_MSG
,
TCA_U32_HASH
,
&
htid
,
4
);
if
(
sel_ok
)
addattr_l
(
n
,
MAX_MSG
,
TCA_U32_SEL
,
&
sel
,
sizeof
(
sel
.
sel
)
+
sel
.
sel
.
nkeys
*
sizeof
(
struct
tc_u32_key
));
tail
->
rta_len
=
(
((
void
*
)
n
)
+
n
->
nlmsg_len
)
-
(
void
*
)
tail
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
n
)
-
(
void
*
)
tail
;
return
0
;
}
...
...
tc/m_action.c
View file @
4a86fe19
...
...
@@ -144,8 +144,7 @@ parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
if
(
argc
<=
0
)
return
-
1
;
tail
=
tail2
=
(
struct
rtattr
*
)
(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
));
tail
=
tail2
=
NLMSG_TAIL
(
n
);
addattr_l
(
n
,
MAX_MSG
,
tca_id
,
NULL
,
0
);
...
...
@@ -185,9 +184,7 @@ done0:
goto
bad_val
;
}
tail
=
(
struct
rtattr
*
)
(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
));
tail
=
NLMSG_TAIL
(
n
);
addattr_l
(
n
,
MAX_MSG
,
++
prio
,
NULL
,
0
);
addattr_l
(
n
,
MAX_MSG
,
TCA_ACT_KIND
,
k
,
strlen
(
k
)
+
1
);
...
...
@@ -197,9 +194,7 @@ done0:
fprintf
(
stderr
,
"bad action parsing
\n
"
);
goto
bad_val
;
}
tail
->
rta_len
=
(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
))
-
(
void
*
)
tail
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
n
)
-
(
void
*
)
tail
;
ok
++
;
}
...
...
@@ -210,8 +205,7 @@ done0:
goto
bad_val
;
}
tail2
->
rta_len
=
(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
))
-
(
void
*
)
tail2
;
tail2
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
n
)
-
(
void
*
)
tail2
;
done:
*
argc_p
=
argc
;
...
...
@@ -376,8 +370,7 @@ int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
argv
+=
1
;
tail
=
(
struct
rtattr
*
)(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
));
tail
=
NLMSG_TAIL
(
&
req
.
n
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_TAB
,
NULL
,
0
);
while
(
argc
>
0
)
{
...
...
@@ -425,17 +418,15 @@ int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
goto
bad_val
;
}
tail2
=
(
struct
rtattr
*
)
(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
));
addattr_l
(
&
req
.
n
,
MAX_MSG
,
++
prio
,
NULL
,
0
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_KIND
,
k
,
strlen
(
k
)
+
1
);
addattr32
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_INDEX
,
i
);
tail2
->
rta_len
=
(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
))
-
(
void
*
)
tail2
;
tail2
=
NLMSG_TAIL
(
&
req
.
n
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
++
prio
,
NULL
,
0
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_KIND
,
k
,
strlen
(
k
)
+
1
);
addattr32
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_INDEX
,
i
);
tail2
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
&
req
.
n
)
-
(
void
*
)
tail2
;
}
tail
->
rta_len
=
(
((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
))
-
(
void
*
)
tail
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
&
req
.
n
)
-
(
void
*
)
tail
;
if
(
rtnl_open
(
&
rth
,
0
)
<
0
)
{
fprintf
(
stderr
,
"Cannot open rtnetlink
\n
"
);
...
...
@@ -485,14 +476,14 @@ int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
req
.
n
.
nlmsg_len
=
NLMSG_LENGTH
(
sizeof
(
struct
tcamsg
));
req
.
n
.
nlmsg_flags
=
NLM_F_REQUEST
|
flags
;
req
.
n
.
nlmsg_type
=
cmd
;
tail
=
(
struct
rtattr
*
)(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
)
);
tail
=
NLMSG_TAIL
(
&
req
.
n
);
argc
-=
1
;
argv
+=
1
;
if
(
parse_action
(
&
argc
,
&
argv
,
TCA_ACT_TAB
,
&
req
.
n
))
{
fprintf
(
stderr
,
"Illegal
\"
action
\"\n
"
);
return
-
1
;
}
tail
->
rta_len
=
(
((
void
*
)
&
req
.
n
)
+
req
.
n
.
nlmsg_len
)
-
(
void
*
)
tail
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
&
req
.
n
)
-
(
void
*
)
tail
;
if
(
rtnl_open
(
&
rth
,
0
)
<
0
)
{
fprintf
(
stderr
,
"Cannot open rtnetlink
\n
"
);
...
...
@@ -530,11 +521,9 @@ int tc_act_list_or_flush(int argc, char **argv, int event)
req
.
n
.
nlmsg_len
=
NLMSG_LENGTH
(
sizeof
(
struct
tcamsg
));
tail
=
(
struct
rtattr
*
)(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
));
tail
=
NLMSG_TAIL
(
&
req
.
n
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_TAB
,
NULL
,
0
);
tail2
=
(
struct
rtattr
*
)
(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
));
tail2
=
NLMSG_TAIL
(
&
req
.
n
);
strncpy
(
k
,
*
argv
,
sizeof
(
k
)
-
1
);
#ifdef CONFIG_GACT
...
...
@@ -555,10 +544,8 @@ int tc_act_list_or_flush(int argc, char **argv, int event)
addattr_l
(
&
req
.
n
,
MAX_MSG
,
++
prio
,
NULL
,
0
);
addattr_l
(
&
req
.
n
,
MAX_MSG
,
TCA_ACT_KIND
,
k
,
strlen
(
k
)
+
1
);
tail2
->
rta_len
=
(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
))
-
(
void
*
)
tail2
;
tail
->
rta_len
=
(((
void
*
)
&
req
.
n
)
+
NLMSG_ALIGN
(
req
.
n
.
nlmsg_len
))
-
(
void
*
)
tail
;
tail2
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
&
req
.
n
)
-
(
void
*
)
tail2
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
&
req
.
n
)
-
(
void
*
)
tail
;
if
(
rtnl_open
(
&
rth
,
0
)
<
0
)
{
fprintf
(
stderr
,
"Cannot open rtnetlink
\n
"
);
...
...
tc/q_hfsc.c
View file @
4a86fe19
...
...
@@ -205,7 +205,7 @@ hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
return
-
1
;
}
tail
=
(
struct
rtattr
*
)(((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
)
);
tail
=
NLMSG_TAIL
(
n
);
addattr_l
(
n
,
1024
,
TCA_OPTIONS
,
NULL
,
0
);
if
(
rsc_ok
)
...
...
@@ -215,7 +215,7 @@ hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
if
(
usc_ok
)
addattr_l
(
n
,
1024
,
TCA_HFSC_USC
,
&
usc
,
sizeof
(
usc
));
tail
->
rta_len
=
(
((
void
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
))
-
(
void
*
)
tail
;
tail
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
n
)
-
(
void
*
)
tail
;
return
0
;
}
...
...
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