curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: curl 7.66.0 to 7.76.0 yield make error: `sa_family_t' undeclared

From: Kevin R. Bulgrien via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 19 Apr 2021 13:59:29 -0500 (CDT)

> > After some digging, it seems /usr/include/sys/socket.h is relevant:
> >
> > /*
> > * Address families.
> > */
> > #define AF_UNSPEC 0 /* unspecified */
> > #define AF_UNIX 1 /* local to host (pipes, portals)
> > */
> > #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
> > #define AF_IMPLINK 3 /* arpanet imp addresses */
> > #define AF_PUP 4 /* pup protocols: e.g. BSP */
> > #define AF_CHAOS 5 /* mit CHAOS protocols */
> > #define AF_NS 6 /* XEROX NS protocols */
> > #define AF_ISO 7 /* ISO protocols */
> > #define AF_OSI AF_ISO
> > #define AF_ECMA 8 /* european computer manufacturers
> > */
> > #define AF_DATAKIT 9 /* datakit protocols */
> > #define AF_CCITT 10 /* CCITT protocols, X.25 etc */
> > #define AF_SNA 11 /* IBM SNA */
> > #define AF_DECnet 12 /* DECnet */
> > #define AF_DLI 13 /* Direct data link interface */
> > #define AF_LAT 14 /* LAT */
> > #define AF_HYLINK 15 /* NSC Hyperchannel */
> > #define AF_APPLETALK 16 /* Apple Talk */
> > #define AF_ROUTE 17 /* Internal Routing Protocol */
> > #define AF_LINK 18 /* Link layer interface */
> > #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no
> > AF)
> > */
> >
> > #define AF_MAX 20
> >
> > /*
> > * Structure used by kernel to store most addresses.
> > */
> > struct sockaddr {
> > u_short sa_family; /* address family */
> > char sa_data[14]; /* up to 14 bytes of direct
> > address */
> > };
> >
> > Any suggestions on a curl convention to follow with respect to
> > handling this variance to what other systems define?
>
> After more digging, I see CURL_SA_FAMILY_T...
  
This comes down to the fact that this is a bug in curl 7.66.0
through 7.76.0. "sa_family_t" should not occur in lib/connect.c,
but rather, CURL_SA_FAMILY_T should appear there:

Build succeeds with this patch applied:

$ cat curl-7.76.0-i686-pc-sco3.2v5.0.7-2.patch
--- curl-7.76.0/lib/connect.c.orig 2021-03-30 16:58:56.000000000 -0500
+++ curl-7.76.0/lib/connect.c 2021-04-19 13:48:21.000000000 -0500
_at__at_ -660,7 +660,7 _at__at_
 #endif
 #if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
     case AF_UNIX:
- if(salen > (curl_socklen_t)sizeof(sa_family_t)) {
+ if(salen > (curl_socklen_t)sizeof(CURL_SA_FAMILY_T)) {
         su = (struct sockaddr_un*)sa;
         msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
       }

$ src/curl --version
curl 7.76.0 (i686-pc-sco3.2v5.0.7) libcurl/7.76.0 OpenSSL/1.0.2u zlib/1.2.11 libssh2/1.8.0
Release-Date: 2021-03-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: alt-svc HTTPS-proxy libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

Kevin R. Bulgrien
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-04-19