aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index e0da92f3..83cf9777 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2610,19 +2610,11 @@ pcap_setfilter_linux(pcap_t *handle, struct bpf_program *filter)
static int
pcap_setdirection_linux(pcap_t *handle, pcap_direction_t d)
{
- switch (d) {
-
- case PCAP_D_IN:
- case PCAP_D_OUT:
- case PCAP_D_INOUT:
- handle->direction = d;
- break;
-
- default:
- snprintf(handle->errbuf, sizeof(handle->errbuf),
- "Invalid direction");
- return -1;
- }
+ /*
+ * It's guaranteed, at this point, that d is a valid
+ * direction value.
+ */
+ handle->direction = d;
return 0;
}