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

Function pfr_route_kentry

freebsd/netpfil/pf/pf_table.c:960–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

958}
959
960static int
961pfr_route_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)
962{
963 union sockaddr_union mask;
964 struct radix_node *rn;
965 struct radix_head *head = NULL;
966
967 PF_RULES_WASSERT();
968
969 bzero(ke->pfrke_node, sizeof(ke->pfrke_node));
970 if (ke->pfrke_af == AF_INET)
971 head = &kt->pfrkt_ip4->rh;
972 else if (ke->pfrke_af == AF_INET6)
973 head = &kt->pfrkt_ip6->rh;
974
975 if (KENTRY_NETWORK(ke)) {
976 pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
977 rn = rn_addroute(&ke->pfrke_sa, &mask, head, ke->pfrke_node);
978 } else
979 rn = rn_addroute(&ke->pfrke_sa, NULL, head, ke->pfrke_node);
980
981 return (rn == NULL ? -1 : 0);
982}
983
984static int
985pfr_unroute_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)

Callers 5

pfr_add_addrsFunction · 0.85
pfr_set_addrsFunction · 0.85
pfr_insert_kentriesFunction · 0.85
pfr_insert_kentryFunction · 0.85
pfr_ina_defineFunction · 0.85

Calls 3

bzeroFunction · 0.85
pfr_prepare_networkFunction · 0.85
rn_addrouteFunction · 0.85

Tested by

no test coverage detected