All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
@ 2018-04-04  8:52 Xiao Yang
  2018-04-04  9:45 ` Petr Vorel
  2018-04-04  9:57 ` Petr Vorel
  0 siblings, 2 replies; 8+ messages in thread
From: Xiao Yang @ 2018-04-04  8:52 UTC (permalink / raw)
  To: ltp

On old distros(e.g. RHEL5), Compilation failed because of redefinitions
from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
----------------------------------------------------------------------
In file included from /usr/include/linux/sctp.h:54,
                 from ../../../include/lapi/sctp.h:22,
                 from sctp_big_chunk.c:35:
/usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
/usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
...
----------------------------------------------------------------------

1) There was a existed netinet/sctp.h based on lksctp-tools-devel package
   in LTP, so we used netinet/sctp.h to fix it as the sctp tests did.
2) We removed lapi/sctp.h and duplicated SOL_SCTP in lapi/socket.h.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 configure.ac                            |  1 -
 include/lapi/sctp.h                     | 29 -----------------------------
 include/lapi/socket.h                   |  4 ----
 testcases/network/sctp/Makefile         |  2 ++
 testcases/network/sctp/sctp_big_chunk.c |  2 +-
 5 files changed, 3 insertions(+), 35 deletions(-)
 delete mode 100644 include/lapi/sctp.h

