After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 617848 - Fail to compile with system ifaddrs after OpenSolaris b137
Fail to compile with system ifaddrs after OpenSolaris b137
Status: RESOLVED FIXED
Product: vino
Classification: Applications
Component: Server
unspecified
Other opensolaris
: Normal critical
: ---
Assigned To: Vino Maintainer(s)
Vino Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-05-06 03:57 UTC by Halton Huo
Modified: 2010-06-21 20:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make code is compatible with diffrent ifaddrs strcucture (4.62 KB, patch)
2010-05-06 07:58 UTC, Halton Huo
committed Details | Review

Description Halton Huo 2010-05-06 03:57:42 UTC
After http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6731945 is fixed into OpenSolaris b137, the vino code use the system ifaddrs API instead. But it fails to compile:

[...]
source='sockets.c' object='sockets.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/bash ../../depcomp \
        /bin/bash ../../libtool --tag=CC   --mode=compile /opt/SunStudioExpress/bin/cc -DHAVE_CONFIG_H -I. -I../..       -g -c -o sockets.lo sockets.c
 /opt/SunStudioExpress/bin/cc -DHAVE_CONFIG_H -I. -I../.. -g -c sockets.c  -KPIC -DPIC -o .libs/sockets.o
"sockets.c", line 624: improper member use: sa_family
"sockets.c", line 638: improper member use: sa_family
"sockets.c", line 642: improper member use: sa_family
cc: acomp failed for sockets.c
[...]
Comment 1 Halton Huo 2010-05-06 04:01:07 UTC
The reason is that the type of ifa_addr member of "struct ifaddrs" is "struct sockaddr_storage", not "struct sockaddr". The latter one is common in BSD like and Linux system. Please refer to http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/head/ifaddrs.h#38.

After talked with the Solaris engineer, he explained as below:

  The ifaddrs structure in BSD and Linux were introduced before the 
  introduction of sockaddr_storage by RFC2553. That is why I think they 
  were never changed to use sockaddr_storage. But the getifaddrs in 
  Solaris is new and we used sockaddr_storage as recommended by the RFC.

Before BSD and Linux convert to use RFC2553, it is durable for top applications themselves to workable with both cases with below likely patch.

#ifdef RFC2553
  ifa->ifa_addr->ss_family
#else
  ifa->ifa_addr->sa_family
#endif

Here RFC2553 is defined during configure time if "struct ifaddrs" use
"struct sockaddr_storage" rather than "struct sockaddr".
Comment 2 Halton Huo 2010-05-06 07:58:59 UTC
Created attachment 160402 [details] [review]
Make code is compatible with diffrent ifaddrs strcucture

As described in comment #1, I work out this patch.

Rather than using lots of "#ifdef..#else..#endif" in code, I use ADDR_FAMILY_MEMBER for different address family member name.

This patch is tested under OpenSolaris b128 and Ubuntu 10.04. Please review.
Comment 3 Jonh Wendell 2010-06-21 20:51:46 UTC
Thanks, Halton, patch pushed.