diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 1ed034a47bd0..9f630310b271 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -351,6 +351,7 @@ static void nft_netdev_hook_free_ops(struct nft_hook *hook) struct nf_hook_ops *ops, *next; list_for_each_entry_safe(ops, next, &hook->ops_list, list) { + printk(KERN_INFO "%s: freeing ops @%p from hook @%p\n", __func__, ops, hook); list_del(&ops->list); kfree(ops); } @@ -2374,6 +2375,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net, err = -ENOMEM; goto err_hook_free; } + printk(KERN_INFO "%s: Adding device %s@%p to new ops @%p of new hook @%p\n", __func__, dev->name, dev, ops, hook); ops->dev = dev; list_add_tail(&ops->list, &hook->ops_list); } @@ -9834,6 +9836,7 @@ static int nft_flowtable_event(unsigned long event, struct net_device *dev, if (!ops || (changename && match)) continue; + printk(KERN_INFO "%s: unregistering device %s@%p in ops @%p of hook @%p with flowtable @%p\n", __func__, dev->name, dev, ops, hook, flowtable); /* flow_offload_netdev_event() cleans up entries for us. */ nft_unregister_flowtable_ops(dev_net(dev), flowtable, ops); @@ -9841,6 +9844,9 @@ static int nft_flowtable_event(unsigned long event, struct net_device *dev, kfree_rcu(ops, rcu); break; case NETDEV_REGISTER: + if (match && !changename && ops) + printk(KERN_ERR "%s: found already registered device %s@%p in ops @%p of hook @%p with flowtable @%p\n", __func__, dev->name, dev, ops, hook, flowtable); + /* NOP if not matching or already registered */ if (!match || (changename && ops)) continue; @@ -9850,6 +9856,8 @@ static int nft_flowtable_event(unsigned long event, struct net_device *dev, if (!ops) return 1; + printk(KERN_INFO "%s: registering device %s@%p in ops @%p of hook @%p with flowtable @%p\n", __func__, dev->name, dev, ops, hook, flowtable); + ops->pf = NFPROTO_NETDEV; ops->hooknum = flowtable->hooknum; ops->priority = flowtable->data.priority;