Re: [PATCH nf-next] netfilter: ctnetlink: remove get_ct indirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-ctnetlink-remove-get_ct-indirection/20210120-190814
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: nios2-randconfig-r002-20210120 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/20f5f1a1d8f0d775b9982e1404cf44840dd0a86a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/netfilter-ctnetlink-remove-get_ct-indirection/20210120-190814
        git checkout 20f5f1a1d8f0d775b9982e1404cf44840dd0a86a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   net/netfilter/nfnetlink_log.c: In function 'nfulnl_log_packet':
   net/netfilter/nfnetlink_log.c:743:9: error: implicit declaration of function 'nf_ct_get' [-Werror=implicit-function-declaration]
     743 |    ct = nf_ct_get(skb, &ctinfo);
         |         ^~~~~~~~~
>> net/netfilter/nfnetlink_log.c:743:7: warning: assignment to 'struct nf_conn *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     743 |    ct = nf_ct_get(skb, &ctinfo);
         |       ^
   cc1: some warnings being treated as errors


vim +743 net/netfilter/nfnetlink_log.c

   674	
   675	/* log handler for internal netfilter logging api */
   676	static void
   677	nfulnl_log_packet(struct net *net,
   678			  u_int8_t pf,
   679			  unsigned int hooknum,
   680			  const struct sk_buff *skb,
   681			  const struct net_device *in,
   682			  const struct net_device *out,
   683			  const struct nf_loginfo *li_user,
   684			  const char *prefix)
   685	{
   686		size_t size;
   687		unsigned int data_len;
   688		struct nfulnl_instance *inst;
   689		const struct nf_loginfo *li;
   690		unsigned int qthreshold;
   691		unsigned int plen = 0;
   692		struct nfnl_log_net *log = nfnl_log_pernet(net);
   693		const struct nfnl_ct_hook *nfnl_ct = NULL;
   694		struct nf_conn *ct = NULL;
   695		enum ip_conntrack_info ctinfo;
   696	
   697		if (li_user && li_user->type == NF_LOG_TYPE_ULOG)
   698			li = li_user;
   699		else
   700			li = &default_loginfo;
   701	
   702		inst = instance_lookup_get(log, li->u.ulog.group);
   703		if (!inst)
   704			return;
   705	
   706		if (prefix)
   707			plen = strlen(prefix) + 1;
   708	
   709		/* FIXME: do we want to make the size calculation conditional based on
   710		 * what is actually present?  way more branches and checks, but more
   711		 * memory efficient... */
   712		size = nlmsg_total_size(sizeof(struct nfgenmsg))
   713			+ nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
   714			+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
   715			+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
   716	#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
   717			+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
   718			+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
   719	#endif
   720			+ nla_total_size(sizeof(u_int32_t))	/* mark */
   721			+ nla_total_size(sizeof(u_int32_t))	/* uid */
   722			+ nla_total_size(sizeof(u_int32_t))	/* gid */
   723			+ nla_total_size(plen)			/* prefix */
   724			+ nla_total_size(sizeof(struct nfulnl_msg_packet_hw))
   725			+ nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp))
   726			+ nla_total_size(sizeof(struct nfgenmsg));	/* NLMSG_DONE */
   727	
   728		if (in && skb_mac_header_was_set(skb)) {
   729			size += nla_total_size(skb->dev->hard_header_len)
   730				+ nla_total_size(sizeof(u_int16_t))	/* hwtype */
   731				+ nla_total_size(sizeof(u_int16_t));	/* hwlen */
   732		}
   733	
   734		spin_lock_bh(&inst->lock);
   735	
   736		if (inst->flags & NFULNL_CFG_F_SEQ)
   737			size += nla_total_size(sizeof(u_int32_t));
   738		if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL)
   739			size += nla_total_size(sizeof(u_int32_t));
   740		if (inst->flags & NFULNL_CFG_F_CONNTRACK) {
   741			nfnl_ct = rcu_dereference(nfnl_ct_hook);
   742			if (nfnl_ct != NULL) {
 > 743				ct = nf_ct_get(skb, &ctinfo);
   744				if (ct != NULL)
   745					size += nfnl_ct->build_size(ct);
   746			}
   747		}
   748		if (pf == NFPROTO_NETDEV || pf == NFPROTO_BRIDGE)
   749			size += nfulnl_get_bridge_size(skb);
   750	
   751		qthreshold = inst->qthreshold;
   752		/* per-rule qthreshold overrides per-instance */
   753		if (li->u.ulog.qthreshold)
   754			if (qthreshold > li->u.ulog.qthreshold)
   755				qthreshold = li->u.ulog.qthreshold;
   756	
   757	
   758		switch (inst->copy_mode) {
   759		case NFULNL_COPY_META:
   760		case NFULNL_COPY_NONE:
   761			data_len = 0;
   762			break;
   763	
   764		case NFULNL_COPY_PACKET:
   765			data_len = inst->copy_range;
   766			if ((li->u.ulog.flags & NF_LOG_F_COPY_LEN) &&
   767			    (li->u.ulog.copy_len < data_len))
   768				data_len = li->u.ulog.copy_len;
   769	
   770			if (data_len > skb->len)
   771				data_len = skb->len;
   772	
   773			size += nla_total_size(data_len);
   774			break;
   775	
   776		case NFULNL_COPY_DISABLED:
   777		default:
   778			goto unlock_and_release;
   779		}
   780	
   781		if (inst->skb && size > skb_tailroom(inst->skb)) {
   782			/* either the queue len is too high or we don't have
   783			 * enough room in the skb left. flush to userspace. */
   784			__nfulnl_flush(inst);
   785		}
   786	
   787		if (!inst->skb) {
   788			inst->skb = nfulnl_alloc_skb(net, inst->peer_portid,
   789						     inst->nlbufsiz, size);
   790			if (!inst->skb)
   791				goto alloc_failure;
   792		}
   793	
   794		inst->qlen++;
   795	
   796		__build_packet_message(log, inst, skb, data_len, pf,
   797					hooknum, in, out, prefix, plen,
   798					nfnl_ct, ct, ctinfo);
   799	
   800		if (inst->qlen >= qthreshold)
   801			__nfulnl_flush(inst);
   802		/* timer_pending always called within inst->lock, so there
   803		 * is no chance of a race here */
   804		else if (!timer_pending(&inst->timer)) {
   805			instance_get(inst);
   806			inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100);
   807			add_timer(&inst->timer);
   808		}
   809	
   810	unlock_and_release:
   811		spin_unlock_bh(&inst->lock);
   812		instance_put(inst);
   813		return;
   814	
   815	alloc_failure:
   816		/* FIXME: statistics */
   817		goto unlock_and_release;
   818	}
   819	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux