Commit 6b76daa7 authored by Matthieu Boutier's avatar Matthieu Boutier Committed by Juliusz Chroboczek

Fix kernel_addresses when called with ifindex == 0.

parent 458e6da4
......@@ -204,7 +204,7 @@ filter_address(struct kernel_addr *addr, void *data) {
int maxroutes = *(int *)args[0];
struct kernel_route *routes = (struct kernel_route*)args[1];
int *found = (int *)args[2];
int ifindex = args[3] ? *(int*)args[3] : 0;
int ifindex = *(int*)args[3];
int ll = args[4] ? !!*(int*)args[4] : 0;
struct kernel_route *route = NULL;
......@@ -214,7 +214,8 @@ filter_address(struct kernel_addr *addr, void *data) {
if(ll == !IN6_IS_ADDR_LINKLOCAL(&addr->addr))
return 0;
if(addr->ifindex != ifindex)
/* ifindex may be 0 -- see kernel_addresses */
if(ifindex && addr->ifindex != ifindex)
return 0;
route = &routes[*found];
......@@ -229,6 +230,8 @@ filter_address(struct kernel_addr *addr, void *data) {
return 1;
}
/* ifindex is 0 for all interfaces. ll indicates whether we are
interested in link-local or global addresses. */
int
kernel_addresses(int ifindex, int ll, struct kernel_route *routes,
int maxroutes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment