Maintain config order of ip rules unless user explicitely provides priority
[project/netifd.git] / system-linux.c
index 87a4efa..d788a01 100644 (file)
@@ -1149,6 +1149,8 @@ static int system_iprule(struct iprule *rule, int cmd)
 
        if (rule->flags & IPRULE_PRIORITY)
                nla_put_u32(msg, FRA_PRIORITY, rule->priority);
 
        if (rule->flags & IPRULE_PRIORITY)
                nla_put_u32(msg, FRA_PRIORITY, rule->priority);
+       else if (cmd == RTM_NEWRULE)
+               nla_put_u32(msg, FRA_PRIORITY, rule->order);
 
        if (rule->flags & IPRULE_FWMARK)
                nla_put_u32(msg, FRA_FWMARK, rule->fwmark);
 
        if (rule->flags & IPRULE_FWMARK)
                nla_put_u32(msg, FRA_FWMARK, rule->fwmark);