Home
last modified time | relevance | path

Searched refs:nlmsg_len (Results 1 – 25 of 75) sorted by relevance

123

/linux/tools/testing/selftests/net/tcp_ao/lib/
H A Dnetlink.c62 return (struct rtattr *)((char *)(nh) + RTA_ALIGN((nh)->nlmsg_len)); in rtattr_hdr()
70 size_t nl_size = RTA_ALIGN(nh->nlmsg_len) + RTA_LENGTH(size); in rtattr_pack()
76 nh->nlmsg_len = nl_size; in rtattr_pack()
104 char *nlmsg_end = (char *)nh + nh->nlmsg_len; in rtattr_end()
147 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in __add_veth()
177 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in __add_veth()
210 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in __ip_addr_add()
222 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in __ip_addr_add()
258 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.rt)); in __ip_route_add()
278 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in __ip_route_add()
[all …]
/linux/tools/include/uapi/linux/
H A Dnetlink.h45 __u32 nlmsg_len; /* Length of message including header */ member
95 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
96 (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
98 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
99 (nlh)->nlmsg_len <= (len))
100 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
/linux/include/uapi/linux/
H A Dnetlink.h53 __u32 nlmsg_len; member
104 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
106 NLMSG_ALIGN((nlh)->nlmsg_len)))
108 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
109 (nlh)->nlmsg_len <= (len))
110 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
/linux/tools/testing/selftests/bpf/
H A Dnetlink_helpers.c193 int len = h->nlmsg_len; in __rtnl_talk_iov()
270 .iov_len = n->nlmsg_len, in __rtnl_talk()
318 if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) { in addattr_l()
328 n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); in addattr_l()
334 if (NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len) > maxlen) { in addraw_l()
342 n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len); in addraw_l()
357 return n->nlmsg_len; in addattr_nest_end()
/linux/drivers/scsi/
H A Dscsi_netlink.c43 if ((nlh->nlmsg_len < (sizeof(*nlh) + sizeof(*hdr))) || in scsi_nl_rcv_msg()
44 (skb->len < nlh->nlmsg_len)) { in scsi_nl_rcv_msg()
50 rlen = NLMSG_ALIGN(nlh->nlmsg_len); in scsi_nl_rcv_msg()
71 if (nlh->nlmsg_len < (sizeof(*nlh) + hdr->msglen)) { in scsi_nl_rcv_msg()
/linux/tools/net/ynl/lib/
H A Dynl-priv.h153 nlh->nlmsg_len = NLMSG_HDRLEN; in ynl_nlmsg_put_header()
160 return nlh->nlmsg_len - NLMSG_HDRLEN; in ynl_nlmsg_data_len()
176 return (char *)nlh + nlh->nlmsg_len; in ynl_nlmsg_end_addr()
184 nlh->nlmsg_len += NLMSG_ALIGN(size); in ynl_nlmsg_put_extra_header()
211 for ((attr) = ynl_attr_first(nlh, (nlh)->nlmsg_len, \
262 o = nlh->nlmsg_len + NLA_HDRLEN + NLMSG_ALIGN(size) > nlh->nlmsg_pid; in __ynl_attr_put_overflow()
281 nlh->nlmsg_len += NLA_HDRLEN; in ynl_attr_nest_start()
307 nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len); in ynl_attr_put()
326 nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len); in ynl_attr_put_str()
/linux/tools/testing/selftests/bpf/prog_tests/
H A Dxfrm_info.c175 (struct rtattr *)((uint8_t *)nh + RTA_ALIGN(nh->nlmsg_len)); in rtattr_add()
178 nh->nlmsg_len = RTA_ALIGN(nh->nlmsg_len) + RTA_ALIGN(rta->rta_len); in rtattr_add()
198 uint8_t *end = (uint8_t *)nh + nh->nlmsg_len; in rtattr_end()
217 nh->nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in setup_xfrmi_external_dev()
236 ret = send(sock, nh, nh->nlmsg_len, 0); in setup_xfrmi_external_dev()
237 if (!ASSERT_EQ(ret, nh->nlmsg_len, "netlink send length")) in setup_xfrmi_external_dev()
/linux/tools/testing/selftests/net/
H A Dtap.c37 (struct rtattr *)((uint8_t *)nh + RTA_ALIGN(nh->nlmsg_len)); in rtattr_add()
40 nh->nlmsg_len = RTA_ALIGN(nh->nlmsg_len) + RTA_ALIGN(rta->rta_len); in rtattr_add()
51 uint8_t *end = (uint8_t *)nh + nh->nlmsg_len; in rtattr_end()
96 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in dev_create()
128 ret = send(rtnl, &req, req.nh.nlmsg_len, 0); in dev_create()
131 ret = (unsigned int)ret != req.nh.nlmsg_len; in dev_create()
153 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in dev_delete()
161 ret = send(rtnl, &req, req.nh.nlmsg_len, 0); in dev_delete()
165 ret = (unsigned int)ret != req.nh.nlmsg_len; in dev_delete()
H A Dtun.c
H A Dipsec.c216 return (struct rtattr *)((char *)(nh) + RTA_ALIGN((nh)->nlmsg_len)); in rtattr_pack()
222 /* NLMSG_ALIGNTO == RTA_ALIGNTO, nlmsg_len already aligned */ in rtattr_pack()
224 size_t nl_size = RTA_ALIGN(nh->nlmsg_len) + RTA_LENGTH(size); in rtattr_pack()
230 nh->nlmsg_len = nl_size; in rtattr_pack()
259 char *nlmsg_end = (char *)nh + nh->nlmsg_len;
325 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in veth_add()
355 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in veth_add()
373 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in ip4_addr_set()
397 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in ip4_addr_set()
413 req.nh.nlmsg_len in link_set_up()
[all...]
/linux/tools/lib/bpf/
H A Dnlattr.h138 return (struct nlattr *)((void *)req + NLMSG_ALIGN(req->nh.nlmsg_len)); in req_tail()
146 if (NLMSG_ALIGN(req->nh.nlmsg_len) + NLA_ALIGN(NLA_HDRLEN + len) > sizeof(*req)) in nlattr_add()
156 req->nh.nlmsg_len = NLMSG_ALIGN(req->nh.nlmsg_len) + NLA_ALIGN(nla->nla_len); in nlattr_add()
H A Dnlattr.c81 static inline int nlmsg_len(const struct nlmsghdr *nlh) in nlmsg_len() function
83 return nlh->nlmsg_len - NLMSG_HDRLEN; in nlmsg_len()
177 hlen += nlmsg_len(&err->msg); in libbpf_nla_dump_errormsg()
180 alen = (void *)nlh + nlh->nlmsg_len - (void *)attr; in libbpf_nla_dump_errormsg()
H A Dnetlink.c239 if (send(sock, req, req->nh.nlmsg_len, 0) < 0) { in libbpf_netlink_send_recv()
272 .nh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN), in libbpf_netlink_resolve_genl_family_id()
296 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); in __bpf_set_link_xdp_fd_replace()
353 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); in __dump_link_nlmsg()
436 .nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)), in bpf_xdp_query()
486 req.nh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); in bpf_xdp_query()
608 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in tc_qdisc_modify()
768 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in bpf_tc_attach()
845 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in __bpf_tc_detach()
912 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in bpf_tc_query()
/linux/net/netfilter/
H A Dnfnetlink.c225 if (nlmsg_len(nlh) < sizeof(struct nfgenmsg)) in nfnetlink_rcv_msg()
259 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_msg()
451 if (nlh->nlmsg_len < NLMSG_HDRLEN || in nfnetlink_rcv_batch()
452 skb->len < nlh->nlmsg_len || in nfnetlink_rcv_batch()
453 nlmsg_len(nlh) < sizeof(struct nfgenmsg)) { in nfnetlink_rcv_batch()
504 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_batch()
563 msglen = NLMSG_ALIGN(nlh->nlmsg_len); in nfnetlink_rcv_batch()
619 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_skb_batch()
625 msglen = NLMSG_ALIGN(nlh->nlmsg_len); in nfnetlink_rcv_skb_batch()
657 nlh->nlmsg_len < NLMSG_HDRLEN || in nfnetlink_rcv()
[all …]
/linux/tools/bpf/bpftool/
H A Dnet.c221 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_class_nlmsg()
236 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_class()
245 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_class()
260 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_qdisc_nlmsg()
275 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_qdisc()
284 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_qdisc()
299 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_filter_nlmsg()
314 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_filter()
324 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_filter()
338 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); in __dump_link_nlmsg()
[all …]
/linux/tools/testing/selftests/net/netfilter/
H A Daudit_logread.c53 .nlmsg_len = NLMSG_SPACE(sizeof(msg.u.s)), in audit_send()
70 ret = sendto(fd, &msg, msg.nlh.nlmsg_len, 0, in audit_send()
74 if (ret != (int)msg.nlh.nlmsg_len) in audit_send()
H A Dnf_queue.c230 if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { in open_queue()
242 if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { in open_queue()
317 if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { in mainloop()
/linux/tools/testing/selftests/landlock/
H A Daudit.h70 ret = sendto(fd, msg, msg->header.nlmsg_len, 0, in audit_send()
77 if (ret != msg->header.nlmsg_len) in audit_send()
147 .nlmsg_len = NLMSG_SPACE(sizeof(msg.rule)) + in audit_filter_exe()
174 .nlmsg_len = NLMSG_SPACE(sizeof(msg.rule)), in audit_filter_drop()
195 .nlmsg_len = NLMSG_SPACE(sizeof(msg.status)), in audit_set_status()
/linux/drivers/connector/
H A Dconnector.c145 if (nlh->nlmsg_len < NLMSG_HDRLEN + sizeof(struct cn_msg) + msg->len) in cn_call_callback()
205 len = nlmsg_len(nlh); in cn_rx_skb()
208 skb->len < nlh->nlmsg_len || in cn_rx_skb()
/linux/include/net/
H A Dnetlink.h617 static inline int nlmsg_len(const struct nlmsghdr *nlh) in nlmsg_len() function
619 return nlh->nlmsg_len - NLMSG_HDRLEN; in nlmsg_len()
632 if (nlh->nlmsg_len < nlmsg_msg_size(len)) in nlmsg_payload()
657 return nlmsg_len(nlh) - NLMSG_ALIGN(hdrlen); in nlmsg_attrlen()
668 nlh->nlmsg_len >= sizeof(struct nlmsghdr) && in nlmsg_ok()
669 nlh->nlmsg_len <= remaining); in nlmsg_ok()
683 int totlen = NLMSG_ALIGN(nlh->nlmsg_len); in nlmsg_next()
784 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { in __nlmsg_parse()
928 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) in nlmsg_validate_deprecated()
1083 nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; in nlmsg_end()
/linux/drivers/infiniband/core/
H A Dnetlink.c221 if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len) in rdma_nl_rcv_skb()
248 msglen = NLMSG_ALIGN(nlh->nlmsg_len); in rdma_nl_rcv_skb()
/linux/tools/testing/selftests/connector/
H A Dproc_filter.c48 hdr->nlmsg_len = NL_MESSAGE_SIZE; in send_message()
50 hdr->nlmsg_len = NL_MESSAGE_SIZE_NF; in send_message()
74 if (send(nl_sock, hdr, hdr->nlmsg_len, 0) == -1) { in send_message()
/linux/tools/testing/selftests/net/af_unix/
H A Ddiag_uid.c85 .nlmsg_len = sizeof(req), in send_request()
161 render_response(_metadata, NLMSG_DATA(nlh), nlh->nlmsg_len); in receive_response()
/linux/tools/testing/vsock/
H A Dvsock_diag_test.c176 .nlmsg_len = sizeof(req), in send_req()
290 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) in read_vsock_stat()
305 if (h->nlmsg_len < in read_vsock_stat()
/linux/tools/testing/selftests/net/mptcp/
H A Dmptcp_diag.c118 .nlmsg_len = sizeof(req), in send_query()
139 req.nlh.nlmsg_len += RTA_LENGTH(sizeof(proto)); in send_query()
271 nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)), in parse_nlmsg()

123