Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/native/libs/System.Native/pal_interfaceaddresses.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
#include "ios/net/if_media.h"
#endif

// SunOS defines both AF_LINK and AF_PACKET but AF_LINK is preferred.
// Using AF_PACKET on SunOS requires access to system-private headers.
// Use undef to keep all the changes here.
#if defined(TARGET_SUNOS)
#undef AF_PACKET
#endif

#if defined(AF_PACKET)
#include <sys/ioctl.h>
#if HAVE_NETPACKET_PACKET_H
Expand Down
7 changes: 7 additions & 0 deletions src/native/libs/System.Native/pal_maphardwaretype.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#include <sys/socket.h>
#include <sys/types.h>

// SunOS defines both AF_LINK and AF_PACKET but AF_LINK is preferred.
// Using AF_PACKET on SunOS requires access to system-private headers.
// Use undef to keep all the changes here.
#if defined(TARGET_SUNOS)
#undef AF_PACKET
#endif

#if defined(AF_PACKET)
#if HAVE_NETPACKET_PACKET_H
#include <netpacket/packet.h>
Expand Down
20 changes: 20 additions & 0 deletions src/native/libs/System.Native/pal_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ static bool TryConvertAddressFamilyPlatformToPal(sa_family_t platformAddressFami
*palAddressFamily = AddressFamily_AF_PACKET;
return true;
#endif
#ifdef AF_LINK
case AF_LINK:
*palAddressFamily = AddressFamily_AF_LINK;
return true;
#endif
#ifdef AF_CAN
case AF_CAN:
*palAddressFamily = AddressFamily_AF_CAN;
Expand Down Expand Up @@ -241,6 +246,11 @@ static bool TryConvertAddressFamilyPalToPlatform(int32_t palAddressFamily, sa_fa
*platformAddressFamily = AF_PACKET;
return true;
#endif
#ifdef AF_LINK
case AddressFamily_AF_LINK:
*platformAddressFamily = AF_LINK;
return true;
#endif
#ifdef AF_CAN
case AddressFamily_AF_CAN:
*platformAddressFamily = AF_CAN;
Expand Down Expand Up @@ -2546,6 +2556,11 @@ static bool TryConvertProtocolTypePalToPlatform(int32_t palAddressFamily, int32_
*platformProtocolType = palProtocolType;
return true;
#endif
#ifdef AF_LINK
case AddressFamily_AF_LINK:
*platformProtocolType = palProtocolType;
return true;
#endif
#if HAVE_LINUX_CAN_H
case AddressFamily_AF_CAN:
switch (palProtocolType)
Expand Down Expand Up @@ -2685,6 +2700,11 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl
*palProtocolType = platformProtocolType;
return true;
#endif
#ifdef AF_LINK
case AddressFamily_AF_LINK:
*palProtocolType = platformProtocolType;
return true;
#endif
#if HAVE_LINUX_CAN_H
case AddressFamily_AF_CAN:
switch (platformProtocolType)
Expand Down
1 change: 1 addition & 0 deletions src/native/libs/System.Native/pal_networking.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedef enum
AddressFamily_AF_UNIX = 1, // System.Net.AddressFamily.Unix
AddressFamily_AF_INET = 2, // System.Net.AddressFamily.InterNetwork
AddressFamily_AF_INET6 = 23, // System.Net.AddressFamily.InterNetworkV6
AddressFamily_AF_LINK = 13, // System.Net.AddressFamily.DataLink
AddressFamily_AF_PACKET = 65536, // System.Net.AddressFamily.Packet
AddressFamily_AF_CAN = 65537, // System.Net.AddressFamily.ControllerAreaNetwork
} AddressFamily;
Expand Down
Loading