diff --git a/configure.ac b/configure.ac
index 9358064..1721ff2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,6 @@ AC_CHECK_HEADERS([ \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
-    linux/sctp.h \
     mm.h \
     pthread.h \
     sys/epoll.h \
diff --git a/include/lapi/sctp.h b/include/lapi/sctp.h
deleted file mode 100644
index 69adc7a..0000000
--- a/include/lapi/sctp.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2018 Oracle and/or its affiliates.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef LAPI_SCTP_H__
-#define LAPI_SCTP_H__
-
-#ifdef HAVE_LINUX_SCTP_H
-# include <linux/sctp.h>
-#endif
-
-#ifndef SCTP_SOCKOPT_BINDX_ADD
-# define SCTP_SOCKOPT_BINDX_ADD	100
-#endif
-
-#endif	/* LAPI_SCTP_H__ */
diff --git a/include/lapi/socket.h b/include/lapi/socket.h
index d58c460..426906f 100644
--- a/include/lapi/socket.h
+++ b/include/lapi/socket.h
@@ -45,10 +45,6 @@
 # define SOCK_CLOEXEC 02000000
 #endif
 
-#ifndef SOL_SCTP
-# define SOL_SCTP	132
-#endif
-
 #ifndef SOL_UDPLITE
 # define SOL_UDPLITE		136 /* UDP-Lite (RFC 3828) */
 #endif
diff --git a/testcases/network/sctp/Makefile b/testcases/network/sctp/Makefile
index 0fa9125..ac4a99a 100644
--- a/testcases/network/sctp/Makefile
+++ b/testcases/network/sctp/Makefile
@@ -17,6 +17,8 @@ top_srcdir		?= ../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
+CPPFLAGS		+= -I$(top_srcdir)/utils/sctp/include
+
 INSTALL_TARGETS		:= sctp01.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c
index 55a2969..d3288ee 100644
--- a/testcases/network/sctp/sctp_big_chunk.c
+++ b/testcases/network/sctp/sctp_big_chunk.c
@@ -32,7 +32,7 @@
 #include "tst_safe_stdio.h"
 #include "lapi/netinet_in.h"
 #include "lapi/socket.h"
-#include "lapi/sctp.h"
+#include "netinet/sctp.h"
 
 static int port;
 static int sfd, cfd;
-- 
1.8.3.1




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

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04  8:52 [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error Xiao Yang
@ 2018-04-04  9:45 ` Petr Vorel
  2018-04-04  9:55   ` Xiao Yang
  2018-04-04  9:57 ` Petr Vorel
  1 sibling, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2018-04-04  9:45 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
> ----------------------------------------------------------------------
> In file included from /usr/include/linux/sctp.h:54,
>                  from ../../../include/lapi/sctp.h:22,
>                  from sctp_big_chunk.c:35:
> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
> ...
> ----------------------------------------------------------------------

> 1) There was a existed netinet/sctp.h based on lksctp-tools-devel package
>    in LTP, so we used netinet/sctp.h to fix it as the sctp tests did.
> 2) We removed lapi/sctp.h and duplicated SOL_SCTP in lapi/socket.h.

> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---

Thank you for the fix. I'd prefer to remove our utils/sctp/include/netinet/sctp.h (I don't
think it's a good idea to copy headers into source code) and fix include/lapi/sctp.h
header trying first include <netinet/sctp.h> (with autotools check) and then
<linux/sctp.h> if the previous is not available, as Alexey suggested [1].

What do you think, Alexey?


Kind regards,
Petr

[1] http://lists.linux.it/pipermail/ltp/2018-March/007517.html

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

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04  9:45 ` Petr Vorel
@ 2018-04-04  9:55   ` Xiao Yang
  2018-04-04 10:46     ` Alexey Kodanev
  0 siblings, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2018-04-04  9:55 UTC (permalink / raw)
  To: ltp

On 2018/04/04 17:45, Petr Vorel wrote:
> Hi Xiao,
>
>> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
>> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
>> ----------------------------------------------------------------------
>> In file included from /usr/include/linux/sctp.h:54,
>>                   from ../../../include/lapi/sctp.h:22,
>>                   from sctp_big_chunk.c:35:
>> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
>> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
>> ...
>> ----------------------------------------------------------------------
>> 1) There was a existed netinet/sctp.h based on lksctp-tools-devel package
>>     in LTP, so we used netinet/sctp.h to fix it as the sctp tests did.
>> 2) We removed lapi/sctp.h and duplicated SOL_SCTP in lapi/socket.h.
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
> Thank you for the fix. I'd prefer to remove our utils/sctp/include/netinet/sctp.h (I don't
> think it's a good idea to copy headers into source code) and fix include/lapi/sctp.h
> header trying first include<netinet/sctp.h>  (with autotools check) and then
> <linux/sctp.h>  if the previous is not available, as Alexey suggested [1].
Hi Petr,

If only<linux/sctp.h>  is provided on RHEL5, it seems that the redefinition problem still exists.

Thanks,
Xiao Yang.

> What do you think, Alexey?
>
>
> Kind regards,
> Petr
>
> [1] http://lists.linux.it/pipermail/ltp/2018-March/007517.html
>
>
> .
>




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

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04  8:52 [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error Xiao Yang
  2018-04-04  9:45 ` Petr Vorel
@ 2018-04-04  9:57 ` Petr Vorel
  1 sibling, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2018-04-04  9:57 UTC (permalink / raw)
  To: ltp

> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
> ----------------------------------------------------------------------
> In file included from /usr/include/linux/sctp.h:54,
>                  from ../../../include/lapi/sctp.h:22,
>                  from sctp_big_chunk.c:35:
> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
And obviously we need to find a way, how to check these old distros. IMHO it's not
feasible with travis, it'd be great to add another CI (docker based) to test these
distros.


Kind regards,
Petr

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

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04  9:55   ` Xiao Yang
@ 2018-04-04 10:46     ` Alexey Kodanev
  2018-04-04 11:12       ` [LTP] [PATCH v2] " Xiao Yang
  2018-04-04 11:16       ` [LTP] [PATCH] " Xiao Yang
  0 siblings, 2 replies; 8+ messages in thread
From: Alexey Kodanev @ 2018-04-04 10:46 UTC (permalink / raw)
  To: ltp

On 04.04.2018 12:55, Xiao Yang wrote:
> On 2018/04/04 17:45, Petr Vorel wrote:
>> Hi Xiao,
>>
>>> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
>>> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
>>> ----------------------------------------------------------------------
>>> In file included from /usr/include/linux/sctp.h:54,
>>>                   from ../../../include/lapi/sctp.h:22,
>>>                   from sctp_big_chunk.c:35:
>>> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
>>> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
>>> ...
>>> ----------------------------------------------------------------------
>>> 1) There was a existed netinet/sctp.h based on lksctp-tools-devel package
>>>     in LTP, so we used netinet/sctp.h to fix it as the sctp tests did.
>>> 2) We removed lapi/sctp.h and duplicated SOL_SCTP in lapi/socket.h.
>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>> ---
>> Thank you for the fix. I'd prefer to remove our utils/sctp/include/netinet/sctp.h (I don't
>> think it's a good idea to copy headers into source code) and fix include/lapi/sctp.h
>> header trying first include<netinet/sctp.h>  (with autotools check) and then
>> <linux/sctp.h>  if the previous is not available, as Alexey suggested [1].
> Hi Petr,
> 
> If only<linux/sctp.h>  is provided on RHEL5, it seems that the redefinition problem still exists.


I think it would be better to just remove the include of linux/sctp.h
for now, to fix this issue. lapi/ has the needed definitions to compile
the test without it.

Optionally,
we could include netinet/sctp.h, if it was installed, in lapi/sctp.h,
or substitute it with the one from utils and support it from there,
including utils/sctp which is lksctp-tools.

Thanks,
Alexey

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

* [LTP] [PATCH v2] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04 10:46     ` Alexey Kodanev
@ 2018-04-04 11:12       ` Xiao Yang
  2018-04-04 13:04         ` Alexey Kodanev
  2018-04-04 11:16       ` [LTP] [PATCH] " Xiao Yang
  1 sibling, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2018-04-04 11:12 UTC (permalink / raw)
  To: ltp

On old distros(e.g. RHEL5), Compilation failed because of redefinitions
from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
----------------------------------------------------------------------
In file included from /usr/include/linux/sctp.h:54,
                 from ../../../include/lapi/sctp.h:22,
                 from sctp_big_chunk.c:35:
/usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
/usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
...
----------------------------------------------------------------------

