Skip to content

Commit

Permalink
Merge pull request #1203 from yast/fix_hotplug_check
Browse files Browse the repository at this point in the history
Do not crash when checking if an interface is a hotplug one (bsc#1184623)
  • Loading branch information
teclator committed Apr 13, 2021
2 parents 30fd929 + 4b9c385 commit c0ea7e2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
7 changes: 7 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 13 12:32:16 UTC 2021 - Knut Anderssen <kanderssen@suse.com>

- Do not crash when checking if an interface is a hotplug one and
it is not present (bsc#1184623)
- 4.4.3

-------------------------------------------------------------------
Fri Apr 9 11:22:42 UTC 2021 - Knut Anderssen <kanderssen@suse.com>

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


Name: yast2-network
Version: 4.4.2
Version: 4.4.3
Release: 0
Summary: YaST2 - Network Configuration
License: GPL-2.0-only
Expand Down
46 changes: 23 additions & 23 deletions src/include/network/lan/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,31 @@ def initialize_network_lan_address(include_target)
def AddressDialog(builder:)
ret = Y2Network::Dialogs::EditInterface.run(builder)

if ret != :back && ret != :abort
if builder.boot_protocol.dhcp? && !builder.interface.hotplug?
# fixed bug #73739 - if dhcp is used, dont set default gw statically
# but also: reset default gw only if DHCP* is used, this branch covers
# "No IP address" case, then default gw must stay (#460262)
# and also: don't delete default GW for usb/pcmcia devices (#307102)
#
# Is check for hotplug really needed? It contained a typo up to SLE-15-SP4 and
# nobody complained - something to think of during next refactoring.
yast_config = Y2Network::Config.find(:yast)
if yast_config&.routing&.default_route
remove_gw = Popup.YesNo(
_(
"A static default route is defined.\n" \
"It is suggested to remove the static default route definition \n" \
"if one can be obtained also via DHCP.\n" \
"Do you want to remove the static default route?"
)
)
yast_config.routing.remove_default_routes if remove_gw
end
end
log.info "AddressDialog res: #{ret.inspect}"

return ret if [:back, :abort].include?(ret)
return ret if builder.interface&.hotplug? || !builder.boot_protocol.dhcp?

# fixed bug #73739 - if dhcp is used, dont set default gw statically
# but also: reset default gw only if DHCP* is used, this branch covers
# "No IP address" case, then default gw must stay (#460262)
# and also: don't delete default GW for usb/pcmcia devices (#307102)
#
# Is check for hotplug really needed? It contained a typo up to SLE-15-SP4 and
# nobody complained - something to think of during next refactoring.
yast_config = Y2Network::Config.find(:yast)
if yast_config&.routing&.default_route
remove_gw = Popup.YesNo(
_(
"A static default route is defined.\n" \
"It is suggested to remove the static default route definition \n" \
"if one can be obtained also via DHCP.\n" \
"Do you want to remove the static default route?"
)
)
yast_config.routing.remove_default_routes if remove_gw
end

log.info "AddressDialog res: #{ret.inspect}"
ret
end
end
Expand Down

0 comments on commit c0ea7e2

Please sign in to comment.