<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi All,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have been having problems with segfaulting since using the 1.0.2 branch but I have not had time to find out if it was Bivio related or something in Suricata until now. I have indentified the problem, though Im not sure why no one using pcap to grab packets has reported this before. Here is a breakdown of the problem:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>When the pcap_dispatch function is called, the cnt field is evaluated by the conditional operator “(pcap_max_read_packets < packet_q_len) ? pcap_max_read_packets : packet_q_len”. In my case this results in 0, which when passed into pcap_dispatch means to grab all the packets in the queue or until an error occurs. When I start suricata and run traffic at high speeds, there is generally around 20,000 packets already in the queue. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The pcap handler function PcapCallback is called, it process all those 20,000 packets and stores them in the PcapThreadVars ptv->array. The problem is that the array is allocated with the defined variable PCAP_FILE_MAX_PKTS which has a value of 256. So ultimately I segfault when accessing ptv->array when the index is greater than 256. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The solution would be either to restrict cnt in pcap_dispatch to 256 or change PCAP_FILE_MAX_PKTS. I found it easier for me to just change PCAP_FILE_MAX_PKTS to 65536. When changed I do not experience any more segfaulting.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Cheers,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>// Joel <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Joel Ebrahimi<o:p></o:p></p><p class=MsoNormal>Senior Solutions Architect<o:p></o:p></p><p class=MsoNormal>Bivio Networks Inc.<o:p></o:p></p><p class=MsoNormal>http://www.bivio.net<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>