]> The Tcpdump Group git mirrors - libpcap/commitdiff
Call the flag to enable remote capture ENABLE_REMOTE.
authorGuy Harris <[email protected]>
Wed, 4 Oct 2017 01:22:29 +0000 (18:22 -0700)
committerGuy Harris <[email protected]>
Wed, 4 Oct 2017 01:22:29 +0000 (18:22 -0700)
HAVE_REMOTE implies that there's some feature in our build environment
that we have, but this is a flag that controls what the user specified
at configuration time.

13 files changed:
CMakeLists.txt
Win32/Prj/wpcap.vcxproj
cmakeconfig.h.in
config.h.in
configure
configure.ac
gencode.c
pcap-int.h
pcap-npf.c
pcap-rpcap.c
pcap-tc.c
pcap.c
tests/findalldevstest.c

index 80f1736bf1e5e5590d02f3c499588e453c90ca3b..9b7db9c7794f49f73bb9e2817e2d7cc93b36289e 100644 (file)
@@ -49,9 +49,9 @@ set(PCAP_TYPE "" CACHE STRING "Packet capture type")
 # not having it on UN*X.
 #
 if(WIN32)
-    option(HAVE_REMOTE "Enable remote capture" ON)
+    option(ENABLE_REMOTE "Enable remote capture" ON)
 else()
-    option(HAVE_REMOTE "Enable remote capture" OFF)
+    option(ENABLE_REMOTE "Enable remote capture" OFF)
 endif(WIN32)
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
@@ -477,10 +477,10 @@ else()
     endif(NOT HAVE_STRTOK_R)
 endif(WIN32)
 
-if(HAVE_REMOTE)
+if(ENABLE_REMOTE)
     set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C}
         pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c)
-endif(HAVE_REMOTE)
+endif(ENABLE_REMOTE)
 
 #
 # Determine the main pcap-XXX.c file to use, and the libraries with
index 061ff591aa53e11fc43df7b708d5715750e4013b..2bd30a5f8ff5abdc290a848d434ef146da6ca32d 100644 (file)
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <WarningLevel>Level3</WarningLevel>
       <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;HAVE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ResourceCompile>
       <Culture>0x0409</Culture>
@@ -125,7 +125,7 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <WarningLevel>Level3</WarningLevel>
       <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;HAVE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ResourceCompile>
       <Culture>0x0409</Culture>
@@ -151,7 +151,7 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <MinimalRebuild>true</MinimalRebuild>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
       <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;HAVE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </ClCompile>
     <ResourceCompile>
@@ -177,7 +177,7 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;HAVE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;BUILDING_PCAP;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </ClCompile>
     <ResourceCompile>
@@ -230,4 +230,4 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
index bbae90d148881ec8ba101f1c1ac6c77e22aee9bb..830c6aec2208675e78db76a480002692ba827d5d 100644 (file)
 #cmakedefine HAVE_PF_NAT_THROUGH_PF_NORDR 1
 
 /* Define to 1 if remote packet capture is to be supported */
-#cmakedefine HAVE_REMOTE 1
+#cmakedefine ENABLE_REMOTE 1
 
 /* define if you have the Septel API */
 #cmakedefine HAVE_SEPTEL_API 1
index 2101737b11f3b4addfc3de72fa95367c0eb1139d..827e55b744dcf55107f32b0c0944843aa1f0f53c 100644 (file)
@@ -6,6 +6,9 @@
 /* Enable optimizer debugging */
 #undef BDEBUG
 
+/* Define to 1 if remote packet capture is to be supported */
+#undef ENABLE_REMOTE
+
 /* define if you have the DAG API */
 #undef HAVE_DAG_API
 
 /* define if net/pfvar.h defines PF_NAT through PF_NORDR */
 #undef HAVE_PF_NAT_THROUGH_PF_NORDR
 
-/* Define to 1 if remote packet capture is to be supported */
-#undef HAVE_REMOTE
-
 /* define if you have the Septel API */
 #undef HAVE_SEPTEL_API
 
