All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: nft_socket: add wildcard support
@ 2020-08-28 15:44 Pablo Neira Ayuso
  2020-08-28 19:55   ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2020-08-28 15:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: bazsi77

Add NFT_SOCKET_WILDCARD to match to wildcard socket listener.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
@Balazs: I think I posted this already but it seems it's not in patchwork.
         Please, let me know if this one looks good to you, thanks.

 include/uapi/linux/netfilter/nf_tables.h |  2 ++
 net/netfilter/nft_socket.c               | 25 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index aeb88cbd303e..5cae73037283 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1010,10 +1010,12 @@ enum nft_socket_attributes {
  *
  * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option
  * @NFT_SOCKET_MARK: Value of the socket mark
+ * @NFT_SOCKET_WILDCARD: Socket listener is bound to any address
  */
 enum nft_socket_keys {
 	NFT_SOCKET_TRANSPARENT,
 	NFT_SOCKET_MARK,
+	NFT_SOCKET_WILDCARD,
 	__NFT_SOCKET_MAX
 };
 #define NFT_SOCKET_MAX	(__NFT_SOCKET_MAX - 1)
diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c
index 637ce3e8c575..684a7e493f45 100644
--- a/net/netfilter/nft_socket.c
+++ b/net/netfilter/nft_socket.c
@@ -14,6 +14,23 @@ struct nft_socket {
 	};
 };
 
+static void nft_socket_wildcard(const struct nft_pktinfo *pkt,
+				struct nft_regs *regs, struct sock *sk,
+				u32 *dest)
+{
+	switch (nft_pf(pkt)) {
+	case NFPROTO_IPV4:
+		nft_reg_store8(dest, inet_sk(sk)->inet_rcv_saddr == 0);
+		break;
+	case NFPROTO_IPV6:
+		nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
+		break;
+	default:
+		regs->verdict.code = NFT_BREAK;
+		return;
+	}
+}
+
 static void nft_socket_eval(const struct nft_expr *expr,
 			    struct nft_regs *regs,
 			    const struct nft_pktinfo *pkt)
@@ -59,6 +76,13 @@ static void nft_socket_eval(const struct nft_expr *expr,
 			return;
 		}
 		break;
+	case NFT_SOCKET_WILDCARD:
+		if (!sk_fullsock(sk)) {
+			regs->verdict.code = NFT_BREAK;
+			return;
+		}
+		nft_socket_wildcard(pkt, regs, sk, dest);
+		break;
 	default:
 		WARN_ON(1);
 		regs->verdict.code = NFT_BREAK;
@@ -97,6 +121,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
 	priv->key = ntohl(nla_get_u32(tb[NFTA_SOCKET_KEY]));
 	switch(priv->key) {
 	case NFT_SOCKET_TRANSPARENT:
+	case NFT_SOCKET_WILDCARD:
 		len = sizeof(u8);
 		break;
 	case NFT_SOCKET_MARK:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH nf-next] netfilter: nft_socket: add wildcard support
  2020-08-28 15:44 [PATCH nf-next] netfilter: nft_socket: add wildcard support Pablo Neira Ayuso
