Thread (63 messages) 63 messages, 5 authors, 2018-02-03

Re: [PATCH 1/4] libbpf: add function to setup XDP

From: Toshiaki Makita <hidden>
Date: 2017-12-28 01:01:03
Also in: lkml

On 2017/12/28 3:02, Eric Leblond wrote:
Most of the code is taken from set_link_xdp_fd() in bpf_load.c and
slightly modified to be library compliant.

Signed-off-by: Eric Leblond <redacted>
---
...
+int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
...
+	if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
+		ret = -errno;
+		goto cleanup;
+	}
+
+	addrlen = sizeof(sa);
+	if (getsockname(sock, (struct sockaddr *)&sa, &addrlen) < 0) {
+		ret = errno;
forgot to prepend '-'?
+		goto cleanup;
+	}
+
+	if (addrlen != sizeof(sa)) {
+		ret = errno;
errno is not set?
+		goto cleanup;
+	}
-- 
Toshiaki Makita
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help