1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-10 11:05:06 +02:00

fixes #2684 "fix address deletion in configlet update_addresses". Add

command to set /proc variable
/proc/sys/net/ipv4/conf/all/promote_secondaries that makes the kernel
"promote" secondary address to a "primary" status when primary address
is deleted. Default behavior in Linux kernel is to delete all
addresses when primary address is deleted.
This commit is contained in:
Vadim Kurland
2012-02-20 11:54:51 -08:00
parent c89b691eff
commit 8a456b3c7d
2 changed files with 32 additions and 2 deletions

View File

@@ -1,3 +1,18 @@
2012-02-20 Vadim Kurland <vadim@netcitadel.com>
* OSConfigurator_linux24_interfaces.cpp (printInterfaceConfigurationCommands):
fixes #2684 "fix address deletion in configlet update_addresses".
This only applies to Linux firewalls and configurations where an
interface has two or more ip addresses. If user deleted one of the
addresses that happens to be the "primary" address of the
interface in the GUI, generated script deleted both addresses on
the firewall machine instead of just one and left interface with
no addresses at all. The fix is to use /proc variable
/proc/sys/net/ipv4/conf/all/promote_secondaries that makes the
kernel "promote" secondary address to a "primary" status when
primary address is deleted. Default behavior in Linux kernel is to
delete all addresses when primary address is deleted.
2012-02-13 Vadim Kurland <vadim@netcitadel.com>
* qmake.inc.in (QMAKE_CXXFLAGS_DEBUG): fix for SF bug #3468802.

View File

@@ -65,6 +65,8 @@
#include <QString>
#include <QStringList>
#include <QRegExp>
#include <QtDebug>
using namespace libfwbuilder;
using namespace fwcompiler;
@@ -121,12 +123,17 @@ string OSConfigurator_linux24::printInterfaceConfigurationCommands()
{
FWOptions* options = fw->getOptionsObject();
QStringList gencmd;
std::auto_ptr<interfaceProperties> int_prop(
interfacePropertiesObjectFactory::getInterfacePropertiesObject(
fw->getStr("host_OS")));
Configlet script(fw, "linux24", "configure_interfaces");
script.removeComments();
script.collapseEmptyStrings(true);
list<FWObject*> interfaces = fw->getByTypeDeep(Interface::TYPENAME);
bool need_promote_command = false;
QStringList gencmd;
list<FWObject*>::iterator i;
for (i=interfaces.begin(); i!=interfaces.end(); ++i )
{
@@ -153,12 +160,20 @@ string OSConfigurator_linux24::printInterfaceConfigurationCommands()
gencmd.push_back(
printUpdateAddressCommand(iface, update_addresses, ignore_addresses));
// update_addresses list looks like this:
// ("eth0", "22.22.22.22/24", "22.22.22.23/24")
// I need to add "promote" command only when there is more than 1 address.
need_promote_command |= (update_addresses.size() > 2);
}
known_interfaces.push_back(iface_name);
}
return gencmd.join("\n").toStdString() + "\n";
script.setVariable("have_interfaces", interfaces.size() > 0);
script.setVariable("need_promote_command", need_promote_command);
script.setVariable("configure_interfaces_script", gencmd.join("\n"));
return script.expand().toStdString() + "\n";
}