From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754206AbcEJB36 (ORCPT ); Mon, 9 May 2016 21:29:58 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:35797 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbcEJB34 (ORCPT ); Mon, 9 May 2016 21:29:56 -0400 Date: Mon, 09 May 2016 21:29:53 -0400 (EDT) Message-Id: <20160509.212953.2176297121729133081.davem@davemloft.net> To: mikko.rapeli@iki.fi Cc: zhangshengju@cmss.chinamobile.com, stephen@networkplumber.org, linux-kernel@vger.kernel.org, jengelh@inai.de, jwboyer@fedoraproject.org, mail@waldemar-brodkorb.de, gabriel@lse.epita.fr, netfilter-devel@vger.kernel.org, libc-alpha@sourceware.org Subject: Re: [PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h From: David Miller In-Reply-To: <1461512707-23058-1-git-send-email-mikko.rapeli@iki.fi> References: <1461512707-23058-1-git-send-email-mikko.rapeli@iki.fi> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-7 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 09 May 2016 18:29:55 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u4A1U4B9011402 From: Mikko Rapeli Date: Sun, 24 Apr 2016 17:45:00 +0200 > glibc's net/if.h contains copies of definitions from linux/if.h and these > conflict and cause build failures if both files are included by application > source code. Changes in uapi headers, which fixed header file dependencies to > include linux/if.h when it was needed, e.g. commit 1ffad83d, made the > net/if.h and linux/if.h incompatibilities visible as build failures for > userspace applications like iproute2 and xtables-addons. > > This patch fixes compile errors when glibc net/if.h is included before > linux/if.h: > > ./linux/if.h:99:21: error: redeclaration of enumerator ¡IFF_NOARP¢ > ./linux/if.h:98:23: error: redeclaration of enumerator ¡IFF_RUNNING¢ > ./linux/if.h:97:26: error: redeclaration of enumerator ¡IFF_NOTRAILERS¢ > ./linux/if.h:96:27: error: redeclaration of enumerator ¡IFF_POINTOPOINT¢ > ./linux/if.h:95:24: error: redeclaration of enumerator ¡IFF_LOOPBACK¢ > ./linux/if.h:94:21: error: redeclaration of enumerator ¡IFF_DEBUG¢ > ./linux/if.h:93:25: error: redeclaration of enumerator ¡IFF_BROADCAST¢ > ./linux/if.h:92:19: error: redeclaration of enumerator ¡IFF_UP¢ > ./linux/if.h:252:8: error: redefinition of ¡struct ifconf¢ > ./linux/if.h:203:8: error: redefinition of ¡struct ifreq¢ > ./linux/if.h:169:8: error: redefinition of ¡struct ifmap¢ > ./linux/if.h:107:23: error: redeclaration of enumerator ¡IFF_DYNAMIC¢ > ./linux/if.h:106:25: error: redeclaration of enumerator ¡IFF_AUTOMEDIA¢ > ./linux/if.h:105:23: error: redeclaration of enumerator ¡IFF_PORTSEL¢ > ./linux/if.h:104:25: error: redeclaration of enumerator ¡IFF_MULTICAST¢ > ./linux/if.h:103:21: error: redeclaration of enumerator ¡IFF_SLAVE¢ > ./linux/if.h:102:22: error: redeclaration of enumerator ¡IFF_MASTER¢ > ./linux/if.h:101:24: error: redeclaration of enumerator ¡IFF_ALLMULTI¢ > ./linux/if.h:100:23: error: redeclaration of enumerator ¡IFF_PROMISC¢ > > The cases where linux/if.h is included before net/if.h need a similar fix in > the glibc side, or the order of include files can be changed userspace > code as a workaround. > > This change was tested in x86 userspace on Debian unstable with > scripts/headers_compile_test.sh: > > $ make headers_install && \ > cd usr/include && ../../scripts/headers_compile_test.sh -l -k > ... > cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I /usr/lib/gcc/i586-linux-gnu/5/include-fixed -I . -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH/i586-linux-gnu -o /dev/null ./linux/if.h_libc_before_kernel.h > PASSED libc before kernel test: ./linux/if.h > > Reported-by: Jan Engelhardt > Reported-by: Josh Boyer > Reported-by: Stephen Hemminger > Reported-by: Waldemar Brodkorb > Cc: Gabriel Laskar > Signed-off-by: Mikko Rapeli Applied and queued up for -stable, t hanks.