return (add) ? system_add_iprule(&rule) : system_del_iprule(&rule);
}
-static int set_ip_lo_policy(bool add, bool v6, struct interface *iface)
-{
- struct iprule rule = {
- .flags = IPRULE_IN | IPRULE_LOOKUP | IPRULE_PRIORITY,
- .priority = IPRULE_PRIORITY_NW + iface->l3_dev.dev->ifindex,
- .lookup = (v6) ? iface->ip6table : iface->ip4table,
- .in_dev = "lo"
- };
-
- if (!rule.lookup)
- return 0;
-
- rule.flags |= (v6) ? IPRULE_INET6 : IPRULE_INET4;
-
- return (add) ? system_add_iprule(&rule) : system_del_iprule(&rule);
-}
-
static bool
__find_ip_addr_target(struct interface_ip_settings *ip, union if_addr *a, bool v6)
{
route.metric = iface->metric;
system_add_route(l3_downlink, &route);
- if (uplink && uplink->l3_dev.dev) {
- int mtu = system_update_ipv6_mtu(
- uplink->l3_dev.dev, 0);
- if (mtu > 0)
+ if (uplink && uplink->l3_dev.dev && !(l3_downlink->settings.flags & DEV_OPT_MTU6)) {
+ int mtu = system_update_ipv6_mtu(uplink->l3_dev.dev, 0);
+ int mtu_old = system_update_ipv6_mtu(l3_downlink, 0);
+
+ if (mtu > 0 && mtu_old > mtu)
system_update_ipv6_mtu(l3_downlink, mtu);
}
if (!strcmp(a->name, ip->iface->name))
interface_set_prefix_address(a, c, ip->iface, enabled);
- if (ip->iface && ip->iface->l3_dev.dev) {
- set_ip_lo_policy(enabled, true, ip->iface);
- set_ip_lo_policy(enabled, false, ip->iface);
-
+ if (ip->iface && ip->iface->l3_dev.dev)
set_ip_source_policy(enabled, true, IPRULE_PRIORITY_REJECT + ip->iface->l3_dev.dev->ifindex,
NULL, 0, 0, ip->iface, "failed_policy");
- }
}
void