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;
}