[patch libteam] teamd: lw: arp_ping: bitmask VID in VLAN BPF filter
by Robert Karbowski
(2nd attempt to publish patch since update via “git send-mail” seems to be lost)
BPF filter arp_vlan_rpl_flt fails if in the ARP response the VLAN tag has,
in addition to VID, also PCP (priority code point).
This patch is masking the last 12 bits from SKF_AD_VLAN_TAG field
to extract VID only.
Signed-off-by: Robert Karbowski <robert_karbowski(a)hotmail.com>
---
teamd/teamd_lw_arp_ping.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c
index c3d4710..5b5c044 100644
--- a/teamd/teamd_lw_arp_ping.c
+++ b/teamd/teamd_lw_arp_ping.c
@@ -90,10 +90,11 @@ static const struct sock_fprog arp_novlan_rpl_fprog = {
static struct sock_filter arp_vlan_rpl_flt[] = {
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_PROTOCOL),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETH_P_ARP, 0, 8),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETH_P_ARP, 0, 9),
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 6, 0),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 7, 0),
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_VLAN_TAG),
+ BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0xfff),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0xffff, 0, 4), /* 0xffff will be replaced by vland id */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, OFFSET_ARP_OP_CODE),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REPLY, 1, 0),
@@ -103,7 +104,7 @@ static struct sock_filter arp_vlan_rpl_flt[] = {
};
/* this hack replaces vlanid value in filter code */
-#define SET_FILTER_VLANID(fprog, vlanid) (fprog)->filter[5].k = vlanid
+#define SET_FILTER_VLANID(fprog, vlanid) (fprog)->filter[6].k = vlanid
static const struct sock_fprog arp_vlan_rpl_fprog = {
.len = ARRAY_SIZE(arp_vlan_rpl_flt),
--
2.35.3
21 hours, 29 minutes
Re: [patch libteam] teamd: lw: arp_ping: bitmask VID in VLAN BPF
filter
by Jiri Pirko
Sun, May 19, 2024 at 12:40:03PM CEST, rkarbowski2(a)gmail.com wrote:
>BPF filter arp_vlan_rpl_flt fails if in the ARP response the VLAN tag has,
>in addition to VID, also PCP (priority code point).
>This patch is masking the last 12 bits from SKF_AD_VLAN_TAG field
>to extract VID only.
>
>Signed-off-by: Robert Karbowski <robert_karbowski(a)hotmail.com>
applied, thanks!
21 hours, 29 minutes
Re: [patch libteam] teamd: Pass correct parameter type to accept API
by Jiri Pirko
Sun, May 12, 2024 at 08:15:59AM CEST, raj.khem(a)gmail.com wrote:
>accept() expects sockaddr as second parameter
>
>int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
>
>Fixes build with gcc-16 on musl systems
>| ../../git/teamd/teamd_usock.c: In function 'callback_usock':
>| ../../git/teamd/teamd_usock.c:280:40: error: passing argument 2 of 'accept' from incompatible pointer type [-Wincompatible-pointer-types]
>| 280 | sock = accept(ctx->usock.sock, &addr, &alen);
>| | ^~~~~
>| | |
>| | struct sockaddr_un *
>
>Signed-off-by: Khem Raj <raj.khem(a)gmail.com>
applied, thanks!
21 hours, 29 minutes
How to use lacp runner with port priority?
by Simon Jones
Hi all,
I'm using teamd-v1.31(tag v1.31) from source compile from
https://github.com/jpirko/libteam .
This is my network topo:
```
teamd-1
| |
veth11 veth01
| |
| |
veth10 veth00
| |
teamd-0
```
Which is run team-1 with veth11 and veth01, run team-2 with veth10 and
veth00.
This is my conf:
```
### teamd-0
[root@centos8-20240407 public-libteam]# cat ../lacp-t0.conf
{
"device": "team0",
"runner": {
"name": "lacp",
"sys_prio": 5,
"agg_select_policy": "lacp_prio",
"active": true,
"tx_hash": ["eth", "ipv4", "ipv6"]
},
"link_watch": {"name": "ethtool"},
"ports": {
"veth00": {"lacp_prio": 30},
"veth10": {"lacp_prio": 20}
}
}
### teamd-1
[root@centos8-20240407 public-libteam]# cat ../lacp-t1.conf
{
"device": "team0",
"runner": {
"name": "lacp",
"sys_prio": 66,
"active": true,
"tx_hash": ["eth", "ipv4", "ipv6"]
},
"link_watch": {"name": "ethtool"},
"ports": {
"veth01": {},
"veth11": {}
}
}
```
In my opinion and code, I think this conf will cause this behavior:
- teamd-0 use lacp, use low system priority, use equal port priority.
- teamd-1 use lacp, use high system priority, use not euqal port priority.
- then veth11 and veth10 will UP, veth01 and veth00 will DOWN.
But in fact, veth11 and veth10 is UP, veth01 and veth00 is also UP.
So:
1) What's wrong with my configure?
2) How to configure use lacp port priority?
----
Simon Jones
21 hours, 47 minutes