@ 2020-08-28 19:55   ` kernel test robot
  2020-08-28 19:59   ` kernel test robot
  2020-08-29  6:19 ` [PATCH nf-next v2] " Balazs Scheidler
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-28 19:55 UTC (permalink / raw)
  To: Pablo Neira Ayuso, netfilter-devel; +Cc: kbuild-all, bazsi77

[-- Attachment #1: Type: text/plain, Size: 16103 bytes --]

Hi Pablo,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: h8300-randconfig-r031-20200828 (attached as .config)
compiler: h8300-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

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

All errors (new ones prefixed by >>):

   In file included from include/net/netfilter/nf_socket.h:5,
                    from net/netfilter/nft_socket.c:6:
   net/netfilter/nft_socket.c: In function 'nft_socket_wildcard':
>> include/net/sock.h:381:37: error: 'struct sock_common' has no member named 'skc_v6_rcv_saddr'; did you mean 'skc_rcv_saddr'?
     381 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
         |                                     ^~~~~~~~~~~~~~~~
   net/netfilter/nft_socket.c:26:43: note: in expansion of macro 'sk_v6_rcv_saddr'
      26 |   nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
         |                                           ^~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/b52e11e3bbfc9394df5d97f507e2f3cd66b58687
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
git checkout b52e11e3bbfc9394df5d97f507e2f3cd66b58687
vim +381 include/net/sock.h

4dc6dc7162c08b Eric Dumazet             2009-07-15  360  
68835aba4d9b74 Eric Dumazet             2010-11-30  361  #define sk_dontcopy_begin	__sk_common.skc_dontcopy_begin
68835aba4d9b74 Eric Dumazet             2010-11-30  362  #define sk_dontcopy_end		__sk_common.skc_dontcopy_end
4dc6dc7162c08b Eric Dumazet             2009-07-15  363  #define sk_hash			__sk_common.skc_hash
5080546682bae3 Eric Dumazet             2013-10-02  364  #define sk_portpair		__sk_common.skc_portpair
05dbc7b59481ca Eric Dumazet             2013-10-03  365  #define sk_num			__sk_common.skc_num
05dbc7b59481ca Eric Dumazet             2013-10-03  366  #define sk_dport		__sk_common.skc_dport
5080546682bae3 Eric Dumazet             2013-10-02  367  #define sk_addrpair		__sk_common.skc_addrpair
5080546682bae3 Eric Dumazet             2013-10-02  368  #define sk_daddr		__sk_common.skc_daddr
5080546682bae3 Eric Dumazet             2013-10-02  369  #define sk_rcv_saddr		__sk_common.skc_rcv_saddr
^1da177e4c3f41 Linus Torvalds           2005-04-16  370  #define sk_family		__sk_common.skc_family
^1da177e4c3f41 Linus Torvalds           2005-04-16  371  #define sk_state		__sk_common.skc_state
^1da177e4c3f41 Linus Torvalds           2005-04-16  372  #define sk_reuse		__sk_common.skc_reuse
055dc21a1d1d21 Tom Herbert              2013-01-22  373  #define sk_reuseport		__sk_common.skc_reuseport
9fe516ba3fb29b Eric Dumazet             2014-06-27  374  #define sk_ipv6only		__sk_common.skc_ipv6only
26abe14379f8e2 Eric W. Biederman        2015-05-08  375  #define sk_net_refcnt		__sk_common.skc_net_refcnt
^1da177e4c3f41 Linus Torvalds           2005-04-16  376  #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
^1da177e4c3f41 Linus Torvalds           2005-04-16  377  #define sk_bind_node		__sk_common.skc_bind_node
8feaf0c0a5488b Arnaldo Carvalho de Melo 2005-08-09  378  #define sk_prot			__sk_common.skc_prot
07feaebfcc10cd Eric W. Biederman        2007-09-12  379  #define sk_net			__sk_common.skc_net
efe4208f47f907 Eric Dumazet             2013-10-03  380  #define sk_v6_daddr		__sk_common.skc_v6_daddr
efe4208f47f907 Eric Dumazet             2013-10-03 @381  #define sk_v6_rcv_saddr	__sk_common.skc_v6_rcv_saddr
33cf7c90fe2f97 Eric Dumazet             2015-03-11  382  #define sk_cookie		__sk_common.skc_cookie
70da268b569d32 Eric Dumazet             2015-10-08  383  #define sk_incoming_cpu		__sk_common.skc_incoming_cpu
8e5eb54d303b7c Eric Dumazet             2015-10-08  384  #define sk_flags		__sk_common.skc_flags
ed53d0ab761f5c Eric Dumazet             2015-10-08  385  #define sk_rxhash		__sk_common.skc_rxhash
efe4208f47f907 Eric Dumazet             2013-10-03  386  
^1da177e4c3f41 Linus Torvalds           2005-04-16  387  	socket_lock_t		sk_lock;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  388  	atomic_t		sk_drops;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  389  	int			sk_rcvlowat;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  390  	struct sk_buff_head	sk_error_queue;
8b27dae5a2e89a Eric Dumazet             2019-03-22  391  	struct sk_buff		*sk_rx_skb_cache;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  392  	struct sk_buff_head	sk_receive_queue;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  393  	/*
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  394  	 * The backlog queue is special, it is always used with
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  395  	 * the per-socket spinlock held and requires low latency
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  396  	 * access. Therefore we special case it's implementation.
b178bb3dfc30d9 Eric Dumazet             2010-11-16  397  	 * Note : rmem_alloc is in this structure to fill a hole
b178bb3dfc30d9 Eric Dumazet             2010-11-16  398  	 * on 64bit arches, not because its logically part of
b178bb3dfc30d9 Eric Dumazet             2010-11-16  399  	 * backlog.
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  400  	 */
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  401  	struct {
b178bb3dfc30d9 Eric Dumazet             2010-11-16  402  		atomic_t	rmem_alloc;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  403  		int		len;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  404  		struct sk_buff	*head;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  405  		struct sk_buff	*tail;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  406  	} sk_backlog;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  407  #define sk_rmem_alloc sk_backlog.rmem_alloc
2c8c56e15df3d4 Eric Dumazet             2014-11-11  408  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  409  	int			sk_forward_alloc;
e0d1095ae34054 Cong Wang                2013-08-01  410  #ifdef CONFIG_NET_RX_BUSY_POLL
dafcc4380deec2 Eliezer Tamir            2013-06-14  411  	unsigned int		sk_ll_usec;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  412  	/* ===== mostly read cache line ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  413  	unsigned int		sk_napi_id;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  414  #endif
b178bb3dfc30d9 Eric Dumazet             2010-11-16  415  	int			sk_rcvbuf;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  416  
b178bb3dfc30d9 Eric Dumazet             2010-11-16  417  	struct sk_filter __rcu	*sk_filter;
ceb5d58b217098 Eric Dumazet             2015-11-29  418  	union {
eaefd1105bc431 Eric Dumazet             2011-02-18  419  		struct socket_wq __rcu	*sk_wq;
66256e0b15bd72 Randy Dunlap             2020-02-15  420  		/* private: */
ceb5d58b217098 Eric Dumazet             2015-11-29  421  		struct socket_wq	*sk_wq_raw;
66256e0b15bd72 Randy Dunlap             2020-02-15  422  		/* public: */
ceb5d58b217098 Eric Dumazet             2015-11-29  423  	};
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  424  #ifdef CONFIG_XFRM
d188ba86dd07a7 Eric Dumazet             2015-12-08  425  	struct xfrm_policy __rcu *sk_policy[2];
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  426  #endif
deaa58542b21d2 Eric Dumazet             2012-06-24  427  	struct dst_entry	*sk_rx_dst;
0e36cbb344575e Cong Wang                2013-01-22  428  	struct dst_entry __rcu	*sk_dst_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  429  	atomic_t		sk_omem_alloc;
4e07a91c37c69e Arnaldo Carvalho de Melo 2007-05-29  430  	int			sk_sndbuf;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  431  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  432  	/* ===== cache line for TX ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  433  	int			sk_wmem_queued;
14afee4b6092fd Reshetova, Elena         2017-06-30  434  	refcount_t		sk_wmem_alloc;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  435  	unsigned long		sk_tsq_flags;
75c119afe14f74 Eric Dumazet             2017-10-05  436  	union {
9115e8cd2a0c6e Eric Dumazet             2016-12-03  437  		struct sk_buff	*sk_send_head;
75c119afe14f74 Eric Dumazet             2017-10-05  438  		struct rb_root	tcp_rtx_queue;
75c119afe14f74 Eric Dumazet             2017-10-05  439  	};
472c2e07eef045 Eric Dumazet             2019-03-22  440  	struct sk_buff		*sk_tx_skb_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  441  	struct sk_buff_head	sk_write_queue;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  442  	__s32			sk_peek_off;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  443  	int			sk_write_pending;
9b8805a325591c Julian Anastasov         2017-02-06  444  	__u32			sk_dst_pending_confirm;
218af599fa635b Eric Dumazet             2017-05-16  445  	u32			sk_pacing_status; /* see enum sk_pacing */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  446  	long			sk_sndtimeo;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  447  	struct timer_list	sk_timer;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  448  	__u32			sk_priority;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  449  	__u32			sk_mark;
76a9ebe811fb3d Eric Dumazet             2018-10-15  450  	unsigned long		sk_pacing_rate; /* bytes per second */
76a9ebe811fb3d Eric Dumazet             2018-10-15  451  	unsigned long		sk_max_pacing_rate;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  452  	struct page_frag	sk_frag;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  453  	netdev_features_t	sk_route_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  454  	netdev_features_t	sk_route_nocaps;
0a6b2a1dc2a210 Eric Dumazet             2018-02-19  455  	netdev_features_t	sk_route_forced_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  456  	int			sk_gso_type;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  457  	unsigned int		sk_gso_max_size;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  458  	gfp_t			sk_allocation;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  459  	__u32			sk_txhash;
fc64869c48494a Andrey Ryabinin          2016-05-18  460  
fc64869c48494a Andrey Ryabinin          2016-05-18  461  	/*
fc64869c48494a Andrey Ryabinin          2016-05-18  462  	 * Because of non atomicity rules, all
fc64869c48494a Andrey Ryabinin          2016-05-18  463  	 * changes are protected by socket lock.
fc64869c48494a Andrey Ryabinin          2016-05-18  464  	 */
bf9765145b856f Mat Martineau            2020-01-09  465  	u8			sk_padding : 1,
cdfbabfb2f0ce9 David Howells            2017-03-09  466  				sk_kern_sock : 1,
28448b80456fea Tom Herbert              2014-05-23  467  				sk_no_check_tx : 1,
28448b80456fea Tom Herbert              2014-05-23  468  				sk_no_check_rx : 1,
bf9765145b856f Mat Martineau            2020-01-09  469  				sk_userlocks : 4;
3a9b76fd0db9f0 Eric Dumazet             2017-11-11  470  	u8			sk_pacing_shift;
bf9765145b856f Mat Martineau            2020-01-09  471  	u16			sk_type;
bf9765145b856f Mat Martineau            2020-01-09  472  	u16			sk_protocol;
bf9765145b856f Mat Martineau            2020-01-09  473  	u16			sk_gso_max_segs;
^1da177e4c3f41 Linus Torvalds           2005-04-16  474  	unsigned long	        sk_lingertime;
476e19cfa131e2 Arnaldo Carvalho de Melo 2005-05-05  475  	struct proto		*sk_prot_creator;
^1da177e4c3f41 Linus Torvalds           2005-04-16  476  	rwlock_t		sk_callback_lock;
^1da177e4c3f41 Linus Torvalds           2005-04-16  477  	int			sk_err,
^1da177e4c3f41 Linus Torvalds           2005-04-16  478  				sk_err_soft;
becb74f0acca19 Eric Dumazet             2015-03-19  479  	u32			sk_ack_backlog;
becb74f0acca19 Eric Dumazet             2015-03-19  480  	u32			sk_max_ack_backlog;
86741ec25462e4 Lorenzo Colitti          2016-11-04  481  	kuid_t			sk_uid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  482  	struct pid		*sk_peer_pid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  483  	const struct cred	*sk_peer_cred;
^1da177e4c3f41 Linus Torvalds           2005-04-16  484  	long			sk_rcvtimeo;
b7aa0bf70c4afb Eric Dumazet             2007-04-19  485  	ktime_t			sk_stamp;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  486  #if BITS_PER_LONG==32
3a0ed3e9619738 Deepa Dinamani           2018-12-27  487  	seqlock_t		sk_stamp_seq;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  488  #endif
b9f40e21ef4298 Willem de Bruijn         2014-08-04  489  	u16			sk_tsflags;
fc64869c48494a Andrey Ryabinin          2016-05-18  490  	u8			sk_shutdown;
09c2d251b70723 Willem de Bruijn         2014-08-04  491  	u32			sk_tskey;
52267790ef52d7 Willem de Bruijn         2017-08-03  492  	atomic_t		sk_zckey;
80b14dee2bea12 Richard Cochran          2018-07-03  493  
80b14dee2bea12 Richard Cochran          2018-07-03  494  	u8			sk_clockid;
80b14dee2bea12 Richard Cochran          2018-07-03  495  	u8			sk_txtime_deadline_mode : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  496  				sk_txtime_report_errors : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  497  				sk_txtime_unused : 6;
80b14dee2bea12 Richard Cochran          2018-07-03  498  
^1da177e4c3f41 Linus Torvalds           2005-04-16  499  	struct socket		*sk_socket;
^1da177e4c3f41 Linus Torvalds           2005-04-16  500  	void			*sk_user_data;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  501  #ifdef CONFIG_SECURITY
^1da177e4c3f41 Linus Torvalds           2005-04-16  502  	void			*sk_security;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  503  #endif
2a56a1fec290bf Tejun Heo                2015-12-07  504  	struct sock_cgroup_data	sk_cgrp_data;
baac50bbc3cdfd Johannes Weiner          2016-01-14  505  	struct mem_cgroup	*sk_memcg;
^1da177e4c3f41 Linus Torvalds           2005-04-16  506  	void			(*sk_state_change)(struct sock *sk);
676d23690fb62b David S. Miller          2014-04-11  507  	void			(*sk_data_ready)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  508  	void			(*sk_write_space)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  509  	void			(*sk_error_report)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  510  	int			(*sk_backlog_rcv)(struct sock *sk,
^1da177e4c3f41 Linus Torvalds           2005-04-16  511  						  struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  512  #ifdef CONFIG_SOCK_VALIDATE_XMIT
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  513  	struct sk_buff*		(*sk_validate_xmit_skb)(struct sock *sk,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  514  							struct net_device *dev,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  515  							struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  516  #endif
^1da177e4c3f41 Linus Torvalds           2005-04-16  517  	void                    (*sk_destruct)(struct sock *sk);
ef456144da8ef5 Craig Gallek             2016-01-04  518  	struct sock_reuseport __rcu	*sk_reuseport_cb;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  519  #ifdef CONFIG_BPF_SYSCALL
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  520  	struct bpf_sk_storage __rcu	*sk_bpf_storage;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  521  #endif
a4298e4522d687 Eric Dumazet             2016-04-01  522  	struct rcu_head		sk_rcu;
^1da177e4c3f41 Linus Torvalds           2005-04-16  523  };
^1da177e4c3f41 Linus Torvalds           2005-04-16  524  

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22334 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf-next] netfilter: nft_socket: add wildcard support
@ 2020-08-28 19:55   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-28 19:55 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 16311 bytes --]

Hi Pablo,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: h8300-randconfig-r031-20200828 (attached as .config)
compiler: h8300-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

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

All errors (new ones prefixed by >>):

   In file included from include/net/netfilter/nf_socket.h:5,
                    from net/netfilter/nft_socket.c:6:
   net/netfilter/nft_socket.c: In function 'nft_socket_wildcard':
>> include/net/sock.h:381:37: error: 'struct sock_common' has no member named 'skc_v6_rcv_saddr'; did you mean 'skc_rcv_saddr'?
     381 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
         |                                     ^~~~~~~~~~~~~~~~
   net/netfilter/nft_socket.c:26:43: note: in expansion of macro 'sk_v6_rcv_saddr'
      26 |   nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
         |                                           ^~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/b52e11e3bbfc9394df5d97f507e2f3cd66b58687
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
git checkout b52e11e3bbfc9394df5d97f507e2f3cd66b58687
vim +381 include/net/sock.h

4dc6dc7162c08b Eric Dumazet             2009-07-15  360  
68835aba4d9b74 Eric Dumazet             2010-11-30  361  #define sk_dontcopy_begin	__sk_common.skc_dontcopy_begin
68835aba4d9b74 Eric Dumazet             2010-11-30  362  #define sk_dontcopy_end		__sk_common.skc_dontcopy_end
4dc6dc7162c08b Eric Dumazet             2009-07-15  363  #define sk_hash			__sk_common.skc_hash
5080546682bae3 Eric Dumazet             2013-10-02  364  #define sk_portpair		__sk_common.skc_portpair
05dbc7b59481ca Eric Dumazet             2013-10-03  365  #define sk_num			__sk_common.skc_num
05dbc7b59481ca Eric Dumazet             2013-10-03  366  #define sk_dport		__sk_common.skc_dport
5080546682bae3 Eric Dumazet             2013-10-02  367  #define sk_addrpair		__sk_common.skc_addrpair
5080546682bae3 Eric Dumazet             2013-10-02  368  #define sk_daddr		__sk_common.skc_daddr
5080546682bae3 Eric Dumazet             2013-10-02  369  #define sk_rcv_saddr		__sk_common.skc_rcv_saddr
^1da177e4c3f41 Linus Torvalds           2005-04-16  370  #define sk_family		__sk_common.skc_family
^1da177e4c3f41 Linus Torvalds           2005-04-16  371  #define sk_state		__sk_common.skc_state
^1da177e4c3f41 Linus Torvalds           2005-04-16  372  #define sk_reuse		__sk_common.skc_reuse
055dc21a1d1d21 Tom Herbert              2013-01-22  373  #define sk_reuseport		__sk_common.skc_reuseport
9fe516ba3fb29b Eric Dumazet             2014-06-27  374  #define sk_ipv6only		__sk_common.skc_ipv6only
26abe14379f8e2 Eric W. Biederman        2015-05-08  375  #define sk_net_refcnt		__sk_common.skc_net_refcnt
^1da177e4c3f41 Linus Torvalds           2005-04-16  376  #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
^1da177e4c3f41 Linus Torvalds           2005-04-16  377  #define sk_bind_node		__sk_common.skc_bind_node
8feaf0c0a5488b Arnaldo Carvalho de Melo 2005-08-09  378  #define sk_prot			__sk_common.skc_prot
07feaebfcc10cd Eric W. Biederman        2007-09-12  379  #define sk_net			__sk_common.skc_net
efe4208f47f907 Eric Dumazet             2013-10-03  380  #define sk_v6_daddr		__sk_common.skc_v6_daddr
efe4208f47f907 Eric Dumazet             2013-10-03 @381  #define sk_v6_rcv_saddr	__sk_common.skc_v6_rcv_saddr
33cf7c90fe2f97 Eric Dumazet             2015-03-11  382  #define sk_cookie		__sk_common.skc_cookie
70da268b569d32 Eric Dumazet             2015-10-08  383  #define sk_incoming_cpu		__sk_common.skc_incoming_cpu
8e5eb54d303b7c Eric Dumazet             2015-10-08  384  #define sk_flags		__sk_common.skc_flags
ed53d0ab761f5c Eric Dumazet             2015-10-08  385  #define sk_rxhash		__sk_common.skc_rxhash
efe4208f47f907 Eric Dumazet             2013-10-03  386  
^1da177e4c3f41 Linus Torvalds           2005-04-16  387  	socket_lock_t		sk_lock;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  388  	atomic_t		sk_drops;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  389  	int			sk_rcvlowat;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  390  	struct sk_buff_head	sk_error_queue;
8b27dae5a2e89a Eric Dumazet             2019-03-22  391  	struct sk_buff		*sk_rx_skb_cache;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  392  	struct sk_buff_head	sk_receive_queue;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  393  	/*
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  394  	 * The backlog queue is special, it is always used with
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  395  	 * the per-socket spinlock held and requires low latency
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  396  	 * access. Therefore we special case it's implementation.
b178bb3dfc30d9 Eric Dumazet             2010-11-16  397  	 * Note : rmem_alloc is in this structure to fill a hole
b178bb3dfc30d9 Eric Dumazet             2010-11-16  398  	 * on 64bit arches, not because its logically part of
b178bb3dfc30d9 Eric Dumazet             2010-11-16  399  	 * backlog.
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  400  	 */
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  401  	struct {
b178bb3dfc30d9 Eric Dumazet             2010-11-16  402  		atomic_t	rmem_alloc;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  403  		int		len;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  404  		struct sk_buff	*head;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  405  		struct sk_buff	*tail;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  406  	} sk_backlog;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  407  #define sk_rmem_alloc sk_backlog.rmem_alloc
2c8c56e15df3d4 Eric Dumazet             2014-11-11  408  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  409  	int			sk_forward_alloc;
e0d1095ae34054 Cong Wang                2013-08-01  410  #ifdef CONFIG_NET_RX_BUSY_POLL
dafcc4380deec2 Eliezer Tamir            2013-06-14  411  	unsigned int		sk_ll_usec;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  412  	/* ===== mostly read cache line ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  413  	unsigned int		sk_napi_id;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  414  #endif
b178bb3dfc30d9 Eric Dumazet             2010-11-16  415  	int			sk_rcvbuf;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  416  
b178bb3dfc30d9 Eric Dumazet             2010-11-16  417  	struct sk_filter __rcu	*sk_filter;
ceb5d58b217098 Eric Dumazet             2015-11-29  418  	union {
eaefd1105bc431 Eric Dumazet             2011-02-18  419  		struct socket_wq __rcu	*sk_wq;
66256e0b15bd72 Randy Dunlap             2020-02-15  420  		/* private: */
ceb5d58b217098 Eric Dumazet             2015-11-29  421  		struct socket_wq	*sk_wq_raw;
66256e0b15bd72 Randy Dunlap             2020-02-15  422  		/* public: */
ceb5d58b217098 Eric Dumazet             2015-11-29  423  	};
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  424  #ifdef CONFIG_XFRM
d188ba86dd07a7 Eric Dumazet             2015-12-08  425  	struct xfrm_policy __rcu *sk_policy[2];
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  426  #endif
deaa58542b21d2 Eric Dumazet             2012-06-24  427  	struct dst_entry	*sk_rx_dst;
0e36cbb344575e Cong Wang                2013-01-22  428  	struct dst_entry __rcu	*sk_dst_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  429  	atomic_t		sk_omem_alloc;
4e07a91c37c69e Arnaldo Carvalho de Melo 2007-05-29  430  	int			sk_sndbuf;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  431  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  432  	/* ===== cache line for TX ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  433  	int			sk_wmem_queued;
14afee4b6092fd Reshetova, Elena         2017-06-30  434  	refcount_t		sk_wmem_alloc;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  435  	unsigned long		sk_tsq_flags;
75c119afe14f74 Eric Dumazet             2017-10-05  436  	union {
9115e8cd2a0c6e Eric Dumazet             2016-12-03  437  		struct sk_buff	*sk_send_head;
75c119afe14f74 Eric Dumazet             2017-10-05  438  		struct rb_root	tcp_rtx_queue;
75c119afe14f74 Eric Dumazet             2017-10-05  439  	};
472c2e07eef045 Eric Dumazet             2019-03-22  440  	struct sk_buff		*sk_tx_skb_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  441  	struct sk_buff_head	sk_write_queue;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  442  	__s32			sk_peek_off;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  443  	int			sk_write_pending;
9b8805a325591c Julian Anastasov         2017-02-06  444  	__u32			sk_dst_pending_confirm;
218af599fa635b Eric Dumazet             2017-05-16  445  	u32			sk_pacing_status; /* see enum sk_pacing */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  446  	long			sk_sndtimeo;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  447  	struct timer_list	sk_timer;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  448  	__u32			sk_priority;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  449  	__u32			sk_mark;
76a9ebe811fb3d Eric Dumazet             2018-10-15  450  	unsigned long		sk_pacing_rate; /* bytes per second */
76a9ebe811fb3d Eric Dumazet             2018-10-15  451  	unsigned long		sk_max_pacing_rate;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  452  	struct page_frag	sk_frag;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  453  	netdev_features_t	sk_route_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  454  	netdev_features_t	sk_route_nocaps;
0a6b2a1dc2a210 Eric Dumazet             2018-02-19  455  	netdev_features_t	sk_route_forced_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  456  	int			sk_gso_type;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  457  	unsigned int		sk_gso_max_size;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  458  	gfp_t			sk_allocation;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  459  	__u32			sk_txhash;
fc64869c48494a Andrey Ryabinin          2016-05-18  460  
fc64869c48494a Andrey Ryabinin          2016-05-18  461  	/*
fc64869c48494a Andrey Ryabinin          2016-05-18  462  	 * Because of non atomicity rules, all
fc64869c48494a Andrey Ryabinin          2016-05-18  463  	 * changes are protected by socket lock.
fc64869c48494a Andrey Ryabinin          2016-05-18  464  	 */
bf9765145b856f Mat Martineau            2020-01-09  465  	u8			sk_padding : 1,
cdfbabfb2f0ce9 David Howells            2017-03-09  466  				sk_kern_sock : 1,
28448b80456fea Tom Herbert              2014-05-23  467  				sk_no_check_tx : 1,
28448b80456fea Tom Herbert              2014-05-23  468  				sk_no_check_rx : 1,
bf9765145b856f Mat Martineau            2020-01-09  469  				sk_userlocks : 4;
3a9b76fd0db9f0 Eric Dumazet             2017-11-11  470  	u8			sk_pacing_shift;
bf9765145b856f Mat Martineau            2020-01-09  471  	u16			sk_type;
bf9765145b856f Mat Martineau            2020-01-09  472  	u16			sk_protocol;
bf9765145b856f Mat Martineau            2020-01-09  473  	u16			sk_gso_max_segs;
^1da177e4c3f41 Linus Torvalds           2005-04-16  474  	unsigned long	        sk_lingertime;
476e19cfa131e2 Arnaldo Carvalho de Melo 2005-05-05  475  	struct proto		*sk_prot_creator;
^1da177e4c3f41 Linus Torvalds           2005-04-16  476  	rwlock_t		sk_callback_lock;
^1da177e4c3f41 Linus Torvalds           2005-04-16  477  	int			sk_err,
^1da177e4c3f41 Linus Torvalds           2005-04-16  478  				sk_err_soft;
becb74f0acca19 Eric Dumazet             2015-03-19  479  	u32			sk_ack_backlog;
becb74f0acca19 Eric Dumazet             2015-03-19  480  	u32			sk_max_ack_backlog;
86741ec25462e4 Lorenzo Colitti          2016-11-04  481  	kuid_t			sk_uid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  482  	struct pid		*sk_peer_pid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  483  	const struct cred	*sk_peer_cred;
^1da177e4c3f41 Linus Torvalds           2005-04-16  484  	long			sk_rcvtimeo;
b7aa0bf70c4afb Eric Dumazet             2007-04-19  485  	ktime_t			sk_stamp;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  486  #if BITS_PER_LONG==32
3a0ed3e9619738 Deepa Dinamani           2018-12-27  487  	seqlock_t		sk_stamp_seq;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  488  #endif
b9f40e21ef4298 Willem de Bruijn         2014-08-04  489  	u16			sk_tsflags;
fc64869c48494a Andrey Ryabinin          2016-05-18  490  	u8			sk_shutdown;
09c2d251b70723 Willem de Bruijn         2014-08-04  491  	u32			sk_tskey;
52267790ef52d7 Willem de Bruijn         2017-08-03  492  	atomic_t		sk_zckey;
80b14dee2bea12 Richard Cochran          2018-07-03  493  
80b14dee2bea12 Richard Cochran          2018-07-03  494  	u8			sk_clockid;
80b14dee2bea12 Richard Cochran          2018-07-03  495  	u8			sk_txtime_deadline_mode : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  496  				sk_txtime_report_errors : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  497  				sk_txtime_unused : 6;
80b14dee2bea12 Richard Cochran          2018-07-03  498  
^1da177e4c3f41 Linus Torvalds           2005-04-16  499  	struct socket		*sk_socket;
^1da177e4c3f41 Linus Torvalds           2005-04-16  500  	void			*sk_user_data;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  501  #ifdef CONFIG_SECURITY
^1da177e4c3f41 Linus Torvalds           2005-04-16  502  	void			*sk_security;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  503  #endif
2a56a1fec290bf Tejun Heo                2015-12-07  504  	struct sock_cgroup_data	sk_cgrp_data;
baac50bbc3cdfd Johannes Weiner          2016-01-14  505  	struct mem_cgroup	*sk_memcg;
^1da177e4c3f41 Linus Torvalds           2005-04-16  506  	void			(*sk_state_change)(struct sock *sk);
676d23690fb62b David S. Miller          2014-04-11  507  	void			(*sk_data_ready)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  508  	void			(*sk_write_space)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  509  	void			(*sk_error_report)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  510  	int			(*sk_backlog_rcv)(struct sock *sk,
^1da177e4c3f41 Linus Torvalds           2005-04-16  511  						  struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  512  #ifdef CONFIG_SOCK_VALIDATE_XMIT
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  513  	struct sk_buff*		(*sk_validate_xmit_skb)(struct sock *sk,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  514  							struct net_device *dev,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  515  							struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  516  #endif
^1da177e4c3f41 Linus Torvalds           2005-04-16  517  	void                    (*sk_destruct)(struct sock *sk);
ef456144da8ef5 Craig Gallek             2016-01-04  518  	struct sock_reuseport __rcu	*sk_reuseport_cb;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  519  #ifdef CONFIG_BPF_SYSCALL
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  520  	struct bpf_sk_storage __rcu	*sk_bpf_storage;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  521  #endif
a4298e4522d687 Eric Dumazet             2016-04-01  522  	struct rcu_head		sk_rcu;
^1da177e4c3f41 Linus Torvalds           2005-04-16  523  };
^1da177e4c3f41 Linus Torvalds           2005-04-16  524  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 22334 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf-next] netfilter: nft_socket: add wildcard support
  2020-08-28 15:44 [PATCH nf-next] netfilter: nft_socket: add wildcard support Pablo Neira Ayuso
@ 2020-08-28 19:59   ` kernel test robot
  2020-08-28 19:59   ` kernel test robot
  2020-08-29  6:19 ` [PATCH nf-next v2] " Balazs Scheidler
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-28 19:59 UTC (permalink / raw)
  To: Pablo Neira Ayuso, netfilter-devel; +Cc: kbuild-all, clang-built-linux, bazsi77

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

