Lines Matching refs:nw

202 handle_default_out(struct nlmsghdr *hdr, struct nl_writer *nw)  in handle_default_out()  argument
205 out_hdr = nlmsg_reserve_data(nw, NLMSG_ALIGN(hdr->nlmsg_len), char); in handle_default_out()
209 nw->num_messages++; in handle_default_out()
216 nlmsg_copy_header(struct nlmsghdr *hdr, struct nl_writer *nw) in nlmsg_copy_header() argument
218 return (nlmsg_add(nw, hdr->nlmsg_pid, hdr->nlmsg_seq, hdr->nlmsg_type, in nlmsg_copy_header()
223 _nlmsg_copy_next_header(struct nlmsghdr *hdr, struct nl_writer *nw, int sz) in _nlmsg_copy_next_header() argument
225 void *next_hdr = nlmsg_reserve_data(nw, sz, void); in _nlmsg_copy_next_header()
234 nlmsg_copy_nla(const struct nlattr *nla_orig, struct nl_writer *nw) in nlmsg_copy_nla() argument
236 struct nlattr *nla = nlmsg_reserve_data(nw, nla_orig->nla_len, struct nlattr); in nlmsg_copy_nla()
248 nlmsg_translate_ifname_nla(struct nlattr *nla, struct nl_writer *nw) in nlmsg_translate_ifname_nla() argument
255 return (nlattr_add_string(nw, IFLA_IFNAME, ifname)); in nlmsg_translate_ifname_nla()
266 struct nl_writer *nw) in nlmsg_translate_all_nla() argument
275 return (nlmsg_translate_ifname_nla(nla, nw)); in nlmsg_translate_all_nla()
286 nlmsg_copy_all_nla(struct nlmsghdr *hdr, int raw_hdrlen, struct nl_writer *nw) in nlmsg_copy_all_nla() argument
300 ret = nlmsg_translate_all_nla(hdr, nla, nw); in nlmsg_copy_all_nla()
302 ret = nlmsg_copy_nla(nla, nw); in nlmsg_copy_all_nla()
355 struct nl_writer *nw) in rtnl_newlink_to_linux() argument
357 if (!nlmsg_copy_header(hdr, nw)) in rtnl_newlink_to_linux()
361 ifinfo = nlmsg_copy_next_header(hdr, nw, struct ifinfomsg); in rtnl_newlink_to_linux()
373 if (!nlmsg_copy_all_nla(hdr, sizeof(struct ifinfomsg), nw)) in rtnl_newlink_to_linux()
377 if (!nlattr_add_string(nw, IFLA_QDISC, "noqueue")) in rtnl_newlink_to_linux()
380 if (!nlattr_add_u32(nw, IFLA_TXQLEN, 1000)) in rtnl_newlink_to_linux()
383 nlmsg_end(nw); in rtnl_newlink_to_linux()
384 RT_LOG(LOG_DEBUG2, "done processing nw %p", nw); in rtnl_newlink_to_linux()
390 struct nl_writer *nw) in rtnl_newaddr_to_linux() argument
392 if (!nlmsg_copy_header(hdr, nw)) in rtnl_newaddr_to_linux()
396 ifamsg = nlmsg_copy_next_header(hdr, nw, struct ifaddrmsg); in rtnl_newaddr_to_linux()
402 if (!nlmsg_copy_all_nla(hdr, sizeof(struct ifaddrmsg), nw)) in rtnl_newaddr_to_linux()
405 nlmsg_end(nw); in rtnl_newaddr_to_linux()
406 RT_LOG(LOG_DEBUG2, "done processing nw %p", nw); in rtnl_newaddr_to_linux()
412 struct nl_writer *nw) in rtnl_newneigh_to_linux() argument
414 if (!nlmsg_copy_header(hdr, nw)) in rtnl_newneigh_to_linux()
418 ndm = nlmsg_copy_next_header(hdr, nw, struct ndmsg); in rtnl_newneigh_to_linux()
423 if (!nlmsg_copy_all_nla(hdr, sizeof(struct ndmsg), nw)) in rtnl_newneigh_to_linux()
426 nlmsg_end(nw); in rtnl_newneigh_to_linux()
427 RT_LOG(LOG_DEBUG2, "done processing nw %p", nw); in rtnl_newneigh_to_linux()
433 struct nl_writer *nw) in rtnl_newroute_to_linux() argument
435 if (!nlmsg_copy_header(hdr, nw)) in rtnl_newroute_to_linux()
439 rtm = nlmsg_copy_next_header(hdr, nw, struct rtmsg); in rtnl_newroute_to_linux()
463 if (!nlattr_add_u32(nw, NL_RTA_TABLE, fibnum)) in rtnl_newroute_to_linux()
468 if (!nlmsg_copy_nla(nla, nw)) in rtnl_newroute_to_linux()
474 nlmsg_end(nw); in rtnl_newroute_to_linux()
475 RT_LOG(LOG_DEBUG2, "done processing nw %p", nw); in rtnl_newroute_to_linux()
480 rtnl_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_writer *nw) in rtnl_to_linux() argument
488 return (rtnl_newlink_to_linux(hdr, nlp, nw)); in rtnl_to_linux()
491 return (rtnl_newaddr_to_linux(hdr, nlp, nw)); in rtnl_to_linux()
494 return (rtnl_newroute_to_linux(hdr, nlp, nw)); in rtnl_to_linux()
498 return (rtnl_newneigh_to_linux(hdr, nlp, nw)); in rtnl_to_linux()
502 return (handle_default_out(hdr, nw)); in rtnl_to_linux()
507 nlmsg_error_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_writer *nw) in nlmsg_error_to_linux() argument
509 if (!nlmsg_copy_header(hdr, nw)) in nlmsg_error_to_linux()
513 nlerr = nlmsg_copy_next_header(hdr, nw, struct nlmsgerr); in nlmsg_error_to_linux()
518 nlmsg_end(nw); in nlmsg_error_to_linux()
530 dst_payload = nlmsg_reserve_data(nw, NLMSG_ALIGN(copy_len), char); in nlmsg_error_to_linux()
535 nlmsg_end(nw); in nlmsg_error_to_linux()
541 nlmsg_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_writer *nw) in nlmsg_to_linux() argument
546 return (nlmsg_error_to_linux(hdr, nlp, nw)); in nlmsg_to_linux()
550 return (handle_default_out(hdr, nw)); in nlmsg_to_linux()
554 return (handle_default_out(hdr, nw)); in nlmsg_to_linux()
560 return (rtnl_to_linux(hdr, nlp, nw)); in nlmsg_to_linux()
562 return (handle_default_out(hdr, nw)); in nlmsg_to_linux()
567 nlmsgs_to_linux(struct nl_writer *nw, struct nlpcb *nlp) in nlmsgs_to_linux() argument
573 nw->buf->datalen, nw->num_messages); in nlmsgs_to_linux()
575 orig = nw->buf; in nlmsgs_to_linux()
579 nw->buf = nb; in nlmsgs_to_linux()
580 orig_messages = nw->num_messages; in nlmsgs_to_linux()
581 nw->num_messages = 0; in nlmsgs_to_linux()
590 if (!nlmsg_to_linux(hdr, nlp, nw)) { in nlmsgs_to_linux()
594 nw->buf = orig; in nlmsgs_to_linux()
595 nw->num_messages = orig_messages; in nlmsgs_to_linux()
600 MPASS(nw->num_messages == orig_messages); in nlmsgs_to_linux()
601 MPASS(nw->buf == nb); in nlmsgs_to_linux()