All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: vgusev@openvz.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: santize headers for iproute2
Date: Tue, 25 Dec 2007 17:13:10 -0800	[thread overview]
Message-ID: <20071225171310.1c43a0e2@deepthought> (raw)
In-Reply-To: <20071225.150238.193724414.davem@davemloft.net>

On Tue, 25 Dec 2007 15:02:38 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Tue, 25 Dec 2007 12:43:23 -0800
> 
> > The problem is that iproute ss.c needs linux/tcp.h to get the
> > tcp_info structure definition but linux/tcp.h has incompatible
> > definitions with netinet/tcp.h.  I propose that the enum be moved
> > from net/tcp_states.h to linux/tcp.h.
> 
> This would be fragile, at best.
> 
> We need to solve this in a way such that both linux/tcp.h and
> netinet/tcp.h can both be included at the same time by userland.
> 
> If we export linux/tcp.h to userspace, we have to make it play nice
> with the existing header file namespace.

Well changing netinet/tcp.h is just not a realistic proposition, it takes
too long to filter from glibc through distro's to be worth it. That means
fixing linux/tcp.h to not conflict.  How do you propose to resolve?

In file included from ss.c:37:
../include/linux/tcp.h:24: error: redefinition of ‘struct tcphdr’
../include/linux/tcp.h:106: error: nested redefinition of ‘enum tcp_ca_state’
../include/linux/tcp.h:106: error: redeclaration of ‘enum tcp_ca_state’
../include/linux/tcp.h:107: error: redeclaration of enumerator ‘TCP_CA_Open’
/usr/include/netinet/tcp.h:179: error: previous definition of ‘TCP_CA_Open’ was her

maybe:

--- a/include/linux/tcp.h	2007-12-25 17:09:26.000000000 -0800
+++ b/include/linux/tcp.h	2007-12-25 17:12:12.000000000 -0800
@@ -21,6 +21,9 @@
 #include <asm/byteorder.h>
 #include <linux/socket.h>
 
+#ifndef __KERNEL__
+#include <netinet/tcp.h>
+#else
 struct tcphdr {
 	__be16	source;
 	__be16	dest;
@@ -55,6 +58,7 @@ struct tcphdr {
 	__sum16	check;
 	__be16	urg_ptr;
 };
+#endif
 
 /*
  *	The union cast uses a gcc extension to avoid aliasing problems
@@ -102,6 +106,7 @@ enum { 
 #define TCPI_OPT_WSCALE		4
 #define TCPI_OPT_ECN		8
 
+#ifdef __KERNEL__
 enum tcp_ca_state
 {
 	TCP_CA_Open = 0,
@@ -115,6 +120,7 @@ enum tcp_ca_state
 	TCP_CA_Loss = 4
 #define TCPF_CA_Loss	(1<<TCP_CA_Loss)
 };
+#endif


-- 
Stephen Hemminger <stephen.hemminger@vyatta.com>

  reply	other threads:[~2007-12-26  1:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21 17:43 [PATCH] net: santize headers for iproute2 Stephen Hemminger
2007-12-25  6:05 ` David Miller
2007-12-25 20:43   ` Stephen Hemminger
2007-12-25 23:02     ` David Miller
2007-12-26  1:13       ` Stephen Hemminger [this message]
2007-12-30  3:22         ` David Miller
2007-12-31 18:55           ` Stephen Hemminger
2007-12-25 20:46   ` [PATCH] veth: move veth.h to include/linux Stephen Hemminger
2007-12-25 22:23     ` Sam Ravnborg
2007-12-26  1:14       ` Stephen Hemminger
2007-12-26  1:19         ` David Miller

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=20071225171310.1c43a0e2@deepthought \
    --to=shemminger@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vgusev@openvz.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 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.