Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Jun 2005 21:44:03 +0900
From:      Hajimu UMEMOTO <ume@mahoroba.org>
To:        freebsd-arch@freebsd.org, standards@freebsd.org, current@freebsd.org
Cc:        nectar@freebsd.org, des@des.no
Subject:   Re: [CFR] correct type of addrinfo.ai_addrlen and netent.n_net
Message-ID:  <ygeacmatffw.wl%ume@mahoroba.org>
In-Reply-To: <ygepsv7i8d1.wl%ume@mahoroba.org>
References:  <ygezmub1t1c.wl%ume@mahoroba.org>	<20050531.075329.118637972.imp@bsdimp.com>	<ygevf4zihhz.wl%ume@mahoroba.org>	<20050531.084832.20036038.imp@bsdimp.com>	<ygeu0kjigeg.wl%ume@mahoroba.org>	<86fyw32yqm.fsf@xps.des.no>	<ygesm03ie9a.wl%ume@mahoroba.org>	<86k6lfbafu.fsf@xps.des.no>	<ygepsv7i8d1.wl%ume@mahoroba.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Wed_Jun__1_21:44:03_2005-1
Content-Type: text/plain; charset=US-ASCII

Hi,

>>>>> On Wed, 01 Jun 2005 03:00:10 +0900
>>>>> Hajimu UMEMOTO <ume@freebsd.org> said:

ume> In anyway, there is one more issue in my patch.  We cannot correct 1st
ume> argument of getnetbyaddr(3) without breaking ABI compatibility.
ume> Fortunately, getnetbyaddr(3) is not refered else where in our
ume> libraries.  So, I'll fix getnetbyaddr(3).

I've attached the patch to correct 1st argument of getnetbyaddr(3) in
this mail.  It is subset of my previous patch.  Since it breaks ABI
compatibility of getnetbyaddr(3), I think it is better to correct
n_net member of struct netent, too.  Since there is objection, the
patch leaves struct addrinfo as is.  So, it doesn't need to bump any
shlib major.  Is it okay?

Sincerely,

--Multipart_Wed_Jun__1_21:44:03_2005-1
Content-Type: text/x-patch; charset=US-ASCII
Content-Disposition: attachment; filename="netdb.h-fix-getnetbyadr.diff"
Content-Transfer-Encoding: 7bit

Index: include/netdb.h
diff -u include/netdb.h.orig include/netdb.h
--- include/netdb.h.orig	Sat May 28 01:20:40 2005
+++ include/netdb.h	Sat May 28 01:31:52 2005
@@ -105,28 +103,11 @@
 #define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
 };
 
-/*
- * Note: n_net used to be an unsigned long integer.
- * In XNS5, and subsequently in POSIX-2001 it was changed to an
- * uint32_t.
- * To accomodate for this while preserving binary compatibility with
- * the old interface, we prepend or append 32 bits of padding,
- * depending on the (LP64) architecture's endianness.
- *
- * This should be deleted the next time the libc major number is
- * incremented.
- */
 struct netent {
 	char		*n_name;	/* official name of net */
 	char		**n_aliases;	/* alias list */
 	int		n_addrtype;	/* net address type */
-#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN
-	uint32_t	__n_pad0;	/* ABI compatibility */
-#endif
 	uint32_t	n_net;		/* network # */
-#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN
-	uint32_t	__n_pad0;	/* ABI compatibility */
-#endif
 };
 
 struct servent {
@@ -262,11 +226,7 @@
 struct hostent	*gethostent(void);
 struct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
 struct hostent	*getipnodebyname(const char *, int, int, int *);
-#if __LONG_BIT == 64
-struct netent	*getnetbyaddr(unsigned long, int);	/* ABI compatibility */
-#else
 struct netent	*getnetbyaddr(uint32_t, int);
-#endif
 struct netent	*getnetbyname(const char *);
 struct netent	*getnetent(void);
 int		getnetgrent(char **, char **, char **);
Index: lib/libc/net/getnetbydns.c
diff -u -p lib/libc/net/getnetbydns.c.orig lib/libc/net/getnetbydns.c
--- lib/libc/net/getnetbydns.c.orig	Sat May 28 01:24:33 2005
+++ lib/libc/net/getnetbydns.c	Sat May 28 01:36:52 2005
@@ -259,9 +259,6 @@ getnetanswer(querybuf *answer, int ansle
 			break;
 		}
 		ne->n_aliases++;
-#if __LONG_BIT == 64
-		ne->__n_pad0 = 0;	/* ABI compatibility */
-#endif
 		return 0;
 	}
 	h_errno = TRY_AGAIN;