Hi Pablo,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: powerpc-randconfig-r004-20200828 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c10e63677f5d20f18010f8f68c631ddc97546f7d)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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

All errors (new ones prefixed by >>):

>> net/netfilter/nft_socket.c:26:43: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
                   nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
                                                           ^
   include/net/sock.h:381:37: note: expanded from macro 'sk_v6_rcv_saddr'
   #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
                                       ^
   include/net/sock.h:170:11: note: 'skc_rcv_saddr' declared here
                           __be32  skc_rcv_saddr;
                                   ^
   1 error generated.

# https://github.com/0day-ci/linux/commit/b52e11e3bbfc9394df5d97f507e2f3cd66b58687
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
git checkout b52e11e3bbfc9394df5d97f507e2f3cd66b58687
vim +26 net/netfilter/nft_socket.c

    16	
    17	static void nft_socket_wildcard(const struct nft_pktinfo *pkt,
    18					struct nft_regs *regs, struct sock *sk,
    19					u32 *dest)
    20	{
    21		switch (nft_pf(pkt)) {
    22		case NFPROTO_IPV4:
    23			nft_reg_store8(dest, inet_sk(sk)->inet_rcv_saddr == 0);
    24			break;
    25		case NFPROTO_IPV6:
  > 26			nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
    27			break;
    28		default:
    29			regs->verdict.code = NFT_BREAK;
    30			return;
    31		}
    32	}
    33	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30561 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf-next] netfilter: nft_socket: add wildcard support
