Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
ffd18f72
Commit
ffd18f72
authored
Jun 17, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check table before parsing kernel route.
parent
90aabddc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
kernel.c
kernel.c
+5
-11
No files found.
kernel.c
View file @
ffd18f72
...
@@ -629,8 +629,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
...
@@ -629,8 +629,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
}
}
static
int
static
int
parse_kernel_route_rta
(
struct
rtmsg
*
rtm
,
int
len
,
parse_kernel_route_rta
(
struct
rtmsg
*
rtm
,
int
len
,
struct
kernel_route
*
route
)
struct
kernel_route
*
route
,
int
*
table
)
{
{
struct
rtattr
*
rta
=
RTM_RTA
(
rtm
);;
struct
rtattr
*
rta
=
RTM_RTA
(
rtm
);;
...
@@ -642,8 +641,6 @@ parse_kernel_route_rta(struct rtmsg *rtm, int len,
...
@@ -642,8 +641,6 @@ parse_kernel_route_rta(struct rtmsg *rtm, int len,
route
->
metric
=
KERNEL_INFINITY
;
route
->
metric
=
KERNEL_INFINITY
;
route
->
ifindex
=
0
;
route
->
ifindex
=
0
;
*
table
=
rtm
->
rtm_table
;
while
(
RTA_OK
(
rta
,
len
))
{
while
(
RTA_OK
(
rta
,
len
))
{
switch
(
rta
->
rta_type
)
{
switch
(
rta
->
rta_type
)
{
case
RTA_DST
:
case
RTA_DST
:
...
@@ -705,7 +702,6 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data)
...
@@ -705,7 +702,6 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data)
{
{
struct
kernel_route
route
;
struct
kernel_route
route
;
int
table
;
int
len
=
nh
->
nlmsg_len
;
int
len
=
nh
->
nlmsg_len
;
struct
rtmsg
*
rtm
;
struct
rtmsg
*
rtm
;
...
@@ -716,7 +712,7 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data)
...
@@ -716,7 +712,7 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data)
rtm
=
(
struct
rtmsg
*
)
NLMSG_DATA
(
nh
);
rtm
=
(
struct
rtmsg
*
)
NLMSG_DATA
(
nh
);
len
-=
NLMSG_LENGTH
(
0
);
len
-=
NLMSG_LENGTH
(
0
);
parse_kernel_route_rta
(
rtm
,
len
,
&
route
,
&
table
);
parse_kernel_route_rta
(
rtm
,
len
,
&
route
);
print_kernel_route
(
nh
->
nlmsg_type
,
rtm
->
rtm_protocol
,
print_kernel_route
(
nh
->
nlmsg_type
,
rtm
->
rtm_protocol
,
rtm
->
rtm_type
,
&
route
);
rtm
->
rtm_type
,
&
route
);
return
0
;
return
0
;
...
@@ -733,7 +729,6 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data)
...
@@ -733,7 +729,6 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data)
int
*
found
=
(
int
*
)
args
[
3
];
int
*
found
=
(
int
*
)
args
[
3
];
struct
rtmsg
*
rtm
;
struct
rtmsg
*
rtm
;
int
table
;
int
len
=
nh
->
nlmsg_len
;
int
len
=
nh
->
nlmsg_len
;
...
@@ -755,12 +750,11 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data)
...
@@ -755,12 +750,11 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data)
if
(
rtm
->
rtm_dst_len
>
maxplen
||
rtm
->
rtm_src_len
!=
0
)
if
(
rtm
->
rtm_dst_len
>
maxplen
||
rtm
->
rtm_src_len
!=
0
)
return
0
;
return
0
;
parse_kernel_route_rta
(
rtm
,
len
,
&
routes
[
*
found
],
&
table
);
if
(
rtm
->
rtm_table
!=
RT_TABLE_MAIN
)
if
(
table
!=
RT_TABLE_MAIN
)
return
0
;
return
0
;
//*found++; ??
parse_kernel_route_rta
(
rtm
,
len
,
&
routes
[
*
found
]);
*
found
=
(
*
found
)
+
1
;
*
found
=
(
*
found
)
+
1
;
return
0
;
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