Commit 4313be61 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix exporting of IPv4 default routes on recent kernels.

Recent kernels don't include RTA_DST in the default route.  This fixes
incorrect parsing of such entries.  Reported by Robert Lukan.
parent ce4ad07e
......@@ -784,7 +784,12 @@ parse_kernel_route_rta(struct rtmsg *rtm, int len, struct kernel_route *route)
memset(&route->prefix, 0, sizeof(struct in6_addr));
memset(&route->gw, 0, sizeof(struct in6_addr));
route->plen = rtm->rtm_dst_len;
if(rtm->rtm_family == AF_INET) route->plen += 96;
if(rtm->rtm_family == AF_INET) {
const char zeroes[4] = {0, 0, 0, 0};
v4tov6(route->prefix, zeroes);
route->plen += 96;
}
route->metric = KERNEL_INFINITY;
route->ifindex = 0;
route->proto = rtm->rtm_protocol;
......
......@@ -223,7 +223,7 @@ mask_prefix(unsigned char *ret,
return (const unsigned char *)ret;
}
static unsigned char v4prefix[16] =
static const unsigned char v4prefix[16] =
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 };
const char *
......
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