Skip to contentSkip to conversation

libbpf: use AF_LOCAL instead of AF_INET in xsk.c

PATCH Applied Stanislav Fomichev 3 participants 4 messages Feb 9, 2021 – Feb 12, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: use AF_LOCAL instead of AF_INET in xsk.c

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.

---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/xsk.c +1 -1
index 20500fb1f17e..ffbb588724d8 100644
@@ -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;
 
Signature · 1 line
2.30.0.478.g8a0d178c01-goog
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Stanislav Fomichev

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.

Stanislav, apologies for the delay!

Björn

Quoted 20 lines
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/xsk.c +1 -2
index 20500fb1f17e..ffbb588724d8 100644
@@ -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

#2 lore raw
Quoted 9 lines · Bj�rn T�pel
Quoted 6 lines · Stanislav Fomichev

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.

Stanislav, apologies for the delay!

No worries, thank you for the review and testing!

Quoted 27 lines

Bj�rn

tools/lib/bpf/xsk.c static int xsk_get_max_queues(struct xsk_socket

Quoted 9 lines
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/xsk.c +0 -0
index 20500fb1f17e..ffbb588724d8 100644
@@ -517,7 +517,7 @@ static int xsk_get_max_queues(struct xsk_socket  

*xsk)

Quoted 11 lines
tools/lib/bpf/xsk.c +1 -2
        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

#3 lore raw
In reply to Stanislav Fomichev
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

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

Quoted 8 lines · 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.

---
 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