diff options
Diffstat (limited to 'interface-ip.c')
-rw-r--r-- | interface-ip.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/interface-ip.c b/interface-ip.c index c159e09..b5029c5 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -94,6 +94,8 @@ const struct uci_blob_param_list neighbor_attr_list = { struct list_head prefixes = LIST_HEAD_INIT(prefixes); static struct device_prefix *ula_prefix = NULL; static struct uloop_timeout valid_until_timeout; +static unsigned int priority_addr = IPRULE_PRIORITY_ADDR; +static unsigned int priority_addr_mask = IPRULE_PRIORITY_ADDR_MASK; static void @@ -599,10 +601,10 @@ interface_add_addr_rules(struct device_addr *addr, bool enabled) { bool v6 = (addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6; - set_ip_source_policy(enabled, v6, IPRULE_PRIORITY_ADDR, &addr->addr, + set_ip_source_policy(enabled, v6, priority_addr, &addr->addr, (v6) ? 128 : 32, addr->policy_table, NULL, NULL, true); - set_ip_source_policy(enabled, v6, IPRULE_PRIORITY_ADDR_MASK, + set_ip_source_policy(enabled, v6, priority_addr_mask, &addr->addr, addr->mask, addr->policy_table, NULL, NULL, false); } @@ -927,7 +929,7 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment, addr.valid_until = now + 7200; if (iface->ip6table) - set_ip_source_policy(false, true, IPRULE_PRIORITY_ADDR_MASK, &addr.addr, + set_ip_source_policy(false, true, priority_addr_mask, &addr.addr, addr.mask < 64 ? 64 : addr.mask, iface->ip6table, NULL, NULL, false); if (prefix->iface) { @@ -963,7 +965,7 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment, if (!assignment->enabled) { if (iface->ip6table) - set_ip_source_policy(true, true, IPRULE_PRIORITY_ADDR_MASK, &addr.addr, + set_ip_source_policy(true, true, priority_addr_mask, &addr.addr, addr.mask < 64 ? 64 : addr.mask, iface->ip6table, NULL, NULL, false); if (prefix->iface) { @@ -1326,6 +1328,18 @@ interface_ip_set_ula_prefix(const char *prefix) } } +void +interface_ip_set_addr_priority(unsigned int priority) +{ + priority_addr = priority; +} + +void +interface_ip_set_addr_mask_priority(unsigned int priority) +{ + priority_addr_mask = priority; +} + static void interface_add_dns_server(struct interface_ip_settings *ip, const char *str) { |