1) Remove the include of linux/sctp.h to fix it.
2) Include netinet/sctp.h, if it was available.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 configure.ac        | 2 +-
 include/lapi/sctp.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9358064..9208f1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,8 +44,8 @@ AC_CHECK_HEADERS([ \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
-    linux/sctp.h \
     mm.h \
+    netinet/sctp.h \
     pthread.h \
     sys/epoll.h \
     sys/fanotify.h \
diff --git a/include/lapi/sctp.h b/include/lapi/sctp.h
index 69adc7a..647052b 100644
--- a/include/lapi/sctp.h
+++ b/include/lapi/sctp.h
@@ -18,8 +18,8 @@
 #ifndef LAPI_SCTP_H__
 #define LAPI_SCTP_H__
 
-#ifdef HAVE_LINUX_SCTP_H
-# include <linux/sctp.h>
+#ifdef HAVE_NETINET_SCTP_H
+# include <netinet/sctp.h>
 #endif
 
 #ifndef SCTP_SOCKOPT_BINDX_ADD
-- 
1.8.3.1




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

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04 10:46     ` Alexey Kodanev
  2018-04-04 11:12       ` [LTP] [PATCH v2] " Xiao Yang
@ 2018-04-04 11:16       ` Xiao Yang
  1 sibling, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2018-04-04 11:16 UTC (permalink / raw)
  To: ltp

On 2018/04/04 18:46, Alexey Kodanev wrote:
> On 04.04.2018 12:55, Xiao Yang wrote:
>> On 2018/04/04 17:45, Petr Vorel wrote:
>>> Hi Xiao,
>>>
>>>> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
>>>> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
>>>> ----------------------------------------------------------------------
>>>> In file included from /usr/include/linux/sctp.h:54,
>>>>                    from ../../../include/lapi/sctp.h:22,
>>>>                    from sctp_big_chunk.c:35:
>>>> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
>>>> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
>>>> ...
>>>> ----------------------------------------------------------------------
>>>> 1) There was a existed netinet/sctp.h based on lksctp-tools-devel package
>>>>      in LTP, so we used netinet/sctp.h to fix it as the sctp tests did.
>>>> 2) We removed lapi/sctp.h and duplicated SOL_SCTP in lapi/socket.h.
>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>>> ---
>>> Thank you for the fix. I'd prefer to remove our utils/sctp/include/netinet/sctp.h (I don't
>>> think it's a good idea to copy headers into source code) and fix include/lapi/sctp.h
>>> header trying first include<netinet/sctp.h>   (with autotools check) and then
>>> <linux/sctp.h>   if the previous is not available, as Alexey suggested [1].
>> Hi Petr,
>>
>> If only<linux/sctp.h>   is provided on RHEL5, it seems that the redefinition problem still exists.
>
> I think it would be better to just remove the include of linux/sctp.h
> for now, to fix this issue. lapi/ has the needed definitions to compile
> the test without it.
Hi Alexey and Petr,

Thanks for your reply.

I will remove linux/sctp.h and check netinet/sctp.h as you suggested in 
v2 patch.

Thanks,
Xiao Yang
> Optionally,
> we could include netinet/sctp.h, if it was installed, in lapi/sctp.h,
> or substitute it with the one from utils and support it from there,
> including utils/sctp which is lksctp-tools.
>
> Thanks,
> Alexey
>
>
>




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

* [LTP] [PATCH v2] sctp/sctp_big_chunk.c: Fix compiler error
  2018-04-04 11:12       ` [LTP] [PATCH v2] " Xiao Yang
@ 2018-04-04 13:04         ` Alexey Kodanev
  0 siblings, 0 replies; 8+ messages in thread
From: Alexey Kodanev @ 2018-04-04 13:04 UTC (permalink / raw)
  To: ltp

On 04.04.2018 14:12, Xiao Yang wrote:
> On old distros(e.g. RHEL5), Compilation failed because of redefinitions
> from linux/sctp.h(including linux/in.h) and netinet/in.h, as below:
> ----------------------------------------------------------------------
> In file included from /usr/include/linux/sctp.h:54,
>                  from ../../../include/lapi/sctp.h:22,
>                  from sctp_big_chunk.c:35:
> /usr/include/linux/in.h:26: error: redeclaration of enumerator ‘IPPROTO_IP’
> /usr/include/netinet/in.h:33: error: previous definition of ‘IPPROTO_IP’ was here
> ...
> ----------------------------------------------------------------------
> 
> 1) Remove the include of linux/sctp.h to fix it.
> 2) Include netinet/sctp.h, if it was available.
> 

Applied, thanks!

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

end of thread, other threads:[~2018-04-04 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04  8:52 [LTP] [PATCH] sctp/sctp_big_chunk.c: Fix compiler error Xiao Yang
2018-04-04  9:45 ` Petr Vorel
2018-04-04  9:55   ` Xiao Yang
2018-04-04 10:46     ` Alexey Kodanev
2018-04-04 11:12       ` [LTP] [PATCH v2] " Xiao Yang
2018-04-04 13:04         ` Alexey Kodanev
2018-04-04 11:16       ` [LTP] [PATCH] " Xiao Yang
2018-04-04  9:57 ` Petr Vorel

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.