mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
To: netdev@vger.kernel.org, linux-api@vger.kernel.org,
	musl@lists.openwall.com
Cc: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Subject: [PATCH] uapi: Prevent redefinition of struct iphdr
Date: Sun, 22 Dec 2019 00:02:27 -0600	[thread overview]
Message-ID: <20191222060227.7089-1-AWilcox@Wilcox-Tech.com> (raw)

As with struct ethhdr, the musl libc provides its own definition of the
iphdr struct.  This guard ensures software like net-tools builds correctly
on the musl libc.

The __UAPI_DEF_IPHDR definition is in ip.h itself to prevent the issue in
commit da360299b673 ("uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define")
from being seen here.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
---
 include/uapi/linux/ip.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
index e42d13b55cf3..d34a0d295672 100644
--- a/include/uapi/linux/ip.h
+++ b/include/uapi/linux/ip.h
@@ -83,6 +83,13 @@
 
 #define IPV4_BEET_PHMAXLEN 8
 
+/* Allow libcs to deactivate this - musl has its own copy in <netinet/ip.h> */
+
+#ifndef __UAPI_DEF_IPHDR
+#define __UAPI_DEF_IPHDR	1
+#endif
+
+#if __UAPI_DEF_IPHDR
 struct iphdr {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
 	__u8	ihl:4,
@@ -104,6 +111,7 @@ struct iphdr {
 	__be32	daddr;
 	/*The options start here. */
 };
+#endif
 
 
 struct ip_auth_hdr {
-- 
2.22.1



             reply	other threads:[~2019-12-22  6:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22  6:02 A. Wilcox [this message]
2019-12-26  0:34 ` David Miller
2019-12-26  1:05   ` Rich Felker
2019-12-26  3:49     ` [musl] " David Miller
2019-12-26 11:13       ` Daniel Kolesa
2019-12-30 17:12         ` Rich Felker

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=20191222060227.7089-1-AWilcox@Wilcox-Tech.com \
    --to=awilcox@wilcox-tech.com \
    --cc=linux-api@vger.kernel.org \
    --cc=musl@lists.openwall.com \
    --cc=netdev@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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).