Skip to content

Commit 00bb90a

Browse files
jukkaraescolar
authored andcommitted
net: if: Check chksum offloading properly for VLAN interfaces
Make sure we check the checksum offloading capabilities correctly for VLAN interfaces. Use the real Ethernet interface when doing the check. Fixes #78724 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent e75316b commit 00bb90a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

subsys/net/ip/net_if.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5173,7 +5173,19 @@ static bool need_calc_checksum(struct net_if *iface, enum ethernet_hw_caps caps,
51735173
enum ethernet_config_type config_type;
51745174

51755175
if (net_if_l2(iface) != &NET_L2_GET_NAME(ETHERNET)) {
5176-
return true;
5176+
/* For VLANs, figure out the main Ethernet interface and
5177+
* get the offloading capabilities from it.
5178+
*/
5179+
if (IS_ENABLED(CONFIG_NET_VLAN) && net_eth_is_vlan_interface(iface)) {
5180+
iface = net_eth_get_vlan_main(iface);
5181+
if (iface == NULL) {
5182+
return true;
5183+
}
5184+
5185+
NET_ASSERT(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET));
5186+
} else {
5187+
return true;
5188+
}
51775189
}
51785190

51795191
if (!(net_eth_get_hw_capabilities(iface) & caps)) {

0 commit comments

Comments
 (0)