From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.mhcomputing.net (master.mhcomputing.net [74.208.46.186]) by dpdk.org (Postfix) with ESMTP id 1246AB35F for ; Thu, 24 Jul 2014 09:58:26 +0200 (CEST) Received: by mail.mhcomputing.net (Postfix, from userid 1000) id 36E5C80C764; Thu, 24 Jul 2014 00:59:18 -0700 (PDT) Date: Thu, 24 Jul 2014 00:59:18 -0700 From: Matthew Hall To: "dev@dpdk.org" Message-ID: <20140724075918.GA21277@mhcomputing.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [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 07:58:26 -0000 Hello, I ran into some weird symbol conflicts between system netinet/in.h and DPDK rte_ip.h. They have a lot of duplicated definitions for stuff like IPPROTO_IP 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 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 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 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 check if the symbols already existed, or if they had subheader files available to grab only non conflicting symbols, or if they would make a proper .h and factor all the inet_pton and inet_ntop inside the cmdline lib into a place where users can access them. It would also be a help if they had a less ugly equivalent to struct sockaddr, which let you work with IP addresses a bit more 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 the DPDK marked its copies of all these functions as "secret" and didn't make 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 DPDK to code it up all by myself. Thanks, Matthew.