| /src/sys/netlink/ |
| H A D | netlink_message_parser.c | 54 nlmsg_report_err_msg(struct nl_pstate *npt, const char *fmt, ...) in nlmsg_report_err_msg() argument 58 if (npt->err_msg != NULL) in nlmsg_report_err_msg() 60 char *buf = npt_alloc(npt, NL_MAX_ERROR_BUF); in nlmsg_report_err_msg() 67 npt->err_msg = buf; in nlmsg_report_err_msg() 72 nlmsg_report_err_offset(struct nl_pstate *npt, uint32_t off) in nlmsg_report_err_offset() argument 74 if (npt->err_off != 0) in nlmsg_report_err_offset() 76 npt->err_off = off; in nlmsg_report_err_offset() 81 nlmsg_report_cookie(struct nl_pstate *npt, struct nlattr *nla) in nlmsg_report_cookie() argument 85 npt->cookie = nla; in nlmsg_report_cookie() 89 nlmsg_report_cookie_u32(struct nl_pstate *npt, uint32_t val) in nlmsg_report_cookie_u32() argument [all …]
|
| H A D | netlink_message_parser.h | 79 npt_alloc(struct nl_pstate *npt, int len) in npt_alloc() argument 81 return (lb_alloc(&npt->lb, len)); in npt_alloc() 86 typedef int parse_field_f(void *hdr, struct nl_pstate *npt, void *target); 94 int nlf_get_ifp(void *src, struct nl_pstate *npt, void *target); 95 int nlf_get_ifpz(void *src, struct nl_pstate *npt, void *target); 96 int nlf_get_u8(void *src, struct nl_pstate *npt, void *target); 97 int nlf_get_u16(void *src, struct nl_pstate *npt, void *target); 98 int nlf_get_u32(void *src, struct nl_pstate *npt, void *target); 99 int nlf_get_u8_u32(void *src, struct nl_pstate *npt, void *target); 102 typedef int parse_attr_f(struct nlattr *attr, struct nl_pstate *npt, [all …]
|
| H A D | netlink_io.c | 261 struct nlpcb *nlp, struct nl_pstate *npt) in nl_receive_message() argument 281 npt->hdr = hdr; in nl_receive_message() 290 &hdr, npt); in nl_receive_message() 294 error = handler(hdr, npt); in nl_receive_message() 299 if (!npt->nw->suppress_ack) { in nl_receive_message() 301 nlmsg_ack(nlp, error, hdr, npt); in nl_receive_message() 309 npt_clear(struct nl_pstate *npt) in npt_clear() argument 311 lb_clear(&npt->lb); in npt_clear() 312 npt->cookie = NULL; in npt_clear() 313 npt->error = 0; in npt_clear() [all …]
|
| H A D | netlink_route.c | 67 rtnl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_handle_message() argument 71 struct nlpcb *nlp = npt->nlp; in rtnl_handle_message() 75 NLMSG_REPORT_ERR_MSG(npt, "unknown message type: %d", hdr->nlmsg_type); in rtnl_handle_message() 81 NLMSG_REPORT_ERR_MSG(npt, "unknown message type: %d", hdr->nlmsg_type); in rtnl_handle_message() 103 error = cmd->cb(hdr, nlp, npt); in rtnl_handle_message()
|
| H A D | netlink_message_writer.c | 268 struct nl_pstate *npt) in nlmsg_ack() argument 273 struct nl_writer *nw = npt->nw; in nlmsg_ack() 289 if ((npt->err_msg || npt->err_off) && nlp->nl_flags & NLF_EXT_ACK) in nlmsg_ack() 303 if (npt->err_msg != NULL && nlp->nl_flags & NLF_EXT_ACK) in nlmsg_ack() 304 nlattr_add_string(nw, NLMSGERR_ATTR_MSG, npt->err_msg); in nlmsg_ack() 305 if (npt->err_off != 0 && nlp->nl_flags & NLF_EXT_ACK) in nlmsg_ack() 306 nlattr_add_u32(nw, NLMSGERR_ATTR_OFFS, npt->err_off); in nlmsg_ack() 307 if (npt->cookie != NULL) in nlmsg_ack() 308 nlattr_add_raw(nw, npt->cookie); in nlmsg_ack()
|
| H A D | netlink_glue.c | 171 struct nl_pstate *npt __unused) in nl_modify_ifp_generic_stub() 177 nl_store_ifp_cookie_stub(struct nl_pstate *npt __unused, struct ifnet *ifp __unused) in nl_store_ifp_cookie_stub() 274 const struct nlattr_bmask *bm , struct nl_pstate *npt) in nl_modify_ifp_generic() argument 276 return (_nl->nl_modify_ifp_generic(ifp, lattrs, bm, npt)); in nl_modify_ifp_generic() 280 nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) in nl_store_ifp_cookie() argument 282 return (_nl->nl_store_ifp_cookie(npt, ifp)); in nl_store_ifp_cookie()
|
| H A D | netlink_generic.c | 114 genl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt) in genl_handle_message() argument 116 struct nlpcb *nlp = npt->nlp; in genl_handle_message() 156 error = cmd->cmd_cb(hdr, npt); in genl_handle_message() 254 nlctrl_handle_getfamily(struct nlmsghdr *hdr, struct nl_pstate *npt) in nlctrl_handle_getfamily() argument 259 error = nl_parse_nlmsg(hdr, &genl_parser, npt, &attrs); in nlctrl_handle_getfamily() 279 return (dump_family(hdr, &ghdr, gf, npt->nw)); in nlctrl_handle_getfamily() 289 error = dump_family(hdr, &ghdr, gf, npt->nw); in nlctrl_handle_getfamily() 295 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in nlctrl_handle_getfamily()
|
| H A D | netlink_var.h | 132 struct nl_pstate *npt); 172 const struct nlattr_bmask *bm, struct nl_pstate *npt); 173 void (*nl_store_ifp_cookie)(struct nl_pstate *npt, struct ifnet *ifp);
|
| H A D | ktest_netlink_message_writer.c | 58 struct test_nlbuf_attrs *attrs = npt_alloc(ctx->npt, sizeof(*attrs)); in test_nlbuf_parser() 62 return (nl_parse_nested(nla, &nlbuf_w_parser, ctx->npt, attrs)); in test_nlbuf_parser()
|
| H A D | netlink_linux.h | 43 struct nl_pstate *npt);
|
| /src/sys/netlink/route/ |
| H A D | route_var.h | 41 struct nl_pstate *npt); 85 const struct nlattr_bmask *bm, struct nl_pstate *npt); 86 void _nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp); 90 const struct nlattr_bmask *bm, struct nl_pstate *npt) in nl_modify_ifp_generic() argument 92 return (_nl_modify_ifp_generic(ifp, lattrs, bm, npt)); in nl_modify_ifp_generic() 96 nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) in nl_store_ifp_cookie() argument 98 _nl_store_ifp_cookie(npt, ifp); in nl_store_ifp_cookie() 103 const struct nlattr_bmask *bm, struct nl_pstate *npt); 104 void nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp); 109 const struct nlattr_bmask *bm, struct nlpcb *nlp, struct nl_pstate *npt); [all …]
|
| H A D | iface_drivers.c | 67 const struct nlattr_bmask *bm, struct nl_pstate *npt) in _nl_modify_ifp_generic() argument 72 if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFDESCR)) { in _nl_modify_ifp_generic() 80 nlmsg_report_err_msg(npt, "Not enough privileges to set descr"); in _nl_modify_ifp_generic() 94 if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFMTU)) { in _nl_modify_ifp_generic() 99 nlmsg_report_err_msg(npt, "Failed to set mtu"); in _nl_modify_ifp_generic() 103 nlmsg_report_err_msg(npt, "Not enough privileges to set mtu"); in _nl_modify_ifp_generic() 120 if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFMAC)) { in _nl_modify_ifp_generic() 125 nlmsg_report_err_msg(npt, in _nl_modify_ifp_generic() 131 nlmsg_report_err_msg(npt, in _nl_modify_ifp_generic() 149 _nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) in _nl_store_ifp_cookie() argument [all …]
|
| H A D | iface.c | 381 check_ifmsg(void *hdr, struct nl_pstate *npt) in check_ifmsg() argument 387 nlmsg_report_err_msg(npt, in check_ifmsg() 458 rtnl_handle_getlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt) in rtnl_handle_getlink() argument 465 error = nl_parse_nlmsg(hdr, &ifmsg_parser, npt, &attrs); in rtnl_handle_getlink() 471 .nw = npt->nw, in rtnl_handle_getlink() 539 rtnl_handle_dellink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt) in rtnl_handle_dellink() argument 546 error = nl_parse_nlmsg(hdr, &ifmsg_parser, npt, &attrs); in rtnl_handle_dellink() 595 struct nlattr_bmask *bm, struct nlpcb *nlp, struct nl_pstate *npt) in create_link() argument 598 NLMSG_REPORT_ERR_MSG(npt, "empty IFLA_IFNAME attribute"); in create_link() 602 NLMSG_REPORT_ERR_MSG(npt, "empty IFLA_INFO_KIND attribute"); in create_link() [all …]
|
| H A D | neigh.c | 341 post_p_neigh(void *_attrs, struct nl_pstate *npt __unused) in post_p_neigh() 360 rtnl_handle_newneigh(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt) in rtnl_handle_newneigh() argument 365 error = nl_parse_nlmsg(hdr, &ndmsg_parser, npt, &attrs); in rtnl_handle_newneigh() 371 NLMSG_REPORT_ERR_MSG(npt, "NDA_IFINDEX / ndm_ifindex not set"); in rtnl_handle_newneigh() 373 NLMSG_REPORT_ERR_MSG(npt, "NDA_DST not set"); in rtnl_handle_newneigh() 375 NLMSG_REPORT_ERR_MSG(npt, "NDA_LLADDR not set"); in rtnl_handle_newneigh() 380 NLMSG_REPORT_ERR_MSG(npt, in rtnl_handle_newneigh() 388 NLMSG_REPORT_ERR_MSG(npt, in rtnl_handle_newneigh() 396 NLMSG_REPORT_ERR_MSG(npt, "ndm_flags %X not supported", in rtnl_handle_newneigh() 415 NLMSG_REPORT_ERR_MSG(npt, "unable to calculate lle prepend data"); in rtnl_handle_newneigh() [all …]
|
| H A D | rt.c | 422 post_p_rtnh(void *_attrs, struct nl_pstate *npt __unused) in post_p_rtnh() 437 nlattr_get_multipath(struct nlattr *nla, struct nl_pstate *npt, in nlattr_get_multipath() argument 449 mp = npt_alloc(npt, (max_nhops + 2) * sizeof(struct rta_mpath_nh)); in nlattr_get_multipath() 457 NLMSG_REPORT_ERR_MSG(npt, "%s: bad length %u", in nlattr_get_multipath() 463 npt, mpnh); in nlattr_get_multipath() 465 NLMSG_REPORT_ERR_MSG(npt, in nlattr_get_multipath() 475 NLMSG_REPORT_ERR_MSG(npt, "invalid RTA_MULTIPATH attr"); in nlattr_get_multipath() 536 post_p_rtmsg(void *_attrs, struct nl_pstate *npt __unused) in post_p_rtmsg() 628 struct nlmsghdr *hdr, struct nl_pstate *npt) in handle_rtm_getroute() argument 638 NLMSG_REPORT_ERR_MSG(npt, "No RTA_DST supplied"); in handle_rtm_getroute() [all …]
|
| H A D | nexthop.c | 660 nlattr_get_nhg(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target) in nlattr_get_nhg() argument 736 post_p_nh(void *_attrs, struct nl_pstate *npt) in post_p_nh() argument 800 struct nl_pstate *npt) in nl_set_nexthop_gw() argument 807 NLMSG_REPORT_ERR_MSG(npt, "interface not set"); in nl_set_nexthop_gw() 819 newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop, struct nl_pstate *npt) in newnhop() argument 827 NLMSG_REPORT_ERR_MSG(npt, "missing NHA_GATEWAY"); in newnhop() 831 NLMSG_REPORT_ERR_MSG(npt, "missing NHA_OIF"); in newnhop() 837 NLMSG_REPORT_ERR_MSG(npt, "Unable to determine default source IP"); in newnhop() 855 error = nl_set_nexthop_gw(nh, attrs->nha_gw, attrs->nha_oif, npt); in newnhop() 882 struct nl_pstate *npt) in rtnl_handle_newnhop() argument [all …]
|
| /src/sys/tests/ |
| H A D | ktest.c | 96 dump_mod_test(struct nlmsghdr *hdr, struct nl_pstate *npt, in dump_mod_test() argument 99 struct nl_writer *nw = npt->nw; in dump_mod_test() 116 dump_mod_tests(struct nlmsghdr *hdr, struct nl_pstate *npt, in dump_mod_tests() argument 123 int error = dump_mod_test(hdr, npt, mod, test_info); in dump_mod_tests() 132 dump_tests(struct nlmsghdr *hdr, struct nl_pstate *npt) in dump_tests() argument 138 error = nl_parse_nlmsg(hdr, &ktest_parser, npt, &attrs); in dump_tests() 148 error = dump_mod_tests(hdr, npt, mod, &attrs); in dump_tests() 154 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in dump_tests() 163 run_test(struct nlmsghdr *hdr, struct nl_pstate *npt) in run_test() argument 169 error = nl_parse_nlmsg(hdr, &ktest_parser, npt, &attrs); in run_test() [all …]
|
| H A D | ktest_example.c | 86 struct test1_attrs *attrs = npt_alloc(ctx->npt, sizeof(*attrs)); in test_with_params_parser() 90 return (nl_parse_nested(nla, &test1_parser, ctx->npt, attrs)); in test_with_params_parser()
|
| /src/sys/netpfil/pf/ |
| H A D | pf_nl.c | 151 struct nl_pstate *npt) in dump_state() argument 153 struct nl_writer *nw = npt->nw; in dump_state() 245 struct nlmsghdr *hdr, struct nl_pstate *npt) in handle_dumpstates() argument 285 error = dump_state(nlp, hdr, s, npt); in handle_dumpstates() 292 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in handle_dumpstates() 302 struct nlmsghdr *hdr, struct nl_pstate *npt) in handle_getstate() argument 310 ret = dump_state(nlp, hdr, s, npt); in handle_getstate() 318 struct nl_pstate *npt) in dump_creatorid() argument 320 struct nl_writer *nw = npt->nw; in dump_creatorid() 339 pf_handle_getstates(struct nlmsghdr *hdr, struct nl_pstate *npt) in pf_handle_getstates() argument [all …]
|
| H A D | pflow.c | 1312 pflow_nl_list(struct nlmsghdr *hdr, struct nl_pstate *npt) in pflow_nl_list() argument 1316 struct nl_writer *nw = npt->nw; in pflow_nl_list() 1351 pflow_nl_create(struct nlmsghdr *hdr, struct nl_pstate *npt) in pflow_nl_create() argument 1353 struct nl_writer *nw = npt->nw; in pflow_nl_create() 1400 pflow_nl_del(struct nlmsghdr *hdr, struct nl_pstate *npt) in pflow_nl_del() argument 1405 error = nl_parse_nlmsg(hdr, &del_parser, npt, &d); in pflow_nl_del() 1455 pflow_nl_get(struct nlmsghdr *hdr, struct nl_pstate *npt) in pflow_nl_get() argument 1460 struct nl_writer *nw = npt->nw; in pflow_nl_get() 1464 error = nl_parse_nlmsg(hdr, &get_parser, npt, &g); in pflow_nl_get() 1524 pflow_postparse_sockaddr(void *parsed_args, struct nl_pstate *npt __unused) in pflow_postparse_sockaddr() [all …]
|
| /src/sys/net/ |
| H A D | if_gre.c | 247 struct nl_pstate *npt = ifd->npt; in gre_clone_modify_nl() local 255 error = nl_modify_ifp_generic(ifp, lattrs, ifd->bm, npt); in gre_clone_modify_nl() 267 if ((error = nl_parse_nested(attrs, &gre_modify_parser, npt, ¶ms)) != 0) in gre_clone_modify_nl() 271 error = gre_set_addr_nl(sc, npt, params.ifla_local, params.ifla_remote); in gre_clone_modify_nl() 274 nlmsg_report_err_msg(npt, "Specify both remote and local address together"); in gre_clone_modify_nl() 278 error = gre_set_flags_nl(sc, npt, params.ifla_flags); in gre_clone_modify_nl() 281 error = gre_set_key_nl(sc, npt, params.ifla_okey); in gre_clone_modify_nl() 284 error = gre_set_encap_nl(sc, npt, params.ifla_encap_type); in gre_clone_modify_nl() 287 error = gre_set_udp_sport_nl(sc, npt, params.ifla_encap_sport); in gre_clone_modify_nl() 290 error = nl_modify_ifp_generic(ifp, ifd->lattrs, ifd->bm, ifd->npt); in gre_clone_modify_nl() [all …]
|
| H A D | if_vlan.c | 1242 struct nl_pstate *npt = ifd->npt; in vlan_clone_create_nl() local 1257 nlmsg_report_err_msg(npt, "vlan id is required, guessing not supported"); in vlan_clone_create_nl() 1261 error = nl_parse_nested(lattrs->ifla_idata, &vlan_parser, npt, &attrs); in vlan_clone_create_nl() 1265 nlmsg_report_err_msg(npt, "Invalid VID: %d", attrs.vlan_id); in vlan_clone_create_nl() 1269 nlmsg_report_err_msg(npt, "Unsupported ethertype: 0x%04X", attrs.vlan_proto); in vlan_clone_create_nl() 1286 nlmsg_report_err_msg(npt, "unable to find parent interface %u", lattrs->ifi_index); in vlan_clone_create_nl() 1307 error = nl_parse_nested(lattrs->ifla_idata, &vlan_parser, ifd->npt, &attrs); in vlan_clone_modify_nl() 1316 nlmsg_report_err_msg(ifd->npt, "unable to find parent interface %u", in vlan_clone_modify_nl() 1329 return (nl_modify_ifp_generic(ifp, ifd->lattrs, ifd->bm, ifd->npt)); in vlan_clone_modify_nl()
|
| /src/sys/compat/linux/ |
| H A D | linux_netlink.c | 76 rtnl_neigh_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_neigh_from_linux() argument 92 rtnl_ifaddr_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_ifaddr_from_linux() argument 112 rtnl_route_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_route_from_linux() argument 158 rtnl_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_from_linux() argument 165 return (rtnl_route_from_linux(hdr, npt)); in rtnl_from_linux() 167 return (rtnl_neigh_from_linux(hdr, npt)); in rtnl_from_linux() 169 return (rtnl_ifaddr_from_linux(hdr, npt)); in rtnl_from_linux() 186 struct nl_pstate *npt) in nlmsg_from_linux() argument 190 return (rtnl_from_linux(*hdr, npt)); in nlmsg_from_linux()
|
| /src/crypto/openssh/openbsd-compat/ |
| H A D | getcwd.c | 194 char *npt; in getcwd() local 201 if ((npt = realloc(pt, ptsize *= 2)) == NULL) in getcwd() 203 bpt = npt + (bpt - pt); in getcwd() 204 pt = npt; in getcwd()
|
| /src/sys/amd64/vmm/amd/ |
| H A D | npt.c | 41 SYSCTL_NODE(_hw_vmm, OID_AUTO, npt, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
|