diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2015-09-09 15:45:51 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-09-10 22:50:25 +0200 |
commit | f566d7a2cdd34dba57c1052284764f5d17229b81 (patch) | |
tree | bcb08c2b5f8773663fd8f231d7a1ef2644a45853 | |
parent | 75cbc687b51ea986c2d2a33e826aedd430d950be (diff) |
interface-ip: Don't create ip network rule if address mask is equal to full mask
Prevents the creation of identical address and network IP rules
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | interface-ip.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/interface-ip.c b/interface-ip.c index 43b63c7..d5f6aff 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -513,8 +513,10 @@ interface_update_proto_addr(struct vlist_tree *tree, if (table) { set_ip_source_policy(false, v6, IPRULE_PRIORITY_ADDR, &a_old->addr, (v6) ? 128 : 32, table, NULL, NULL); - set_ip_source_policy(false, v6, IPRULE_PRIORITY_NW, &a_old->addr, - a_old->mask, table, NULL, NULL); + + if (a_old->mask != ((v6) ? 128 : 32)) + set_ip_source_policy(false, v6, IPRULE_PRIORITY_NW, &a_old->addr, + a_old->mask, table, NULL, NULL); } if (!(a_old->flags & DEVADDR_EXTERNAL)) { @@ -546,8 +548,10 @@ interface_update_proto_addr(struct vlist_tree *tree, if (table) { set_ip_source_policy(true, v6, IPRULE_PRIORITY_ADDR, &a_new->addr, (v6) ? 128 : 32, table, NULL, NULL); - set_ip_source_policy(true, v6, IPRULE_PRIORITY_NW, &a_new->addr, - a_new->mask, table, NULL, NULL); + + if (a_new->mask != ((v6) ? 128 : 32)) + set_ip_source_policy(true, v6, IPRULE_PRIORITY_NW, &a_new->addr, + a_new->mask, table, NULL, NULL); } } } |