mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-19 09:47:20 +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:
parent
0132087bb4
commit
2ce9852aeb
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Address</string>
|
||||
<string>IP Address</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user