Skip to content

Commit

Permalink
netfilter: xt_qtaguid: Allow tracking loopback
Browse files Browse the repository at this point in the history
In the past it would always ignore interfaces with loopback addresses.
Now we just treat them like any other.
This also helps with writing tests that check for the presence
of the qtaguid module.

Signed-off-by: JP Abgrall <jpa@google.com>
  • Loading branch information
jpa468 authored and Stratos Karafotis committed Aug 11, 2013
1 parent 72e00a8 commit 9ca5a51
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions net/netfilter/xt_qtaguid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,18 +1108,13 @@ static void iface_stat_create(struct net_device *net_dev,
spin_lock_bh(&iface_stat_list_lock);
entry = get_iface_entry(ifname);
if (entry != NULL) {
bool activate = !ipv4_is_loopback(ipaddr);
IF_DEBUG("qtaguid: iface_stat: create(%s): entry=%p\n",
ifname, entry);
iface_check_stats_reset_and_adjust(net_dev, entry);
_iface_stat_set_active(entry, net_dev, activate);
_iface_stat_set_active(entry, net_dev, true);
IF_DEBUG("qtaguid: %s(%s): "
"tracking now %d on ip=%pI4\n", __func__,
entry->ifname, activate, &ipaddr);
goto done_unlock_put;
} else if (ipv4_is_loopback(ipaddr)) {
IF_DEBUG("qtaguid: iface_stat: create(%s): "
"ignore loopback dev. ip=%pI4\n", ifname, &ipaddr);
entry->ifname, true, &ipaddr);
goto done_unlock_put;
}

Expand Down Expand Up @@ -1170,19 +1165,13 @@ static void iface_stat_create_ipv6(struct net_device *net_dev,
spin_lock_bh(&iface_stat_list_lock);
entry = get_iface_entry(ifname);
if (entry != NULL) {
bool activate = !(addr_type & IPV6_ADDR_LOOPBACK);
IF_DEBUG("qtaguid: %s(%s): entry=%p\n", __func__,
ifname, entry);
iface_check_stats_reset_and_adjust(net_dev, entry);
_iface_stat_set_active(entry, net_dev, activate);
_iface_stat_set_active(entry, net_dev, true);
IF_DEBUG("qtaguid: %s(%s): "
"tracking now %d on ip=%pI6c\n", __func__,
entry->ifname, activate, &ifa->addr);
goto done_unlock_put;
} else if (addr_type & IPV6_ADDR_LOOPBACK) {
IF_DEBUG("qtaguid: %s(%s): "
"ignore loopback dev. ip=%pI6c\n", __func__,
ifname, &ifa->addr);
entry->ifname, true, &ifa->addr);
goto done_unlock_put;
}

Expand Down

0 comments on commit 9ca5a51

Please sign in to comment.