[Openvas-commits] r13334 - in trunk/openvas-libraries: . misc
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Tue Apr 24 15:04:58 CEST 2012
Author: mwiegand
Date: 2012-04-24 15:04:57 +0200 (Tue, 24 Apr 2012)
New Revision: 13334
Modified:
trunk/openvas-libraries/ChangeLog
trunk/openvas-libraries/misc/pcap.c
Log:
* misc/pcap.c (routethrough): Use the most specific route and not the
first matching route. Patch suggested by Christian Schmidt
<christian.schmidt at greenbone.net>.
Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog 2012-04-24 13:00:43 UTC (rev 13333)
+++ trunk/openvas-libraries/ChangeLog 2012-04-24 13:04:57 UTC (rev 13334)
@@ -1,3 +1,9 @@
+2012-04-24 Michael Wiegand <michael.wiegand at greenbone.net>
+
+ * misc/pcap.c (routethrough): Use the most specific route and not the
+ first matching route. Patch suggested by Christian Schmidt
+ <christian.schmidt at greenbone.net>.
+
2012-03-28 Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
* CMakeLists.txt, INSTALL: Raised dependency for glib from 2.12
Modified: trunk/openvas-libraries/misc/pcap.c
===================================================================
--- trunk/openvas-libraries/misc/pcap.c 2012-04-24 13:00:43 UTC (rev 13333)
+++ trunk/openvas-libraries/misc/pcap.c 2012-04-24 13:04:57 UTC (rev 13334)
@@ -1394,6 +1394,8 @@
char iface[64];
static int numroutes = 0;
FILE *routez;
+ long match = -1;
+ unsigned long bestmatch = 0;
struct in_addr src = socket_get_next_source_addr ();
@@ -1512,7 +1514,7 @@
{
for (i = 0; i < numroutes; i++)
{
- if ((dest->s_addr & myroutes[i].mask) == myroutes[i].dest)
+ if ((dest->s_addr & myroutes[i].mask) == myroutes[i].dest && myroutes[i].mask >= bestmatch)
{
if (source)
{
@@ -1521,9 +1523,12 @@
else
source->s_addr = myroutes[i].dev->addr.s_addr;
}
- return myroutes[i].dev->name;
+ match = i;
+ bestmatch = myroutes[i].mask;
}
}
+ if (match != -1)
+ return myroutes[match].dev->name;
}
else if (technique == connectsockettechnique)
{
More information about the Openvas-commits
mailing list