From 8b0febcb237fb517de7112e4f40a5503ecd009af Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sun, 10 Apr 2011 17:12:05 -0700 Subject: [PATCH] * platforms.cpp (setInterfaceTypes): see #2224 "FreeBSD - Bridge interfaces with the name vlan dont show as Bridge Port Interfaces". This actually applies to all OS where we support vlan and bridge interfaces. Fwbuilder GUI should allow the user to set subinterface type to both "ethernet" and "vlan" when its parent interface has type "bridge". Setting subinterface type to "ethernet" makes it bridge port, while setting the type to "vlan" signals policy compiler that it should generate code to configure real vlan interface. If the name of the subinterface does not include the name of the parent, such as "vlan101", or when the name does not match vlan ID, such as "vlan8101", global preferences option "Verify interface names and autoconfigure their parameters..." should turned off. The option is located in the Preferences dialog, tab "Objects". --- VERSION | 2 +- VERSION.h | 2 +- doc/ChangeLog | 17 +++++++ packaging/fwbuilder-static-qt.spec | 2 +- packaging/fwbuilder.control | 2 +- packaging/fwbuilder.spec | 2 +- src/libgui/platforms.cpp | 71 ++++++++++++++++-------------- src/res/os/dd-wrt-jffs.xml | 1 + src/res/os/dd-wrt-nvram.xml | 1 + src/res/os/endian.xml | 1 + src/res/os/freebsd.xml | 1 + src/res/os/ipcop.xml | 1 + src/res/os/linux24.xml | 1 + src/res/os/oneshield.xml | 1 + src/res/os/openbsd.xml | 1 + src/res/os/openwrt.xml | 1 + src/res/os/secuwall.xml | 1 + src/res/os/sveasoft.xml | 1 + 18 files changed, 70 insertions(+), 39 deletions(-) diff --git a/VERSION b/VERSION index f4a38dc9e..20070966d 100644 --- a/VERSION +++ b/VERSION @@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0 # build number is like "nano" version number. I am incrementing build # number during development cycle # -BUILD_NUM="3522" +BUILD_NUM="3523" VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM" diff --git a/VERSION.h b/VERSION.h index c750d78c2..9b9ad70cb 100644 --- a/VERSION.h +++ b/VERSION.h @@ -1,2 +1,2 @@ -#define VERSION "4.2.0.3522" +#define VERSION "4.2.0.3523" #define GENERATION "4.2" diff --git a/doc/ChangeLog b/doc/ChangeLog index edf8afacf..6bbe5d5d3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,20 @@ +2011-04-10 vadim + + * platforms.cpp (setInterfaceTypes): see #2224 "FreeBSD - Bridge + interfaces with the name vlan don't show as Bridge Port + Interfaces". This actually applies to all OS where we support vlan + and bridge interfaces. Fwbuilder GUI should allow the user to set + subinterface type to both "ethernet" and "vlan" when its parent + interface has type "bridge". Setting subinterface type to + "ethernet" makes it bridge port, while setting the type to "vlan" + signals policy compiler that it should generate code to configure + real vlan interface. If the name of the subinterface does not + include the name of the parent, such as "vlan101", or when the + name does not match vlan ID, such as "vlan8101", global + preferences option "Verify interface names and autoconfigure their + parameters..." should turned off. The option is located in the + Preferences dialog, tab "Objects". + 2011-04-08 vadim * FWBSettings.cpp (init): fixed bug (no #): "Show text diff --git a/packaging/fwbuilder-static-qt.spec b/packaging/fwbuilder-static-qt.spec index b7b65025a..f7a7ec015 100644 --- a/packaging/fwbuilder-static-qt.spec +++ b/packaging/fwbuilder-static-qt.spec @@ -3,7 +3,7 @@ %define name fwbuilder -%define version 4.2.0.3522 +%define version 4.2.0.3523 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/packaging/fwbuilder.control b/packaging/fwbuilder.control index 45396147d..9988e14ce 100644 --- a/packaging/fwbuilder.control +++ b/packaging/fwbuilder.control @@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu Priority: extra Section: checkinstall Maintainer: vadim@fwbuilder.org -Version: 4.2.0.3522-1 +Version: 4.2.0.3523-1 Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15 Description: Firewall Builder GUI and policy compilers diff --git a/packaging/fwbuilder.spec b/packaging/fwbuilder.spec index 79378e85f..c2b26b276 100644 --- a/packaging/fwbuilder.spec +++ b/packaging/fwbuilder.spec @@ -1,6 +1,6 @@ %define name fwbuilder -%define version 4.2.0.3522 +%define version 4.2.0.3523 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/src/libgui/platforms.cpp b/src/libgui/platforms.cpp index 3f9952948..bfaf6f0ca 100644 --- a/src/libgui/platforms.cpp +++ b/src/libgui/platforms.cpp @@ -565,44 +565,47 @@ void setInterfaceTypes(QComboBox *iface_type, getSubInterfaceTypes(Interface::cast(iface->getParent()), mapping); else getInterfaceTypes(iface, mapping); - // #335 : if interface name matches naming convention for vlan - // interfaces and vlan type is in the list that came from the - // resource file, then leave only vlan in the list we return. - // Note that if resource file says this subint can not be vlan, we - // dan't return vlan type on the list even if its name looks like - // it could be one. - FWObject *p = iface->getParentHost(); - assert(p!=NULL); - QString host_os = p->getStr("host_OS").c_str(); - QString obj_name = iface->getName().c_str(); - - Resources* os_res = Resources::os_res[p->getStr("host_OS")]; - string os_family = p->getStr("host_OS"); - if (os_res!=NULL) - os_family = os_res->getResourceStr("/FWBuilderResources/Target/family"); - - std::auto_ptr int_prop( - interfacePropertiesObjectFactory::getInterfacePropertiesObject( - os_family)); - if (int_prop->looksLikeVlanInterface(obj_name)) + if (st->getBool("Objects/Interface/autoconfigureInterfaces")) { - QString parent_name = iface->getParent()->getName().c_str(); - QString err; - if (int_prop->isValidVlanInterfaceName(obj_name, parent_name, err)) + // #335 : if interface name matches naming convention for vlan + // interfaces and vlan type is in the list that came from the + // resource file, then leave only vlan in the list we return. + // Note that if resource file says this subint can not be vlan, we + // dan't return vlan type on the list even if its name looks like + // it could be one. + FWObject *p = iface->getParentHost(); + assert(p!=NULL); + QString host_os = p->getStr("host_OS").c_str(); + QString obj_name = iface->getName().c_str(); + + Resources* os_res = Resources::os_res[p->getStr("host_OS")]; + string os_family = p->getStr("host_OS"); + if (os_res!=NULL) + os_family = os_res->getResourceStr("/FWBuilderResources/Target/family"); + + std::auto_ptr int_prop( + interfacePropertiesObjectFactory::getInterfacePropertiesObject( + os_family)); + if (int_prop->looksLikeVlanInterface(obj_name)) { - // iface can be valid vlan interface. Leave only vlan type - // in the list if it was there to begin with. - for (list::iterator it=mapping.begin(); - it!=mapping.end(); ++it) + QString parent_name = iface->getParent()->getName().c_str(); + QString err; + if (int_prop->isValidVlanInterfaceName(obj_name, parent_name, err)) { - QString itype = it->first; - QString rtype = it->second; - if (itype == "8021q") + // iface can be valid vlan interface. Leave only vlan type + // in the list if it was there to begin with. + for (list::iterator it=mapping.begin(); + it!=mapping.end(); ++it) { - mapping.clear(); - mapping.push_back(QStringPair(itype, rtype)); - mapping.push_back(QStringPair("unknown", "Unknown")); - break; + QString itype = it->first; + QString rtype = it->second; + if (itype == "8021q") + { + mapping.clear(); + mapping.push_back(QStringPair(itype, rtype)); + mapping.push_back(QStringPair("unknown", "Unknown")); + break; + } } } } diff --git a/src/res/os/dd-wrt-jffs.xml b/src/res/os/dd-wrt-jffs.xml index 111aa8566..43ccd48e8 100644 --- a/src/res/os/dd-wrt-jffs.xml +++ b/src/res/os/dd-wrt-jffs.xml @@ -112,6 +112,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/dd-wrt-nvram.xml b/src/res/os/dd-wrt-nvram.xml index 71729d2a7..f26068a26 100644 --- a/src/res/os/dd-wrt-nvram.xml +++ b/src/res/os/dd-wrt-nvram.xml @@ -112,6 +112,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/endian.xml b/src/res/os/endian.xml index 642d9f99f..0107be303 100644 --- a/src/res/os/endian.xml +++ b/src/res/os/endian.xml @@ -56,6 +56,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/freebsd.xml b/src/res/os/freebsd.xml index 3e36c95f7..b1ff89d75 100644 --- a/src/res/os/freebsd.xml +++ b/src/res/os/freebsd.xml @@ -76,6 +76,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/ipcop.xml b/src/res/os/ipcop.xml index f06ce70e1..e391bd5d7 100644 --- a/src/res/os/ipcop.xml +++ b/src/res/os/ipcop.xml @@ -56,6 +56,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/linux24.xml b/src/res/os/linux24.xml index 138d1ca92..459a426f9 100644 --- a/src/res/os/linux24.xml +++ b/src/res/os/linux24.xml @@ -113,6 +113,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/oneshield.xml b/src/res/os/oneshield.xml index c9ac2ccbb..ca1e689bc 100644 --- a/src/res/os/oneshield.xml +++ b/src/res/os/oneshield.xml @@ -56,6 +56,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/openbsd.xml b/src/res/os/openbsd.xml index 605c6ef03..39fbe3740 100644 --- a/src/res/os/openbsd.xml +++ b/src/res/os/openbsd.xml @@ -75,6 +75,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/openwrt.xml b/src/res/os/openwrt.xml index f32f8a6b7..5593ac20f 100644 --- a/src/res/os/openwrt.xml +++ b/src/res/os/openwrt.xml @@ -112,6 +112,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/secuwall.xml b/src/res/os/secuwall.xml index 55a03a1d2..e71188189 100644 --- a/src/res/os/secuwall.xml +++ b/src/res/os/secuwall.xml @@ -89,6 +89,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown diff --git a/src/res/os/sveasoft.xml b/src/res/os/sveasoft.xml index 339e99022..1d02cb700 100644 --- a/src/res/os/sveasoft.xml +++ b/src/res/os/sveasoft.xml @@ -54,6 +54,7 @@ ethernet,Ethernet + 8021q,VLAN unknown,Unknown