def nat_translation_addr_port(self,action,type,rule_num,trans_addr_port): if vld.testip(trans_addr_port): suffix=[rule_num,"translation address",trans_addr_port] elif str(trans_addr_port).isdigit(): suffix=[rule_num,"translation port",trans_addr_port] else: logger.error("%s: unknown type either it is an ip address or a port number in translation operation!"%addr_port) return False return self.nat_config(action,type,suffix)
def nat_translation_addr_port(self, action, type, rule_num, trans_addr_port): if vld.testip(trans_addr_port): suffix = [rule_num, "translation address", trans_addr_port] elif str(trans_addr_port).isdigit(): suffix = [rule_num, "translation port", trans_addr_port] else: logger.error( "%s: unknown type either it is an ip address or a port number in translation operation!" % addr_port) return False return self.nat_config(action, type, suffix)
def nat_filter_addr_port(self,action,type,rule_num,orient,addr_port): if not orient in self.type: logger.error("%s: invalid position!"%orient) return False if vld.testip(addr_port): suffix=[rule_num,orient,"address",addr_port+"/24"] elif str(addr_port).isdigit(): suffix=[rule_num,orient,"port",addr_port] else: logger.error("%s: unknown type either it is an ip address or a port number in filtering operation!"%addr_port) return False return self.nat_config(action,type,suffix)
def nat_filter_addr_port(self, action, type, rule_num, orient, addr_port): if not orient in self.type: logger.error("%s: invalid position!" % orient) return False if vld.testip(addr_port): suffix = [rule_num, orient, "address", addr_port + "/24"] elif str(addr_port).isdigit(): suffix = [rule_num, orient, "port", addr_port] else: logger.error( "%s: unknown type either it is an ip address or a port number in filtering operation!" % addr_port) return False return self.nat_config(action, type, suffix)