{
#ifdef HAVE_PACKET_FANOUT
int fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- if (fd != -1) {
- uint16_t mode = PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG;
- uint16_t id = 1;
- uint32_t option = (mode << 16) | (id & 0xffff);
- int r = setsockopt(fd, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option));
- close(fd);
+ if (fd < 0)
+ return 0;
- if (r < 0) {
- SCLogPerf("fanout not supported by kernel: %s", strerror(errno));
- return 0;
- }
- return 1;
+ uint16_t mode = PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG;
+ uint16_t id = 1;
+ uint32_t option = (mode << 16) | (id & 0xffff);
+ int r = setsockopt(fd, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option));
+ close(fd);
+
+ if (r < 0) {
+ SCLogPerf("fanout not supported by kernel: %s", strerror(errno));
+ return 0;
}
-#endif
+ return 1;
+#else
return 0;
+#endif
}
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)