[PATCH bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c

Subsystems: bpf [general] (safe dynamic programs and tools), bpf [library] (libbpf), the rest

STALE2001d LANDED

Landed in mainline as 1e0aa3fb05f8 on 2021-02-12.

4 messages, 3 authors, 2021-02-12 · open the first message on its own page

[PATCH bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c

From: Stanislav Fomichev <hidden>
Date: 2021-02-09 22:47:59

We have the environments where usage of AF_INET is prohibited
(cgroup/sock_create returns EPERM for AF_INET). Let's use
AF_LOCAL instead of AF_INET, it should perfectly work with SIOCETHTOOL.

Signed-off-by: Stanislav Fomichev <redacted>
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 20500fb1f17e..ffbb588724d8 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -517,7 +517,7 @@ static int xsk_get_max_queues(struct xsk_socket *xsk)
 	struct ifreq ifr = {};
 	int fd, err, ret;
 
-	fd = socket(AF_INET, SOCK_DGRAM, 0);
+	fd = socket(AF_LOCAL, SOCK_DGRAM, 0);
 	if (fd < 0)
 		return -errno;
 
-- 
2.30.0.478.g8a0d178c01-goog

Re: [PATCH bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c

From: Björn Töpel <hidden>
Date: 2021-02-12 07:00:09

On Tue, 9 Feb 2021 at 23:50, Stanislav Fomichev [off-list ref] wrote:
We have the environments where usage of AF_INET is prohibited
(cgroup/sock_create returns EPERM for AF_INET). Let's use
AF_LOCAL instead of AF_INET, it should perfectly work with SIOCETHTOOL.

Signed-off-by: Stanislav Fomichev <redacted>
Stanislav, apologies for the delay!

Tested-by: Björn Töpel <redacted>
Acked-by: Björn Töpel <redacted>


Björn
quoted hunk
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 20500fb1f17e..ffbb588724d8 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -517,7 +517,7 @@ static int xsk_get_max_queues(struct xsk_socket *xsk)
        struct ifreq ifr = {};
        int fd, err, ret;

-       fd = socket(AF_INET, SOCK_DGRAM, 0);
+       fd = socket(AF_LOCAL, SOCK_DGRAM, 0);
        if (fd < 0)
                return -errno;

--
2.30.0.478.g8a0d178c01-goog

Re: [PATCH bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c

From: <hidden>
Date: 2021-02-12 16:16:39

On 02/12, Bj�rn T�pel wrote:
On Tue, 9 Feb 2021 at 23:50, Stanislav Fomichev [off-list ref] wrote:
quoted
We have the environments where usage of AF_INET is prohibited
(cgroup/sock_create returns EPERM for AF_INET). Let's use
AF_LOCAL instead of AF_INET, it should perfectly work with SIOCETHTOOL.

Signed-off-by: Stanislav Fomichev <redacted>
Stanislav, apologies for the delay!
No worries, thank you for the review and testing!
Tested-by: Bj�rn T�pel <redacted>
Acked-by: Bj�rn T�pel <redacted>
Bj�rn
quoted
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 20500fb1f17e..ffbb588724d8 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -517,7 +517,7 @@ static int xsk_get_max_queues(struct xsk_socket  
*xsk)
quoted
        struct ifreq ifr = {};
        int fd, err, ret;

-       fd = socket(AF_INET, SOCK_DGRAM, 0);
+       fd = socket(AF_LOCAL, SOCK_DGRAM, 0);
        if (fd < 0)
                return -errno;

--
2.30.0.478.g8a0d178c01-goog

Re: [PATCH bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-02-12 19:40:52

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Tue,  9 Feb 2021 14:18:26 -0800 you wrote:
We have the environments where usage of AF_INET is prohibited
(cgroup/sock_create returns EPERM for AF_INET). Let's use
AF_LOCAL instead of AF_INET, it should perfectly work with SIOCETHTOOL.

Signed-off-by: Stanislav Fomichev <redacted>
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
  - [bpf-next] libbpf: use AF_LOCAL instead of AF_INET in xsk.c
    https://git.kernel.org/bpf/bpf-next/c/1e0aa3fb05f8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help