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

Function pfr_attach_table

freebsd/netpfil/pf/pf_table.c:2122–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2120}
2121
2122struct pfr_ktable *
2123pfr_attach_table(struct pf_kruleset *rs, char *name)
2124{
2125 struct pfr_ktable *kt, *rt;
2126 struct pfr_table tbl;
2127 struct pf_kanchor *ac = rs->anchor;
2128
2129 PF_RULES_WASSERT();
2130
2131 bzero(&tbl, sizeof(tbl));
2132 strlcpy(tbl.pfrt_name, name, sizeof(tbl.pfrt_name));
2133 if (ac != NULL)
2134 strlcpy(tbl.pfrt_anchor, ac->path, sizeof(tbl.pfrt_anchor));
2135 kt = pfr_lookup_table(&tbl);
2136 if (kt == NULL) {
2137 kt = pfr_create_ktable(&tbl, time_second, 1);
2138 if (kt == NULL)
2139 return (NULL);
2140 if (ac != NULL) {
2141 bzero(tbl.pfrt_anchor, sizeof(tbl.pfrt_anchor));
2142 rt = pfr_lookup_table(&tbl);
2143 if (rt == NULL) {
2144 rt = pfr_create_ktable(&tbl, 0, 1);
2145 if (rt == NULL) {
2146 pfr_destroy_ktable(kt, 0);
2147 return (NULL);
2148 }
2149 pfr_insert_ktable(rt);
2150 }
2151 kt->pfrkt_root = rt;
2152 }
2153 pfr_insert_ktable(kt);
2154 }
2155 if (!kt->pfrkt_refcnt[PFR_REFCNT_RULE]++)
2156 pfr_setflags_ktable(kt, kt->pfrkt_flags|PFR_TFLAG_REFERENCED);
2157 return (kt);
2158}
2159
2160void
2161pfr_detach_table(struct pfr_ktable *kt)

Callers 3

pfi_dynaddr_setupFunction · 0.85
pf_addr_setupFunction · 0.85
pfioctlFunction · 0.85

Calls 7

bzeroFunction · 0.85
pfr_lookup_tableFunction · 0.85
pfr_create_ktableFunction · 0.85
pfr_destroy_ktableFunction · 0.85
pfr_insert_ktableFunction · 0.85
pfr_setflags_ktableFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected