diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-10-01 20:21:46 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-10-01 20:21:46 -0700 |
commit | 5538939dedbbf55a0490b451fe6ab47d858be9d0 (patch) | |
tree | 1695dceea392c216094fc1276b28e7288455e6e7 /pcap-rpcap.c | |
parent | 746f5b78efffb05953809ee8d3b973bd4d486282 (diff) |
Explicitly reject non-blocking mode on D-Bus and rpcap.
We currently don't support non-blocking mode on either of those, so have
routines that return errors for pcap_getnonblock() and
pcap_setnonblock(); you can't set those function pointers to null to say
"we don't support it".
Diffstat (limited to 'pcap-rpcap.c')
-rw-r--r-- | pcap-rpcap.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/pcap-rpcap.c b/pcap-rpcap.c index 16ffd047..5aa699c7 100644 --- a/pcap-rpcap.c +++ b/pcap-rpcap.c @@ -1846,6 +1846,23 @@ static int rpcap_sendauth(SOCKET sock, struct pcap_rmtauth *auth, char *errbuf) return 0; } +/* We don't currently support non-blocking mode. */ +static int +pcap_getnonblock_rpcap(pcap_t *p) +{ + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "Non-blocking mode isn't supported for capturing remotely with rpcap"); + return (-1); +} + +static int +pcap_setnonblock_rpcap(pcap_t *p, int nonblock _U_) +{ + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "Non-blocking mode isn't supported for capturing remotely with rpcap"); + return (-1); +} + /* * This function opens a remote adapter by opening an RPCAP connection and * so on. @@ -2085,8 +2102,8 @@ pcap_t *pcap_open_rpcap(const char *source, int snaplen, int flags, int read_tim fp->read_op = pcap_read_rpcap; fp->save_current_filter_op = pcap_save_current_filter_rpcap; fp->setfilter_op = pcap_setfilter_rpcap; - fp->getnonblock_op = NULL; /* This is not implemented in remote capture */ - fp->setnonblock_op = NULL; /* This is not implemented in remote capture */ + fp->getnonblock_op = pcap_getnonblock_rpcap; + fp->setnonblock_op = pcap_setnonblock_rpcap; fp->stats_op = pcap_stats_rpcap; #ifdef _WIN32 fp->stats_ex_op = pcap_stats_ex_rpcap; |