DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] llib/ibrte_net: workaround to avoid macro conflict
Date: Tue, 30 Sep 2014 10:49:08 +0800	[thread overview]
Message-ID: <1412045348-18543-1-git-send-email-jingjing.wu@intel.com> (raw)

Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>.
If user's application includes <netinet/in.h> and rte_ip.h at the same time,
there will be conflict error.

This patch uses the way "#ifndef #endif" to avoid the conflict. 

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_net/rte_ip.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index e3f65c1..2bcb479 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -116,6 +116,8 @@ struct ipv4_hdr {
 
 #define	IPV4_HDR_OFFSET_UNITS	8
 
+#ifndef _NETINET_IN_H
+#ifndef _NETINET_IN_H_
 /* IPv4 protocols */
 #define IPPROTO_IP         0  /**< dummy for IP */
 #define IPPROTO_HOPOPTS    0  /**< IP6 hop-by-hop options */
@@ -227,6 +229,9 @@ struct ipv4_hdr {
 #define IPPROTO_RAW      255  /**< raw IP packet */
 #define IPPROTO_MAX      256  /**< maximum protocol number */
 
+#endif /*_NETINET_IN_H_*/
+#endif /*_NETINET_IN_H*/
+
 /*
  * IPv4 address types
  */
-- 
1.8.1.4

             reply	other threads:[~2014-09-30  2:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30  2:49 Jingjing Wu [this message]
2014-09-30  5:07 ` Thomas Monjalon
2014-10-09  5:17   ` Wu, Jingjing
2014-09-30 13:09 ` Neil Horman
2014-10-09  5:20   ` Wu, Jingjing
2014-10-09  5:37     ` Matthew Hall
2014-10-09 11:29     ` Neil Horman
2014-11-03  7:41       ` Thomas Monjalon
2014-11-17 14:17         ` Neil Horman
2014-11-27 11:48           ` [dpdk-dev] [PATCH] net: fix conflict with libc Thomas Monjalon
2014-11-27 14:03             ` Ivan Boule
2014-11-27 18:13               ` Thomas Monjalon

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=1412045348-18543-1-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.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 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).