From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-6.cisco.com (alln-iport-6.cisco.com [173.37.142.93]) by dpdk.org (Postfix) with ESMTP id 5A673B372 for ; Thu, 24 Jul 2014 17:41:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2514; q=dns/txt; s=iport; t=1406216591; x=1407426191; h=from:to:subject:date:message-id:references:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=oAEiHZ3YU1RKAficifldAvdaZIxfyv8Y8nbNQhovZ/w=; b=RbS4lalhIKP+Hl8rM+yduiq/opZd1t4ORWfJt7uftI4NMWZNgPTWMsyC iyev8dDeGpIiDoLOGXS14SVw4JTsgOXIbeM6rru6XJFiQwjE9SrqyJxwt jy4/3O6lUhrepEgGAoP5I0cOySCmF2GGAdr9vMsTTZR78BGpx9p56D1KO 0=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhcFABcp0VOtJA2J/2dsb2JhbABYgw6BKQTQeQGBDRZ3hAQBAQQ6TwIBCA4oEDIlAgQBEohCwDkXj1KERgWbM4tuiFSDSGyBRQ X-IronPort-AV: E=Sophos;i="5.01,724,1400025600"; d="scan'208";a="63699581" Received: from alln-core-4.cisco.com ([173.36.13.137]) by alln-iport-6.cisco.com with ESMTP; 24 Jul 2014 15:43:09 +0000 Received: from xhc-aln-x01.cisco.com (xhc-aln-x01.cisco.com [173.36.12.75]) by alln-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id s6OFh9K2028377 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 24 Jul 2014 15:43:09 GMT Received: from xmb-aln-x03.cisco.com ([169.254.6.216]) by xhc-aln-x01.cisco.com ([173.36.12.75]) with mapi id 14.03.0123.003; Thu, 24 Jul 2014 10:43:09 -0500 From: "Niraj Sharma (nirajsha)" To: Matthew Hall , "dev@dpdk.org" Thread-Topic: [dpdk-dev] symbol conflicts between netinet/in.h, arpa/inet.h, and rte_ip.h Thread-Index: AQHPp1XoQIQgUFGYs0WGfpEzv5FdNQ== Date: Thu, 24 Jul 2014 15:43:08 +0000 Message-ID: References: <20140724075918.GA21277@mhcomputing.net> In-Reply-To: <20140724075918.GA21277@mhcomputing.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.21.94.227] Content-Type: text/plain; charset="us-ascii" Content-ID: <91E382E4810AA84E8A3919BDF8EBE787@emea.cisco.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] symbol conflicts between netinet/in.h, arpa/inet.h, and rte_ip.h X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jul 2014 15:41:42 -0000 I also noticed this problem. It is a serious one. I would like it solved. -- Niraj Sharma Principal Eng. Cisco System, Inc. On 7/24/14 12:59 AM, "Matthew Hall" wrote: >Hello, > >I ran into some weird symbol conflicts between system netinet/in.h and >DPDK=20 >rte_ip.h. They have a lot of duplicated definitions for stuff like >IPPROTO_IP=20 >and so on. This breaks when you want to use inet_pton from arpa/inet.h, >because it includes netinet/in.h to define struct in_addr. > >Thus with all the conflicts it's impossible to use a DPDK IP struct >instead of=20 >all the system's sockaddr stuff, to store a value from the system copy of >inet_pton. This would be a common operation if, for example, you want to >configure all the IP addresses on your box from a JSON file, which is >what I=20 >was doing. > >The DPDK kludged around it internally by using a file called >cmdline_parse_ipaddr.c with private copies of these functions. But it in >my=20 >opinion very unwisely marked all of the functions as static except for >cmdline_parse_ipaddr, which only works on the DPDK's proprietary argument >handling, and not with anything the user might have which is a different >format. > >So, it would be a big help for users if the macros in librte_net files >would=20 >check if the symbols already existed, or if they had subheader files >available=20 >to grab only non conflicting symbols, or if they would make a proper .h >and=20 >factor all the inet_pton and inet_ntop inside the cmdline lib into a >place=20 >where users can access them. It would also be a help if they had a less >ugly=20 >equivalent to struct sockaddr, which let you work with IP addresses a bit >more=20 >easily, such as something like this: > >struct ip4_addr { > uint32_t addr; >}; > >typedef struct ip4_addr ip4_addr; > >struct ip6_addr { > uint8_t addr[16]; >}; > >typedef struct ip6_addr ip6_addr; > >struct ip_addr { > uint8_t family; > uint8_t prefix; > union { > struct ip4_addr ipv4; > struct ip6_addr ipv6; > }; >}; > >I had to create a bunch of duplicate code to handle it in my project, >since=20 >the DPDK marked its copies of all these functions as "secret" and didn't >make=20 >a .h for them. If any of it is useful I am happy to donate it, although I >don't think I've got quite enough experience with this specifc part of >the=20 >DPDK to code it up all by myself. > >Thanks, >Matthew.