Skip to content

Commit e130a4f

Browse files
committed
Check for Solaris "any" pseudo-interface on Solaris only.
Other BPF systems either have their own variety of the pseudo-interface or do not have it in the first place.
1 parent 0210ee6 commit e130a4f

File tree

2 files changed

+41
-37
lines changed

2 files changed

+41
-37
lines changed

CMakeLists.txt

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,27 +2188,29 @@ else(WIN32)
21882188
endif()
21892189
cmake_pop_check_state()
21902190

2191-
#
2192-
# Check whether there's a inet/ipnet.h header and,
2193-
# if so, whether it defines IPNET_ANY_LINK - if so,
2194-
# we assume we have the "any" device (that's a
2195-
# Solaris header, and later versions of Solaris
2196-
# have an "any" device).
2197-
#
2198-
# Attempting to include it at compile time could
2199-
# be a pain, as it's a kernel header.
2200-
#
2201-
message(STATUS "Checking whether the Solaris \"any\" device is supported")
2202-
if(EXISTS /usr/include/inet/ipnet.h)
2203-
file(STRINGS /usr/include/inet/ipnet.h IPNET_ANY_LINK_LINES REGEX IPNET_ANY_LINK)
2204-
if(NOT IPNET_ANY_LINK_LINES STREQUAL "")
2205-
set(HAVE_SOLARIS_ANY_DEVICE TRUE)
2191+
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
2192+
#
2193+
# Check whether there's a inet/ipnet.h header and,
2194+
# if so, whether it defines IPNET_ANY_LINK - if so,
2195+
# we assume we have the "any" device (that's a
2196+
# Solaris header, and later versions of Solaris
2197+
# have an "any" device).
2198+
#
2199+
# Attempting to include it at compile time could
2200+
# be a pain, as it's a kernel header.
2201+
#
2202+
message(STATUS "Checking whether the Solaris \"any\" device is supported")
2203+
if(EXISTS /usr/include/inet/ipnet.h)
2204+
file(STRINGS /usr/include/inet/ipnet.h IPNET_ANY_LINK_LINES REGEX IPNET_ANY_LINK)
2205+
if(NOT IPNET_ANY_LINK_LINES STREQUAL "")
2206+
set(HAVE_SOLARIS_ANY_DEVICE TRUE)
2207+
endif()
2208+
endif()
2209+
if(HAVE_SOLARIS_ANY_DEVICE)
2210+
message(STATUS "Checking whether the Solaris \"any\" device is supported - supported")
2211+
else()
2212+
message(STATUS "Checking whether the Solaris \"any\" device is supported - not supported")
22062213
endif()
2207-
endif()
2208-
if(HAVE_SOLARIS_ANY_DEVICE)
2209-
message(STATUS "Checking whether the Solaris \"any\" device is supported - supported")
2210-
else()
2211-
message(STATUS "Checking whether the Solaris \"any\" device is supported - not supported")
22122214
endif()
22132215
elseif(PCAP_TYPE STREQUAL "haiku")
22142216
set(PCAP_SRC pcap-${PCAP_TYPE}.c)

configure.ac

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,23 +1128,25 @@ bpf)
11281128
#include <net/bpf.h>
11291129
])
11301130

1131-
#
1132-
# Check whether there's a net/ipnet.h header and,
1133-
# if so, whether it defines IPNET_ANY_LINK - if so,
1134-
# we assume we have the "any" device (that's a
1135-
# Solaris header, and later versions of Solaris
1136-
# have an "any" device).
1137-
#
1138-
# Attempting to include it at compile time could
1139-
# be a pain, as it's a kernel header.
1140-
#
1141-
AC_MSG_CHECKING(whether the Solaris "any" device is supported)
1142-
if test -e /usr/include/inet/ipnet.h &&
1143-
grep -q IPNET_ANY_LINK /usr/include/inet/ipnet.h; then
1144-
AC_MSG_RESULT(yes)
1145-
AC_DEFINE(HAVE_SOLARIS_ANY_DEVICE, 1, [target host supports Solaris "any" device])
1146-
else
1147-
AC_MSG_RESULT(no)
1131+
if expr "$host_os" : solaris >/dev/null; then
1132+
#
1133+
# Check whether there's a net/ipnet.h header and,
1134+
# if so, whether it defines IPNET_ANY_LINK - if so,
1135+
# we assume we have the "any" device (that's a
1136+
# Solaris header, and later versions of Solaris
1137+
# have an "any" device).
1138+
#
1139+
# Attempting to include it at compile time could
1140+
# be a pain, as it's a kernel header.
1141+
#
1142+
AC_MSG_CHECKING(whether the Solaris "any" device is supported)
1143+
if test -e /usr/include/inet/ipnet.h &&
1144+
grep -q IPNET_ANY_LINK /usr/include/inet/ipnet.h; then
1145+
AC_MSG_RESULT(yes)
1146+
AC_DEFINE(HAVE_SOLARIS_ANY_DEVICE, 1, [target host supports Solaris "any" device])
1147+
else
1148+
AC_MSG_RESULT(no)
1149+
fi
11481150
fi
11491151
;;
11501152

0 commit comments

Comments
 (0)