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

Function pfr_prepare_network

freebsd/netpfil/pf/pf_table.c:935–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933}
934
935static void
936pfr_prepare_network(union sockaddr_union *sa, int af, int net)
937{
938 int i;
939
940 bzero(sa, sizeof(*sa));
941 if (af == AF_INET) {
942 sa->sin.sin_len = sizeof(sa->sin);
943 sa->sin.sin_family = AF_INET;
944 sa->sin.sin_addr.s_addr = net ? htonl(-1 << (32-net)) : 0;
945 } else if (af == AF_INET6) {
946 sa->sin6.sin6_len = sizeof(sa->sin6);
947 sa->sin6.sin6_family = AF_INET6;
948 for (i = 0; i < 4; i++) {
949 if (net <= 32) {
950 sa->sin6.sin6_addr.s6_addr32[i] =
951 net ? htonl(-1 << (32-net)) : 0;
952 break;
953 }
954 sa->sin6.sin6_addr.s6_addr32[i] = 0xFFFFFFFF;
955 net -= 32;
956 }
957 }
958}
959
960static int
961pfr_route_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)

Callers 5

pfr_lookup_addrFunction · 0.85
pfr_route_kentryFunction · 0.85
pfr_unroute_kentryFunction · 0.85
pfr_walktreeFunction · 0.85
pfr_pool_getFunction · 0.85

Calls 1

bzeroFunction · 0.85

Tested by

no test coverage detected