@@ -851,6 +851,20 @@ def getPrivateGatewayNetworks(self):
851851 interfaces .append (interface )
852852 return interfaces
853853
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+
854868 def portsToString (self , ports , delimiter ):
855869 ports_parts = ports .split (":" , 2 )
856870 if ports_parts [0 ] == ports_parts [1 ]:
@@ -996,6 +1010,10 @@ def processStaticNatRule(self, rule):
9961010 for private_gw in private_gateways :
9971011 self .fw .append (["mangle" , "front" , "-A %s -d %s -j RETURN" %
9981012 (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' ])])
9991017
10001018 self .fw .append (["nat" , "front" ,
10011019 "-A PREROUTING -d %s/32 -j DNAT --to-destination %s" % (rule ["public_ip" ], rule ["internal_ip" ])])
0 commit comments