From 9f3c9ce503a1f983ee8fffeb6f1eaf571b976ca0 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Fri, 13 Mar 2026 09:19:04 +0000
Subject: [PATCH] Move gw4/gw6 options to network level (with optional overrides)

---
 lib/NetworkDriver.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/lib/NetworkDriver.py b/lib/NetworkDriver.py
index 948a6a6..478414b 100644
--- a/lib/NetworkDriver.py
+++ b/lib/NetworkDriver.py
@@ -37,7 +37,7 @@
         ip.link('set', index=idx, state='up')
         if 'parent' in network.Options:
             id_parent = ip.link_lookup(ifname=network.Options['parent'])[0]
-            print(ip.link("set", index=idx, master=id_parent))
+            ip.link("set", index=idx, master=id_parent)
         endpoint.Interface.Peer = ifname1
 
     return ifname0, ifname1
@@ -157,11 +157,26 @@
             'SrcName': interface,
             'DstPrefix': 'eth',
         },
+        'StaticRoutes': [],
     }
     if gw4 is not None:
         result['Gateway'] = gw4.ip.compressed
     if gw6 is not None:
         result['GatewayIPv6'] = gw6.ip.compressed
+    gw4 = endpoint.Options.get("gw4", network.Options.get("gw4", None))
+    if gw4 is not None:
+        result['StaticRoutes'].append({
+            'Destination': gw4 + '/32',
+            'RouteType': 1,
+        })
+        result['Gateway'] = gw4
+    gw6 = endpoint.Options.get("gw6", network.Options.get("gw6", None))
+    if gw6 is not None:
+        result['StaticRoutes'].append({
+            'Destination': gw6 + '/128',
+            'RouteType': 1,
+        })
+        result['GatewayIPv6'] = gw6
     return result
 
 

--
Gitblit v1.10.0