afp: nicer error message in case of fanout failure

Use clearer message in case fanout is not supported or cluster_id is
already in use.

Closes redmine ticket #1940.
pull/4280/head
Shivani Bhardwaj 7 years ago
parent ac55b21184
commit 8940a9d326

@ -613,7 +613,7 @@ finalize:
/* if the number of threads is not 1, we need to first check if fanout
* functions on this system. */
if (aconf->threads != 1) {
if (AFPIsFanoutSupported() == 0) {
if (AFPIsFanoutSupported(aconf->cluster_id) == 0) {
if (aconf->threads != 0) {
SCLogNotice("fanout not supported on this system, falling "
"back to 1 capture thread");

@ -1995,7 +1995,7 @@ mmap_err:
/** \brief test if we can use FANOUT. Older kernels like those in
* CentOS6 have HAVE_PACKET_FANOUT defined but fail to work
*/
int AFPIsFanoutSupported(void)
int AFPIsFanoutSupported(int cluster_id)
{
#ifdef HAVE_PACKET_FANOUT
int fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
@ -2009,7 +2009,8 @@ int AFPIsFanoutSupported(void)
close(fd);
if (r < 0) {
SCLogPerf("fanout not supported by kernel: %s", strerror(errno));
SCLogError(SC_ERR_INVALID_VALUE, "fanout not supported by kernel: "
"Kernel too old or cluster-id %d already in use.", cluster_id);
return 0;
}
return 1;

@ -186,6 +186,7 @@ TmEcode AFPPeersListCheck(void);
void AFPPeersListClean(void);
int AFPGetLinkType(const char *ifname);
int AFPIsFanoutSupported(void);
int AFPIsFanoutSupported(int cluster_id);
#endif /* __SOURCE_AFP_H__ */

Loading…
Cancel
Save