Re: [l1k:nft_egress_v5 4/5] net/netfilter/nfnetlink_hook.c:232:17: error: 'netdev' undeclared; did you mean 'net_eq'?

From: Lukas Wunner
Date: Thu Sep 30 2021 - 03:20:46 EST


On Thu, Sep 30, 2021 at 02:39:37PM +0800, kernel test robot wrote:
> net/netfilter/nfnetlink_hook.c: In function 'nfnl_hook_entries_head':
> >> net/netfilter/nfnetlink_hook.c:232:17: error: 'netdev' undeclared (first use in this function); did you mean 'net_eq'?
> 232 | netdev = dev_get_by_name_rcu(net, dev);
> | ^~~~~~
> | net_eq
> net/netfilter/nfnetlink_hook.c:232:17: note: each undeclared identifier is reported only once for each function it appears in

Thank you, trusty robot. I've just fixed up the branch as follows:


diff --git a/net/netfilter/nfnetlink_hook.c b/net/netfilter/nfnetlink_hook.c
index 782d2db..c1559e8 100644
--- a/net/netfilter/nfnetlink_hook.c
+++ b/net/netfilter/nfnetlink_hook.c
@@ -185,7 +185,7 @@ static int nfnl_hook_dump_one(struct sk_buff *nlskb,
nfnl_hook_entries_head(u8 pf, unsigned int hook, struct net *net, const char *dev)
{
const struct nf_hook_entries *hook_head = NULL;
-#ifdef CONFIG_NETFILTER_INGRESS
+#if defined(CONFIG_NETFILTER_INGRESS) || defined(CONFIG_NETFILTER_EGRESS)
struct net_device *netdev;
#endif