MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfr_validate_addr

Function pfr_validate_addr

freebsd/netpfil/pf/pf_table.c:688–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686}
687
688static int
689pfr_validate_addr(struct pfr_addr *ad)
690{
691 int i;
692
693 switch (ad->pfra_af) {
694#ifdef INET
695 case AF_INET:
696 if (ad->pfra_net > 32)
697 return (-1);
698 break;
699#endif /* INET */
700#ifdef INET6
701 case AF_INET6:
702 if (ad->pfra_net > 128)
703 return (-1);
704 break;
705#endif /* INET6 */
706 default:
707 return (-1);
708 }
709 if (ad->pfra_net < 128 &&
710 (((caddr_t)ad)[ad->pfra_net/8] & (0xFF >> (ad->pfra_net%8))))
711 return (-1);
712 for (i = (ad->pfra_net+7)/8; i < sizeof(ad->pfra_u); i++)
713 if (((caddr_t)ad)[i])
714 return (-1);
715 if (ad->pfra_not && ad->pfra_not != 1)
716 return (-1);
717 if (ad->pfra_fback)
718 return (-1);
719 return (0);
720}
721
722static void
723pfr_enqueue_addrs(struct pfr_ktable *kt, struct pfr_kentryworkq *workq,

Callers 6

pfr_add_addrsFunction · 0.85
pfr_del_addrsFunction · 0.85
pfr_set_addrsFunction · 0.85
pfr_tst_addrsFunction · 0.85
pfr_clr_astatsFunction · 0.85
pfr_ina_defineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected