[firewalld-recode] master: Comment more on the logic in IPAddress class constructor (45c1db4)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 45c1db4491c2fa4cb4831dd2f7b6ada56499efe4
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Dec 10 11:37:56 2014 +0100
Comment more on the logic in IPAddress class constructor
>---------------------------------------------------------------
src/Daemon/Firewall/IPAddress.cpp | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index 789fc4a..161481b 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -46,17 +46,19 @@ namespace firewalld
_is_network = true;
ip = addr_spec.substr(0, slash_pos);
net = addr_spec.substr(slash_pos + 1);
-
- //
- // Net has to be either /<N> (IPv4/6) or /<n>.<n>.<n>.<n> (IPv4)
- //
- auto regex_cidr = Glib::Regex::create("^[0-9]{1,2}$");
- auto regex_ipv4 = Glib::Regex::create("^([0-9]{1,2}\\.){3}[0-9]{1,2}$");
+ /*
+ * Net has to be either /<N> (IPv4/6) or /<n>.<n>.<n>.<n> (IPv4)
+ *
+ * NOTE/TODO: Would love to use std::regex (C++11) here, but at the
+ * current time it's not working properly (gcc-c++-4.8.3)
+ */
+ auto const regex_cidr = Glib::Regex::create("^[0-9]{1,2}$");
+ auto const regex_ipv4 = Glib::Regex::create("^([0-9]{1,2}\\.){3}[0-9]{1,2}$");
if (regex_ipv4->match(net)) {
struct ::sockaddr_storage sa;
if (::inet_pton(AF_INET, net.c_str(), &sa) != 1) {
-
+ throw std::runtime_error("Invalid IPv4 mask");
}
else {
net_protocol = Protocol::IPv4;
@@ -73,12 +75,12 @@ namespace firewalld
}
}
else {
+ /* No slash found -- the string should contain just an IPv4/6 address */
_is_network = false;
ip = addr_spec;
}
-
+ /* Try to parse the string as IPv4 or IPv6 address */
struct ::sockaddr_storage sa;
-
if (::inet_pton(AF_INET, ip.c_str(), &sa) != 1) {
if (::inet_pton(AF_INET6, ip.c_str(), &sa) != 1) {
throw std::runtime_error("Invalid IP address");
@@ -90,14 +92,17 @@ namespace firewalld
else {
addr_protocol = Protocol::IPv4;
}
-
+ /*
+ * If we found a subnet specification, check that it's a sane one,
+ * i.e. if the address is IPv6, then only CIDR notation is acceptable.
+ * IPv4 may have CIDR or an IPv4 mask.
+ */
if (_is_network) {
if (addr_protocol == Protocol::IPv6
&& net_protocol == Protocol::IPv4) {
throw std::runtime_error("Invalid network specification");
}
}
-
/*
* If we got here, it's a correct IP address/network spec
*/
9 years, 4 months
[firewalld-recode] master: Added implementation of several methods of the LinuxXTables backend (5ec543e)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 5ec543ebec67bb7c42ce92d48be16475dd04b001
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 21:26:18 2014 +0100
Added implementation of several methods of the LinuxXTables backend
>---------------------------------------------------------------
src/Daemon/Backends/LinuxXTables.cpp | 329 +++++++++++++++++++++++++++++-----
src/Daemon/Backends/LinuxXTables.hpp | 3 +
2 files changed, 287 insertions(+), 45 deletions(-)
diff --git a/src/Daemon/Backends/LinuxXTables.cpp b/src/Daemon/Backends/LinuxXTables.cpp
index 8efbbf3..bb88d80 100644
--- a/src/Daemon/Backends/LinuxXTables.cpp
+++ b/src/Daemon/Backends/LinuxXTables.cpp
@@ -21,6 +21,7 @@
#include "LinuxXTables.hpp"
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
+#include "Common/Utility.hpp"
#include "Linux/KernelModule.hpp"
#include "Daemon/Firewall/RichRules/ServiceRule.hpp"
#include "Daemon/Firewall/RichRules/PortRule.hpp"
@@ -37,6 +38,11 @@ namespace firewalld
_ip6tables(FIREWALLD_IP6TABLES_PATH)
{
initDefaultChains();
+ /*
+ * TODO: Initial next_mark value has to be set from
+ * the configuration file.
+ */
+ _next_mark = 100;
}
void LinuxXTables::initDefaultChains()
@@ -133,27 +139,23 @@ namespace firewalld
ipXtables->newChain("filter", prefix + zone.name() + suffix);
}
}
-
for (const String& prefix : { "IN_", "FWDI_", "FWDO_" }) {
for (const String& suffix : { "_log", "_deny", "_allow" }) {
ipXtables->appendRule("filter", prefix + zone.name(),
"-j " + prefix + zone.name() + suffix, 0);
}
}
-
for (const String& prefix : { "PRE_" }) {
for (const String& suffix : { "", "_allow", "_deny", "_log" }) {
ipXtables->newChain("mangle", prefix + zone.name() + suffix);
}
}
-
for (const String& prefix : { "PRE_" }) {
for (const String& suffix : { "_log", "_deny", "_allow" }) {
ipXtables->appendRule("mangle", prefix + zone.name(),
"-j " + prefix + zone.name() + suffix, 0);
}
}
- return;
}
/*
@@ -174,6 +176,9 @@ namespace firewalld
for (auto map_entry : zone.getRichRules()) {
addRichRule(zone, *map_entry.second);
}
+ for (auto map_entry : zone.getICMPBlocks()) {
+ addICMPBlock(zone, *map_entry.second);
+ }
for (auto map_entry : zone.getInterfaces()) {
addInterface(zone, *map_entry.second);
}
@@ -186,6 +191,12 @@ namespace firewalld
void LinuxXTables::addInterface(const Zone& zone, const Interface& interface)
{
for (IPTables * const ipXtables : { &_ip4tables, &_ip6tables }) {
+ ipXtables->appendRule("mangle", "PREROUTING_ZONES",
+ "-i " + interface.identifier() + " -g PRE_" + zone.name(), 0);
+ ipXtables->appendRule("nat", "POSTROUTING_ZONES",
+ "-o " + interface.identifier() + " -g POST_" + zone.name(), 0);
+ ipXtables->appendRule("nat", "PREROUTING_ZONES",
+ "-i " + interface.identifier() + " -g PRE_" + zone.name(), 0);
ipXtables->appendRule("filter", "INPUT_ZONES",
"-i " + interface.identifier() + " -g IN_" + zone.name(), 0);
ipXtables->appendRule("filter", "FORWARD_IN_ZONES",
@@ -198,7 +209,34 @@ namespace firewalld
void LinuxXTables::addSource(const Zone& zone, const Source& source)
{
- LOG(DEBUG) << "addSource: " << zone.name() << ", " << source.specification();
+ IPTables * ipXtables;
+
+ switch (source.address().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ throw std::runtime_error("BUG: addSource: unknown address protocol");
+ }
+
+ String source_spec = source.address().toString();
+ String source_op = source.isNegated() ? "! " : " ";
+
+ ipXtables->appendRule("nat", "POSTROUTING_ZONES_SOURCE",
+ source_op + "-d " + source_spec + " -g POST_" + zone.name(), 0);
+ ipXtables->appendRule("nat", "PREROUTING_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g PRE_" + zone.name(), 0);
+ ipXtables->appendRule("mangle", "PREROUTING_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g PRE_" + zone.name(), 0);
+ ipXtables->appendRule("filter", "FORWARD_IN_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g FWDI_" + zone.name(), 0);
+ ipXtables->appendRule("filter", "FORWARD_OUT_ZONES_SOURCE",
+ source_op + "-d " + source_spec + " -g FWDO_" + zone.name(), 0);
+ ipXtables->appendRule("filter", "INPUT_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g IN_" + zone.name(), 0);
}
void LinuxXTables::addPort(const Zone& zone, const Port& port)
@@ -212,9 +250,8 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
- case Port::Protocol::AnyProtocol:
- // TODO
- break;
+ default:
+ throw std::runtime_error("BUG: addPort: invalid port protocol");
}
rule_spec += port.range().toString(":");
@@ -229,7 +266,61 @@ namespace firewalld
void LinuxXTables::addPortForward(const Zone& zone, const PortForward& port_forward)
{
- LOG(DEBUG) << "addPortForward";
+ IPTables* ipXtables;
+
+ switch(port_forward.destinationAddress().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ /*
+ * Without an explicitly set IP protocol, we default
+ * to IPv4
+ */
+ ipXtables = &_ip4tables;
+ }
+
+ String protocol;
+ switch(port_forward.protocol()) {
+ case Port::Protocol::TCP:
+ protocol = "tcp";
+ break;
+ case Port::Protocol::UDP:
+ protocol = "udp";
+ break;
+ default:
+ throw std::runtime_error("BUG: addPortForward: invalid port protocol");
+ }
+
+ String destination = port_forward.destinationAddress().toString() + ":"
+ + port_forward.destinationPort()->range().toString("-");
+
+ String mark = numberToString(_next_mark++, "0x", 16);
+
+ ipXtables->appendRule("nat", "PRE_" + zone.name() + "_allow",
+ "-p " + protocol
+ + " "
+ + "-m mark --mark " + mark
+ + " "
+ + "-j DNAT --to-destination " + destination, 0);
+
+ ipXtables->appendRule("mangle", "PRE_" + zone.name() + "_allow",
+ "-p " + protocol
+ + " "
+ + "-m " + protocol + " --dport " + port_forward.sourcePort()->range().toString("-")
+ + " "
+ + "-j MARK --set-xmark " + mark + "/0xffffffff", 0);
+
+ ipXtables->appendRule("filter", "IN_" + zone.name() + "_allow",
+ "-m conntrack --ctstate NEW"
+ " "
+ "-m mark --mark " + mark
+ + " "
+ + "-j ACCEPT", 0);
+ return;
}
void LinuxXTables::addService(const Zone& zone, const Service& service)
@@ -243,31 +334,32 @@ namespace firewalld
return;
}
- void LinuxXTables::addRichRule(const Zone& zone, const RichRule& rule)
+ void LinuxXTables::addRichRule(const Zone& zone, const RichRule& base_rule)
{
- const UString& type = rule.getType();
+ const UString& type = base_rule.getType();
if (type == "service") {
- const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
- addService(zone, srule.getService());
+ const ServiceRule& rule = dynamic_cast<const ServiceRule&>(base_rule);
+ addService(zone, rule.getService());
}
else if (type == "port") {
- const PortRule& prule = dynamic_cast<const PortRule&>(rule);
- addPort(zone, prule.getPort());
+ const PortRule& rule = dynamic_cast<const PortRule&>(base_rule);
+ addPort(zone, rule.getPort());
}
else if (type == "protocol") {
- const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
+ const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(base_rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& irule = dynamic_cast<const ICMPBlockRule&>(rule);
- addICMPBlock(zone, irule.getICMPType());
+ const ICMPBlockRule& rule = dynamic_cast<const ICMPBlockRule&>(base_rule);
+ addICMPBlock(zone, rule.getICMPType());
}
else if (type == "masquerade") {
- const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(rule);
+ const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(base_rule);
+ addMasquerade(zone, *rule.source());
}
else if (type == "forward-port") {
- const ForwardPortRule& fprule = dynamic_cast<const ForwardPortRule&>(rule);
- addPortForward(zone, fprule.getPortForward());
+ const ForwardPortRule& rule = dynamic_cast<const ForwardPortRule&>(base_rule);
+ addPortForward(zone, rule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
@@ -293,42 +385,79 @@ namespace firewalld
return;
}
+ void LinuxXTables::addMasquerade(const Zone& zone, const Source& source)
+ {
+ IPTables * ipXtables;
+
+ switch (source.address().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ throw std::runtime_error("BUG: addSource: unknown address protocol");
+ }
+
+ ipXtables->appendRule("nat", "POST_" + zone.name() + "_allow",
+ "! -i lo -j MASQUERADE", 0);
+ ipXtables->appendRule("filter", "FWDO_" + zone.name() + "_allow",
+ "-j ACCEPT", 0);
+ return;
+ }
+
void LinuxXTables::removeZone(const Zone& zone)
{
/*
* Remove the zone state from the system. Interfaces and Sources first.
*/
for (auto map_entry : zone.getSources()) {
- addSource(zone, *map_entry.second);
+ removeSource(zone, *map_entry.second);
}
for (auto map_entry : zone.getInterfaces()) {
- addInterface(zone, *map_entry.second);
+ removeInterface(zone, *map_entry.second);
+ }
+ for (auto map_entry : zone.getICMPBlocks()) {
+ removeICMPBlock(zone, *map_entry.second);
}
for (auto map_entry : zone.getPorts(Port::Protocol::TCP)) {
- addPort(zone, *map_entry.second);
+ removePort(zone, *map_entry.second);
}
for (auto map_entry : zone.getPorts(Port::Protocol::UDP)) {
- addPort(zone, *map_entry.second);
+ removePort(zone, *map_entry.second);
}
for (auto map_entry : zone.getPortForwards()) {
- addPortForward(zone, *map_entry.second);
+ removePortForward(zone, *map_entry.second);
}
for (auto map_entry : zone.getServices()) {
- addService(zone, *map_entry.second);
+ removeService(zone, *map_entry.second);
}
for (auto map_entry : zone.getRichRules()) {
- addRichRule(zone, *map_entry.second);
+ removeRichRule(zone, *map_entry.second);
}
/*
* Delete the zone chains. Nothing should be left here.
*/
for (IPTables * const ipXtables : { &_ip4tables, &_ip6tables }) {
for (const String& prefix : { "IN_", "FWDI_", "FWDO_" }) {
+ for (const String& suffix : { "_log", "_deny", "_allow" }) {
+ ipXtables->deleteRule("filter", prefix + zone.name(),
+ "-j " + prefix + zone.name() + suffix, 0);
+ }
+ }
+ for (const String& prefix : { "IN_", "FWDI_", "FWDO_" }) {
for (const String& suffix : { "", "_allow", "_deny", "_log" }) {
ipXtables->deleteChain("filter", prefix + zone.name() + suffix);
}
}
for (const String& prefix : { "PRE_" }) {
+ for (const String& suffix : { "_log", "_deny", "_allow" }) {
+ ipXtables->deleteRule("mangle", prefix + zone.name(),
+ "-j " + prefix + zone.name() + suffix, 0);
+ }
+ }
+ for (const String& prefix : { "PRE_" }) {
for (const String& suffix : { "", "_allow", "_deny", "_log" }) {
ipXtables->deleteChain("mangle", prefix + zone.name() + suffix);
}
@@ -340,6 +469,12 @@ namespace firewalld
void LinuxXTables::removeInterface(const Zone& zone, const Interface& interface)
{
for (IPTables * const ipXtables : { &_ip4tables, &_ip6tables }) {
+ ipXtables->deleteRule("mangle", "PREROUTING_ZONES",
+ "-i " + interface.identifier() + " -g PRE_" + zone.name(), 0);
+ ipXtables->deleteRule("nat", "POSTROUTING_ZONES",
+ "-o " + interface.identifier() + " -g POST_" + zone.name(), 0);
+ ipXtables->deleteRule("nat", "PREROUTING_ZONES",
+ "-i " + interface.identifier() + " -g PRE_" + zone.name(), 0);
ipXtables->deleteRule("filter", "INPUT_ZONES",
"-i " + interface.identifier() + " -g IN_" + zone.name(), 0);
ipXtables->deleteRule("filter", "FORWARD_IN_ZONES",
@@ -352,7 +487,35 @@ namespace firewalld
void LinuxXTables::removeSource(const Zone& zone, const Source& source)
{
- LOG(DEBUG) << "removeSource";
+ IPTables * ipXtables;
+
+ switch (source.address().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ throw std::runtime_error("BUG: addSource: unknown address protocol");
+ }
+
+ String source_spec = source.address().toString();
+ String source_op = source.isNegated() ? "! " : " ";
+
+ ipXtables->deleteRule("nat", "POSTROUTING_ZONES_SOURCE",
+ source_op + "-d " + source_spec + " -g POST_" + zone.name(), 0);
+ ipXtables->deleteRule("nat", "PREROUTING_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g PRE_" + zone.name(), 0);
+ ipXtables->deleteRule("mangle", "PREROUTING_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g PRE_" + zone.name(), 0);
+ ipXtables->deleteRule("filter", "FORWARD_IN_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g FWDI_" + zone.name(), 0);
+ ipXtables->deleteRule("filter", "FORWARD_OUT_ZONES_SOURCE",
+ source_op + "-d " + source_spec + " -g FWDO_" + zone.name(), 0);
+ ipXtables->deleteRule("filter", "INPUT_ZONES_SOURCE",
+ source_op + "-s " + source_spec + " -g IN_" + zone.name(), 0);
+ return;
}
void LinuxXTables::removePort(const Zone& zone, const Port& port)
@@ -366,9 +529,8 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
- case Port::Protocol::AnyProtocol:
- // TODO
- break;
+ default:
+ throw std::runtime_error("BUG: removePort: invalid port protocol");
}
rule_spec += port.range().toString(":");
@@ -382,7 +544,61 @@ namespace firewalld
void LinuxXTables::removePortForward(const Zone& zone, const PortForward& port_forward)
{
- LOG(DEBUG) << "removePortForward";
+ IPTables* ipXtables;
+
+ switch(port_forward.destinationAddress().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ /*
+ * Without an explicitly set IP protocol, we default
+ * to IPv4
+ */
+ ipXtables = &_ip4tables;
+ }
+
+ String protocol;
+ switch(port_forward.protocol()) {
+ case Port::Protocol::TCP:
+ protocol = "tcp";
+ break;
+ case Port::Protocol::UDP:
+ protocol = "udp";
+ break;
+ default:
+ throw std::runtime_error("BUG: addPortForward: invalid port protocol");
+ }
+
+ String destination = port_forward.destinationAddress().toString() + ":"
+ + port_forward.destinationPort()->range().toString("-");
+
+ String mark = numberToString(_next_mark++, "0x", 16);
+
+ ipXtables->deleteRule("nat", "PRE_" + zone.name() + "_allow",
+ "-p " + protocol
+ + " "
+ + "-m mark --mark " + mark
+ + " "
+ + "-j DNAT --to-destination " + destination, 0);
+
+ ipXtables->deleteRule("mangle", "PRE_" + zone.name() + "_allow",
+ "-p " + protocol
+ + " "
+ + "-m " + protocol + " --dport " + port_forward.sourcePort()->range().toString("-")
+ + " "
+ + "-j MARK --set-xmark " + mark + "/0xffffffff", 0);
+
+ ipXtables->deleteRule("filter", "IN_" + zone.name() + "_allow",
+ "-m conntrack --ctstate NEW"
+ " "
+ "-m mark --mark " + mark
+ + " "
+ + "-j ACCEPT", 0);
+ return;
}
void LinuxXTables::removeService(const Zone& zone, const Service& service)
@@ -392,31 +608,32 @@ namespace firewalld
}
}
- void LinuxXTables::removeRichRule(const Zone& zone, const RichRule& rule)
+ void LinuxXTables::removeRichRule(const Zone& zone, const RichRule& base_rule)
{
- const UString& type = rule.getType();
+ const UString& type = base_rule.getType();
if (type == "service") {
- const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
- removeService(zone, srule.getService());
+ const ServiceRule& rule = dynamic_cast<const ServiceRule&>(base_rule);
+ removeService(zone, rule.getService());
}
else if (type == "port") {
- const PortRule& prule = dynamic_cast<const PortRule&>(rule);
- removePort(zone, prule.getPort());
+ const PortRule& rule = dynamic_cast<const PortRule&>(base_rule);
+ removePort(zone, rule.getPort());
}
else if (type == "protocol") {
- const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
+ const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(base_rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& irule = dynamic_cast<const ICMPBlockRule&>(rule);
- removeICMPBlock(zone, irule.getICMPType());
+ const ICMPBlockRule& rule = dynamic_cast<const ICMPBlockRule&>(base_rule);
+ removeICMPBlock(zone, rule.getICMPType());
}
else if (type == "masquerade") {
- const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(rule);
+ const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(base_rule);
+ removeMasquerade(zone, *rule.source());
}
else if (type == "forward-port") {
- const ForwardPortRule& fprule = dynamic_cast<const ForwardPortRule&>(rule);
- removePortForward(zone, fprule.getPortForward());
+ const ForwardPortRule& rule = dynamic_cast<const ForwardPortRule&>(base_rule);
+ removePortForward(zone, rule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
@@ -442,4 +659,26 @@ namespace firewalld
return;
}
+ void LinuxXTables::removeMasquerade(const Zone& zone, const Source& source)
+ {
+ IPTables * ipXtables;
+
+ switch (source.address().protocol()) {
+ case IPAddress::Protocol::IPv4:
+ ipXtables = &_ip4tables;
+ break;
+ case IPAddress::Protocol::IPv6:
+ ipXtables = &_ip6tables;
+ break;
+ default:
+ throw std::runtime_error("BUG: addSource: unknown address protocol");
+ }
+
+ ipXtables->deleteRule("nat", "POST_" + zone.name() + "_allow",
+ "! -i lo -j MASQUERADE", 0);
+ ipXtables->deleteRule("filter", "FWDO_" + zone.name() + "_allow",
+ "-j ACCEPT", 0);
+ return;
+ }
+
} /* namespace firewalld */
diff --git a/src/Daemon/Backends/LinuxXTables.hpp b/src/Daemon/Backends/LinuxXTables.hpp
index a865898..519182b 100644
--- a/src/Daemon/Backends/LinuxXTables.hpp
+++ b/src/Daemon/Backends/LinuxXTables.hpp
@@ -42,6 +42,7 @@ namespace firewalld
void addService(const Zone& zone, const Service& service);
void addRichRule(const Zone& zone, const RichRule& rule);
void addICMPBlock(const Zone& zone, const ICMPType& icmptype);
+ void addMasquerade(const Zone& zone, const Source& source);
void removeZone(const Zone& zone);
void removeInterface(const Zone& zone, const Interface& interface);
@@ -51,10 +52,12 @@ namespace firewalld
void removeService(const Zone& zone, const Service& service);
void removeRichRule(const Zone& zone, const RichRule& rule);
void removeICMPBlock(const Zone& zone, const ICMPType& icmptype);
+ void removeMasquerade(const Zone& zone, const Source& source);
void initDefaultChains();
void cleanup();
private:
+ unsigned int _next_mark;
IPTables _ip4tables;
IPTables _ip6tables;
EBTables _ebtables;
9 years, 4 months
[firewalld-recode] master: Adapt the code in getZoneSettings, getForwardPorts, getSources and Zone to recent changes (fa0413c)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit fa0413c7ab76f8bb84e40f99cf499eb20d1a3cb4
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 21:24:02 2014 +0100
Adapt the code in getZoneSettings,getForwardPorts,getSources and Zone to recent changes
>---------------------------------------------------------------
src/Daemon/DBus/getZoneSettings.cpp | 6 +++---
src/Daemon/DBus/zone/getForwardPorts.cpp | 6 +++---
src/Daemon/DBus/zone/getSources.cpp | 2 +-
src/Daemon/Firewall/Zone.cpp | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/Daemon/DBus/getZoneSettings.cpp b/src/Daemon/DBus/getZoneSettings.cpp
index d1bbbde..a924177 100644
--- a/src/Daemon/DBus/getZoneSettings.cpp
+++ b/src/Daemon/DBus/getZoneSettings.cpp
@@ -70,7 +70,7 @@ namespace firewalld
int forward_index = 0;
for (auto const& map_entry : zone->getPortForwards()) {
Pointer<const PortForward> port_forward = map_entry.second;
- forward_array[forward_index] << UString(port_forward->sourcePort()->range().toString());
+ forward_array[forward_index] << UString(port_forward->sourcePort()->range().toUString());
switch(port_forward->protocol()) {
case Port::Protocol::TCP:
forward_array[forward_index] << UString("tcp");
@@ -81,8 +81,8 @@ namespace firewalld
default:
throw FirewallError("INVALID_ZONE", "Ambiguous port protocol");
}
- forward_array[forward_index] << UString(port_forward->destinationPort()->range().toString());
- forward_array[forward_index] << port_forward->destinationAddress();
+ forward_array[forward_index] << port_forward->destinationPort()->range().toUString();
+ forward_array[forward_index] << port_forward->destinationAddress().toUString();
++forward_index;
}
diff --git a/src/Daemon/DBus/zone/getForwardPorts.cpp b/src/Daemon/DBus/zone/getForwardPorts.cpp
index e8abbe6..eb9e71d 100644
--- a/src/Daemon/DBus/zone/getForwardPorts.cpp
+++ b/src/Daemon/DBus/zone/getForwardPorts.cpp
@@ -38,11 +38,11 @@ namespace firewalld
for (auto const& map_entry : port_forwards) {
Pointer<const PortForward> port_forward = map_entry.second;
- result[i][0] = port_forward->sourcePort()->range().toString();
+ result[i][0] = port_forward->sourcePort()->range().toUString();
result[i][1] = (port_forward->sourcePort()->protocol() == Port::Protocol::TCP ? \
UString("tcp") : UString("udp"));
- result[i][2] = port_forward->destinationPort()->range().toString();
- result[i][3] = port_forward->destinationAddress();
+ result[i][2] = port_forward->destinationPort()->range().toUString();
+ result[i][3] = port_forward->destinationAddress().toUString();
++i;
}
}
diff --git a/src/Daemon/DBus/zone/getSources.cpp b/src/Daemon/DBus/zone/getSources.cpp
index 4f206a7..f1737e4 100644
--- a/src/Daemon/DBus/zone/getSources.cpp
+++ b/src/Daemon/DBus/zone/getSources.cpp
@@ -37,7 +37,7 @@ namespace firewalld
for (auto const& map_entry : source_map) {
Pointer<const Source> source = map_entry.second;
- source_spec_vector.push_back(source->specification());
+ source_spec_vector.push_back(source->address().toUString());
}
result = source_spec_vector;
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index 46e5ca2..175fc26 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -733,7 +733,7 @@ namespace firewalld
if (forward->sourcePort() != forward->destinationPort()) {
stream << " to-port=\"" << forward->destinationPort()->range().toString() << "\"";
}
- if (!forward->destinationAddress().empty()) {
+ if (!forward->destinationAddress()) {
stream << " to-addr=\"" << forward->destinationAddress() << "\"";
}
9 years, 4 months
[firewalld-recode] master: Use the IPAddress class in PortForward and Source classes (163dd36)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 163dd364c998a9289d26571e1d2255ea9a96ef69
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 21:07:24 2014 +0100
Use the IPAddress class in PortForward and Source classes
>---------------------------------------------------------------
src/Daemon/Firewall/PortForward.cpp | 6 +++---
src/Daemon/Firewall/PortForward.hpp | 9 +++++----
src/Daemon/Firewall/Source.cpp | 25 +++++++++++++++++++++----
src/Daemon/Firewall/Source.hpp | 9 +++++++--
4 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/src/Daemon/Firewall/PortForward.cpp b/src/Daemon/Firewall/PortForward.cpp
index d32470e..1005ced 100644
--- a/src/Daemon/Firewall/PortForward.cpp
+++ b/src/Daemon/Firewall/PortForward.cpp
@@ -30,7 +30,7 @@ namespace firewalld
_dst_port = nullptr;
}
- PortForward::PortForward(Pointer<Port> src_port, Pointer<Port> dst_port, const UString& dst_address)
+ PortForward::PortForward(Pointer<Port> src_port, Pointer<Port> dst_port, const IPAddress& dst_address)
: FirewallObject("PortForward")
{
_src_port = src_port;
@@ -48,7 +48,7 @@ namespace firewalld
return _dst_port;
}
- const UString& PortForward::destinationAddress() const
+ const IPAddress& PortForward::destinationAddress() const
{
return _dst_address;
}
@@ -57,4 +57,4 @@ namespace firewalld
{
return _src_port->protocol();
}
-}
+} /* namespace firewalld */
diff --git a/src/Daemon/Firewall/PortForward.hpp b/src/Daemon/Firewall/PortForward.hpp
index ab13ceb..9a9569a 100644
--- a/src/Daemon/Firewall/PortForward.hpp
+++ b/src/Daemon/Firewall/PortForward.hpp
@@ -23,6 +23,7 @@
#include "Common/Types.hpp"
#include "Daemon/Firewall/Port.hpp"
#include "Daemon/Firewall/FirewallObject.hpp"
+#include "Daemon/Firewall/IPAddress.hpp"
namespace firewalld
{
@@ -30,17 +31,17 @@ namespace firewalld
{
public:
PortForward();
- PortForward(Pointer<Port> src_port, Pointer<Port> dst_port, const UString& dst_address);
+ PortForward(Pointer<Port> src_port, Pointer<Port> dst_port, const IPAddress& dst_address);
Pointer<const Port> sourcePort() const;
Pointer<const Port> destinationPort() const;
- const UString& destinationAddress() const;
+ const IPAddress& destinationAddress() const;
Port::Protocol protocol() const;
- protected:
+
private:
Pointer<Port> _src_port;
Pointer<Port> _dst_port;
- UString _dst_address;
+ IPAddress _dst_address;
};
}
diff --git a/src/Daemon/Firewall/Source.cpp b/src/Daemon/Firewall/Source.cpp
index ba23008..8195127 100644
--- a/src/Daemon/Firewall/Source.cpp
+++ b/src/Daemon/Firewall/Source.cpp
@@ -25,12 +25,23 @@ namespace firewalld
Source::Source()
: FirewallObject("Source")
{
+ _negated = false;
}
- Source::Source(const UString& identifier)
+ Source::Source(const UString& address_spec, bool negated)
: FirewallObject("Source")
{
- _identifier = identifier;
+ _address = IPAddress(address_spec);
+ _negated = negated;
+ _identifier = (_negated ? "!" : "") + _address.toUString();
+ }
+
+ Source::Source(const IPAddress& address, bool negated)
+ : FirewallObject("Source")
+ {
+ _address = address;
+ _negated = negated;
+ _identifier = (_negated ? "!" : "") + _address.toUString();
}
const UString& Source::identifier() const
@@ -38,8 +49,14 @@ namespace firewalld
return _identifier;
}
- const UString& Source::specification() const
+ bool Source::isNegated() const
{
- return _identifier;
+ return _negated;
}
+
+ const IPAddress& Source::address() const
+ {
+ return _address;
+ }
+
} /* namespace firewalld */
diff --git a/src/Daemon/Firewall/Source.hpp b/src/Daemon/Firewall/Source.hpp
index 7a6a947..e454418 100644
--- a/src/Daemon/Firewall/Source.hpp
+++ b/src/Daemon/Firewall/Source.hpp
@@ -22,6 +22,7 @@
#include "Common/Types.hpp"
#include "Daemon/Firewall/FirewallObject.hpp"
+#include "Daemon/Firewall/IPAddress.hpp"
namespace firewalld
{
@@ -31,14 +32,18 @@ namespace firewalld
{
public:
Source();
- Source(const UString& identifier);
+ Source(const UString& address_spec, bool negated = false);
+ Source(const IPAddress& address, bool negated = false);
const UString& identifier() const;
- const UString& specification() const;
+ bool isNegated() const;
+ const IPAddress& address() const;
protected:
private:
UString _identifier;
+ IPAddress _address;
+ bool _negated;
};
} /* namespace firewalld */
9 years, 4 months
[firewalld-recode] master: Added Port::toUString() method (558519a)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 558519aa9e51a67864ed6448490f41a5b76539b3
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 21:02:37 2014 +0100
Added Port::toUString() method
>---------------------------------------------------------------
src/Daemon/Firewall/Port.cpp | 5 +++++
src/Daemon/Firewall/Port.hpp | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/Daemon/Firewall/Port.cpp b/src/Daemon/Firewall/Port.cpp
index 3da0274..39463c4 100644
--- a/src/Daemon/Firewall/Port.cpp
+++ b/src/Daemon/Firewall/Port.cpp
@@ -59,6 +59,11 @@ namespace firewalld
}
}
+ UString Port::Range::toUString(const UString& range_separator) const
+ {
+ return toString(range_separator);
+ }
+
bool Port::Range::operator==(const Port::Range& rhs) const
{
return (min <= rhs.min && rhs.max <= max);
diff --git a/src/Daemon/Firewall/Port.hpp b/src/Daemon/Firewall/Port.hpp
index 3df2b2f..a98d1bd 100644
--- a/src/Daemon/Firewall/Port.hpp
+++ b/src/Daemon/Firewall/Port.hpp
@@ -44,6 +44,7 @@ namespace firewalld
bool isRange() const;
String toString(const UString& range_separator = "-") const;
+ UString toUString(const UString& range_separator = "-") const;
bool operator==(const Range& rhs) const;
bool operator<(const Range& rhs) const;
9 years, 4 months
[firewalld-recode] master: Added missing logic and methods to IPAddress class implementation (a34b45c)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit a34b45c2d053ac51d3c9c16374e0e9f394852f25
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 21:01:36 2014 +0100
Added missing logic and methods to IPAddress class implementation
>---------------------------------------------------------------
src/Daemon/Firewall/IPAddress.cpp | 59 +++++++++++++++++++++++++++++++-----
src/Daemon/Firewall/IPAddress.hpp | 4 ++
2 files changed, 54 insertions(+), 9 deletions(-)
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index f856290..789fc4a 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -27,13 +27,18 @@
namespace firewalld
{
+ IPAddress::IPAddress()
+ {
+ _protocol = Protocol::Unknown;
+ _is_network = false;
+ }
IPAddress::IPAddress(const UString& addr_spec)
{
UString ip;
UString net;
- //Protocol ip_protocol = Protocol::Unknown;
- //Protocol net_protocol = Protocol::Unknown;
+ Protocol addr_protocol = Protocol::Unknown;
+ Protocol net_protocol = Protocol::Unknown;
UString::size_type slash_pos = addr_spec.find_first_of('/');
@@ -53,16 +58,21 @@ namespace firewalld
if (::inet_pton(AF_INET, net.c_str(), &sa) != 1) {
}
- //net_protocol = Protocol::IPv4;
- } else if (regex_cidr->match(net)) {
+ else {
+ net_protocol = Protocol::IPv4;
+ }
+ }
+ else if (regex_cidr->match(net)) {
int cidr = stringToNumber<int>(net);
if (cidr < 0 || cidr > 32) {
throw std::runtime_error("Invalid IP address cidr subnet specification ");
}
- } else {
+ }
+ else {
throw std::runtime_error("Invalid IP address subnet specification");
}
- } else {
+ }
+ else {
_is_network = false;
ip = addr_spec;
}
@@ -73,11 +83,26 @@ namespace firewalld
if (::inet_pton(AF_INET6, ip.c_str(), &sa) != 1) {
throw std::runtime_error("Invalid IP address");
}
+ else {
+ addr_protocol = Protocol::IPv6;
+ }
+ }
+ else {
+ addr_protocol = Protocol::IPv4;
+ }
+
+ if (_is_network) {
+ if (addr_protocol == Protocol::IPv6
+ && net_protocol == Protocol::IPv4) {
+ throw std::runtime_error("Invalid network specification");
+ }
}
- //
- // If we got here, it's a correct IP address spec
- //
+
+ /*
+ * If we got here, it's a correct IP address/network spec
+ */
_addr_spec = addr_spec;
+ _protocol = addr_protocol;
}
bool IPAddress::isNetwork() const
@@ -100,4 +125,20 @@ namespace firewalld
return _addr_spec.raw();
}
+ IPAddress::operator bool() const
+ {
+ return (!_addr_spec.empty()
+ || _protocol == Protocol::Unknown);
+ }
+
+ IPAddress::operator String() const
+ {
+ return toString();
+ }
+
+ IPAddress::operator UString() const
+ {
+ return toUString();
+ }
+
} /* namespace firewalld */
diff --git a/src/Daemon/Firewall/IPAddress.hpp b/src/Daemon/Firewall/IPAddress.hpp
index be2b785..36ced51 100644
--- a/src/Daemon/Firewall/IPAddress.hpp
+++ b/src/Daemon/Firewall/IPAddress.hpp
@@ -32,6 +32,7 @@ namespace firewalld
Unknown
};
+ IPAddress();
IPAddress(const UString& addr_spec);
bool isNetwork() const;
@@ -39,6 +40,9 @@ namespace firewalld
const UString& toUString() const;
const String& toString() const;
+ operator bool() const;
+ operator String() const;
+ operator UString() const;
private:
UString _addr_spec;
9 years, 4 months
[firewalld-recode] master: Fixed transaction allocation in Firewall::getWritableZone (74de368)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 74de3683c1ab9ccb943810d6cd353e67ff5ffb64
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 20:57:19 2014 +0100
Fixed transaction allocation in Firewall::getWritableZone
>---------------------------------------------------------------
src/Daemon/Firewall/Firewall.cpp | 46 +++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/src/Daemon/Firewall/Firewall.cpp b/src/Daemon/Firewall/Firewall.cpp
index 13864a9..5832560 100644
--- a/src/Daemon/Firewall/Firewall.cpp
+++ b/src/Daemon/Firewall/Firewall.cpp
@@ -166,26 +166,27 @@ namespace firewalld
{
Pointer<Zone> zone = PointerMapOp::findOne(_zone_map, name);
- if (zone != nullptr) {
- return zone;
- }
-
- Pointer<const Zone> zone_definition = FirewallD::instance()->lookupZone(name);
-
- if (zone_definition == nullptr) {
- throw FirewallError("INVALID_ZONE", "Zone \"" + name + "\" not defined");
- }
+ if (zone == nullptr) {
+ /*
+ * The requested zone either doesn't exist or this is the
+ * first modification request.
+ */
+ Pointer<const Zone> zone_definition = FirewallD::instance()->lookupZone(name);
- /*
- * Create a deep copy of the zone definition object and
- * add it to the internal firewall state. All runtime data
- * will be tracked in this instance.
- */
- zone = makePointer<Zone>(*zone_definition);
- _zone_map[name] = zone;
+ if (zone_definition == nullptr) {
+ throw FirewallError("INVALID_ZONE", "Zone \"" + name + "\" not defined");
+ }
- LOG(DEBUG) << "Zone \"" << name << "\" copied to the internal firewall state";
+ /*
+ * Create a deep copy of the zone definition object and
+ * add it to the internal firewall state. All runtime data
+ * will be tracked in this instance.
+ */
+ zone = makePointer<Zone>(*zone_definition);
+ _zone_map[name] = zone;
+ LOG(DEBUG) << "Zone \"" << name << "\" copied to the internal firewall state";
+ }
/*
* Since a writable zone was requested, we assume that
* modification will be made to this zone and they may
@@ -201,7 +202,12 @@ namespace firewalld
if (!zone->hasTransaction() && !without_transaction) {
Pointer<Transaction> transaction = createTransaction();
zone->setTransaction(transaction);
- LOG(DEBUG) << "Crated a new transaction for zone \"" << zone->name() << "\"";
+ LOG(DEBUG) << "Created a new transaction for zone \"" << zone->name() << "\"";
+ } else {
+ LOG(DEBUG) << "No transaction created for dirty zone \"" << zone->name() << "\"";
+ LOG(DEBUG) << "hasTransaction()=" << zone->hasTransaction()
+ << " "
+ << "without_transaction=" << without_transaction;
}
return zone;
9 years, 4 months
[firewalld-recode] master: Extended the numberToString function (959b7a3)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 959b7a39e4c70415e38914ad1435a4a30c12fe9b
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Tue Dec 9 17:49:27 2014 +0100
Extended the numberToString function
It's now possible to specify a prefix and the numeric
base of the string representation of the number.
>---------------------------------------------------------------
src/Common/Utility.hpp | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/Common/Utility.hpp b/src/Common/Utility.hpp
index dd12b64..cf0b590 100644
--- a/src/Common/Utility.hpp
+++ b/src/Common/Utility.hpp
@@ -27,6 +27,7 @@
#include <vector>
#include <sstream>
#include <regex>
+#include <iomanip>
#include <sys/types.h>
#include <dirent.h>
@@ -104,9 +105,13 @@ namespace firewalld
* representation.
*/
template<typename T>
- String numberToString(T number)
+ String numberToString(T number, const String& prefix = String(), int base = 10)
{
std::ostringstream ss;
+ if (!prefix.empty()) {
+ ss << prefix;
+ }
+ ss << std::setbase(base);
ss << number;
return ss.str();
}
9 years, 4 months
[firewalld-recode] master: Include build-config.h from all source files (bfad949)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit bfad9495694b2b57d6c686b0de178cba35fece84
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Mon Dec 8 15:16:45 2014 +0100
Include build-config.h from all source files
>---------------------------------------------------------------
configure.ac | 2 +-
src/Common/Logging.cpp | 2 ++
src/Common/Logging.hpp | 1 +
src/Common/Types.hpp | 1 +
src/Common/Utility.cpp | 2 ++
src/Common/Utility.hpp | 1 +
src/Common/XMLStorage.cpp | 2 ++
src/Common/XMLStorage.hpp | 1 +
src/Common/glibmm_ext.cpp | 2 ++
src/Common/glibmm_ext.hpp | 1 +
src/Daemon/Backends/Linux/EBTables.cpp | 2 ++
src/Daemon/Backends/Linux/EBTables.hpp | 1 +
src/Daemon/Backends/Linux/IPTables.cpp | 2 ++
src/Daemon/Backends/Linux/IPTables.hpp | 1 +
src/Daemon/Backends/Linux/KernelModule.cpp | 2 ++
src/Daemon/Backends/Linux/KernelModule.hpp | 1 +
src/Daemon/Backends/Linux/Sysctl.cpp | 2 ++
src/Daemon/Backends/Linux/Sysctl.hpp | 1 +
src/Daemon/Backends/Linux/XTables.cpp | 2 ++
src/Daemon/Backends/Linux/XTables.hpp | 1 +
src/Daemon/Backends/LinuxXTables.cpp | 2 ++
src/Daemon/Backends/LinuxXTables.hpp | 1 +
src/Daemon/CLI.cpp | 2 ++
src/Daemon/CLI.hpp | 2 ++
src/Daemon/DBus.cpp | 2 ++
src/Daemon/DBus.hpp | 1 +
src/Daemon/Exceptions.hpp | 1 +
src/Daemon/Firewall/Backend.cpp | 2 ++
src/Daemon/Firewall/Backend.hpp | 1 +
src/Daemon/Firewall/BackendOpTable.hpp | 1 +
src/Daemon/Firewall/Firewall.cpp | 2 ++
src/Daemon/Firewall/Firewall.hpp | 1 +
src/Daemon/Firewall/FirewallObject.hpp | 1 +
src/Daemon/Firewall/ICMPType.cpp | 2 ++
src/Daemon/Firewall/ICMPType.hpp | 1 +
src/Daemon/Firewall/IPAddress.cpp | 2 ++
src/Daemon/Firewall/IPAddress.hpp | 1 +
src/Daemon/Firewall/Interface.cpp | 2 ++
src/Daemon/Firewall/Interface.hpp | 1 +
src/Daemon/Firewall/Port.cpp | 2 ++
src/Daemon/Firewall/Port.hpp | 1 +
src/Daemon/Firewall/PortForward.cpp | 2 ++
src/Daemon/Firewall/PortForward.hpp | 1 +
src/Daemon/Firewall/RichLanguageParser/Lexer.qx | 4 ++++
src/Daemon/Firewall/RichLanguageParser/Parser.y | 2 ++
src/Daemon/Firewall/RichRule.cpp | 2 ++
src/Daemon/Firewall/RichRule.hpp | 1 +
src/Daemon/Firewall/RichRuleParser.cpp | 3 ++-
src/Daemon/Firewall/RichRuleParser.hpp | 1 +
src/Daemon/Firewall/RichRules/ForwardPortRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/ForwardPortRule.hpp | 1 +
src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp | 1 +
src/Daemon/Firewall/RichRules/MasqueradeRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/MasqueradeRule.hpp | 1 +
src/Daemon/Firewall/RichRules/PortRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/PortRule.hpp | 1 +
src/Daemon/Firewall/RichRules/ProtocolRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/ProtocolRule.hpp | 1 +
src/Daemon/Firewall/RichRules/ServiceRule.cpp | 2 ++
src/Daemon/Firewall/RichRules/ServiceRule.hpp | 1 +
src/Daemon/Firewall/Service.cpp | 2 ++
src/Daemon/Firewall/Service.hpp | 1 +
src/Daemon/Firewall/Source.cpp | 2 ++
src/Daemon/Firewall/Source.hpp | 1 +
src/Daemon/Firewall/Transaction.cpp | 2 ++
src/Daemon/Firewall/Transaction.hpp | 1 +
src/Daemon/Firewall/Zone.cpp | 2 ++
src/Daemon/Firewall/Zone.hpp | 1 +
src/Daemon/Firewall/ZoneObject.hpp | 1 +
src/Daemon/FirewallD.cpp | 2 ++
src/Daemon/FirewallD.hpp | 1 +
src/Daemon/GlobalVariables.hpp | 1 +
src/Daemon/LockdownWhitelist.cpp | 2 ++
src/Daemon/LockdownWhitelist.hpp | 1 +
src/Daemon/SignalHandler.cpp | 2 ++
src/Daemon/SignalHandler.hpp | 1 +
src/Daemon/main.cpp | 2 ++
78 files changed, 118 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae7f3cc..3693305 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ([2.69])
AC_INIT([firewalld], [0.0], [bugs(a)firewalld.org])
AC_CONFIG_SRCDIR([src/])
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([src/build-config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
diff --git a/src/Common/Logging.cpp b/src/Common/Logging.cpp
index 76a0ec9..2edc850 100644
--- a/src/Common/Logging.cpp
+++ b/src/Common/Logging.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Logging.hpp"
namespace firewalld
diff --git a/src/Common/Logging.hpp b/src/Common/Logging.hpp
index b48aaac..0e19742 100644
--- a/src/Common/Logging.hpp
+++ b/src/Common/Logging.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_LOGGING_H_
#define _FIREWALLD_LOGGING_H_
+#include <build-config.h>
/**
* EasyLogging compile time options.
diff --git a/src/Common/Types.hpp b/src/Common/Types.hpp
index 0d06762..bdd1401 100644
--- a/src/Common/Types.hpp
+++ b/src/Common/Types.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_TYPES_H_
#define _FIREWALLD_TYPES_H_
+#include <build-config.h>
#include <glibmm.h>
#include <string.h>
diff --git a/src/Common/Utility.cpp b/src/Common/Utility.cpp
index 9cf263f..83c5343 100644
--- a/src/Common/Utility.cpp
+++ b/src/Common/Utility.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Utility.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Common/Utility.hpp b/src/Common/Utility.hpp
index cbbf720..dd12b64 100644
--- a/src/Common/Utility.hpp
+++ b/src/Common/Utility.hpp
@@ -18,6 +18,7 @@
//
#ifndef _UTILITY_H_
#define _UTILITY_H_
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Common/XMLStorage.cpp b/src/Common/XMLStorage.cpp
index c5d922c..e08ecb6 100644
--- a/src/Common/XMLStorage.cpp
+++ b/src/Common/XMLStorage.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/XMLStorage.hpp"
#include <expat.h>
diff --git a/src/Common/XMLStorage.hpp b/src/Common/XMLStorage.hpp
index 1ddcaac..09f44f9 100644
--- a/src/Common/XMLStorage.hpp
+++ b/src/Common/XMLStorage.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_XMLSTORAGE_HPP
#define FIREWALLD_XMLSTORAGE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
diff --git a/src/Common/glibmm_ext.cpp b/src/Common/glibmm_ext.cpp
index 8d9cc53..ccd7c36 100644
--- a/src/Common/glibmm_ext.cpp
+++ b/src/Common/glibmm_ext.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/glibmm_ext.hpp"
#include "Common/Types.hpp"
diff --git a/src/Common/glibmm_ext.hpp b/src/Common/glibmm_ext.hpp
index 029551c..c6f5592 100644
--- a/src/Common/glibmm_ext.hpp
+++ b/src/Common/glibmm_ext.hpp
@@ -18,6 +18,7 @@
//
#ifndef _GLIBMM_EXT_H_
#define _GLIBMM_EXT_H_
+#include <build-config.h>
#include "Common/Types.hpp"
#include <glibmm.h>
diff --git a/src/Daemon/Backends/Linux/EBTables.cpp b/src/Daemon/Backends/Linux/EBTables.cpp
index c00ab5b..975666a 100644
--- a/src/Daemon/Backends/Linux/EBTables.cpp
+++ b/src/Daemon/Backends/Linux/EBTables.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Backends/Linux/EBTables.hpp"
#include "Daemon/Backends/Linux/XTables.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/Backends/Linux/EBTables.hpp b/src/Daemon/Backends/Linux/EBTables.hpp
index 1398ab4..bc99f2b 100644
--- a/src/Daemon/Backends/Linux/EBTables.hpp
+++ b/src/Daemon/Backends/Linux/EBTables.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_EBTABLES_HPP
#define FIREWALLD_EBTABLES_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Backends/Linux/XTables.hpp"
diff --git a/src/Daemon/Backends/Linux/IPTables.cpp b/src/Daemon/Backends/Linux/IPTables.cpp
index 677441e..76c45c6 100644
--- a/src/Daemon/Backends/Linux/IPTables.cpp
+++ b/src/Daemon/Backends/Linux/IPTables.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Backends/Linux/IPTables.hpp"
#include "Daemon/Backends/Linux/XTables.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/Backends/Linux/IPTables.hpp b/src/Daemon/Backends/Linux/IPTables.hpp
index abd9593..223ef3e 100644
--- a/src/Daemon/Backends/Linux/IPTables.hpp
+++ b/src/Daemon/Backends/Linux/IPTables.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_IPTABLES_HPP
#define FIREWALLD_IPTABLES_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Backends/Linux/XTables.hpp"
diff --git a/src/Daemon/Backends/Linux/KernelModule.cpp b/src/Daemon/Backends/Linux/KernelModule.cpp
index 3d38df5..0d348c6 100644
--- a/src/Daemon/Backends/Linux/KernelModule.cpp
+++ b/src/Daemon/Backends/Linux/KernelModule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Logging.hpp"
#include "Daemon/Backends/Linux/KernelModule.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/Backends/Linux/KernelModule.hpp b/src/Daemon/Backends/Linux/KernelModule.hpp
index 481f42d..2853845 100644
--- a/src/Daemon/Backends/Linux/KernelModule.hpp
+++ b/src/Daemon/Backends/Linux/KernelModule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_KERNELMODULE_HPP
#define FIREWALLD_KERNELMODULE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include <regex.h>
diff --git a/src/Daemon/Backends/Linux/Sysctl.cpp b/src/Daemon/Backends/Linux/Sysctl.cpp
index 16906af..4553303 100644
--- a/src/Daemon/Backends/Linux/Sysctl.cpp
+++ b/src/Daemon/Backends/Linux/Sysctl.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Backends/Linux/Sysctl.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Backends/Linux/Sysctl.hpp b/src/Daemon/Backends/Linux/Sysctl.hpp
index 437be95..3f987e5 100644
--- a/src/Daemon/Backends/Linux/Sysctl.hpp
+++ b/src/Daemon/Backends/Linux/Sysctl.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_SYSCTL_HPP_
#define _FIREWALLD_SYSCTL_HPP_
+#include <build-config.h>
#include "Common/Types.hpp"
diff --git a/src/Daemon/Backends/Linux/XTables.cpp b/src/Daemon/Backends/Linux/XTables.cpp
index 8cfc1b3..a375f3b 100644
--- a/src/Daemon/Backends/Linux/XTables.cpp
+++ b/src/Daemon/Backends/Linux/XTables.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Backends/Linux/XTables.hpp"
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Backends/Linux/XTables.hpp b/src/Daemon/Backends/Linux/XTables.hpp
index 1c9a428..075804a 100644
--- a/src/Daemon/Backends/Linux/XTables.hpp
+++ b/src/Daemon/Backends/Linux/XTables.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_XTABLES_HPP
#define FIREWALLD_XTABLES_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
diff --git a/src/Daemon/Backends/LinuxXTables.cpp b/src/Daemon/Backends/LinuxXTables.cpp
index 29dfdd5..8efbbf3 100644
--- a/src/Daemon/Backends/LinuxXTables.cpp
+++ b/src/Daemon/Backends/LinuxXTables.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "LinuxXTables.hpp"
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Backends/LinuxXTables.hpp b/src/Daemon/Backends/LinuxXTables.hpp
index 2b54092..a865898 100644
--- a/src/Daemon/Backends/LinuxXTables.hpp
+++ b/src/Daemon/Backends/LinuxXTables.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_BACKENDS_LINUXXTABLES_HPP
#define FIREWALLD_BACKENDS_LINUXXTABLES_HPP
+#include <build-config.h>
#include "Daemon/Backends/Linux/IPTables.hpp"
#include "Daemon/Backends/Linux/EBTables.hpp"
diff --git a/src/Daemon/CLI.cpp b/src/Daemon/CLI.cpp
index e56c3ae..3b352bd 100644
--- a/src/Daemon/CLI.cpp
+++ b/src/Daemon/CLI.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/CLI.hpp"
#include "Common/Logging.hpp"
#include "Common/glibmm_ext.hpp"
diff --git a/src/Daemon/CLI.hpp b/src/Daemon/CLI.hpp
index b2d6a30..8817262 100644
--- a/src/Daemon/CLI.hpp
+++ b/src/Daemon/CLI.hpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Types.hpp"
#include <glibmm.h>
diff --git a/src/Daemon/DBus.cpp b/src/Daemon/DBus.cpp
index 4f53787..82d9190 100644
--- a/src/Daemon/DBus.cpp
+++ b/src/Daemon/DBus.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Logging.hpp"
#include "Common/Types.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/DBus.hpp b/src/Daemon/DBus.hpp
index d4c349f..46d3770 100644
--- a/src/Daemon/DBus.hpp
+++ b/src/Daemon/DBus.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_DBUS_H_
#define _FIREWALLD_DBUS_H_
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Exceptions.hpp b/src/Daemon/Exceptions.hpp
index d0122c6..cb1b25a 100644
--- a/src/Daemon/Exceptions.hpp
+++ b/src/Daemon/Exceptions.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_EXCEPTIONS_HPP
#define FIREWALLD_EXCEPTIONS_HPP
+#include <build-config.h>
#include <stdexcept>
diff --git a/src/Daemon/Firewall/Backend.cpp b/src/Daemon/Firewall/Backend.cpp
index d8b0636..7be385b 100644
--- a/src/Daemon/Firewall/Backend.cpp
+++ b/src/Daemon/Firewall/Backend.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Types.hpp"
#include "Common/Utility.hpp"
#include "Daemon/Firewall/Transaction.hpp"
diff --git a/src/Daemon/Firewall/Backend.hpp b/src/Daemon/Firewall/Backend.hpp
index 52d6162..ea84291 100644
--- a/src/Daemon/Firewall/Backend.hpp
+++ b/src/Daemon/Firewall/Backend.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_BACKEND_HPP
#define FIREWALLD_FIREWALL_BACKEND_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/Transaction.hpp"
diff --git a/src/Daemon/Firewall/BackendOpTable.hpp b/src/Daemon/Firewall/BackendOpTable.hpp
index 0f07976..b5a4b9f 100644
--- a/src/Daemon/Firewall/BackendOpTable.hpp
+++ b/src/Daemon/Firewall/BackendOpTable.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_BACKENDOPTABLE_HPP
#define FIREWALLD_FIREWALL_BACKENDOPTABLE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
diff --git a/src/Daemon/Firewall/Firewall.cpp b/src/Daemon/Firewall/Firewall.cpp
index cb08679..13864a9 100644
--- a/src/Daemon/Firewall/Firewall.cpp
+++ b/src/Daemon/Firewall/Firewall.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/FirewallD.hpp"
#include "Daemon/Firewall/Firewall.hpp"
#include "Daemon/Firewall/Backend.hpp"
diff --git a/src/Daemon/Firewall/Firewall.hpp b/src/Daemon/Firewall/Firewall.hpp
index b7ac1b6..8d0d742 100644
--- a/src/Daemon/Firewall/Firewall.hpp
+++ b/src/Daemon/Firewall/Firewall.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALL_H_
#define _FIREWALL_H_
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/Zone.hpp"
diff --git a/src/Daemon/Firewall/FirewallObject.hpp b/src/Daemon/Firewall/FirewallObject.hpp
index 25b216b..2909d60 100644
--- a/src/Daemon/Firewall/FirewallObject.hpp
+++ b/src/Daemon/Firewall/FirewallObject.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALLOBJECT_HPP
#define FIREWALLD_FIREWALLOBJECT_HPP
+#include <build-config.h>
namespace firewalld
{
diff --git a/src/Daemon/Firewall/ICMPType.cpp b/src/Daemon/Firewall/ICMPType.cpp
index 842aa8e..4a8d896 100644
--- a/src/Daemon/Firewall/ICMPType.cpp
+++ b/src/Daemon/Firewall/ICMPType.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/ICMPType.hpp"
#include "Common/Utility.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Firewall/ICMPType.hpp b/src/Daemon/Firewall/ICMPType.hpp
index 267d7eb..11f8f79 100644
--- a/src/Daemon/Firewall/ICMPType.hpp
+++ b/src/Daemon/Firewall/ICMPType.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_ICMPTYPE_HPP
#define FIREWALLD_FIREWALL_ICMPTYPE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Common/XMLStorage.hpp"
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index 2f31e5d..f856290 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Types.hpp"
#include "Common/Utility.hpp"
#include "IPAddress.hpp"
diff --git a/src/Daemon/Firewall/IPAddress.hpp b/src/Daemon/Firewall/IPAddress.hpp
index 1c4bb72..be2b785 100644
--- a/src/Daemon/Firewall/IPAddress.hpp
+++ b/src/Daemon/Firewall/IPAddress.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_IPADDRESS_HPP
#define FIREWALLD_FIREWALL_IPADDRESS_HPP
+#include <build-config.h>
namespace firewalld
{
diff --git a/src/Daemon/Firewall/Interface.cpp b/src/Daemon/Firewall/Interface.cpp
index c34dc8d..a6e6165 100644
--- a/src/Daemon/Firewall/Interface.cpp
+++ b/src/Daemon/Firewall/Interface.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/Interface.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/Interface.hpp b/src/Daemon/Firewall/Interface.hpp
index 06492ea..ca568c9 100644
--- a/src/Daemon/Firewall/Interface.hpp
+++ b/src/Daemon/Firewall/Interface.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_INTERFACE_HPP
#define FIREWALLD_FIREWALL_INTERFACE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/FirewallObject.hpp"
diff --git a/src/Daemon/Firewall/Port.cpp b/src/Daemon/Firewall/Port.cpp
index 4267b19..3da0274 100644
--- a/src/Daemon/Firewall/Port.cpp
+++ b/src/Daemon/Firewall/Port.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/Port.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/Firewall/Port.hpp b/src/Daemon/Firewall/Port.hpp
index 8d1a744..3df2b2f 100644
--- a/src/Daemon/Firewall/Port.hpp
+++ b/src/Daemon/Firewall/Port.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_PORT_HPP
#define FIREWALLD_FIREWALL_PORT_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/FirewallObject.hpp"
diff --git a/src/Daemon/Firewall/PortForward.cpp b/src/Daemon/Firewall/PortForward.cpp
index 4dc4408..d32470e 100644
--- a/src/Daemon/Firewall/PortForward.cpp
+++ b/src/Daemon/Firewall/PortForward.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/PortForward.hpp"
#include "Daemon/Firewall/Port.hpp"
diff --git a/src/Daemon/Firewall/PortForward.hpp b/src/Daemon/Firewall/PortForward.hpp
index 0c67165..ab13ceb 100644
--- a/src/Daemon/Firewall/PortForward.hpp
+++ b/src/Daemon/Firewall/PortForward.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_FORWARDPORT_HPP
#define FIREWALLD_FIREWALL_FORWARDPORT_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/Port.hpp"
diff --git a/src/Daemon/Firewall/RichLanguageParser/Lexer.qx b/src/Daemon/Firewall/RichLanguageParser/Lexer.qx
index 7d56a8e..06dfa50 100644
--- a/src/Daemon/Firewall/RichLanguageParser/Lexer.qx
+++ b/src/Daemon/Firewall/RichLanguageParser/Lexer.qx
@@ -1,3 +1,7 @@
+header {
+ #include <build-config.h>
+}
+
start = RICH;
mode RICH :
diff --git a/src/Daemon/Firewall/RichLanguageParser/Parser.y b/src/Daemon/Firewall/RichLanguageParser/Parser.y
index aaafce0..8d1f338 100644
--- a/src/Daemon/Firewall/RichLanguageParser/Parser.y
+++ b/src/Daemon/Firewall/RichLanguageParser/Parser.y
@@ -1,4 +1,6 @@
%include {
+ #include <build-config.h>
+
#include "Common/Logging.hpp"
#include "Common/Types.hpp"
#include "Daemon/Firewall/RichRuleParser.hpp"
diff --git a/src/Daemon/Firewall/RichRule.cpp b/src/Daemon/Firewall/RichRule.cpp
index 744dea3..311f24c 100644
--- a/src/Daemon/Firewall/RichRule.cpp
+++ b/src/Daemon/Firewall/RichRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "RichRule.hpp"
#include "Common/Logging.hpp"
#include <stdexcept>
diff --git a/src/Daemon/Firewall/RichRule.hpp b/src/Daemon/Firewall/RichRule.hpp
index 3c026d1..a7e89a6 100644
--- a/src/Daemon/Firewall/RichRule.hpp
+++ b/src/Daemon/Firewall/RichRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_RICHRULE_HPP
#define FIREWALLD_FIREWALL_RICHRULE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/IPAddress.hpp"
diff --git a/src/Daemon/Firewall/RichRuleParser.cpp b/src/Daemon/Firewall/RichRuleParser.cpp
index fb5da96..6bb4541 100644
--- a/src/Daemon/Firewall/RichRuleParser.cpp
+++ b/src/Daemon/Firewall/RichRuleParser.cpp
@@ -16,8 +16,9 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
-#include "RichRuleParser.hpp"
+#include <build-config.h>
+#include "RichRuleParser.hpp"
#include "RichRule.hpp"
#include "RichRules/ServiceRule.hpp"
#include "RichRules/PortRule.hpp"
diff --git a/src/Daemon/Firewall/RichRuleParser.hpp b/src/Daemon/Firewall/RichRuleParser.hpp
index 29fedd9..0297fc8 100644
--- a/src/Daemon/Firewall/RichRuleParser.hpp
+++ b/src/Daemon/Firewall/RichRuleParser.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_RICHRULEPARSER_HPP
#define FIREWALLD_FIREWALL_RICHRULEPARSER_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp b/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
index a900782..db5fc29 100644
--- a/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "ForwardPortRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp b/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
index fa356e1..fab9374 100644
--- a/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_FORWARDPORTRULE_HPP
#define FIREWALLD_FIREWALL_FORWARDPORTRULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
#include "Daemon/Firewall/PortForward.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp b/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
index 6f7a9b9..90c73f1 100644
--- a/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "ICMPBlockRule.hpp"
#include "Daemon/FirewallD.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp b/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
index 65fba5c..d490f95 100644
--- a/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_ICMPBLOCKRULE_HPP
#define FIREWALLD_FIREWALL_ICMPBLOCKRULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
#include "Daemon/Firewall/ICMPType.hpp"
diff --git a/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp b/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
index 9d13361..9aa6ae7 100644
--- a/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
+++ b/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "MasqueradeRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp b/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
index ad30331..5433815 100644
--- a/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
+++ b/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_MASQUERADERULE_HPP
#define FIREWALLD_FIREWALL_MASQUERADERULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
diff --git a/src/Daemon/Firewall/RichRules/PortRule.cpp b/src/Daemon/Firewall/RichRules/PortRule.cpp
index 19944ee..2c6689d 100644
--- a/src/Daemon/Firewall/RichRules/PortRule.cpp
+++ b/src/Daemon/Firewall/RichRules/PortRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "PortRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/PortRule.hpp b/src/Daemon/Firewall/RichRules/PortRule.hpp
index 0cc9017..489db28 100644
--- a/src/Daemon/Firewall/RichRules/PortRule.hpp
+++ b/src/Daemon/Firewall/RichRules/PortRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_PORTRULE_HPP
#define FIREWALLD_FIREWALL_PORTRULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
#include "Daemon/Firewall/Port.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ProtocolRule.cpp b/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
index 69ee634..ab3ae5a 100644
--- a/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "ProtocolRule.hpp"
#include "Common/Utility.hpp"
#include <netdb.h>
diff --git a/src/Daemon/Firewall/RichRules/ProtocolRule.hpp b/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
index 73baad3..06a13e8 100644
--- a/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_PROTOCOLRULE_HPP
#define FIREWALLD_FIREWALL_PROTOCOLRULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ServiceRule.cpp b/src/Daemon/Firewall/RichRules/ServiceRule.cpp
index fcd7b66..82bd03a 100644
--- a/src/Daemon/Firewall/RichRules/ServiceRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ServiceRule.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "ServiceRule.hpp"
#include "Daemon/FirewallD.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ServiceRule.hpp b/src/Daemon/Firewall/RichRules/ServiceRule.hpp
index 7d38ad0..eb7cbe2 100644
--- a/src/Daemon/Firewall/RichRules/ServiceRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ServiceRule.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_SERVICERULE_HPP
#define FIREWALLD_FIREWALL_SERVICERULE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/RichRule.hpp"
#include "Daemon/Firewall/Service.hpp"
diff --git a/src/Daemon/Firewall/Service.cpp b/src/Daemon/Firewall/Service.cpp
index ec8f32c..6b68c88 100644
--- a/src/Daemon/Firewall/Service.cpp
+++ b/src/Daemon/Firewall/Service.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/Service.hpp"
#include "Common/Utility.hpp"
#include "Daemon/Firewall/Port.hpp"
diff --git a/src/Daemon/Firewall/Service.hpp b/src/Daemon/Firewall/Service.hpp
index c59db9f..362f7e5 100644
--- a/src/Daemon/Firewall/Service.hpp
+++ b/src/Daemon/Firewall/Service.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_SERVICE_HPP
#define FIREWALLD_FIREWALL_SERVICE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Common/XMLStorage.hpp"
diff --git a/src/Daemon/Firewall/Source.cpp b/src/Daemon/Firewall/Source.cpp
index a663c36..ba23008 100644
--- a/src/Daemon/Firewall/Source.cpp
+++ b/src/Daemon/Firewall/Source.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/Source.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/Source.hpp b/src/Daemon/Firewall/Source.hpp
index 7624184..7a6a947 100644
--- a/src/Daemon/Firewall/Source.hpp
+++ b/src/Daemon/Firewall/Source.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_SOURCE_HPP
#define FIREWALLD_FIREWALL_SOURCE_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Firewall/FirewallObject.hpp"
diff --git a/src/Daemon/Firewall/Transaction.cpp b/src/Daemon/Firewall/Transaction.cpp
index 80b51a3..05499c8 100644
--- a/src/Daemon/Firewall/Transaction.cpp
+++ b/src/Daemon/Firewall/Transaction.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Transaction.hpp"
#include <stdexcept>
diff --git a/src/Daemon/Firewall/Transaction.hpp b/src/Daemon/Firewall/Transaction.hpp
index 32e34da..02ebd1c 100644
--- a/src/Daemon/Firewall/Transaction.hpp
+++ b/src/Daemon/Firewall/Transaction.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_TRANSACTION_HPP
#define FIREWALLD_FIREWALL_TRANSACTION_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/Exceptions.hpp"
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index 3853aab..46e5ca2 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/Firewall/Zone.hpp"
#include "Common/Utility.hpp"
#include "Daemon/FirewallD.hpp"
diff --git a/src/Daemon/Firewall/Zone.hpp b/src/Daemon/Firewall/Zone.hpp
index cf903a6..898ea95 100644
--- a/src/Daemon/Firewall/Zone.hpp
+++ b/src/Daemon/Firewall/Zone.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_ZONE_HPP
#define FIREWALLD_FIREWALL_ZONE_HPP
+#include <build-config.h>
#include "Daemon/Firewall/Interface.hpp"
#include "Daemon/Firewall/Service.hpp"
diff --git a/src/Daemon/Firewall/ZoneObject.hpp b/src/Daemon/Firewall/ZoneObject.hpp
index f7e7c02..8f26261 100644
--- a/src/Daemon/Firewall/ZoneObject.hpp
+++ b/src/Daemon/Firewall/ZoneObject.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_FIREWALL_ZONEOBJECT_HPP
#define FIREWALLD_FIREWALL_ZONEOBJECT_HPP
+#include <build-config.h>
#include "Daemon/Firewall/FirewallObject.hpp"
diff --git a/src/Daemon/FirewallD.cpp b/src/Daemon/FirewallD.cpp
index cabe05b..915236d 100644
--- a/src/Daemon/FirewallD.cpp
+++ b/src/Daemon/FirewallD.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/FirewallD.hpp"
#include "Daemon/Firewall/Firewall.hpp"
#include "Daemon/DBus.hpp"
diff --git a/src/Daemon/FirewallD.hpp b/src/Daemon/FirewallD.hpp
index fbec33a..a162795 100644
--- a/src/Daemon/FirewallD.hpp
+++ b/src/Daemon/FirewallD.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_H_
#define _FIREWALLD_H_
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Daemon/DBus.hpp"
diff --git a/src/Daemon/GlobalVariables.hpp b/src/Daemon/GlobalVariables.hpp
index 7f820af..6a69454 100644
--- a/src/Daemon/GlobalVariables.hpp
+++ b/src/Daemon/GlobalVariables.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_GLOBAL_VARIABLES_H_
#define _FIREWALLD_GLOBAL_VARIABLES_H_
+#include <build-config.h>
namespace firewalld
{
diff --git a/src/Daemon/LockdownWhitelist.cpp b/src/Daemon/LockdownWhitelist.cpp
index 9dd4ec1..4fcd1ef 100644
--- a/src/Daemon/LockdownWhitelist.cpp
+++ b/src/Daemon/LockdownWhitelist.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/LockdownWhitelist.hpp"
#include "Daemon/Exceptions.hpp"
#include "Common/Utility.hpp"
diff --git a/src/Daemon/LockdownWhitelist.hpp b/src/Daemon/LockdownWhitelist.hpp
index 0848cc6..525938f 100644
--- a/src/Daemon/LockdownWhitelist.hpp
+++ b/src/Daemon/LockdownWhitelist.hpp
@@ -18,6 +18,7 @@
//
#ifndef FIREWALLD_LOCKDOWNWHITELIST_HPP
#define FIREWALLD_LOCKDOWNWHITELIST_HPP
+#include <build-config.h>
#include "Common/Types.hpp"
#include "Common/XMLStorage.hpp"
diff --git a/src/Daemon/SignalHandler.cpp b/src/Daemon/SignalHandler.cpp
index c06558a..ed6c4d8 100644
--- a/src/Daemon/SignalHandler.cpp
+++ b/src/Daemon/SignalHandler.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Daemon/SignalHandler.hpp"
#include "Common/Logging.hpp"
#include "Daemon/GlobalVariables.hpp"
diff --git a/src/Daemon/SignalHandler.hpp b/src/Daemon/SignalHandler.hpp
index e37ed4b..98e820b 100644
--- a/src/Daemon/SignalHandler.hpp
+++ b/src/Daemon/SignalHandler.hpp
@@ -18,6 +18,7 @@
//
#ifndef _FIREWALLD_SIGNAL_HANDLER_H_
#define _FIREWALLD_SIGNAL_HANDLER_H_
+#include <build-config.h>
#include <glibmm.h>
diff --git a/src/Daemon/main.cpp b/src/Daemon/main.cpp
index eb41c45..5a32432 100644
--- a/src/Daemon/main.cpp
+++ b/src/Daemon/main.cpp
@@ -16,6 +16,8 @@
//
// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
//
+#include <build-config.h>
+
#include "Common/Logging.hpp"
#include "Common/Utility.hpp"
#include "Daemon/FirewallD.hpp"
9 years, 5 months
[firewalld-recode] master: Fix compiler warnings. (40bc6b6)
by jpopelka@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 40bc6b68c7ea1670c4b4015a3a5fc4a985d3e314
Author: Jiri Popelka <jpopelka(a)redhat.com>
Date: Sat Dec 6 14:51:05 2014 +0100
Fix compiler warnings.
to be able to build with 'all warnings being treated as errors', like:
./autogen.sh; rpm -E %configure | bash
>---------------------------------------------------------------
src/Common/Utility.cpp | 2 +-
src/Daemon/Backends/Linux/IPTables.cpp | 10 +++---
src/Daemon/Backends/Linux/IPTables.hpp | 2 +-
src/Daemon/Backends/Linux/KernelModule.cpp | 2 +-
src/Daemon/Backends/Linux/Sysctl.cpp | 2 +-
src/Daemon/Backends/LinuxXTables.cpp | 38 +++++++++++++---------
src/Daemon/DBus.cpp | 2 +-
src/Daemon/DBus.hpp | 10 +++---
src/Daemon/DBus/direct/getChains.cpp | 3 +-
src/Daemon/DBus/zone/getActiveZones.cpp | 4 +-
src/Daemon/Firewall/IPAddress.cpp | 6 ++--
src/Daemon/Firewall/RichLanguageParser/Parser.c | 2 +-
src/Daemon/SignalHandler.cpp | 2 +-
13 files changed, 46 insertions(+), 39 deletions(-)
diff --git a/src/Common/Utility.cpp b/src/Common/Utility.cpp
index d8e8805..9cf263f 100644
--- a/src/Common/Utility.cpp
+++ b/src/Common/Utility.cpp
@@ -135,7 +135,7 @@ namespace firewalld
// +1 ... for nullptr termination of the array
//
char **args_cstr = (char **)(::alloca(sizeof(const char *) * (args.size() + 2)));
- int i;
+ unsigned int i;
args_cstr[0] = const_cast<char *>(path.c_str());
for (i = 0; i < args.size(); ++i) {
diff --git a/src/Daemon/Backends/Linux/IPTables.cpp b/src/Daemon/Backends/Linux/IPTables.cpp
index b26365a..677441e 100644
--- a/src/Daemon/Backends/Linux/IPTables.cpp
+++ b/src/Daemon/Backends/Linux/IPTables.cpp
@@ -24,12 +24,12 @@
namespace firewalld
{
IPTables::IPTables(const char * const ipXtables_path)
- : _filter("filter"),
- _nat("nat"),
- _mangle("mangle"),
+ : _ipXtables_path(ipXtables_path),
_security("security"),
_raw("raw"),
- _ipXtables_path(ipXtables_path)
+ _mangle("mangle"),
+ _nat("nat"),
+ _filter("filter")
{
cleanup();
@@ -191,7 +191,7 @@ namespace firewalld
#endif
}
- int IPTables::cleanup()
+ void IPTables::cleanup()
{
for (auto table : listTables()) {
execute({"-t", table, "-F"});
diff --git a/src/Daemon/Backends/Linux/IPTables.hpp b/src/Daemon/Backends/Linux/IPTables.hpp
index eccfd04..abd9593 100644
--- a/src/Daemon/Backends/Linux/IPTables.hpp
+++ b/src/Daemon/Backends/Linux/IPTables.hpp
@@ -43,7 +43,7 @@ namespace firewalld
XTable& getTableRef(const String& table);
int execute(const XTables::Operation& op);
int execute(const StringVector& args);
- int cleanup();
+ void cleanup();
private:
const char * const _ipXtables_path;
diff --git a/src/Daemon/Backends/Linux/KernelModule.cpp b/src/Daemon/Backends/Linux/KernelModule.cpp
index bc24f3d..3d38df5 100644
--- a/src/Daemon/Backends/Linux/KernelModule.cpp
+++ b/src/Daemon/Backends/Linux/KernelModule.cpp
@@ -32,7 +32,7 @@ namespace firewalld
_name = UString(name);
char regexp_cstr[256];
- if (snprintf(regexp_cstr, sizeof regexp_cstr, "^%s\\s\\+", name) >= sizeof regexp_cstr) {
+ if (snprintf(regexp_cstr, sizeof regexp_cstr, "^%s\\s\\+", name) >= static_cast <int> (sizeof regexp_cstr)) {
LOG(FATAL) << "BUG: Buffer too small for constructing the regular expression";
}
if (regcomp(&_regexp, regexp_cstr, REG_NOSUB) != 0) {
diff --git a/src/Daemon/Backends/Linux/Sysctl.cpp b/src/Daemon/Backends/Linux/Sysctl.cpp
index 7df4db7..16906af 100644
--- a/src/Daemon/Backends/Linux/Sysctl.cpp
+++ b/src/Daemon/Backends/Linux/Sysctl.cpp
@@ -31,7 +31,7 @@ namespace firewalld
static void sysctlNameToProcFSPath(const char *name, char *buffer, size_t buflen)
{
- int i;
+ size_t i;
CHECK_NOTNULL(name);
CHECK_NOTNULL(buffer);
diff --git a/src/Daemon/Backends/LinuxXTables.cpp b/src/Daemon/Backends/LinuxXTables.cpp
index 8580a76..29dfdd5 100644
--- a/src/Daemon/Backends/LinuxXTables.cpp
+++ b/src/Daemon/Backends/LinuxXTables.cpp
@@ -210,6 +210,9 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
+ case Port::Protocol::AnyProtocol:
+ // TODO
+ break;
}
rule_spec += port.range().toString(":");
@@ -243,26 +246,26 @@ namespace firewalld
const UString& type = rule.getType();
if (type == "service") {
- const ServiceRule& rule = dynamic_cast<const ServiceRule&>(rule);
- addService(zone, rule.getService());
+ const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
+ addService(zone, srule.getService());
}
else if (type == "port") {
- const PortRule& rule = dynamic_cast<const PortRule&>(rule);
- addPort(zone, rule.getPort());
+ const PortRule& prule = dynamic_cast<const PortRule&>(rule);
+ addPort(zone, prule.getPort());
}
else if (type == "protocol") {
const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& rule = dynamic_cast<const ICMPBlockRule&>(rule);
- addICMPBlock(zone, rule.getICMPType());
+ const ICMPBlockRule& irule = dynamic_cast<const ICMPBlockRule&>(rule);
+ addICMPBlock(zone, irule.getICMPType());
}
else if (type == "masquerade") {
const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(rule);
}
else if (type == "forward-port") {
- const ForwardPortRule& rule = dynamic_cast<const ForwardPortRule&>(rule);
- addPortForward(zone, rule.getPortForward());
+ const ForwardPortRule& fprule = dynamic_cast<const ForwardPortRule&>(rule);
+ addPortForward(zone, fprule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
@@ -361,6 +364,9 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
+ case Port::Protocol::AnyProtocol:
+ // TODO
+ break;
}
rule_spec += port.range().toString(":");
@@ -389,26 +395,26 @@ namespace firewalld
const UString& type = rule.getType();
if (type == "service") {
- const ServiceRule& rule = dynamic_cast<const ServiceRule&>(rule);
- removeService(zone, rule.getService());
+ const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
+ removeService(zone, srule.getService());
}
else if (type == "port") {
- const PortRule& rule = dynamic_cast<const PortRule&>(rule);
- removePort(zone, rule.getPort());
+ const PortRule& prule = dynamic_cast<const PortRule&>(rule);
+ removePort(zone, prule.getPort());
}
else if (type == "protocol") {
const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& rule = dynamic_cast<const ICMPBlockRule&>(rule);
- removeICMPBlock(zone, rule.getICMPType());
+ const ICMPBlockRule& irule = dynamic_cast<const ICMPBlockRule&>(rule);
+ removeICMPBlock(zone, irule.getICMPType());
}
else if (type == "masquerade") {
const MasqueradeRule& rule = dynamic_cast<const MasqueradeRule&>(rule);
}
else if (type == "forward-port") {
- const ForwardPortRule& rule = dynamic_cast<const ForwardPortRule&>(rule);
- removePortForward(zone, rule.getPortForward());
+ const ForwardPortRule& fprule = dynamic_cast<const ForwardPortRule&>(rule);
+ removePortForward(zone, fprule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
diff --git a/src/Daemon/DBus.cpp b/src/Daemon/DBus.cpp
index 59996a2..4f53787 100644
--- a/src/Daemon/DBus.cpp
+++ b/src/Daemon/DBus.cpp
@@ -112,7 +112,7 @@ namespace firewalld
void DBus::on_bus_acquired(const Glib::RefPtr<Gio::DBus::Connection>& connection,
const UString& name)
{
- guint id;
+ //guint id;
LOG(TRACE) << "DBus acquired. Registering interfaces.";
connection->set_exit_on_close(false);
diff --git a/src/Daemon/DBus.hpp b/src/Daemon/DBus.hpp
index ae10f6a..d4c349f 100644
--- a/src/Daemon/DBus.hpp
+++ b/src/Daemon/DBus.hpp
@@ -171,8 +171,8 @@ namespace firewalld
* Default constructor of an empty builder
*/
DBusResultBuilder(const char *signature = nullptr)
- : _g_variant_base(_dummy_variant_base),
- _g_variant_container(_dummy_variant_container)
+ : _g_variant_container(_dummy_variant_container),
+ _g_variant_base(_dummy_variant_base)
{
_builder_type = BuilderType::Intermediate;
_value_type = ValueType::Unknown;
@@ -200,8 +200,8 @@ namespace firewalld
* Constructor of a DBus property value response builder.
*/
DBusResultBuilder(Glib::VariantBase& g_variant_base, const char *signature = nullptr)
- : _g_variant_base(g_variant_base),
- _g_variant_container(_dummy_variant_container)
+ : _g_variant_container(_dummy_variant_container),
+ _g_variant_base(g_variant_base)
{
_builder_type = BuilderType::PropertyValue;
_value_type = ValueType::Unknown;
@@ -303,7 +303,7 @@ namespace firewalld
{
if (_value_type == ValueType::Array || _value_type == ValueType::Unknown) {
/* Allocate more space if necessary */
- if (index >= _array.size()) {
+ if (index >= static_cast <int> (_array.size())) {
_array.resize(index+10, nullptr);
}
DBusResultBuilder*& builder = _array[index];
diff --git a/src/Daemon/DBus/direct/getChains.cpp b/src/Daemon/DBus/direct/getChains.cpp
index 7805797..0745381 100644
--- a/src/Daemon/DBus/direct/getChains.cpp
+++ b/src/Daemon/DBus/direct/getChains.cpp
@@ -48,6 +48,7 @@ namespace firewalld
LOG(DEBUG) << "return: " << chains;
result.setTypeSignature("(as)");
- result = chains;
+ if (fwret)
+ result = chains;
}
} /* namespace firewalld */
diff --git a/src/Daemon/DBus/zone/getActiveZones.cpp b/src/Daemon/DBus/zone/getActiveZones.cpp
index 2a9f355..00290a2 100644
--- a/src/Daemon/DBus/zone/getActiveZones.cpp
+++ b/src/Daemon/DBus/zone/getActiveZones.cpp
@@ -28,9 +28,9 @@ namespace firewalld
// (a{sa{sas}})
//
// Array Of Dictionaries
- // \
+ //
// --- Array Of Dictionaries
- // \
+ //
// --- Array Of Strings
//
result.setTypeSignature("(a{sa{sas}})");
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index 442f210..2f31e5d 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -30,8 +30,8 @@ namespace firewalld
{
UString ip;
UString net;
- Protocol ip_protocol = Protocol::Unknown;
- Protocol net_protocol = Protocol::Unknown;
+ //Protocol ip_protocol = Protocol::Unknown;
+ //Protocol net_protocol = Protocol::Unknown;
UString::size_type slash_pos = addr_spec.find_first_of('/');
@@ -51,7 +51,7 @@ namespace firewalld
if (::inet_pton(AF_INET, net.c_str(), &sa) != 1) {
}
- net_protocol = Protocol::IPv4;
+ //net_protocol = Protocol::IPv4;
} else if (regex_cidr->match(net)) {
int cidr = stringToNumber<int>(net);
if (cidr < 0 || cidr > 32) {
diff --git a/src/Daemon/Firewall/RichLanguageParser/Parser.c b/src/Daemon/Firewall/RichLanguageParser/Parser.c
index 8b30b7c..b20f730 100644
--- a/src/Daemon/Firewall/RichLanguageParser/Parser.c
+++ b/src/Daemon/Firewall/RichLanguageParser/Parser.c
@@ -354,7 +354,7 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */
){
- RichLanguageParserARG_FETCH;
+ //RichLanguageParserARG_FETCH;
switch( yymajor ){
/* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen
diff --git a/src/Daemon/SignalHandler.cpp b/src/Daemon/SignalHandler.cpp
index 81fbc59..c06558a 100644
--- a/src/Daemon/SignalHandler.cpp
+++ b/src/Daemon/SignalHandler.cpp
@@ -33,7 +33,7 @@ using namespace Glib;
namespace firewalld
{
- static Threads::Thread *G_signal_handler_thread = nullptr;
+ //static Threads::Thread *G_signal_handler_thread = nullptr;
static ::sigset_t G_signal_mask;
SignalHandler::SignalHandler(FirewallD* firewalld_ptr)
9 years, 5 months