1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-19 17:57:22 +01:00

see #2516 "Enhance Find to include searching for IP addresses in

ranges". Function "find" now finds ip addresses inside address ranges.
This commit is contained in:
Vadim Kurland 2011-07-21 12:42:51 -07:00
parent 0132087bb4
commit 2ce9852aeb
3 changed files with 36 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2011-07-21 vadim <vadim@netcitadel.com>
* FindObjectWidget.cpp (matchAttr): see #2516 "Enhance Find to
include searching for IP addresses in ranges". Function "find"
now finds ip addresses inside address ranges.
2011-07-20 vadim <vadim@netcitadel.com>
* FWBTree.cpp (init_statics): see #2619 "Attempting to

View File

@ -52,6 +52,7 @@
#include "fwbuilder/UDPService.h"
#include "fwbuilder/MultiAddress.h"
#include "fwbuilder/Interface.h"
#include "fwbuilder/AddressRange.h"
#include <QLineEdit>
#include <QStackedWidget>
@ -225,13 +226,13 @@ bool FindObjectWidget::matchID(int id)
return s_id==id;
}
bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
bool FindObjectWidget::matchAttr(FWObject *obj)
{
if (!m_widget->findDropArea->isEmpty()) return true;
QString s=m_widget->findAttr->currentText();
QString s = m_widget->findAttr->currentText();
if (s.isEmpty()) return true;
bool res=false;
bool res = false;
int attrN = m_widget->attribute->currentIndex();
switch (attrN) {
@ -257,6 +258,31 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
case 1: // Address
{
if ( ! m_widget->useRegexp->isChecked())
{
AddressRange *ar = AddressRange::cast(obj);
if (ar)
{
const InetAddr &inet_addr_start = ar->getRangeStart();
const InetAddr &inet_addr_end = ar->getRangeEnd();
// if address entered by the user has /NN perfix length or
// /255.255.255.0 netmask, do not match it to address ranges
if ( ! s.contains("/"))
{
int af = AF_INET;
if (s.contains(':')) af = AF_INET6;
InetAddr addr = InetAddr(af, s.toStdString());
res = (inet_addr_start == addr || inet_addr_end == addr ||
(inet_addr_start < addr && addr < inet_addr_end));
break;
}
}
}
Address *a = Address::cast(obj);
if (a!=NULL)
{

View File

@ -56,7 +56,7 @@
</item>
<item>
<property name="text">
<string>Address</string>
<string>IP Address</string>
</property>
</item>
<item>