Skip to content

Commit 13fbcc8

Browse files
Shannon Nelsondavem330
authored andcommitted
macvlan: filter out unsupported feature flags
Adding a macvlan device on top of a lowerdev that supports the xfrm offloads fails with a new regression: # ip link add link ens1f0 mv0 type macvlan RTNETLINK answers: Operation not permitted Tracing down the failure shows that the macvlan device inherits the NETIF_F_HW_ESP and NETIF_F_HW_ESP_TX_CSUM feature flags from the lowerdev, but with no dev->xfrmdev_ops API filled in, it doesn't actually support xfrm. When the request is made to add the new macvlan device, the XFRM listener for NETDEV_REGISTER calls xfrm_api_check() which fails the new registration because dev->xfrmdev_ops is NULL. The macvlan creation succeeds when we filter out the ESP feature flags in macvlan_fix_features(), so let's filter them out like we're already filtering out ~NETIF_F_NETNS_LOCAL. When XFRM support is added in the future, we can add the flags into MACVLAN_FEATURES. This same problem could crop up in the future with any other new feature flags, so let's filter out any flags that aren't defined as supported in macvlan. Fixes: d77e38e ("xfrm: Add an IPsec hardware offloading API") Reported-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 87de120 commit 13fbcc8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/net/macvlan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
10361036
lowerdev_features &= (features | ~NETIF_F_LRO);
10371037
features = netdev_increment_features(lowerdev_features, features, mask);
10381038
features |= ALWAYS_ON_FEATURES;
1039-
features &= ~NETIF_F_NETNS_LOCAL;
1039+
features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES);
10401040

10411041
return features;
10421042
}

0 commit comments

Comments
 (0)