- 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[:inet6][:routes]
- interface[:inet6][:routes].each do |to, parameters|
- next if parameters[:via] == interface[:inet6][:address]
-
- route = {
- "to" => to
- }
-
- route["type"] = parameters[:type] if parameters[:type]
- route["via"] = parameters[:via] if parameters[:via]
- route["metric"] = parameters[:metric] if parameters[:metric]
-
- deviceplan["routes"].push(route)
- end
- end
- end
- else
- node.rm(:networking, :interfaces, name)
- end
- end