Commit d1bdd8cc authored by dermiste's avatar dermiste

fixing kernel_addresses looping

parent 219c1400
...@@ -659,7 +659,7 @@ kernel_addresses(char *ifname, int ifindex, int ll, ...@@ -659,7 +659,7 @@ kernel_addresses(char *ifname, int ifindex, int ll,
i = 0; i = 0;
while(ifap && i < maxroutes) { while(ifap && i < maxroutes) {
if(ifap->ifa_name == NULL || ifname == NULL || strcmp(ifap->ifa_name, ifname) != 0) if((ifname != NULL && strcmp(ifap->ifa_name, ifname) != 0))
goto next; goto next;
if(ifap->ifa_addr->sa_family == AF_INET6) { if(ifap->ifa_addr->sa_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)ifap->ifa_addr; struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)ifap->ifa_addr;
...@@ -671,6 +671,7 @@ kernel_addresses(char *ifname, int ifindex, int ll, ...@@ -671,6 +671,7 @@ kernel_addresses(char *ifname, int ifindex, int ll,
routes[i].ifindex = ifindex; routes[i].ifindex = ifindex;
routes[i].proto = RTPROT_BABEL_LOCAL; routes[i].proto = RTPROT_BABEL_LOCAL;
memset(routes[i].gw, 0, 16); memset(routes[i].gw, 0, 16);
i++;
} else if(ifap->ifa_addr->sa_family == AF_INET) { } else if(ifap->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in*)ifap->ifa_addr; struct sockaddr_in *sin = (struct sockaddr_in*)ifap->ifa_addr;
if(ll) if(ll)
...@@ -682,10 +683,10 @@ kernel_addresses(char *ifname, int ifindex, int ll, ...@@ -682,10 +683,10 @@ kernel_addresses(char *ifname, int ifindex, int ll,
routes[i].ifindex = ifindex; routes[i].ifindex = ifindex;
routes[i].proto = RTPROT_BABEL_LOCAL; routes[i].proto = RTPROT_BABEL_LOCAL;
memset(routes[i].gw, 0, 16); memset(routes[i].gw, 0, 16);
i++;
} }
next: next:
ifap = ifap->ifa_next; ifap = ifap->ifa_next;
i++;
} }
freeifaddrs(ifa); freeifaddrs(ifa);
......
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