Commit 4e70b650 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Unify kernel_*_addresses into kernel_addresses.

parent 0ec9de17
...@@ -58,9 +58,7 @@ int kernel_route(int operation, const unsigned char *dest, unsigned short plen, ...@@ -58,9 +58,7 @@ int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
unsigned int newmetric); unsigned int newmetric);
int kernel_routes(struct kernel_route *routes, int maxroutes); int kernel_routes(struct kernel_route *routes, int maxroutes);
int kernel_callback(int (*fn)(int, void*), void *closure); int kernel_callback(int (*fn)(int, void*), void *closure);
int kernel_addresses(char *ifname, int ifindex, int kernel_addresses(char *ifname, int ifindex, int ll,
struct kernel_route *routes, int maxroutes); struct kernel_route *routes, int maxroutes);
int kernel_ll_addresses(char *ifname, int ifindex,
struct kernel_route *routes, int maxroutes);
int if_eui64(char *ifname, int ifindex, unsigned char *eui); int if_eui64(char *ifname, int ifindex, unsigned char *eui);
int gettime(struct timeval *tv); int gettime(struct timeval *tv);
...@@ -1266,10 +1266,9 @@ filter_netlink(struct nlmsghdr *nh, void *data) ...@@ -1266,10 +1266,9 @@ filter_netlink(struct nlmsghdr *nh, void *data)
return 0; return 0;
} }
static int int
kernel_addresses_internal(char *ifname, int ifindex, kernel_addresses(char *ifname, int ifindex, int ll,
struct kernel_route *routes, int maxroutes, struct kernel_route *routes, int maxroutes)
int ll)
{ {
int maxr = maxroutes; int maxr = maxroutes;
int found = 0; int found = 0;
...@@ -1307,20 +1306,6 @@ kernel_addresses_internal(char *ifname, int ifindex, ...@@ -1307,20 +1306,6 @@ kernel_addresses_internal(char *ifname, int ifindex,
return found; return found;
} }
int
kernel_addresses(char *ifname, int ifindex,
struct kernel_route *routes, int maxroutes)
{
return kernel_addresses_internal(ifname, ifindex, routes, maxroutes, 0);
}
int
kernel_ll_addresses(char *ifname, int ifindex,
struct kernel_route *routes, int maxroutes)
{
return kernel_addresses_internal(ifname, ifindex, routes, maxroutes, 1);
}
int int
kernel_callback(int (*fn)(int, void*), void *closure) kernel_callback(int (*fn)(int, void*), void *closure)
{ {
......
...@@ -609,21 +609,13 @@ socket_read(int sock) ...@@ -609,21 +609,13 @@ socket_read(int sock)
} }
int int
kernel_addresses(char *ifname, int ifindex, kernel_addresses(char *ifname, int ifindex, int ll,
struct kernel_route *routes, int maxroutes) struct kernel_route *routes, int maxroutes)
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int
kernel_ll_addresses(char *ifname, int ifindex,
struct kernel_route *routes, int maxroutes)
{
errno = ENOSYS;
return -1;
}
int int
kernel_callback(int (*fn)(int, void*), void *closure) kernel_callback(int (*fn)(int, void*), void *closure)
{ {
......
...@@ -317,7 +317,7 @@ network_up(struct network *net, int up) ...@@ -317,7 +317,7 @@ network_up(struct network *net, int up)
free(net->ll); free(net->ll);
net->numll = 0; net->numll = 0;
net->ll = NULL; net->ll = NULL;
rc = kernel_ll_addresses(net->ifname, net->ifindex, ll, 32); rc = kernel_addresses(net->ifname, net->ifindex, 1, ll, 32);
if(rc < 0) { if(rc < 0) {
perror("kernel_ll_addresses"); perror("kernel_ll_addresses");
} else if(rc > 0) { } else if(rc > 0) {
......
...@@ -135,7 +135,7 @@ check_xroutes(int send_updates) ...@@ -135,7 +135,7 @@ check_xroutes(int send_updates)
if(routes == NULL) if(routes == NULL)
return -1; return -1;
rc = kernel_addresses(NULL, 0, routes, maxroutes); rc = kernel_addresses(NULL, 0, 0, routes, maxroutes);
if(rc < 0) { if(rc < 0) {
perror("kernel_addresses"); perror("kernel_addresses");
numroutes = 0; numroutes = 0;
......
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