@ 2020-08-28 19:59   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-28 19:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2709 bytes --]

Hi Pablo,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: powerpc-randconfig-r004-20200828 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c10e63677f5d20f18010f8f68c631ddc97546f7d)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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

All errors (new ones prefixed by >>):

>> net/netfilter/nft_socket.c:26:43: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
                   nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
                                                           ^
   include/net/sock.h:381:37: note: expanded from macro 'sk_v6_rcv_saddr'
   #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
                                       ^
   include/net/sock.h:170:11: note: 'skc_rcv_saddr' declared here
                           __be32  skc_rcv_saddr;
                                   ^
   1 error generated.

# https://github.com/0day-ci/linux/commit/b52e11e3bbfc9394df5d97f507e2f3cd66b58687
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Pablo-Neira-Ayuso/netfilter-nft_socket-add-wildcard-support/20200828-234531
git checkout b52e11e3bbfc9394df5d97f507e2f3cd66b58687
vim +26 net/netfilter/nft_socket.c

    16	
    17	static void nft_socket_wildcard(const struct nft_pktinfo *pkt,
    18					struct nft_regs *regs, struct sock *sk,
    19					u32 *dest)
    20	{
    21		switch (nft_pf(pkt)) {
    22		case NFPROTO_IPV4:
    23			nft_reg_store8(dest, inet_sk(sk)->inet_rcv_saddr == 0);
    24			break;
    25		case NFPROTO_IPV6:
  > 26			nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
    27			break;
    28		default:
    29			regs->verdict.code = NFT_BREAK;
    30			return;
    31		}
    32	}
    33	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30561 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH nf-next v2] netfilter: nft_socket: add wildcard support
  2020-08-28 15:44 [PATCH nf-next] netfilter: nft_socket: add wildcard support Pablo Neira Ayuso
  2020-08-28 19:55   ` kernel test robot
  2020-08-28 19:59   ` kernel test robot
