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
7230121b
Commit
7230121b
authored
Oct 09, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make kernel_addresses take an interface name and index.
parent
1f3e1cba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
kernel.h
kernel.h
+2
-2
kernel_netlink.c
kernel_netlink.c
+8
-2
kernel_socket.c
kernel_socket.c
+3
-1
xroute.c
xroute.c
+1
-1
No files found.
kernel.h
View file @
7230121b
...
...
@@ -57,6 +57,6 @@ 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
(
struct
kernel_route
*
routes
,
int
maxroutes
);
int
kernel_addresses
(
char
*
ifname
,
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
);
int
gettime
(
struct
timeval
*
tv
);
kernel_netlink.c
View file @
7230121b
...
...
@@ -1120,12 +1120,14 @@ filter_addresses(struct nlmsghdr *nh, void *data)
int
len
;
struct
ifaddrmsg
*
ifa
;
char
ifname
[
IFNAMSIZ
];
int
ifindex
=
0
;
if
(
data
)
{
void
**
args
=
(
void
**
)
data
;
maxroutes
=
*
(
int
*
)
args
[
0
];
routes
=
(
struct
kernel_route
*
)
args
[
1
];
found
=
(
int
*
)
args
[
2
];
ifindex
=
args
[
3
]
?
0
:
*
(
int
*
)
args
[
3
];
}
len
=
nh
->
nlmsg_len
;
...
...
@@ -1147,6 +1149,9 @@ filter_addresses(struct nlmsghdr *nh, void *data)
if
(
IN6_IS_ADDR_LINKLOCAL
(
&
addr
))
return
0
;
if
(
ifindex
&&
ifa
->
ifa_index
!=
ifindex
)
return
0
;
kdebugf
(
"found address on interface %s(%d): %s
\n
"
,
if_indextoname
(
ifa
->
ifa_index
,
ifname
),
ifa
->
ifa_index
,
format_address
(
addr
.
s6_addr
));
...
...
@@ -1199,11 +1204,12 @@ filter_netlink(struct nlmsghdr *nh, void *data)
}
int
kernel_addresses
(
struct
kernel_route
*
routes
,
int
maxroutes
)
kernel_addresses
(
char
*
ifname
,
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
)
{
int
maxr
=
maxroutes
;
int
found
=
0
;
void
*
data
[]
=
{
&
maxr
,
routes
,
&
found
,
NULL
};
void
*
data
[]
=
{
&
maxr
,
routes
,
&
found
,
&
ifindex
,
NULL
};
struct
rtgenmsg
g
;
int
rc
;
...
...
kernel_socket.c
View file @
7230121b
/*
Copyright (c) 2007 by Grégoire Henry
Copyright (c) 2008 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
...
...
@@ -600,7 +601,8 @@ socket_read(int sock)
}
int
kernel_addresses
(
struct
kernel_route
*
routes
,
int
maxroutes
)
kernel_addresses
(
char
*
ifname
,
int
ifindex
,
struct
kernel_route
*
routes
,
int
maxroutes
)
{
errno
=
ENOSYS
;
return
-
1
;
...
...
xroute.c
View file @
7230121b
...
...
@@ -135,7 +135,7 @@ check_xroutes(int send_updates)
if
(
routes
==
NULL
)
return
-
1
;
rc
=
kernel_addresses
(
routes
,
maxroutes
);
rc
=
kernel_addresses
(
NULL
,
0
,
routes
,
maxroutes
);
if
(
rc
<
0
)
{
perror
(
"kernel_addresses"
);
numroutes
=
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