RFR: 8296615: use of undeclared identifier 'IPV6_DONTFRAG'

Xue-Lei Andrew Fan xuelei at openjdk.org
Wed Nov 9 16:10:15 UTC 2022


On Wed, 9 Nov 2022 11:15:06 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

> Seems strange that the definition has been removed in a newer Xcode version. Have you checked if it has been moved to a different header file?

It is still in the in6.h.  But it is not included because of the macro definitions.

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
    ...
#ifdef __APPLE_USE_RFC_3542
    ...
#define	IPV6_DONTFRAG		62 /* bool; disable IPv6 fragmentation */
    ...
#endif /* __APPLE_USE_RFC_3542 */
    ...
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */


If I updated the MacOSXSocketOptions.c code to:

#define __APPLE_USE_RFC_3542
#include <netinet/in.h>

#ifndef IP_DONTFRAG
#define IP_DONTFRAG             28
#endif

#if defined(_POSIX_C_SOURCE)
#undef IP_DONTFRAG
#endif

#if !defined(_DARWIN_C_SOURCE)
#undef IP_DONTFRAG
#endif

/*
#ifndef IPV6_DONTFRAG
#define IPV6_DONTFRAG           62
#endif
*/


I can see neither IP_DONTFRAG nor IPV6_DONTFRAG is defined.   I think the _POSIX_C_SOURCE is defined, and _DARWIN_C_SOURCE not in the building environment.  And the definitions of _POSIX_C_SOURCE and _DARWIN_C_SOURCE get the IPV6_DONTFRAG definition in in6.h out.

Alternatively, we may be able to define _DARWIN_C_SOURCE as we did for __APPLE_USE_RFC_3542.  But the impact may be more wider.

  #define __APPLE_USE_RFC_3542
+ #define _DARWIN_C_SOURCE
  #include <netinet/in.h>

-------------

PR: https://git.openjdk.org/jdk/pull/11047


More information about the net-dev mailing list