def update_ipf(self): """Update the IP filter. Used for compiling search queries and firewall rules.""" self.update_network() ip_info = two_to_four( int(self.network.network), int(self.network.broadcast)) self.ipf = IPFilter(self, self.ip_type, *ip_info)
def update_ipf(self): """Update the IP filter. Used for compiling search queries and firewall rules.""" self.update_network() self.ipf = IPFilter(self.network.network, self.network.broadcast, self.ip_type, object_=self)
def build_network_qsets(network_str): # Todo move these directive processors into functions. if network_str.find(':') > -1: Klass = ipaddr.IPv6Network ip_type = '6' if network_str.find('.') > -1: Klass = ipaddr.IPv4Network ip_type = '4' try: network = Klass(network_str) ipf = IPFilter(network.network, network.broadcast, ip_type) except (ipaddr.AddressValueError, ipaddr.NetmaskValueError): raise BadDirective("{0} isn't a valid " "network.".format(network_str)) return build_ipf_qsets(ipf.Q)