@@ -851,6 +851,20 @@ def getPrivateGatewayNetworks(self):
851
851
interfaces .append (interface )
852
852
return interfaces
853
853
854
+ def getStaticRoutes (self ):
855
+ static_routes = CsStaticRoutes ("staticroutes" , self .config )
856
+ routes = []
857
+ if not static_routes :
858
+ return routes
859
+ for item in static_routes .get_bag ():
860
+ if item == "id" :
861
+ continue
862
+ static_route = static_routes .get_bag ()[item ]
863
+ if static_route ['revoke' ]:
864
+ continue
865
+ routes .append (static_route )
866
+ return routes
867
+
854
868
def portsToString (self , ports , delimiter ):
855
869
ports_parts = ports .split (":" , 2 )
856
870
if ports_parts [0 ] == ports_parts [1 ]:
@@ -996,6 +1010,10 @@ def processStaticNatRule(self, rule):
996
1010
for private_gw in private_gateways :
997
1011
self .fw .append (["mangle" , "front" , "-A %s -d %s -j RETURN" %
998
1012
(chain_name , private_gw .get_network ())])
1013
+ static_routes = self .getStaticRoutes ()
1014
+ for static_route in static_routes :
1015
+ self .fw .append (["mangle" , "front" , "-A %s -d %s -j RETURN" %
1016
+ (chain_name , static_route ['network' ])])
999
1017
1000
1018
self .fw .append (["nat" , "front" ,
1001
1019
"-A PREROUTING -d %s/32 -j DNAT --to-destination %s" % (rule ["public_ip" ], rule ["internal_ip" ])])
0 commit comments