ip6: fix setting default route with libnl3 (bgo #668286)

libnl3 wants a destination address when setting a route, so just hand
it '::' with a address len of 0 so we don't get -NLE_MISSING_ATTR
when trying to set the IPv6 default route.
This commit is contained in:
Dan Williams 2012-03-22 00:41:53 -05:00
parent 1ecc9c215c
commit 71ad568cfb

View file

@ -1041,11 +1041,10 @@ replace_default_ip6_route (int ifindex, const struct in6_addr *gw)
g_return_val_if_fail (route != NULL, -ENOMEM);
/* Add the new default route */
err = nm_netlink_route6_add (route, NULL, 0, gw, NLM_F_REPLACE);
err = nm_netlink_route6_add (route, &in6addr_any, 0, gw, NLM_F_REPLACE);
if (err == -NLE_EXIST) {
/* FIXME: even though we use NLM_F_REPLACE the kernel won't replace
* the route if it's the same. Should try to remove it first, then
* add the new one again here.
* the route if it's the same. Suppress the pointless error.
*/
err = 0;
}