@@ -334,9 +331,6 @@ _dns_getnetbyaddr(void *rval, void *cb_d
 		while ((net & 0xff) == 0 && net != 0)
 			net >>= 8;
 		ne->n_net = net;
-#if __LONG_BIT == 64
-		ne->__n_pad0 = 0;	/* ABI compatibility */
-#endif
 		return NS_SUCCESS;
 	}
 	return NS_NOTFOUND;
Index: lib/libc/net/getnetbyht.c
diff -u -p lib/libc/net/getnetbyht.c.orig lib/libc/net/getnetbyht.c
--- lib/libc/net/getnetbyht.c.orig	Sat May 28 01:24:33 2005
+++ lib/libc/net/getnetbyht.c	Sat May 28 01:37:13 2005
@@ -122,9 +122,6 @@ again:
 	if (p != NULL)
 		*p++ = '\0';
 	ne->n_net = inet_network(cp);
-#if __LONG_BIT == 64
-	ne->__n_pad0 = 0;	/* ABI compatibility */
-#endif
 	ne->n_addrtype = AF_INET;
 	q = ne->n_aliases = ned->net_aliases;
 	if (p != NULL) {
Index: lib/libc/net/getnetbynis.c
diff -u -p lib/libc/net/getnetbynis.c.orig lib/libc/net/getnetbynis.c
--- lib/libc/net/getnetbynis.c.orig	Sat May 28 01:24:33 2005
+++ lib/libc/net/getnetbynis.c	Sat May 28 01:37:35 2005
@@ -99,9 +99,6 @@ _getnetbynis(const char *name, char *map
 		cp++;
 
 	ne->n_net = inet_network(cp);
-#if __LONG_BIT == 64
-	ne->__n_pad0 = 0;	/* ABI compatibility */
-#endif
 	ne->n_addrtype = AF_INET;
 
 	q = ne->n_aliases = ned->net_aliases;
Index: lib/libc/net/getnetnamadr.c
diff -u -p lib/libc/net/getnetnamadr.c.orig lib/libc/net/getnetnamadr.c
--- lib/libc/net/getnetnamadr.c.orig	Sat May 28 01:35:00 2005
+++ lib/libc/net/getnetnamadr.c	Sat May 28 01:35:32 2005
@@ -165,17 +165,13 @@ getnetbyname(const char *name)
 }
 
 struct netent *
-#if __LONG_BIT == 64
-getnetbyaddr(u_long addr, int af)		/* ABI compatibility */
-#else
 getnetbyaddr(uint32_t addr, int af)
-#endif
 {
 	struct netdata *nd;
 
 	if ((nd = __netdata_init()) == NULL)
 		return NULL;
-	if (getnetbyaddr_r((uint32_t)addr, af, &nd->net, &nd->data) != 0)
+	if (getnetbyaddr_r(addr, af, &nd->net, &nd->data) != 0)
 		return NULL;
 	return &nd->net;
 }

--Multipart_Wed_Jun__1_21:44:03_2005-1
Content-Type: text/plain; charset=US-ASCII

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

--Multipart_Wed_Jun__1_21:44:03_2005-1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygeacmatffw.wl%ume>