netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Akemi Yagi <amyagi@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Linux 4.2 build error in net/netfilter/ipset/ip_set_hash_netnet.c
Date: Mon, 13 Jul 2015 18:41:22 +0200	[thread overview]
Message-ID: <20150713164122.GA26283@salvia> (raw)
In-Reply-To: <mo0o3b$g5d$1@ger.gmane.org>

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

On Mon, Jul 13, 2015 at 04:13:31PM +0000, Akemi Yagi wrote:
> On Sun, 05 Jul 2015 08:35:20 -0700, Guenter Roeck wrote:
> 
> > On Sat, Jul 04, 2015 at 12:44:36AM -0700, Vinson Lee wrote:
> >> Hi.
> >> 
> >> With the latest Linux 4.2-rc1, I am hitting this build error with GCC
> >> 4.4.7 on CentOS 6.
> >> 
> >>   CC      net/netfilter/ipset/ip_set_hash_netnet.o
> >> net/netfilter/ipset/ip_set_hash_netnet.c: In function
> >> ‘hash_netnet4_uadt’:
> >> net/netfilter/ipset/ip_set_hash_netnet.c:163: error: unknown field
> >> ‘cidr’ specified in initializer
> >> net/netfilter/ipset/ip_set_hash_netnet.c:163: warning: missing braces
> >> around initializer net/netfilter/ipset/ip_set_hash_netnet.c:163:
> >> warning: (near initialization for ‘e.<anonymous>.ip’)
> >> net/netfilter/ipset/ip_set_hash_netnet.c: In function
> >> ‘hash_netnet6_uadt’:
> >> net/netfilter/ipset/ip_set_hash_netnet.c:388: error: unknown field
> >> ‘cidr’ specified in initializer
> >> net/netfilter/ipset/ip_set_hash_netnet.c:388: warning: missing braces
> >> around initializer net/netfilter/ipset/ip_set_hash_netnet.c:388:
> >> warning: (near initialization for ‘e.ip[0]’)
> >> 
> > Previously fixed with commit 1a869205c75cb ("netfilter: ipset: The
> > unnamed union initialization may lead to compilation error"),
> > reintroduced with commit aff227581ed1a ("netfilter: ipset: Check CIDR
> > value only when attribute is given").
> > 
> > Guenter
> 
> I wonder what can be done to get this issue fixed. This problem was seen 
> in 4.2-rc1 and now in 4.2-rc2 on RHEL-6.6.
> 
> $ gcc --version
> gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)

Could you please test this patch? Thank you.

[-- Attachment #2: 0001-netfilter-ipset-fix-build-error-with-old-gcc-version.patch --]
[-- Type: text/x-diff, Size: 2183 bytes --]

>From 72562eafde64a242a2a1b0b40882aa7bf2b99270 Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Mon, 13 Jul 2015 18:31:20 +0200
Subject: [PATCH] netfilter: ipset: fix build error with old gcc version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

  CC      net/netfilter/ipset/ip_set_hash_netnet.o
net/netfilter/ipset/ip_set_hash_netnet.c: In function ‘hash_netnet4_uadt’: net/netfilter/ipset/ip_set_hash_netnet.c:163: error: unknown field ‘cidr’ specified in initializer

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)

Similar to 1a869205c75c ("netfilter: ipset: The unnamed union initialization
may lead to compilation error").

Reported-by: Akemi Yagi <amyagi@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipset/ip_set_hash_netnet.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipset/ip_set_hash_netnet.c b/net/netfilter/ipset/ip_set_hash_netnet.c
index 3c862c0..4cafb7e 100644
--- a/net/netfilter/ipset/ip_set_hash_netnet.c
+++ b/net/netfilter/ipset/ip_set_hash_netnet.c
@@ -160,12 +160,13 @@ hash_netnet4_uadt(struct ip_set *set, struct nlattr *tb[],
 {
 	const struct hash_netnet *h = set->data;
 	ipset_adtfn adtfn = set->variant->adt[adt];
-	struct hash_netnet4_elem e = { .cidr = { HOST_MASK, HOST_MASK, }, };
+	struct hash_netnet4_elem e = {};
 	struct ip_set_ext ext = IP_SET_INIT_UEXT(set);
 	u32 ip = 0, ip_to = 0, last;
 	u32 ip2 = 0, ip2_from = 0, ip2_to = 0, last2;
 	int ret;
 
+	e.cidr[0] = e.cidr[1] = HOST_MASK;
 	if (tb[IPSET_ATTR_LINENO])
 		*lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
 
@@ -385,10 +386,11 @@ hash_netnet6_uadt(struct ip_set *set, struct nlattr *tb[],
 		  enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
 {
 	ipset_adtfn adtfn = set->variant->adt[adt];
-	struct hash_netnet6_elem e = { .cidr = { HOST_MASK, HOST_MASK, }, };
+	struct hash_netnet6_elem e = {};
 	struct ip_set_ext ext = IP_SET_INIT_UEXT(set);
 	int ret;
 
+	e.cidr[0] = e.cidr[1] = HOST_MASK;
 	if (tb[IPSET_ATTR_LINENO])
 		*lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]);
 
-- 
1.7.10.4


  reply	other threads:[~2015-07-13 16:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-04  7:44 Linux 4.2 build error in net/netfilter/ipset/ip_set_hash_netnet.c Vinson Lee
2015-07-05 15:35 ` Guenter Roeck
2015-07-13 16:13   ` Akemi Yagi
2015-07-13 16:41     ` Pablo Neira Ayuso [this message]
2015-07-13 16:46       ` Akemi Yagi
2015-07-13 18:29         ` Alan Bartlett
2015-07-14 17:12       ` Jozsef Kadlecsik
2015-07-14 17:40         ` Akemi Yagi
2015-08-11 15:50         ` Akemi Yagi
2015-08-20 19:27           ` Pablo Neira Ayuso
2015-08-20 20:11             ` Alan Bartlett
2015-07-13 18:17     ` Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150713164122.GA26283@salvia \
    --to=pablo@netfilter.org \
    --cc=amyagi@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).