* [PATCH net] macvlan: filter out unsupported feature flags
@ 2018-03-09 0:17 Shannon Nelson
2018-03-12 2:46 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Shannon Nelson @ 2018-03-09 0:17 UTC (permalink / raw)
To: davem, netdev; +Cc: steffen.klassert
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: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
Reported-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
---
drivers/net/macvlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 8fc02d9..725f4b4 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1036,7 +1036,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
lowerdev_features &= (features | ~NETIF_F_LRO);
features = netdev_increment_features(lowerdev_features, features, mask);
features |= ALWAYS_ON_FEATURES;
- features &= ~NETIF_F_NETNS_LOCAL;
+ features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES);
return features;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] macvlan: filter out unsupported feature flags
2018-03-09 0:17 [PATCH net] macvlan: filter out unsupported feature flags Shannon Nelson
@ 2018-03-12 2:46 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-12 2:46 UTC (permalink / raw)
To: shannon.nelson; +Cc: netdev, steffen.klassert
From: Shannon Nelson <shannon.nelson@oracle.com>
Date: Thu, 8 Mar 2018 16:17:23 -0800
> 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: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
> Reported-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-12 2:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 0:17 [PATCH net] macvlan: filter out unsupported feature flags Shannon Nelson
2018-03-12 2:46 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).