index 7de59d301918acef5c2d25981e464cfad0b1935f..f256ddd40f2c4d0babf5bc6f2cc3aeb0a1a404dc 100755 (executable)
--- a/configure
+++ b/configure
@@ -7237,7 +7237,7 @@ $as_echo "$as_me: WARNING: Remote packet capture may expose libpcap-based applic
        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: to attacks by malicious remote capture servers!" >&5
 $as_echo "$as_me: WARNING: to attacks by malicious remote capture servers!" >&2;}
 
-$as_echo "#define HAVE_REMOTE /**/" >>confdefs.h
+$as_echo "#define ENABLE_REMOTE /**/" >>confdefs.h
 
        SSRC="$SSRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c"
        RPCAPD=rpcapd
index 0c2b87e8933f95fa3a4fe0fe050979bb90299c0f..3e7b67fc76cf4d99a7a3d591d5b1eee3cdaf0ad7 100644 (file)
@@ -1224,7 +1224,7 @@ case "$enableval" in
 yes)   AC_MSG_RESULT(yes)
        AC_WARN([Remote packet capture may expose libpcap-based applications])
        AC_WARN([to attacks by malicious remote capture servers!])
-       AC_DEFINE(HAVE_REMOTE,,
+       AC_DEFINE(ENABLE_REMOTE,,
            [Define to 1 if remote packet capture is to be supported])
        SSRC="$SSRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c"
        RPCAPD=rpcapd
index a3dc35a260d5eed6055828900d85086e890b2400..8aa69cf4ec26f9d6c052768b1894519974875f99 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -683,7 +683,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
        done = 1;
 #endif
 
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
        /*
         * If the device on which we're capturing need to be notified
         * that a new filter is being compiled, do so.
index 6406aa65c70af5a25f21cc69e7c4ca352615fe83..9e8283e99005151af9ce01782b6ee0db26a3f472 100644 (file)
@@ -165,7 +165,7 @@ struct pcap {
 
        void *priv;             /* private data for methods */
 
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
        struct pcap_samp rmt_samp;      /* parameters related to the sampling process. */
 #endif
 
index 520d61f5470d5fd5ab6800d605590cbb0bfb722e..8ade6f1b61ce1e3741c031bd5165a042698d2741 100644 (file)
@@ -78,7 +78,7 @@ struct pcap_win {
        int     dag_fcs_bits;           /* Number of checksum bits from link layer */
 #endif
 
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
        int samp_npkt;                  /* parameter needed for sampling, with '1 out of N' method has been requested */
        struct timeval samp_time;       /* parameter needed for sampling, with '1 every N ms' method has been requested */
 #endif
@@ -210,7 +210,7 @@ pcap_stats_ex_win32(pcap_t *p, int *pcap_stat_size)
        p->stat.ps_recv = bstats.bs_recv;
        p->stat.ps_drop = bstats.bs_drop;
        p->stat.ps_ifdrop = bstats.ps_ifdrop;
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
        p->stat.ps_capt = bstats.bs_capt;
 #endif
        return (&p->stat);
@@ -565,7 +565,7 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                if (pw->filtering_in_kernel ||
                    p->fcode.bf_insns == NULL ||
                    bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, caplen)) {
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
                        switch (p->rmt_samp.method) {
 
                        case PCAP_SAMP_1_EVERY_N:
@@ -604,7 +604,7 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                                }
                            }
                        }
-#endif /* HAVE_REMOTE */
+#endif /* ENABLE_REMOTE */
 
                        /*
                         * XXX A bpf_hdr matches a pcap_pkthdr.
index 5aa699c7c86edb26cf9ce7d06dff326db956e5e3..3f5076c7eb9340acbf6054e3950d348886e54b59 100644 (file)
@@ -734,14 +734,14 @@ static struct pcap_stat *rpcap_stats_rpcap(pcap_t *p, struct pcap_stat *ps, int
                ps->ps_drop = 0;
                ps->ps_ifdrop = 0;
                ps->ps_recv = 0;
-#if defined(_WIN32) && defined(HAVE_REMOTE)
+#if defined(_WIN32) && defined(ENABLE_REMOTE)
                if (mode == PCAP_STATS_EX)
                {
                        ps->ps_capt = 0;
                        ps->ps_sent = 0;
                        ps->ps_netdrop = 0;
                }
-#endif /* _WIN32 && HAVE_REMOTE */
+#endif /* _WIN32 && ENABLE_REMOTE */
 
                return ps;
        }
