>-----Original Message-----
>From: [email protected] <[email protected]>
>Sent: Wednesday, July 24, 2024 10:50 AM
>To: [email protected]; 'libcurl development'
<[email protected]>
>Subject: RE: [Breakage] curl 8.9.0 tool_operate.c introduces use of
ss_family
>
>On Wednesday, July 24, 2024 10:47 AM, I wrote:
>>The introduction of the use of ss_family is not necessarily portable
>>and
>causes
>>breakages on NonStop (among others). What is the best way to suppress,
>>get
>past,
>>this? Undefining IP_TOS is not an option as this is defined by the
>operating system.
>>I have sun_family, but not ss_family.
>
>Actually, I have __ss_family and will go with that for now. I think that is
what is
>meant.

For discussion: my suggestion for this situation is as follows (roughly). I
am not sure how broadly this issue presents, so went flexible in the first
option.

#ifdef IP_TOS
static int get_address_family(curl_socket_t sockfd)
{
  struct sockaddr_storage addr;
  socklen_t addrlen = sizeof(addr);
  if(getsockname(sockfd, (struct sockaddr *)&addr, &addrlen) == 0)
# if defined SS_FAMILY_NORMAL
    return addr.ss_family;
# elif defined SS_FAMILY_PREFACED
    return addr.__ss_family;
# else
  return AF_UNSPEC;
# endif
  return AF_UNSPEC;
}
#endif

Alteratively, we can go with predefines (NonStop = __TANDEM). We could add
__GNUC__ as a separate case.

#ifdef IP_TOS
static int get_address_family(curl_socket_t sockfd)
{
  struct sockaddr_storage addr;
  socklen_t addrlen = sizeof(addr);
  if(getsockname(sockfd, (struct sockaddr *)&addr, &addrlen) == 0)
# ifdef __TANDEM
    return addr.__ss_family;
# else
    return addr.ss_family;
# endif
  return AF_UNSPEC;
}
#endif

I can make a formal PR if requested.
Regards,
Randall

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to