aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-02-25 17:10:42 -0800
committerGuy Harris <guy@alum.mit.edu>2017-02-25 17:10:42 -0800
commita6a4e428ddcfd7010d9ed04346190a6ef70a2aed (patch)
treedf72110b06a520c58e66da45e5fe999910eb10d4 /pcap-linux.c
parent1bd5003a2966cd520e661b881e95b6317d56d5a2 (diff)
Support setting non-blocking mode before activating.
We just set a flag and attempt to set non-blocking mode after activating. If a module can't support non-blocking mode, it should set the set non-blocking operator in the create routine, so a pre-activation call will fail the same way a post-activation call fails. While we're at it: Have the get non-blocking and set non-blocking modes not take an error buffer as an argument; they have the error buffer in the pcap_t to set. pcap_getnonblock() and pcap_setnonblock() just copy the error from there to the argument passed in. Make sure we set the cleanup op pointer when appropriate.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 4ba90a80..ee8d3ee4 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -404,8 +404,8 @@ static int pcap_read_linux_mmap_v2(pcap_t *, int, pcap_handler , u_char *);
static int pcap_read_linux_mmap_v3(pcap_t *, int, pcap_handler , u_char *);
#endif
static int pcap_setfilter_linux_mmap(pcap_t *, struct bpf_program *);
-static int pcap_setnonblock_mmap(pcap_t *p, int nonblock, char *errbuf);
-static int pcap_getnonblock_mmap(pcap_t *p, char *errbuf);
+static int pcap_setnonblock_mmap(pcap_t *p, int nonblock);
+static int pcap_getnonblock_mmap(pcap_t *p);
static void pcap_oneshot_mmap(u_char *user, const struct pcap_pkthdr *h,
const u_char *bytes);
#endif
@@ -4468,7 +4468,7 @@ pcap_cleanup_linux_mmap( pcap_t *handle )
static int
-pcap_getnonblock_mmap(pcap_t *p, char *errbuf)
+pcap_getnonblock_mmap(pcap_t *p)
{
struct pcap_linux *handlep = p->priv;
@@ -4477,7 +4477,7 @@ pcap_getnonblock_mmap(pcap_t *p, char *errbuf)
}
static int
-pcap_setnonblock_mmap(pcap_t *p, int nonblock, char *errbuf)
+pcap_setnonblock_mmap(pcap_t *p, int nonblock)
{
struct pcap_linux *handlep = p->priv;
@@ -4485,7 +4485,7 @@ pcap_setnonblock_mmap(pcap_t *p, int nonblock, char *errbuf)
* Set the file descriptor to non-blocking mode, as we use
* it for sending packets.
*/
- if (pcap_setnonblock_fd(p, nonblock, errbuf) == -1)
+ if (pcap_setnonblock_fd(p, nonblock) == -1)
return -1;
/*