diff mbox series

[v2] sctp/sctp_big_chunk.c: Fix compiler error

Message ID 1522840374-10311-1-git-send-email-yangx.jy@cn.fujitsu.com
State Accepted
Delegated to: Alexey Kodanev
Headers show
Series [v2] sctp/sctp_big_chunk.c: Fix compiler error | expand

Commit Message

Xiao Yang April 4, 2018, 11:12 a.m. UTC
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(-)

Comments

Alexey Kodanev April 4, 2018, 1:04 p.m. UTC | #1
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!
diff mbox series

Patch

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