Commit 4310842b authored by Olav Kvittem's avatar Olav Kvittem

0.9.4 protect crude against small packets from non-rudes

parent 3eb53ef7
......@@ -1018,6 +1018,7 @@ static int rec_to_file(unsigned short port, unsigned long limit)
struct pcap_pkthdr *header;
const u_char *packet;
int result;
int nsmallpkts=0;
while(1)
{
......@@ -1036,6 +1037,8 @@ static int rec_to_file(unsigned short port, unsigned long limit)
if(rec_bytes <= 0)
{
RUDEBUG1("crude: error when receiving packet: %s\n",strerror(errno));
} else if (rec_bytes < sizeof(struct udp_data)){ // not a rude packet
nsmallpkts++;
}
else
{
......@@ -1247,6 +1250,7 @@ static int rec_n_print(unsigned short port, unsigned long limit)
int ttl = 64;
int hoplimit = 64;
int received_ttl;
int nsmallpkts=0;
struct sockaddr_storage src_addr;
struct msghdr msgh;
struct iovec iov;
......@@ -1288,8 +1292,9 @@ static int rec_n_print(unsigned short port, unsigned long limit)
if(rec_bytes <= 0)
{
RUDEBUG1("crude: error when receiving packet: %s\n",strerror(errno));
}
else
} else if (rec_bytes < sizeof(struct udp_data)){ // not a rude/crude packet
nsmallpkts++;
} else
{
struct cmsghdr *cmsg;
int *ttlptr;
......
......@@ -35,7 +35,7 @@
#define PMAXSIZE 32768 /* Maximum accepted UDP-data field/packet size */
#define MINDURAT 0.001 /* Minimum allowed flow duration in seconds (float) */
#define VERSION "0.9.3"
#define VERSION "0.9.4"
/*
* Enumeration definition for different (known) flow types
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment