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
c7535333
Commit
c7535333
authored
Oct 09, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a function to determine an interface's link-local addresses.
parent
ff148e90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
kernel.c
kernel.c
+29
-0
kernel.h
kernel.h
+2
-0
No files found.
kernel.c
View file @
c7535333
...
...
@@ -29,6 +29,35 @@ THE SOFTWARE.
#include "kernel_netlink.c"
#endif
/* Return an interface's link-local addresses */
int
kernel_ll_addresses
(
char
*
ifname
,
int
ifindex
,
unsigned
char
(
*
addresses
)[
16
],
int
maxaddr
)
{
struct
kernel_route
routes
[
64
];
int
rc
,
i
,
j
;
rc
=
kernel_addresses
(
ifname
,
ifindex
,
routes
,
64
);
if
(
rc
<
0
)
return
-
1
;
j
=
0
;
for
(
i
=
0
;
i
<
rc
;
i
++
)
{
unsigned
char
*
prefix
;
if
(
j
>=
maxaddr
)
break
;
if
(
routes
[
i
].
ifindex
!=
ifindex
)
continue
;
prefix
=
routes
[
i
].
prefix
;
if
(
prefix
[
0
]
==
0xFE
&&
prefix
[
1
]
==
0x80
&&
memcmp
(
prefix
+
2
,
zeroes
,
6
)
==
0
)
{
memcpy
(
addresses
[
j
],
prefix
,
16
);
j
++
;
}
}
return
j
;
}
/* Like gettimeofday, but should return monotonic time. If POSIX clocks
are not available, falls back to gettimeofday. */
int
...
...
kernel.h
View file @
c7535333
...
...
@@ -59,4 +59,6 @@ int kernel_routes(struct kernel_route *routes, int maxroutes);
int
kernel_callback
(
int
(
*
fn
)(
int
,
void
*
),
void
*
closure
);
int
kernel_addresses
(
char
*
ifname
,
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
);
int
kernel_ll_addresses
(
char
*
ifname
,
int
ifindex
,
unsigned
char
(
*
addresses
)[
16
],
int
maxaddr
);
int
gettime
(
struct
timeval
*
tv
);
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