af-packet: minor cleanups

pull/2164/head
Victor Julien 10 years ago
parent 402bdf9b2b
commit 4111331ab0

@ -408,12 +408,14 @@ finalize:
if (rss_queues > 0) { if (rss_queues > 0) {
if (rss_queues < aconf->threads) { if (rss_queues < aconf->threads) {
aconf->threads = rss_queues; aconf->threads = rss_queues;
SCLogInfo("More cores than RSS queues, using %d threads for interface %s", SCLogInfo("More cores than RSS queues, using %d threads "
aconf->threads, iface); "for interface %s", aconf->threads, iface);
} }
} }
if (aconf->threads) if (aconf->threads) {
SCLogPerf("Using %d AF_PACKET threads for interface %s", aconf->threads, iface); SCLogPerf("Using %d AF_PACKET threads for interface %s",
aconf->threads, iface);
}
} }
if (aconf->threads <= 0) { if (aconf->threads <= 0) {
aconf->threads = 1; aconf->threads = 1;

@ -1879,7 +1879,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
if (setsockopt(ptv->socket, SOL_PACKET, PACKET_AUXDATA, &val, if (setsockopt(ptv->socket, SOL_PACKET, PACKET_AUXDATA, &val,
sizeof(val)) == -1 && errno != ENOPROTOOPT) { sizeof(val)) == -1 && errno != ENOPROTOOPT) {
SCLogWarning(SC_ERR_NO_AF_PACKET, SCLogWarning(SC_ERR_NO_AF_PACKET,
"'kernel' checksum mode not supported, failling back to full mode."); "'kernel' checksum mode not supported, falling back to full mode.");
ptv->checksum_mode = CHECKSUM_VALIDATION_ENABLE; ptv->checksum_mode = CHECKSUM_VALIDATION_ENABLE;
} }
} }
@ -1920,14 +1920,13 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
#ifdef HAVE_PACKET_FANOUT #ifdef HAVE_PACKET_FANOUT
/* add binded socket to fanout group */ /* add binded socket to fanout group */
if (ptv->threads > 1) { if (ptv->threads > 1) {
uint32_t option = 0;
uint16_t mode = ptv->cluster_type; uint16_t mode = ptv->cluster_type;
uint16_t id = ptv->cluster_id; uint16_t id = ptv->cluster_id;
option = (mode << 16) | (id & 0xffff); uint32_t option = (mode << 16) | (id & 0xffff);
r = setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option)); r = setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option));
if (r < 0) { if (r < 0) {
SCLogError(SC_ERR_AFP_CREATE, SCLogError(SC_ERR_AFP_CREATE,
"Coudn't set fanout mode, error %s", "Couldn't set fanout mode, error %s",
strerror(errno)); strerror(errno));
goto socket_err; goto socket_err;
} }
@ -1938,7 +1937,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
if (if_flags == -1) { if (if_flags == -1) {
if (verbose) { if (verbose) {
SCLogError(SC_ERR_AFP_READ, SCLogError(SC_ERR_AFP_READ,
"Can not acces to interface '%s'", "Couldn't get flags for interface '%s'",
ptv->iface); ptv->iface);
} }
ret = AFP_RECOVERABLE_ERROR; ret = AFP_RECOVERABLE_ERROR;

Loading…
Cancel
Save