Skip to content

rh_interface: Support for routes in ip(8) command arguments format

For the OPA-Ethernet routers in Tetralith/Sigma, the regular ipv4routes parameter (a hash of network => next hop) is not sufficient as we need to set MSS for the route (example route: 10.24.246.1/32 via 10.24.200.1 dev ib0 advmss 4042).

This can be accomplished by writing the ip(8) arguments format directly to the /etc/sysconfig/network-scripts/route-$INTERFACE (one route per line) instead of ADDRESS/NETMASK/GATEWAY lines.

We currently use the following local modification:

diff --git a/manifests/rh_interface.pp b/manifests/rh_interface.pp
index 0eac515b..ac56da9a 100644
--- a/manifests/rh_interface.pp
+++ b/manifests/rh_interface.pp
@@ -62,6 +62,9 @@
  *    this hash (target "0.0.0.0/0" or "default"), or using the 'gateway'
  *    parameter, but not both at the same time.
  *
+ *    Alternatively, routes can be provided as an array of strings in ip(8)
+ *    command arguments format (such as "10.1.2.3/32 via 10.1.8.9 dev ib0").
+ *
  *  - ipv6routes:
  *    Hash of static IPv6 routes to configure on the interface.  The keys
  *    should be IPv6 network specifications on the format "1:2:3::18/127",
@@ -187,7 +190,10 @@ define networking::rh_interface(
 
 		"/etc/sysconfig/network-scripts/route-${name}":
 		    ensure => $ipv4_inuse ? { true => file, default => absent },
-		    content => template('networking/rh-ifroute-v4.erb'),
+		    content => $ipv4routes ? {
+			Array[String] => sprintf("%s\n", $ipv4routes.join("\n")),
+			default => template('networking/rh-ifroute-v4.erb'),
+		    },
 		    owner => 'root', group => 'root', mode => '0444',
 		    notify => Class[networking::rh_interface::network_service];
 

But this is not necessarily the correct solution to implement upstream in this module.

A proper solution should also add support for IPv6.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information