native: Check if in_pktinfo exists#3941
Conversation
|
@dotnet-bot test this please |
|
LGTM |
There was a problem hiding this comment.
Please CMIIW: I am under the impression that if the statement in #if block is not starting with #, it should be considered as a CXX code statement and 4-space indentation should be applied.
|
LGTM 2, thanks for the good write up as well! |
|
Minor nits re: indentation. LGTM otherwise. |
|
Thank you. I have rebased and resolved conflicts. The |
There was a problem hiding this comment.
How about this instead of the typedef?
struct in_pktinfo
{
in_addr ipi_addr;
};
There was a problem hiding this comment.
It's really confusing me below that in_pktinfo has to be used completely differently than when typedef'ed here.
There was a problem hiding this comment.
@nguerrera, I like your approach. Thank you. I have defined the suggested struct.
|
LGTM. Thanks. |
There was a problem hiding this comment.
Nit: an explanatory comment would be nice.
|
@jasonwilliams200OK, can you rebase this? |
If it does not exist, `typedef in_addr in_pktinfo`.
|
Done. |
native: Check if in_pktinfo exists
…ive-pt2 native: Check if in_pktinfo exists Commit migrated from dotnet/corefx@52eaf3e
If it does not exist,
typedef in_addr in_pktinfo.Same question as I asked under the outdated commit:
Note that even BSDs aren't same. I configured NetBSD 7.0 amd64 VM today and found that
in_pktinfois defined innetinet/in.hheader (but not on FreeBSD). On Ubuntu 14 (LTS),in_pkinfois forward declared innetinet/in.h, but the actual definition lives inlinux/in.hand so forth..Nevertheless, this feature detection approach is working out quite well (much better than OS detection).
Disclaimer / Credits:
I have taken some inspirations from OpenVPN for this work: https://github.com/OpenVPN/openvpn/search?utf8=✓&q=HAVE_IN_PKTINFO. They are using autoconfig; I translated ac constructs to corresponding cmake ones.