Re: [gnet] build problem with 'ss_family'



On Wed, 2005-04-13 at 14:57 +0100, Tim Müller wrote:
> On Wednesday 06 April 2005 16:44, Mark Drago wrote:
> 
> > I'm having an interesting problem trying to compile gnet.  I'm using
> > gnet-2.0.7.  I am trying to compile it on a fairly old version of SuSE
> > (7.1).  I'm guessing that this is what is causing my problems, but
> > before I go through a flurry of updates I wanted to see if anyone had
> > seen this before.  There was a post to the mailing list a little over a
> > year ago with a similar problem [1], however there was no resolution.
> >
> >  ...
> >
> > gnet-private.c: In function `gnet_private_create_listen_socket':
> > gnet-private.c:46: structure has no member named `ss_family'
> > gnet-private.c:48: structure has no member named `ss_family'
> 
> This should be fixed in GNet CVS now (based on Jeremy Denise's patch), would 
> be great if you could give it a spin and check whether it really works now 
> (including 'make check').

Well, I'm having a little bit of trouble getting the CVS version built
on the machine in question due to our versions of auto* being on very
old crack.  But if I check gnet out of CVS on a modern distribution, run
'./autogen.sh', run 'make dist' and bring the resulting tar.gz over to
the older machine, the build fails with the same error:

gnet-private.c: In function `gnet_private_create_listen_socket':
gnet-private.c:46: structure has no member named `ss_family'
gnet-private.c:48: structure has no member named `ss_family'

Depending on when you committed this, I suppose it could be possible
that it just isn't on the anonymous mirror yet.

After reading Jeremy Denise's original post [1] and extracting his patch
(which doesn't apply cleanly to newer gnets) I realized that the problem
is that my libc headers refer to the __ss_family member of
sockaddr_storage instead of ss_family.  So, I went through gnet and
changed all of the references to ss_family to __ss_family (it's only in
about a dozen places).  After doing this gnet does build cleanly.  So,
at least I know that this is what is causing the problem.  I have
attached a patch of the changes that I made to get gnet to build.
Clearly this kind of patch is only meant for google to find at some
point and not for inclusion into gnet.  The patch applies to both CVS
and gnet-2.0.7 and 'make check' passes for both of them.  I'd like to
help get a check for this into CVS.  I'm not terribly familiar with
writing autoconf tests, but I'll gladly help test things out.

Thanks,
Mark Drago

[1] http://lists.gnetlibrary.org/pipermail/gnet-dev/2003-May/000268.html
diff -ru gnet-2.0.7-main/src/gnet-private.h gnet-2.0.7/src/gnet-private.h
--- gnet-2.0.7-main/src/gnet-private.h	2004-09-26 22:04:49.000000000 -0400
+++ gnet-2.0.7/src/gnet-private.h	2005-04-13 18:10:02.290481344 -0400
@@ -136,7 +136,7 @@
 #define GNET_SOCKADDR_IN(s)    	(*((struct sockaddr_in*) &s))
 #define GNET_SOCKADDR_SA(s)	(*((struct sockaddr*) &s))
 #define GNET_SOCKADDR_SA4(s)	(*((struct sockaddr_in*) &s))
-#define GNET_SOCKADDR_FAMILY(s) ((s).ss_family)
+#define GNET_SOCKADDR_FAMILY(s) ((s).__ss_family)
 
 #ifdef HAVE_IPV6
 
@@ -149,27 +149,27 @@
 #endif
 
 #define GNET_SOCKADDR_SA6(s)	(*((struct sockaddr_in6*) &s))
-#define GNET_SOCKADDR_ADDRP(s)	(((s).ss_family == AF_INET)?\
+#define GNET_SOCKADDR_ADDRP(s)	(((s).__ss_family == AF_INET)?\
                                   (void*)&((struct sockaddr_in*)&s)->sin_addr:\
                                   (void*)&((struct sockaddr_in6*)&s)->sin6_addr)
-#define GNET_SOCKADDR_ADDR32(s,n)(((s).ss_family == AF_INET)?\
+#define GNET_SOCKADDR_ADDR32(s,n)(((s).__ss_family == AF_INET)?\
                                   ((struct sockaddr_in*)&s)->sin_addr.s_addr:\
                                   *(guint32*)&((struct sockaddr_in6*)&s)->sin6_addr.s6_addr[(n)*4])
