def add_ether_type_term(self, ff, ether_type_match): if not ether_type_match: return None term = Term() from_ = From() term.set_from(from_) term.set_name("ether-type") from_.set_ether_type(ether_type_match.lower()) term.set_then(Then(accept_or_reject=True)) ff.add_terms(term)
def add_dns_dhcp_terms(self, ff): port_list = [67, 68, 53] term = Term() term.set_name("allow-dns-dhcp") from_ = From() from_.set_ip_protocol("udp") term.set_from(from_) for port in port_list: from_.add_source_ports(str(port)) term.set_then(Then(accept_or_reject=True)) ff.add_terms(term)
def add_filter_term(self, ff, name): term = Term() term.set_name(name) ff.add_terms(term) term.set_then(Then(accept_or_reject=True)) return term