Home
last modified time | relevance | path

Searched refs:sock (Results 1 – 10 of 10) sorted by relevance

/samples/bpf/
Dsock_example.h16 int sock; in open_raw_sock() local
18 sock = socket(PF_PACKET, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, htons(ETH_P_ALL)); in open_raw_sock()
19 if (sock < 0) { in open_raw_sock()
28 if (bind(sock, (struct sockaddr *)&sll, sizeof(sll)) < 0) { in open_raw_sock()
30 close(sock); in open_raw_sock()
34 return sock; in open_raw_sock()
Dsockex1_user.c16 int i, sock; in main() local
27 sock = open_raw_sock("lo"); in main()
29 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in main()
Dsockex2_user.c23 int i, sock; in main() local
35 sock = open_raw_sock("lo"); in main()
37 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in main()
Dxdp_router_ipv4_user.c28 int sock, sock_arp, flags = XDP_FLAGS_UPDATE_IF_NOEXIST; variable
66 close(sock); in close_and_exit()
92 static int recv_msg(struct sockaddr_nl sock_addr, int sock) in recv_msg() argument
100 len = recv(sock, buf_ptr, sizeof(buf) - nll, 0); in recv_msg()
316 int sock, seq = 0; in get_route_table() local
328 sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); in get_route_table()
329 if (sock < 0) { in get_route_table()
335 if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) { in get_route_table()
354 ret = sendmsg(sock, &msg, 0); in get_route_table()
361 nll = recv_msg(sa, sock); in get_route_table()
[all …]
Dfds_example.c112 int fd, sock, ret; in bpf_do_prog() local
128 sock = open_raw_sock("lo"); in bpf_do_prog()
129 assert(sock > 0); in bpf_do_prog()
131 ret = setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &fd, sizeof(fd)); in bpf_do_prog()
132 printf("bpf: sock:%d <- fd:%d attached ret:(%d,%s)\n", sock, fd, in bpf_do_prog()
Dsockex3_user.c36 int i, sock, err, id, key = PARSE_IP; in main() local
55 sock = open_raw_sock("lo"); in main()
57 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd[4], in main()
Dsock_example.c37 int sock = -1, map_fd, prog_fd, i, key; in test_sock() local
70 sock = open_raw_sock("lo"); in test_sock()
72 if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in test_sock()
/samples/seccomp/
Duser-trap.c32 static int send_fd(int sock, int fd) in send_fd() argument
53 if (sendmsg(sock, &msg, 0) < 0) { in send_fd()
61 static int recv_fd(int sock) in recv_fd() argument
76 if (recvmsg(sock, &msg, 0) < 0) { in recv_fd()
/samples/connector/
Dcn_test.c22 static struct sock *nls;
/samples/qmi/
Dqmi_sample_client.c471 ret = kernel_connect(sample->qmi.sock, (struct sockaddr *)sq, in qmi_sample_probe()