Lines Matching refs:nlh

140 ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh,
149 if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) {
154 ynl_attr_for_each(attr, nlh, hlen) {
194 start = ynl_nlmsg_data_offset(ys->nlh, ys->family->hdr_len);
195 end = ynl_nlmsg_end_addr(ys->nlh);
219 start = ynl_nlmsg_data_offset(ys->nlh, ys->family->hdr_len);
220 end = ynl_nlmsg_end_addr(ys->nlh);
260 ynl_cb_error(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
262 const struct nlmsgerr *err = ynl_nlmsg_data(nlh);
271 if (!(nlh->nlmsg_flags & NLM_F_CAPPED))
274 ynl_ext_ack_check(yarg->ys, nlh, hlen);
279 static int ynl_cb_done(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
283 err = *(int *)NLMSG_DATA(nlh);
288 ynl_ext_ack_check(yarg->ys, nlh, sizeof(int));
398 struct nlmsghdr *nlh;
402 nlh = ys->nlh = ynl_nlmsg_put_header(ys->tx_buf);
403 nlh->nlmsg_type = id;
404 nlh->nlmsg_flags = flags;
405 nlh->nlmsg_seq = ++ys->seq;
411 nlh->nlmsg_pid = YNL_SOCKET_BUFFER_SIZE;
413 return nlh;
416 static int ynl_msg_end(struct ynl_sock *ys, struct nlmsghdr *nlh)
419 if (nlh->nlmsg_pid == 0) {
424 if (nlh->nlmsg_pid == YNL_MSG_OVERFLOW) {
430 nlh->nlmsg_pid = 0;
439 struct nlmsghdr *nlh;
442 nlh = ynl_msg_start(ys, id, flags);
448 data = ynl_nlmsg_put_extra_header(nlh, sizeof(gehdr));
451 return nlh;
477 static int ynl_cb_null(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
489 const struct nlmsghdr *nlh;
501 for (rem = len; rem > 0; NLMSG_NEXT(nlh, rem)) {
502 nlh = (struct nlmsghdr *)&ys->rx_buf[len - rem];
503 if (!NLMSG_OK(nlh, rem)) {
509 if (nlh->nlmsg_flags & NLM_F_DUMP_INTR) {
516 switch (nlh->nlmsg_type) {
526 ret = ynl_cb_error(nlh, yarg);
529 ret = ynl_cb_done(nlh, yarg);
532 ret = cb(nlh, yarg);
595 ynl_get_family_info_cb(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
601 ynl_attr_for_each(attr, nlh, sizeof(struct genlmsghdr)) {
628 struct nlmsghdr *nlh;
631 nlh = ynl_gemsg_start_req(ys, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 1);
632 ynl_attr_put_str(nlh, CTRL_ATTR_FAMILY_NAME, family_name);
634 err = ynl_msg_end(ys, nlh);
638 err = send(ys->socket, nlh, nlh->nlmsg_len, 0);
789 static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)
797 gehdr = ynl_nlmsg_data(nlh);
809 ret = info->cb(nlh, &yarg);
813 rsp->family = nlh->nlmsg_type;
827 ynl_ntf_trampoline(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
829 return ynl_ntf_parse(yarg->ys, nlh);
864 ynl_check_alien(struct ynl_sock *ys, const struct nlmsghdr *nlh, __u32 rsp_cmd)
868 if (ynl_nlmsg_data_len(nlh) < sizeof(*gehdr)) {
874 gehdr = ynl_nlmsg_data(nlh);
876 return ynl_ntf_parse(ys, nlh);
882 int ynl_req_trampoline(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg)
887 ret = ynl_check_alien(yrs->yarg.ys, nlh, yrs->rsp_cmd);
891 return yrs->cb(nlh, &yrs->yarg);
915 ynl_dump_trampoline(const struct nlmsghdr *nlh, struct ynl_parse_arg *data)
922 ret = ynl_check_alien(ds->yarg.ys, nlh, ds->rsp_cmd);
939 return ds->cb(nlh, &yarg);