Lines Matching full:hdr
76 rtnl_neigh_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_neigh_from_linux() argument
78 struct ndmsg *ndm = (struct ndmsg *)(hdr + 1); in rtnl_neigh_from_linux()
81 if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + sizeof(struct ndmsg)) in rtnl_neigh_from_linux()
92 rtnl_ifaddr_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_ifaddr_from_linux() argument
94 struct ifaddrmsg *ifam = (struct ifaddrmsg *)(hdr + 1); in rtnl_ifaddr_from_linux()
97 if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + in rtnl_ifaddr_from_linux()
109 * XXX: in case of error state of hdr is inconsistent.
112 rtnl_route_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_route_from_linux() argument
115 struct rtmsg *rtm = (struct rtmsg *)(hdr + 1); in rtnl_route_from_linux()
120 if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + sizeof(struct rtmsg)) in rtnl_route_from_linux()
129 attrs_len = hdr->nlmsg_len - sizeof(struct nlmsghdr); in rtnl_route_from_linux()
158 rtnl_from_linux(struct nlmsghdr *hdr, struct nl_pstate *npt) in rtnl_from_linux() argument
161 switch (hdr->nlmsg_type) { in rtnl_from_linux()
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()
177 hdr->nlmsg_type); in rtnl_from_linux()
185 nlmsg_from_linux(int netlink_family, struct nlmsghdr **hdr, in nlmsg_from_linux() argument
190 return (rtnl_from_linux(*hdr, npt)); in nlmsg_from_linux()
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()
208 memcpy(out_hdr, hdr, hdr->nlmsg_len); 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()
219 hdr->nlmsg_flags, 0)); in nlmsg_copy_header()
223 _nlmsg_copy_next_header(struct nlmsghdr *hdr, struct nl_writer *nw, int sz) in _nlmsg_copy_next_header() argument
226 memcpy(next_hdr, hdr + 1, NLMSG_ALIGN(sz)); in _nlmsg_copy_next_header()
265 nlmsg_translate_all_nla(struct nlmsghdr *hdr, struct nlattr *nla, in nlmsg_translate_all_nla() argument
269 switch (hdr->nlmsg_type) { 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
292 int attrs_len = hdr->nlmsg_len - sizeof(struct nlmsghdr) - hdrlen; in nlmsg_copy_all_nla()
293 struct nlattr *nla_head = (struct nlattr *)((char *)(hdr + 1) + hdrlen); in nlmsg_copy_all_nla()
300 ret = nlmsg_translate_all_nla(hdr, nla, nw); in nlmsg_copy_all_nla()
354 rtnl_newlink_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, 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()
389 rtnl_newaddr_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, 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()
411 rtnl_newneigh_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, 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()
432 rtnl_newroute_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, 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()
445 int attrs_len = hdr->nlmsg_len - sizeof(struct nlmsghdr) - hdrlen; in rtnl_newroute_to_linux()
446 struct nlattr *nla_head = (struct nlattr *)((char *)(hdr + 1) + hdrlen); in rtnl_newroute_to_linux()
480 rtnl_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_writer *nw) in rtnl_to_linux() argument
482 RT_LOG(LOG_DEBUG2, "Got message type %d", hdr->nlmsg_type); in rtnl_to_linux()
484 switch (hdr->nlmsg_type) { in rtnl_to_linux()
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()
501 hdr->nlmsg_type); 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()
517 if (hdr->nlmsg_len == copied_len) { in nlmsg_error_to_linux()
529 int copy_len = hdr->nlmsg_len - copied_len; in nlmsg_error_to_linux()
532 src_payload = (char *)hdr + copied_len; in nlmsg_error_to_linux()
541 nlmsg_to_linux(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_writer *nw) in nlmsg_to_linux() argument
543 if (hdr->nlmsg_type < NLMSG_MIN_TYPE) { in nlmsg_to_linux()
544 switch (hdr->nlmsg_type) { in nlmsg_to_linux()
546 return (nlmsg_error_to_linux(hdr, nlp, nw)); in nlmsg_to_linux()
550 return (handle_default_out(hdr, nw)); in nlmsg_to_linux()
553 hdr->nlmsg_type); 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()
587 struct nlmsghdr *hdr = (struct nlmsghdr *)&orig->data[offset]; in nlmsgs_to_linux() local
589 msglen = NLMSG_ALIGN(hdr->nlmsg_len); in nlmsgs_to_linux()
590 if (!nlmsg_to_linux(hdr, nlp, nw)) { in nlmsgs_to_linux()
592 hdr->nlmsg_type); in nlmsgs_to_linux()