Skip to content

Commit

Permalink
changes based on CR
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Nov 7, 2024
1 parent 8eb2df4 commit 0c3f1c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/y2network/network_manager/config_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ def routes_for(conn, routes)

explicit = routes.select { |r| r.interface&.name == conn.name }

return explicit if !conn.static_valid_ip?
return explicit unless conn.static_valid_ip?

conn_network = (IPAddr.new conn.ip.address.to_s).to_range

# select the routes without an specific interface and which gateway belongs to the
# same network
global = routes.select do |r|
next if r.interface || !r.default? || !r.gateway

(IPAddr.new conn.ip.address.to_s).to_range.include?(IPAddr.new(r.gateway.to_s))
conn_network.include?(IPAddr.new(r.gateway.to_s))
end

explicit + global
Expand Down

0 comments on commit 0c3f1c3

Please sign in to comment.