Skip to content

Commit

Permalink
Merge pull request #11 from yast/no-ifconfig
Browse files Browse the repository at this point in the history
Fix "One or more selected network interfaces is not configured"
  • Loading branch information
mvidner committed Feb 25, 2016
2 parents b998f5c + b38c4fa commit ef149bf
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 42 deletions.
7 changes: 7 additions & 0 deletions package/yast2-dhcp-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jan 26 13:14:57 UTC 2016 - mvidner@suse.com

- Fix "One or more selected network interfaces is not configured"
when ifconfig is not installed (boo#958525).
- 3.1.10

-------------------------------------------------------------------
Thu Jan 14 15:46:22 UTC 2016 - igonzalezsosa@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: 3.1.9
Version: 3.1.10
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
6 changes: 0 additions & 6 deletions src/include/dhcp-server/commandline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ def initialize_dhcp_server_commandline(include_target)
),
"type" => "string"
},
"list" => {
# command line help text for an option
"help" => _(
"List all defined hosts with a fixed address"
)
},
"select" => {
# command line help text for an option
"help" => _(
Expand Down
8 changes: 3 additions & 5 deletions src/include/dhcp-server/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def PoolDialog
Wizard.RestoreAbortButton

return CWM.Run(w, @functions)
:back
end

# Run group dialog
Expand Down Expand Up @@ -369,7 +368,6 @@ def ClassDialog
Wizard.RestoreAbortButton

return CWM.Run(w, @functions)
:back
end

# Run shared network dialog
Expand All @@ -382,9 +380,9 @@ def SectionTypeChoose
while par_id != ""
parents = Builtins.add(parents, par_type)

p = DhcpServer.GetEntryParent(par_type, par_id)
par_type = Ops.get(p, "type", "")
par_id = Ops.get(p, "id", "")
par = DhcpServer.GetEntryParent(par_type, par_id)
par_type = Ops.get(par, "type", "")
par_id = Ops.get(par, "id", "")
end
possible = ["subnet", "host", "shared-network", "group", "pool", "class"]
if Builtins.contains(parents, "class") ||
Expand Down
11 changes: 0 additions & 11 deletions src/include/dhcp-server/dialogs2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ def time2seconds(count, unit)
end

def seconds2time(seconds)
unit = "seconds"
count = seconds
if Ops.modulo(seconds, 60 * 60 * 24) == 0
return {
"unit" => "days",
Expand Down Expand Up @@ -942,9 +940,6 @@ def GlobalSettingsValidate(key, event)
timeserver = Convert.to_string(UI.QueryWidget(Id("timeserver"), :Value))
printserver = Convert.to_string(UI.QueryWidget(Id("printserver"), :Value))
winsserver = Convert.to_string(UI.QueryWidget(Id("winsserver"), :Value))
defaultleasetime = Convert.to_string(
UI.QueryWidget(Id("defaultleasetime"), :Value)
)

# FIXME: it is not defined which of values must be filled (must be lease time defined?)
# shouldn't be lease time controlled for too small or too big value?
Expand Down Expand Up @@ -1491,12 +1486,6 @@ def DynamicDHCPValidate(key, event)
event = deep_copy(event)
from_ip = Convert.to_string(UI.QueryWidget(Id("from_ip"), :Value))
to_ip = Convert.to_string(UI.QueryWidget(Id("to_ip"), :Value))
defaultleasetime = Convert.to_string(
UI.QueryWidget(Id("defaultleasetime"), :Value)
)
maxleasetime = Convert.to_string(
UI.QueryWidget(Id("maxleasetime"), :Value)
)

if from_ip == "" && to_ip == ""
# disable dynamic IP assigning
Expand Down
2 changes: 0 additions & 2 deletions src/include/dhcp-server/dns-server-management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def RemoveDNSRangeWorker(first_ip, last_ip)
zone_counter = -1
zone_found = false

filtered_zone = {}
Builtins.foreach(all_zones) do |one_zone|
zone_counter = Ops.add(zone_counter, 1)
if Ops.get(one_zone, "zone") == zone_name
Expand Down Expand Up @@ -629,7 +628,6 @@ def SetZoneRecords(zone_name, new_records)
return nil
end

ret = nil
all_records = DnsServer.FetchZones

zone_counter = -1
Expand Down
6 changes: 0 additions & 6 deletions src/include/dhcp-server/helps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,6 @@ def initialize_dhcp_server_helps(include_target)
"To enter the complete configuration of the DHCP server, click\n" +
"<b>DHCP Server Expert Configuration</b>.</p>"
),
# help text 1/2
"interfaces" => _(
"<p><b><big>Network Interfaces</big></b><br>\n" +
"Select the network interfaces to which the DHCP server should listen from\n" +
"<b>Available Interfaces</b>.</p>"
),
# host management help 1/3
"host_management" => _(
"<p><b><big>Host Management</big></b><br>\nUse this dialog to edit hosts with static address binding.</p>"
Expand Down
1 change: 0 additions & 1 deletion src/include/dhcp-server/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def initialize_dhcp_server_options(include_target)
"pid-file-name" => "name",
"ping-check" => "onoff",
"ping-timeout" => "seconds",
"ping-timeout" => "seconds",
"server-identifier" => "hostname",
"server-name" => "name",
"site-option-space" => "name",
Expand Down
3 changes: 1 addition & 2 deletions src/include/dhcp-server/wizards.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def MainSequence
"section_type_select" => [lambda { SelectEditationDialog() }, true],
"store" => [lambda { SectionStore() }, true],
"tsig_keys" => lambda { RunTsigKeysDialog(false) },
"tsig_keys_1" => lambda { RunTsigKeysDialog(true) },
"commonsetup" => lambda { CommonConfigDialog() }
"tsig_keys_1" => lambda { RunTsigKeysDialog(true) }
}

sequence = {
Expand Down
18 changes: 10 additions & 8 deletions src/modules/DhcpServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2267,27 +2267,29 @@ sub GetInterfaceInformation {
#}
#my $iface = $out{"stdout"};

# sample output:
# 9: virbr0 inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0\ valid_lft forever preferred_lft forever
my %out = %{SCR->Execute (".target.bash_output",
"LANG=en_EN /sbin/ifconfig $interface") || {}};
"LANG=C ip -4 -oneline addr show dev $interface") || {}};
if ($out{"exit"} != 0)
{
y2error ("ifconfig exited with code $out{\"exit\"}");
y2error ("'ip addr' exited with code $out{\"exit\"}");
return {};
}

my @lines = split /\n/, $out{"stdout"};
@lines = grep /inet addr:.*Bcast:.*Mask:.*/, @lines;
@lines = grep /inet .* brd .*/, @lines;
my $line = $lines[0] || "";
if ($line =~ /inet addr:[ \t]*([0-9\.]+)[ \t]*Bcast:[ \t]*([0-9\.]+)[ \t]*Mask:[ \t]*([0-9\.]+)[ \t]*$/)
if ($line =~ /inet[ \t]*([0-9\.]+)\/([0-9\.]+)[ \t]*brd[ \t]*([0-9\.]+)/)
{
$ip = $1;
$bcast = $2;
$netmask = $3;
$netmask = Netmask->FromBits($2);
$bcast = $3;
}
else
else
{
chomp($interface);
y2warning ("ifconfig didn't return meaningful data about $interface, asking NetworkInterfaces");
y2warning ("'ip addr' didn't return meaningful data about $interface, asking NetworkInterfaces");
$ip = NetworkInterfaces->GetValue($interface, "IPADDR");
$bcast = NetworkInterfaces->GetValue($interface, "BROADCAST");
$netmask = NetworkInterfaces->GetValue($interface, "NETMASK");
Expand Down

0 comments on commit ef149bf

Please sign in to comment.