]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-bt-linux.c
Do the check for a valid direction value in pcap_setdirection().
[libpcap] / pcap-bt-linux.c
index 47ff969f9b9f95c1c7d5c428ad82eb8c82a97e94..dbaa92ea46ffa3a39567a50fd2929b7be6018dd3 100644 (file)
@@ -430,17 +430,10 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 static int
 bt_setdirection_linux(pcap_t *p, pcap_direction_t d)
 {
-       switch (d) {
-
-       case PCAP_D_IN:
-       case PCAP_D_OUT:
-       case PCAP_D_INOUT:
-               p->direction = d;
-               break;
-
-       default:
-               snprintf(p->errbuf, sizeof(p->errbuf), "Invalid direction");
-               return (-1);
-       }
+       /*
+        * It's guaranteed, at this point, that d is a valid
+        * direction value.
+        */
+       p->direction = d;
        return 0;
 }