@@ -791,14 +791,14 @@ static struct pcap_stat *rpcap_stats_rpcap(pcap_t *p, struct pcap_stat *ps, int
        ps->ps_drop = ntohl(netstats.krnldrop);
        ps->ps_ifdrop = ntohl(netstats.ifdrop);
        ps->ps_recv = ntohl(netstats.ifrecv);
-#if defined(_WIN32) && defined(HAVE_REMOTE)
+#if defined(_WIN32) && defined(ENABLE_REMOTE)
        if (mode == PCAP_STATS_EX)
        {
                ps->ps_capt = pr->TotCapt;
                ps->ps_netdrop = pr->TotNetDrops;
                ps->ps_sent = ntohl(netstats.svrcapt);
        }
-#endif /* _WIN32 && HAVE_REMOTE */
+#endif /* _WIN32 && ENABLE_REMOTE */
 
        /* Checks if all the data has been read; if not, discard the data in excess */
        if (totread != ntohl(header.plen))
index db91e579fed5f3378dd927534d3fb82dbbde352c..67584efaa882bc37f71cc344d31a20cb886470d3 100644 (file)
--- a/pcap-tc.c
+++ b/pcap-tc.c
@@ -1106,7 +1106,7 @@ TcStats(pcap_t *p, struct pcap_stat *ps)
                s.ps_drop = 0xFFFFFFFF;
        }
 
-#if defined(_WIN32) && defined(HAVE_REMOTE)
+#if defined(_WIN32) && defined(ENABLE_REMOTE)
        s.ps_capt = pt->TcAcceptedCount;
 #endif
        *ps = s;
@@ -1191,7 +1191,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size)
                p->stat.ps_drop = 0xFFFFFFFF;
        }
 
-#if defined(_WIN32) && defined(HAVE_REMOTE)
+#if defined(_WIN32) && defined(ENABLE_REMOTE)
        p->stat.ps_capt = pt->TcAcceptedCount;
 #endif
 
diff --git a/pcap.c b/pcap.c
index bddb36fddc66513edc9b70c5b09bba6f141d691a..fb65c9db3ca7701dedbdae80a25bee47e81224bf 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -1334,7 +1334,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
 }
 #endif /* !defined(_WIN32) && !defined(MSDOS) */
 
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
 #include "pcap-rpcap.h"
 
 /*
@@ -2355,7 +2355,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *er
 {
        pcap_t *p;
        int status;
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
        char host[PCAP_BUF_SIZE + 1];
        char port[PCAP_BUF_SIZE + 1];
        char name[PCAP_BUF_SIZE + 1];
@@ -2401,7 +2401,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *er
                                device += strlen(PCAP_SRC_IF_STRING);
                }
        }
-#endif /* HAVE_REMOTE */
+#endif /* ENABLE_REMOTE */
 
        p = pcap_create(device, errbuf);
        if (p == NULL)
index e7f3caabc1ebdd7bb7782c6f242f7b9fe7938d16..2e79fcc6ec4c39d5ef4fd7ca7cf0d8e4afbf9ed9 100644 (file)
@@ -103,14 +103,14 @@ int main(int argc, char **argv)
   bpf_u_int32 net, mask;
   int exit_status = 0;
   char errbuf[PCAP_ERRBUF_SIZE+1];
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
   struct pcap_rmtauth auth;
   char username[128+1];
   char *p;
   char *password;
 #endif
 
-#ifdef HAVE_REMOTE
+#ifdef ENABLE_REMOTE
   if (argc >= 2)
   {
     if (pcap_findalldevs_ex(argv[1], NULL, &alldevs, errbuf) == -1)