struct device *dev = iface->l3_dev.dev;
struct device_route route;
+ if (addr->flags & DEVADDR_OFFLINK)
+ return;
+
memset(&route, 0, sizeof(route));
route.iface = iface;
route.flags = addr->flags;
route.flags |= DEVADDR_KERNEL;
system_del_route(dev, &route);
- if (!(addr->flags & DEVADDR_OFFLINK)) {
- route.flags &= ~DEVADDR_KERNEL;
- route.metric = iface->metric;
- system_add_route(dev, &route);
- }
+ route.flags &= ~DEVADDR_KERNEL;
+ route.metric = iface->metric;
+ system_add_route(dev, &route);
} else {
- if (!(addr->flags & DEVADDR_OFFLINK))
- system_del_route(dev, &route);
+ system_del_route(dev, &route);
}
}
}
}
- if ((a_new->flags & DEVADDR_OFFLINK) || iface->metric)
+ if (iface->metric)
interface_handle_subnet_route(iface, a_new, true);
}
}
if (enabled) {
system_add_address(dev, addr);
- if ((addr->flags & DEVADDR_OFFLINK) || iface->metric)
+ if (iface->metric)
interface_handle_subnet_route(iface, addr, true);
} else {
interface_handle_subnet_route(iface, addr, false);
.ifa_family = (alen == 4) ? AF_INET : AF_INET6,
.ifa_prefixlen = addr->mask,
.ifa_index = dev->ifindex,
+ .ifa_flags = (addr->flags & DEVADDR_OFFLINK) ? IFA_F_NOPREFIXROUTE : 0,
};
struct nl_msg *msg;