mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-20 18:27:16 +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>
|
2011-07-20 vadim <vadim@netcitadel.com>
|
||||||
|
|
||||||
* FWBTree.cpp (init_statics): see #2619 "Attempting to
|
* FWBTree.cpp (init_statics): see #2619 "Attempting to
|
||||||
|
|||||||
@ -52,6 +52,7 @@
|
|||||||
#include "fwbuilder/UDPService.h"
|
#include "fwbuilder/UDPService.h"
|
||||||
#include "fwbuilder/MultiAddress.h"
|
#include "fwbuilder/MultiAddress.h"
|
||||||
#include "fwbuilder/Interface.h"
|
#include "fwbuilder/Interface.h"
|
||||||
|
#include "fwbuilder/AddressRange.h"
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
@ -225,13 +226,13 @@ bool FindObjectWidget::matchID(int id)
|
|||||||
return s_id==id;
|
return s_id==id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
bool FindObjectWidget::matchAttr(FWObject *obj)
|
||||||
{
|
{
|
||||||
if (!m_widget->findDropArea->isEmpty()) return true;
|
if (!m_widget->findDropArea->isEmpty()) return true;
|
||||||
QString s=m_widget->findAttr->currentText();
|
QString s = m_widget->findAttr->currentText();
|
||||||
if (s.isEmpty()) return true;
|
if (s.isEmpty()) return true;
|
||||||
|
|
||||||
bool res=false;
|
bool res = false;
|
||||||
int attrN = m_widget->attribute->currentIndex();
|
int attrN = m_widget->attribute->currentIndex();
|
||||||
|
|
||||||
switch (attrN) {
|
switch (attrN) {
|
||||||
@ -257,6 +258,31 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
|||||||
|
|
||||||
case 1: // Address
|
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);
|
Address *a = Address::cast(obj);
|
||||||
if (a!=NULL)
|
if (a!=NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Address</string>
|
<string>IP Address</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user