• Jose Blanquicet's avatar
    firewall: Remove old rules · 23c6d808
    Jose Blanquicet authored
    When a new service becomes ready or online, it is checked if its
    technology is more preferred than the one used by the currrent default
    gateway. If so, this new service becomes the new default gateway.
    
    When the tethering is enabled, a NAT rule is created to forward traffic
    between the interface playing the AP role and the interface connected
    to current default gateway. The problem comes out when the default
    gateway changes, because the NAT rule is disabled but not removed from
    the firewall rules list. Therefore, when the new rule is installed also
    the old rule is installed because it is still in the list. If it
    changes again, then three rules will be installed, and so on. They are
    never removed.
    
    This patch adds a deletion of all the rules from the firewall list
    exactly after they are disabled to avoid the described problem.
    23c6d808
firewall.c 10.9 KB