Lines Matching refs:addr
163 return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr)));
175 nvlist_add_binary(nvl, "addr", paddr, sizeof(*paddr));
273 pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr)
277 bzero(addr, sizeof(*addr));
279 PFNV_CHK(pf_nvuint8(nvl, "type", &addr->type));
280 PFNV_CHK(pf_nvuint8(nvl, "iflags", &addr->iflags));
281 if (addr->type == PF_ADDR_DYNIFTL)
282 PFNV_CHK(pf_nvstring(nvl, "ifname", addr->v.ifname,
283 sizeof(addr->v.ifname)));
284 if (addr->type == PF_ADDR_TABLE)
285 PFNV_CHK(pf_nvstring(nvl, "tblname", addr->v.tblname,
286 sizeof(addr->v.tblname)));
288 if (! nvlist_exists_nvlist(nvl, "addr"))
290 PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"),
291 &addr->v.a.addr));
296 &addr->v.a.mask));
298 switch (addr->type) {
315 pf_addr_wrap_to_nvaddr_wrap(const struct pf_addr_wrap *addr)
324 nvlist_add_number(nvl, "type", addr->type);
325 nvlist_add_number(nvl, "iflags", addr->iflags);
326 if (addr->type == PF_ADDR_DYNIFTL)
327 nvlist_add_string(nvl, "ifname", addr->v.ifname);
328 if (addr->type == PF_ADDR_TABLE)
329 nvlist_add_string(nvl, "tblname", addr->v.tblname);
331 tmp = pf_addr_to_nvaddr(&addr->v.a.addr);
334 nvlist_add_nvlist(nvl, "addr", tmp);
336 tmp = pf_addr_to_nvaddr(&addr->v.a.mask);
372 pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr)
376 if (! nvlist_exists_nvlist(nvl, "addr"))
379 PFNV_CHK(pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"),
380 &addr->addr));
381 PFNV_CHK(pf_nvuint16_array(nvl, "port", addr->port, 2, NULL));
382 PFNV_CHK(pf_nvuint8(nvl, "neg", &addr->neg));
383 PFNV_CHK(pf_nvuint8(nvl, "port_op", &addr->port_op));
385 PFNV_CHK(pf_validate_op(addr->port_op));
392 pf_rule_addr_to_nvrule_addr(const struct pf_rule_addr *addr)
401 tmp = pf_addr_wrap_to_nvaddr_wrap(&addr->addr);
404 nvlist_add_nvlist(nvl, "addr", tmp);
406 pf_uint16_array_nv(nvl, "port", addr->port, 2);
407 nvlist_add_number(nvl, "neg", addr->neg);
408 nvlist_add_number(nvl, "port_op", addr->port_op);
457 pf_check_rule_addr(const struct pf_rule_addr *addr)
460 switch (addr->addr.type) {
472 if (addr->addr.p.dyn != NULL) {
606 if (! nvlist_exists_nvlist(nvldivert, "addr"))
608 PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvldivert, "addr"),
609 &rule->divert.addr));
643 tmp = pf_addr_to_nvaddr(&rule->divert.addr);
646 nvlist_add_nvlist(nvl, "addr", tmp);
860 tmp = pf_addr_to_nvaddr(&key->addr[i]);
863 nvlist_append_nvlist_array(nvl, "addr", tmp);