-#define GNET_SOCKADDR_ADDR32_SET(s,n,a) if ((s).ss_family == AF_INET) \
+#define GNET_SOCKADDR_ADDR32_SET(s,n,a) if ((s).__ss_family == AF_INET) \
                                           ((struct sockaddr_in*)&s)->sin_addr.s_addr = a; \
                                         else \
                                           *(guint32*)&((struct sockaddr_in6*)&s)->sin6_addr.s6_addr[(n)*4] = a;
-#define GNET_SOCKADDR_ADDRLEN(s) (((s).ss_family == AF_INET)?\
+#define GNET_SOCKADDR_ADDRLEN(s) (((s).__ss_family == AF_INET)?\
 				 sizeof(struct in_addr):\
 				 sizeof(struct in6_addr))
-#define GNET_SOCKADDR_PORT(s)	(((s).ss_family == AF_INET)?\
+#define GNET_SOCKADDR_PORT(s)	(((s).__ss_family == AF_INET)?\
                                   ((struct sockaddr_in*)&s)->sin_port:\
                                   ((struct sockaddr_in6*)&s)->sin6_port)
-#define GNET_SOCKADDR_PORT_SET(s, p)	if ((s).ss_family == AF_INET)\
+#define GNET_SOCKADDR_PORT_SET(s, p)	if ((s).__ss_family == AF_INET)\
                                           ((struct sockaddr_in*)&(s))->sin_port = p;\
                                         else \
                                           ((struct sockaddr_in6*)&(s))->sin6_port = p;
-#define GNET_SOCKADDR_LEN(s)	(((s).ss_family == AF_INET)?\
+#define GNET_SOCKADDR_LEN(s)	(((s).__ss_family == AF_INET)?\
                                   sizeof(struct sockaddr_in):\
                                   sizeof(struct sockaddr_in6))
 #else /* NO IPV6 */
diff -ru gnet-2.0.7-main/src/inetaddr.c gnet-2.0.7/src/inetaddr.c
--- gnet-2.0.7-main/src/inetaddr.c	2005-02-19 12:15:51.000000000 -0500
+++ gnet-2.0.7/src/inetaddr.c	2005-04-13 18:09:40.112852856 -0400
@@ -106,7 +106,7 @@
 
       ia = g_new0(GInetAddr, 1);
       ia->ref_count = 1;
-      ia->sa.ss_family = he->h_addrtype;
+      ia->sa.__ss_family = he->h_addrtype;
       GNET_INETADDR_SET_SS_LEN(ia);
       memcpy (GNET_SOCKADDR_ADDRP(ia->sa), he->h_addr_list[i], he->h_length);
       list = g_list_prepend(list, ia);
@@ -1327,7 +1327,7 @@
 	      /* Save the address */
 	      ia = g_new0(GInetAddr, 1);
 	      ia->ref_count = 1;
-	      ia->sa.ss_family = (size == 4)? AF_INET : AF_INET6;
+	      ia->sa.__ss_family = (size == 4)? AF_INET : AF_INET6;
 	      GNET_INETADDR_SET_SS_LEN(ia);
 	      memcpy(GNET_INETADDR_ADDRP(ia), buf, size);
 	      GNET_INETADDR_PORT(ia) = g_htons(state->port);
diff -ru gnet-2.0.7-main/src/udp.c gnet-2.0.7/src/udp.c
--- gnet-2.0.7-main/src/udp.c	2005-02-19 12:15:51.000000000 -0500
+++ gnet-2.0.7/src/udp.c	2005-04-13 18:09:26.373941488 -0400
@@ -265,7 +265,7 @@
       if (GNET_INETADDR_FAMILY(dst) == AF_INET && 
 	  GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET6)
 	{
-          sa.ss_family = AF_INET6;
+          sa.__ss_family = AF_INET6;
 	  GNET_SOCKADDR_SET_SS_LEN(sa);
           GNET_SOCKADDR_PORT_SET(sa, GNET_INETADDR_PORT(dst));
           GNET_SOCKADDR_ADDR32_SET(sa, 0, 0);
@@ -279,7 +279,7 @@
                GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET &&
                IN6_IS_ADDR_V4MAPPED(&GNET_INETADDR_SA6(dst).sin6_addr))
 	{
-          sa.ss_family = AF_INET;
+          sa.__ss_family = AF_INET;
 	  GNET_SOCKADDR_SET_SS_LEN(sa);
           GNET_SOCKADDR_PORT_SET(sa, GNET_INETADDR_PORT(dst));
           GNET_SOCKADDR_ADDR32_SET(sa, 0, GNET_INETADDR_ADDR32(dst, 3));

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]