logo_kerberos.gif

Portability research

From K5Wiki
Jump to: navigation, search

This page collects some research we have done into the portability of various platform features. See Portability assumptions for the assumptions we make about target platforms based on this and other knowledge.

C99 Compiler Support

Full C99 support is common in modern Unix compilers, but is not present in Microsoft Visual C (see this blog post). Some C99 features are supported in MSVC; here is a partial list of supported and unsupported features based on experimenting with version 7.1 of the SDK:

  • The // comment syntax is supported.
  • Variadic macros are supported.
  • The "long long int" type is supported, as is the printf length modifier "ll".
  • stdint.h is supported.
  • Non-constant aggregate initializers of automatic variables are supported.
  • inline functions are supported, but the keyword is __inline.
  • MSVC defines __FUNCTION__ instead of C99's __func__.
  • va_copy is not supported, but va_list positions can be copied by assignment.
  • The printf length modifier for size_t is "I" instead of C99's "z".
  • inttypes.h is not supported. The length modifiers "I32" and "I64" can be used for 32-bit and 64-bit types.
  • Mixed declarations and code (declarations after statements) is not supported.
  • Named structure initializers are not supported.
  • Variable length arrays are not supported.
  • stdbool.h is not supported.

IPv4 and IPv6 pktinfo support

The basic BSD sockets API does not allow discovery of the interface address on which data was received, or control over the interface address used to send data. This makes it difficult to implement a UDP server which cooperates with NATs. Where available, we use an extension which allows this discovery and control. This extension was originally defined in RFC 2292 for the IPv6 socket API, and was revised in RFC 3542. Some platforms provide analagous support for IPv4.

The following table was collected in a platform survey to determine the prevalence of pktinfo support:

Platform RFC 2292 (IPV6_PKTINFO) RFC 3542 (IPV6_RECVPKTINFO) IPv4 pktinfo
Linux 2.6.32 yes yes yes
Solaris 10 yes yes no
Solaris 11 yes yes yes
FreeBSD 8.1-1 yes yes no
Hurd-0.3 yes no no
OSX (unknown version) yes no no
AIX 6.1 yes yes no
HP-UX B.11.11 yes yes no

2016-01-07 update: OS X 10.9 has IP_PKTINFO and IPV6_RECVPKTINFO. NetBSD added IP_PKTINFO in 2013. FreeBSD still does not implement IP_PKTINFO, but implements an alternative using IP_RECVDSTADDR and IP_SENDSRCADDR. OS X 10.6 appears to have IP_RECVDSTADDR but not IP_SENDSRCADDR; it is not clear if it is possible in 10.6 to specify the from address when sending UDP messages.

Leap second handling

Personal tools