@ 2020-08-29  6:19 ` Balazs Scheidler
  2020-08-29 11:07   ` Pablo Neira Ayuso
  2 siblings, 1 reply; 7+ messages in thread
From: Balazs Scheidler @ 2020-08-29  6:19 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Balazs Scheidler, Pablo Neira Ayuso

Add NFT_SOCKET_WILDCARD to match to wildcard socket listener.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
---

@Pablo: this contains the enum addition as well as the explicit check for IPv6

 include/uapi/linux/netfilter/nf_tables.h |  2 ++
 net/netfilter/nft_socket.c               | 27 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 42f351c1f5c5..6e1dbdf1427f 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1008,10 +1008,12 @@ enum nft_socket_attributes {
  *
  * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option
  * @NFT_SOCKET_MARK: Value of the socket mark
+ * @NFT_SOCKET_WILDCARD: Whether the socket is zero-bound (e.g. 0.0.0.0 or ::0)
  */
 enum nft_socket_keys {
 	NFT_SOCKET_TRANSPARENT,
 	NFT_SOCKET_MARK,
+	NFT_SOCKET_WILDCARD,
 	__NFT_SOCKET_MAX
 };
 #define NFT_SOCKET_MAX	(__NFT_SOCKET_MAX - 1)
diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c
index 637ce3e8c575..a28aca5124ce 100644
--- a/net/netfilter/nft_socket.c
+++ b/net/netfilter/nft_socket.c
@@ -14,6 +14,25 @@ struct nft_socket {
 	};
 };
 
