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
2991a533
Commit
2991a533
authored
Mar 09, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make kernel_addresses return struct kernel_route.
parent
d8401b34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
kernel.h
kernel.h
+1
-1
kernel_netlink.c
kernel_netlink.c
+23
-19
No files found.
kernel.h
View file @
2991a533
...
...
@@ -59,4 +59,4 @@ int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
unsigned
int
newmetric
);
int
kernel_routes
(
struct
kernel_route
*
routes
,
int
maxroutes
);
int
kernel_callback
(
int
(
*
fn
)(
int
,
void
*
),
void
*
closure
);
int
kernel_addresses
(
int
ifindex
,
struct
in6_addr
*
addresses
,
int
maxaddr
);
int
kernel_addresses
(
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
);
kernel_netlink.c
View file @
2991a533
...
...
@@ -1057,10 +1057,9 @@ int
filter_addresses
(
struct
nlmsghdr
*
nh
,
void
*
data
)
{
int
rc
;
int
max
addr
=
0
;
struct
in6_addr
*
addr
s
=
NULL
;
int
max
routes
=
0
;
struct
kernel_route
*
route
s
=
NULL
;
struct
in6_addr
addr
;
struct
in6_addr
*
current_addr
;
int
*
found
=
NULL
;
int
len
;
struct
ifaddrmsg
*
ifa
;
...
...
@@ -1069,15 +1068,15 @@ filter_addresses(struct nlmsghdr *nh, void *data)
if
(
data
)
{
void
**
args
=
(
void
**
)
data
;
max
addr
=
*
(
int
*
)
args
[
0
];
addrs
=
(
struct
in6_addr
*
)
args
[
1
];
max
routes
=
*
(
int
*
)
args
[
0
];
routes
=
(
struct
kernel_route
*
)
args
[
1
];
found
=
(
int
*
)
args
[
2
];
index
=
*
(
int
*
)
args
[
3
];
}
len
=
nh
->
nlmsg_len
;
if
(
data
&&
*
found
>=
max
addr
)
if
(
data
&&
*
found
>=
max
routes
)
return
0
;
if
(
nh
->
nlmsg_type
!=
RTM_NEWADDR
&&
...
...
@@ -1090,23 +1089,28 @@ filter_addresses(struct nlmsghdr *nh, void *data)
if
(
index
&&
ifa
->
ifa_index
!=
index
)
return
0
;
if
(
data
)
current_addr
=
&
addrs
[
*
found
];
else
current_addr
=
&
addr
;
rc
=
parse_addr_rta
(
ifa
,
len
,
current_addr
);
rc
=
parse_addr_rta
(
ifa
,
len
,
&
addr
);
if
(
rc
<
0
)
return
0
;
if
(
IN6_IS_ADDR_LINKLOCAL
(
current_
addr
))
if
(
IN6_IS_ADDR_LINKLOCAL
(
&
addr
))
return
0
;
if
(
data
)
*
found
=
(
*
found
)
+
1
;
kdebugf
(
"found address on interface %s(%d): %s
\n
"
,
if_indextoname
(
index
,
ifname
),
index
,
format_address
(
current_addr
->
s6_addr
));
format_address
(
addr
.
s6_addr
));
if
(
data
)
{
struct
kernel_route
*
route
=
&
routes
[
*
found
];
memcpy
(
route
->
prefix
,
addr
.
s6_addr
,
16
);
route
->
plen
=
128
;
route
->
metric
=
0
;
route
->
ifindex
=
index
;
route
->
proto
=
RTPROTO_BABEL_LOCAL
;
memset
(
route
->
gw
,
0
,
16
);
*
found
=
(
*
found
)
+
1
;
}
return
1
;
}
...
...
@@ -1144,11 +1148,11 @@ filter_netlink(struct nlmsghdr *nh, void *data)
}
int
kernel_addresses
(
int
ifindex
,
struct
in6_addr
*
addr
,
int
maxaddr
)
kernel_addresses
(
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
)
{
int
max
a
=
maxaddr
;
int
max
r
=
maxroutes
;
int
found
=
0
;
void
*
data
[]
=
{
&
max
a
,
addr
,
&
found
,
(
void
*
)
&
ifindex
};
void
*
data
[]
=
{
&
max
r
,
routes
,
&
found
,
(
void
*
)
&
ifindex
};
struct
rtgenmsg
g
;
int
rc
;
...
...
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