/openbmc/linux/tools/include/uapi/linux/ |
H A D | netlink.h | 45 __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)))
|
/openbmc/linux/include/uapi/linux/ |
H A D | netlink.h | 53 __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)))
|
/openbmc/phosphor-networkd/src/ |
H A D | netlink.cpp | 30 if (hdr.nlmsg_len < sizeof(hdr)) in processMsg() 34 hdr.nlmsg_len, sizeof(hdr))); in processMsg() 36 if (msgs.size() < hdr.nlmsg_len) in processMsg() 40 hdr.nlmsg_len)); in processMsg() 42 auto msg = msgs.substr(NLMSG_HDRLEN, hdr.nlmsg_len - NLMSG_HDRLEN); in processMsg() 43 msgs.remove_prefix(NLMSG_ALIGN(hdr.nlmsg_len)); in processMsg()
|
/openbmc/linux/drivers/scsi/ |
H A D | scsi_netlink.c | 43 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()
|
/openbmc/linux/tools/testing/selftests/bpf/ |
H A D | netlink_helpers.c | 193 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()
|
/openbmc/qemu/linux-user/ |
H A D | fd-trans.c | 313 nlh->nlmsg_len = tswap32(nlh->nlmsg_len); in tswap_nlmsghdr() 325 uint32_t nlmsg_len; in host_to_target_for_each_nlmsg() local 331 nlmsg_len = nlh->nlmsg_len; in host_to_target_for_each_nlmsg() 332 if (nlmsg_len < sizeof(struct nlmsghdr) || in host_to_target_for_each_nlmsg() 333 nlmsg_len > len) { in host_to_target_for_each_nlmsg() 361 aligned_nlmsg_len = NLMSG_ALIGN(nlmsg_len); in host_to_target_for_each_nlmsg() 380 if (tswap32(nlh->nlmsg_len) < sizeof(struct nlmsghdr) || in target_to_host_for_each_nlmsg() 381 tswap32(nlh->nlmsg_len) > len) { in target_to_host_for_each_nlmsg() 404 aligned_nlmsg_len = NLMSG_ALIGN(nlh->nlmsg_len); in target_to_host_for_each_nlmsg() 1235 uint32_t nlmsg_len; in host_to_target_data_route() local [all …]
|
/openbmc/phosphor-networkd/test/ |
H A D | test_netlink.cpp | 44 hdr.nlmsg_len = NLMSG_LENGTH(0) - 1; in TEST() 59 hdr.nlmsg_len = NLMSG_LENGTH(0) + 1; in TEST() 74 hdr.nlmsg_len = NLMSG_LENGTH(0); in TEST() 92 hdr.nlmsg_len = len; in TEST() 114 hdr.nlmsg_len = len; in TEST() 143 hdr.nlmsg_len = NLMSG_LENGTH(0); in TEST() 159 hdr.nlmsg_len = NLMSG_LENGTH(0); in TEST() 184 hdr.nlmsg_len = NLMSG_LENGTH(0); in TEST() 209 hdr.nlmsg_len = NLMSG_LENGTH(0); in TEST()
|
H A D | mock_syscall.cpp | 127 hdr.nlmsg_len = msgBuf.size() - nlbegin; in sendmsg_link_dump() 135 hdr.nlmsg_len = NLMSG_LENGTH(0); in sendmsg_link_dump() 147 hdr.nlmsg_len = NLMSG_LENGTH(sizeof(ack)); in sendmsg_ack() 149 auto& out = msgs.emplace(hdr.nlmsg_len, '\0'); in sendmsg_ack()
|
/openbmc/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | xfrm_info.c | 175 (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()
|
/openbmc/linux/tools/testing/selftests/net/ |
H A D | tap.c | 37 (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() 102 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in dev_create() 134 ret = send(rtnl, &req, req.nh.nlmsg_len, 0); in dev_create() 137 ret = (unsigned int)ret != req.nh.nlmsg_len; in dev_create() 159 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in dev_delete() 167 ret = send(rtnl, &req, req.nh.nlmsg_len, 0); in dev_delete() 171 ret = (unsigned int)ret != req.nh.nlmsg_len; in dev_delete()
|
H A D | tun.c | 84 req.nh.nlmsg_len = NLMSG_ALIGN(NLMSG_LENGTH(sizeof(req.ifm))); in tun_delete() 90 rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.nh.nlmsg_len)); in tun_delete() 93 req.nh.nlmsg_len += rta->rta_len; in tun_delete() 96 ret = send(rtnl, &req, req.nh.nlmsg_len, 0); in tun_delete() 99 ret = (unsigned int)ret != req.nh.nlmsg_len; in tun_delete()
|
H A D | ipsec.c | 212 return (struct rtattr *)((char *)(nh) + RTA_ALIGN((nh)->nlmsg_len)); in rtattr_hdr() 220 size_t nl_size = RTA_ALIGN(nh->nlmsg_len) + RTA_LENGTH(size); in rtattr_pack() 226 nh->nlmsg_len = nl_size; in rtattr_pack() 255 char *nlmsg_end = (char *)nh + nh->nlmsg_len; in rtattr_end() 321 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in veth_add() 351 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in veth_add() 369 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in ip4_addr_set() 393 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in ip4_addr_set() 409 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.info)); in link_set_up() 419 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) { in link_set_up() [all …]
|
/openbmc/linux/drivers/staging/gdm724x/ |
H A D | netlink_k.c | 23 #define ND_NLMSG_R_LEN(nlh) ((nlh)->nlmsg_len - ND_IFINDEX_LEN) 49 if (skb->len < nlh->nlmsg_len || nlh->nlmsg_len > ND_MAX_MSG_LEN) { in netlink_rcv_cb() 51 skb->len, nlh->nlmsg_len); in netlink_rcv_cb()
|
/openbmc/linux/tools/lib/bpf/ |
H A D | nlattr.h | 138 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 D | nlattr.c | 81 static inline int nlmsg_len(const struct nlmsghdr *nlh) in nlmsg_len() function 83 return nlh->nlmsg_len - NLMSG_HDRLEN; in nlmsg_len() 178 hlen += nlmsg_len(&err->msg); in libbpf_nla_dump_errormsg() 181 alen = (void *)nlh + nlh->nlmsg_len - (void *)attr; in libbpf_nla_dump_errormsg()
|
H A D | netlink.c | 237 if (send(sock, req, req->nh.nlmsg_len, 0) < 0) { in libbpf_netlink_send_recv() 270 .nh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN), in libbpf_netlink_resolve_genl_family_id() 294 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); in __bpf_set_link_xdp_fd_replace() 351 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); in __dump_link_nlmsg() 434 .nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)), in bpf_xdp_query() 484 req.nh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); in bpf_xdp_query() 593 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in tc_qdisc_modify() 752 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in bpf_tc_attach() 829 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in __bpf_tc_detach() 896 req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); in bpf_tc_query()
|
/openbmc/linux/net/netfilter/ |
H A D | nfnetlink.c | 225 if (nlmsg_len(nlh) < sizeof(struct nfgenmsg)) in nfnetlink_rcv_msg() 259 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_msg() 444 if (nlh->nlmsg_len < NLMSG_HDRLEN || in nfnetlink_rcv_batch() 445 skb->len < nlh->nlmsg_len || in nfnetlink_rcv_batch() 446 nlmsg_len(nlh) < sizeof(struct nfgenmsg)) { in nfnetlink_rcv_batch() 497 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_batch() 556 msglen = NLMSG_ALIGN(nlh->nlmsg_len); in nfnetlink_rcv_batch() 609 int attrlen = nlh->nlmsg_len - min_len; in nfnetlink_rcv_skb_batch() 615 msglen = NLMSG_ALIGN(nlh->nlmsg_len); in nfnetlink_rcv_skb_batch() 647 nlh->nlmsg_len < NLMSG_HDRLEN || in nfnetlink_rcv() [all …]
|
/openbmc/linux/tools/bpf/bpftool/ |
H A D | net.c | 212 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_class_nlmsg() 227 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_class() 236 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_class() 251 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_qdisc_nlmsg() 266 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_qdisc() 275 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_qdisc() 290 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t)); in __dump_filter_nlmsg() 305 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), in netlink_get_filter() 315 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) in netlink_get_filter() 329 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); in __dump_link_nlmsg() [all …]
|
/openbmc/linux/tools/testing/selftests/netfilter/ |
H A D | audit_logread.c | 53 .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()
|
/openbmc/linux/tools/accounting/ |
H A D | procacct.c | 136 msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); in send_cmd() 147 msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); in send_cmd() 150 buflen = msg.n.nlmsg_len; in send_cmd() 369 sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len); in main()
|
H A D | getdelays.c | 129 msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); in send_cmd() 140 msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); in send_cmd() 143 buflen = msg.n.nlmsg_len ; in send_cmd() 485 sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len); in main()
|
/openbmc/linux/drivers/connector/ |
H A D | connector.c | 146 if (nlh->nlmsg_len < NLMSG_HDRLEN + sizeof(struct cn_msg) + msg->len) in cn_call_callback() 206 len = nlmsg_len(nlh); in cn_rx_skb() 209 skb->len < nlh->nlmsg_len || in cn_rx_skb()
|
/openbmc/linux/include/net/ |
H A D | netlink.h | 589 static inline int nlmsg_len(const struct nlmsghdr *nlh) in nlmsg_len() function 591 return nlh->nlmsg_len - NLMSG_HDRLEN; in nlmsg_len() 613 return nlmsg_len(nlh) - NLMSG_ALIGN(hdrlen); in nlmsg_attrlen() 624 nlh->nlmsg_len >= sizeof(struct nlmsghdr) && in nlmsg_ok() 625 nlh->nlmsg_len <= remaining); in nlmsg_ok() 639 int totlen = NLMSG_ALIGN(nlh->nlmsg_len); in nlmsg_next() 740 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { in __nlmsg_parse() 884 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) in nlmsg_validate_deprecated() 1013 nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; in nlmsg_end()
|
/openbmc/linux/drivers/infiniband/core/ |
H A D | netlink.c | 221 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()
|
/openbmc/linux/tools/testing/selftests/connector/ |
H A D | proc_filter.c | 48 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()
|