Lines Matching defs:sock
38 int sock;
43 sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
44 if (sock < 0)
47 if (setsockopt(sock, SOL_NETLINK, NETLINK_EXT_ACK,
52 if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
58 if (getsockname(sock, (struct sockaddr *)&sa, &addrlen) < 0) {
69 return sock;
72 close(sock);
76 static int bpf_netlink_recv(int sock, __u32 nl_pid, int seq,
88 len = recv(sock, buf, sizeof(buf), 0);
137 int sock, seq = 0, ret;
146 sock = libbpf_netlink_open(&nl_pid);
147 if (sock < 0)
148 return sock;
191 if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) {
195 ret = bpf_netlink_recv(sock, nl_pid, seq, NULL, NULL, NULL);
198 close(sock);
285 static int libbpf_nl_get_link(int sock, unsigned int nl_pid,
292 int sock, ret;
305 sock = libbpf_netlink_open(&nl_pid);
306 if (sock < 0)
307 return sock;
312 ret = libbpf_nl_get_link(sock, nl_pid, get_xdp_info, &xdp_id);
320 close(sock);
352 int libbpf_nl_get_link(int sock, unsigned int nl_pid,
367 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
370 return bpf_netlink_recv(sock, nl_pid, seq, __dump_link_nlmsg,