Skip to content

Commit

Permalink
Merge 1e4f24c into 2d0a28c
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Oct 5, 2018
2 parents 2d0a28c + 1e4f24c commit aaf06fd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
6 changes: 6 additions & 0 deletions package/yast2-dhcp-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 5 15:06:58 CEST 2018 - schubi@suse.de

- Adapting to new firewall API (bsc#1108942)
- 4.1.3

-------------------------------------------------------------------
Fri Aug 24 14:21:19 UTC 2018 - dgonzalez@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-dhcp-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-dhcp-server
Version: 4.1.2
Version: 4.1.3
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
9 changes: 5 additions & 4 deletions src/include/dhcp-server/widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
require "yast2/system_service"
require "cwm"
require "cwm/service_widget"
require "y2firewall/firewalld"
require "y2firewall/helpers/interfaces"

# Representation of the configuration of dhcp-server.
# Input and output routines.
Expand All @@ -27,7 +29,6 @@ def initialize_dhcp_server_widgets(include_target)
Yast.import "LogView"
Yast.import "Popup"
Yast.import "TablePopup"
Yast.import "SuSEFirewall"
Yast.import "Mode"
end

Expand Down Expand Up @@ -280,7 +281,7 @@ def ldapHandle(id, event)
# Initialize the widget
# @param [String] id any widget id
def OpenFirewallInit(id)
enabled = SuSEFirewall.GetEnableService
enabled = firewalld.enabled?
open = DhcpServer.GetOpenFirewall
UI.ChangeWidget(Id(id), :Enabled, enabled)
UI.ChangeWidget(Id(id), :Value, open)
Expand All @@ -303,7 +304,7 @@ def OpenFirewallStore(id, event)
def OpenFirewallValidate(id, event)
event = deep_copy(event)
open = Convert.to_boolean(UI.QueryWidget(Id(id), :Value))
enabled = SuSEFirewall.GetEnableService
enabled = firewalld.enabled?

if enabled && !open
# yes-no popup
Expand All @@ -325,7 +326,7 @@ def OpenFirewallValidate(id, event)
Builtins.foreach(@ifaces) do |ifcfg, interface|
# interface is active
if Ops.get_boolean(interface, "active", false) == true
if SuSEFirewall.GetZoneOfInterface(ifcfg) == nil
if interface_zone(ifcfg) == nil
ifaces_not_in_fw = Builtins.add(ifaces_not_in_fw, ifcfg)
end
end
Expand Down
20 changes: 10 additions & 10 deletions src/modules/DhcpServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ YaST::YCP::Import ("Service");
YaST::YCP::Import ("Popup");
YaST::YCP::Import ("Progress");
YaST::YCP::Import ("Report");
YaST::YCP::Import ("SuSEFirewall");
YaST::YCP::Import ("FirewalldWrapper");
YaST::YCP::Import ("DnsServerAPI");

##-------------------------------------------------------------------------
Expand Down Expand Up @@ -1496,7 +1496,7 @@ DHCP server will not be available."));

if (! Mode->test ()) {
my $progress_orig = Progress->set (0);
SuSEFirewall->Read ();
FirewalldWrapper->read();
Progress->set ($progress_orig);
}

Expand All @@ -1514,11 +1514,11 @@ DHCP server will not be available."));
@allowed_interfaces = split (/ /, $ifaces_list);

# if firewall is enabled
if (SuSEFirewall->GetEnableService()) {
if (FirewalldWrapper->is_enabled()) {
foreach my $iface (@allowed_interfaces) {
my $iface_zone = SuSEFirewall->GetZoneOfInterface($iface);
my $iface_zone = FirewalldWrapper->zone_name_of_interface($iface);
if (defined $iface_zone) {
$open_firewall = SuSEFirewall->IsServiceSupportedInZone("service:dhcp-server", $iface_zone);
$open_firewall = FirewalldWrapper->is_service_in_zone("service:dhcp-server", $iface_zone);
} else {
$open_firewall = 0;
}
Expand Down Expand Up @@ -1656,7 +1656,7 @@ sub Write {

my $ok = 1;

$modified = $modified || SuSEFirewall->GetModified ();
$modified = $modified || FirewalldWrapper->is_modified ();

if (! $modified)
{
Expand Down Expand Up @@ -1713,20 +1713,20 @@ sub Write {
if (\@original_allowed_interfaces != \@allowed_interfaces) {
# disabling on all interfaces
my @all_ifaces;
foreach my $iface (@{SuSEFirewall->GetAllKnownInterfaces()}) {
foreach my $iface (@{FirewalldWrapper->all_known_interfaces() // []}) {
push @all_ifaces, $iface->{'id'};
}
SuSEFirewall->SetServices (["service:dhcp-server"], \@all_ifaces, 0);
FirewalldWrapper->set_services (["service:dhcp-server"], \@all_ifaces, 0);
if ($open_firewall) {
# allowing on selected interfaces
SuSEFirewall->SetServices (["service:dhcp-server"], \@allowed_interfaces, 1);
FirewalldWrapper->set_services (["service:dhcp-server"], \@allowed_interfaces, 1);
}
}

if (! Mode->test ())
{
my $progress_orig = Progress->set (0);
SuSEFirewall->Write ();
FirewalldWrapper->write ();
Progress->set ($progress_orig);
}

Expand Down
1 change: 0 additions & 1 deletion src/modules/DhcpServerUI.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def main
Yast.import "Mode"
Yast.import "Popup"
Yast.import "Report"
Yast.import "SuSEFirewall"

@current_entry_type = ""
@current_entry_id = ""
Expand Down

0 comments on commit aaf06fd

Please sign in to comment.