- if interface[:inet6]
- if interface[:inet6][:gateway] && interface[:inet6][:gateway] != interface[:inet6][:address]
- deviceplan["routes"].push(
- "to" => "::/0",
- "via" => interface[:inet6][:gateway],
- "metric" => interface[:metric],
- "on-link" => true
- )
-
- # This ordering relies on systemd-networkd adding routes
- # in reverse order and will need moving before the previous
- # route once that is fixed:
- #
- # https://github.com/systemd/systemd/issues/5430
- # https://github.com/systemd/systemd/pull/10938
- if !IPAddr.new(interface[:inet6][:address]).mask(interface[:inet6][:prefix]).include?(interface[:inet6][:gateway]) &&
- !IPAddr.new("fe80::/64").include?(interface[:inet6][:gateway])
- deviceplan["routes"].push(
- "to" => interface[:inet6][:gateway],
- "scope" => "link"
- )
- end
- end
+ if interface[:inet] && role[:inet]
+ node.default_unless[:networking][:interfaces][name][:inet][:prefix] = role[:inet][:prefix]
+ node.default_unless[:networking][:interfaces][name][:inet][:gateway] = role[:inet][:gateway]
+ node.default_unless[:networking][:interfaces][name][:inet][:routes] = role[:inet][:routes]
+ end