+static void nft_socket_wildcard(const struct nft_pktinfo *pkt,
+				struct nft_regs *regs, struct sock *sk,
+				u32 *dest)
+{
+	switch (nft_pf(pkt)) {
+	case NFPROTO_IPV4:
+		nft_reg_store8(dest, inet_sk(sk)->inet_rcv_saddr == 0);
+		break;
+#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
+	case NFPROTO_IPV6:
+		nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr));
+		break;
+#endif
+	default:
+		regs->verdict.code = NFT_BREAK;
+		return;
+	}
+}
+
 static void nft_socket_eval(const struct nft_expr *expr,
 			    struct nft_regs *regs,
 			    const struct nft_pktinfo *pkt)
@@ -59,6 +78,13 @@ static void nft_socket_eval(const struct nft_expr *expr,
 			return;
 		}
 		break;
+	case NFT_SOCKET_WILDCARD:
+		if (!sk_fullsock(sk)) {
+			regs->verdict.code = NFT_BREAK;
+			return;
+		}
+		nft_socket_wildcard(pkt, regs, sk, dest);
+		break;
 	default:
 		WARN_ON(1);
 		regs->verdict.code = NFT_BREAK;
@@ -97,6 +123,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
 	priv->key = ntohl(nla_get_u32(tb[NFTA_SOCKET_KEY]));
 	switch(priv->key) {
 	case NFT_SOCKET_TRANSPARENT:
+	case NFT_SOCKET_WILDCARD:
 		len = sizeof(u8);
 		break;
 	case NFT_SOCKET_MARK:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH nf-next v2] netfilter: nft_socket: add wildcard support
  2020-08-29  6:19 ` [PATCH nf-next v2] " Balazs Scheidler
@ 2020-08-29 11:07   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2020-08-29 11:07 UTC (permalink / raw)
  To: Balazs Scheidler; +Cc: netfilter-devel

On Sat, Aug 29, 2020 at 08:19:15AM +0200, Balazs Scheidler wrote:
> Add NFT_SOCKET_WILDCARD to match to wildcard socket listener.

Applied, thanks Balazs.

> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
> ---
> @Pablo: this contains the enum addition as well as the explicit check for IPv6

Thanks, hopefully this is fixing up the kbuild robot report.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-29 11:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 15:44 [PATCH nf-next] netfilter: nft_socket: add wildcard support Pablo Neira Ayuso
2020-08-28 19:55 ` kernel test robot
2020-08-28 19:55   ` kernel test robot
2020-08-28 19:59 ` kernel test robot
2020-08-28 19:59   ` kernel test robot
2020-08-29  6:19 ` [PATCH nf-next v2] " Balazs Scheidler
2020-08-29 11:07   ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.