NetBSD Problem Report #48166

From jnemeth@CornerstoneService.ca  Sat Aug 31 09:08:31 2013
Return-Path: <jnemeth@CornerstoneService.ca>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id EC56271AA4
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 31 Aug 2013 09:08:31 +0000 (UTC)
Message-Id: <201308310909.r7V99GQJ009283@server.cornerstoneservice.ca>
Date: Sat, 31 Aug 2013 02:09:16 -0700 (PDT)
From: jnemeth@CornerstoneService.ca
Reply-To: jnemeth@CornerstoneService.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: struct in_pktinfo incompatible with all other systems
X-Send-Pr-Version: 3.95

>Number:         48166
>Category:       kern
>Synopsis:       struct in_pktinfo incompatible with all other systems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 31 09:10:00 +0000 2013
>Last-Modified:  Sun Oct 13 06:55:00 +0000 2013
>Originator:     John Nemeth
>Release:        various 6.99.XX
>Organization:
NetBSD
>Environment:
>Description:
     Recently support for IP_PKTINFO was added to NetBSD 6.99.XX.
It is associated with struct in_pktinfo which looks like:

struct in_pktinfo {
	struct		in_addr	ipi_addr;	/* src/dst address */
	unsigned	int	ipi_ifindex;	/* interface index */
};

On all other systems that I've checked (Illumos, Linux, and MacOSX) {none
of the other BSDs have it} the struct is defined like:

typedef struct in_pktinfo {
	unsigned	int	ipi_ifindex;	/* send/recv interface index */
	struct		in_addr	ipi_spec_dst;	/* matched source address */
	struct		in_addr	ipi_addr;	/* src/dst address in IP hdr */
} in_pktinfo_t;

The exact order of the elements varies, but they all exist.

     This is causing problems with numerous third party packages
(at least four known).  This would appear to be a gratuitous
incompatibility with an established interface.  This should really
be fixed before NetBSD 7 is branched.

>How-To-Repeat:
     Attempt to compile various third party packages including,
but not necessarily limited to, asterisk (any variation), mit-krb5,
mrt, and xorp.  To see the issue, you will need to remove the work
around for this problem.
>Fix:

>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/48166: struct in_pktinfo incompatible with all other systems
Date: Sat, 31 Aug 2013 05:28:05 -0400

 On Aug 31,  9:10am, jnemeth@CornerstoneService.ca (jnemeth@CornerstoneService.ca) wrote:
 -- Subject: kern/48166: struct in_pktinfo incompatible with all other systems

 | struct in_pktinfo {
 | 	struct		in_addr	ipi_addr;	/* src/dst address */
 | 	unsigned	int	ipi_ifindex;	/* interface index */
 | };
 | 
 | On all other systems that I've checked (Illumos, Linux, and MacOSX) {none
 | of the other BSDs have it} the struct is defined like:
 | 
 | typedef struct in_pktinfo {
 | 	unsigned	int	ipi_ifindex;	/* send/recv interface index */
 | 	struct		in_addr	ipi_spec_dst;	/* matched source address */
 | 	struct		in_addr	ipi_addr;	/* src/dst address in IP hdr */
 | } in_pktinfo_t;
 | 

 And some don't have it:

 Windows:
 http://msdn.microsoft.com/en-us/library/windows/desktop/ms738572(v=vs.85).aspx
 AIX:
 https://publib.boulder.ibm.com/infocenter/ieduasst/stgv1r0/topic/com.ibm.iea.zos/zos/1.13/Application-Middleware-Workload_Enablement/zOS_V1R13_zOS_UNIX_IPV4-pktinfo-Support.pdf?dmuid=20110825162439438278
 Cygwin:
 http://cygwin.com/ml/cygwin/2009-09/msg00150.html

 We could provide it, but it does not seem necessary or symmetric to the
 IPV6 interface:

 /*                   
  * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
  */
 struct in6_pktinfo {            
         struct in6_addr ipi6_addr;      /* src/dst IPv6 address */
         unsigned int    ipi6_ifindex;   /* send/recv interface index */
 };

 christos

From: John Nemeth <jnemeth@cue.bc.ca>
To: christos@zoulas.com (Christos Zoulas), gnats-bugs@NetBSD.org,
        kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
        netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: kern/48166: struct in_pktinfo incompatible with all other systems
Date: Sat, 12 Oct 2013 23:45:30 -0700

 On Aug 31,  5:28am, Christos Zoulas wrote:
 } On Aug 31,  9:10am, jnemeth@CornerstoneService.ca (jnemeth@CornerstoneService.ca) wrote:
 } 
 } | struct in_pktinfo {
 } | 	struct		in_addr	ipi_addr;	/* src/dst address */
 } | 	unsigned	int	ipi_ifindex;	/* interface index */
 } | };
 } | 
 } | On all other systems that I've checked (Illumos, Linux, and MacOSX) {none
 } | of the other BSDs have it} the struct is defined like:
 } | 
 } | typedef struct in_pktinfo {
 } | 	unsigned	int	ipi_ifindex;	/* send/recv interface index */
 } | 	struct		in_addr	ipi_spec_dst;	/* matched source address */
 } | 	struct		in_addr	ipi_addr;	/* src/dst address in IP hdr */
 } | } in_pktinfo_t;
 } | 
 } 
 } And some don't have it:
 } 
 } Windows:
 } http://msdn.microsoft.com/en-us/library/windows/desktop/ms738572(v=vs.85).aspx

     Windows is weird and porting software to Windows is a major task.

 } AIX:
 } https://publib.boulder.ibm.com/infocenter/ieduasst/stgv1r0/topic/com.ibm.iea.zos/zos/1.13/Application-Middleware-Workload_Enablement/zOS_V1R13_zOS_UNIX_IPV4-pktinfo-Support.pdf?dmuid=20110825162439438278

      AIX is really weird, but okay.

 } Cygwin:
 } http://cygwin.com/ml/cygwin/2009-09/msg00150.html

      Cygwin says they do it the way they do because it's what the
 underlying Windows implementation does.  So, I'm going to write
 this one off as being not an independent implementation.  That
 leaves us with only two.

 } We could provide it, but it does not seem necessary or symmetric to the
 } IPV6 interface:
 } 
 } /*                   
 }  * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
 }  */
 } struct in6_pktinfo {            
 }         struct in6_addr ipi6_addr;      /* src/dst IPv6 address */
 }         unsigned int    ipi6_ifindex;   /* send/recv interface index */
 } };

      I'm aware of this, and although it would be nice to be
 symmetrical, I don't think this should be an overriding concern.

      A couple more apps with problems were found after this PR was
 filed.  I also noticed a related PR (48280) was filed by you.

      Anyways, the most used Unix systems (and derivative) have
 ipi_spec_dst.  In order to maintain compatibility, we should have
 it as well.  If it really serves no purpose, then just create a
 dummy field and everybody will be happy.  But, given the other PR,
 I suspect it does serve a purpose.

 }-- End of excerpt from Christos Zoulas

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.