mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
openvswitch: Fix egress tunnel info.
While transitioning to netdev based vport we broke OVS
feature which allows user to retrieve tunnel packet egress
information for lwtunnel devices. Following patch fixes it
by introducing ndo operation to get the tunnel egress info.
Same ndo operation can be used for lwtunnel devices and compat
ovs-tnl-vport devices. So after adding such device operation
we can remove similar operation from ovs-vport.
Fixes: 614732eaa1
("openvswitch: Use regular VXLAN net_device device").
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0c472b9b39
commit
fc4099f172
16 changed files with 192 additions and 173 deletions
|
@ -99,6 +99,7 @@
|
|||
#include <linux/rtnetlink.h>
|
||||
#include <linux/stat.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/dst_metadata.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <net/checksum.h>
|
||||
#include <net/xfrm.h>
|
||||
|
@ -681,6 +682,32 @@ int dev_get_iflink(const struct net_device *dev)
|
|||
}
|
||||
EXPORT_SYMBOL(dev_get_iflink);
|
||||
|
||||
/**
|
||||
* dev_fill_metadata_dst - Retrieve tunnel egress information.
|
||||
* @dev: targeted interface
|
||||
* @skb: The packet.
|
||||
*
|
||||
* For better visibility of tunnel traffic OVS needs to retrieve
|
||||
* egress tunnel information for a packet. Following API allows
|
||||
* user to get this info.
|
||||
*/
|
||||
int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
struct ip_tunnel_info *info;
|
||||
|
||||
if (!dev->netdev_ops || !dev->netdev_ops->ndo_fill_metadata_dst)
|
||||
return -EINVAL;
|
||||
|
||||
info = skb_tunnel_info_unclone(skb);
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
if (unlikely(!(info->mode & IP_TUNNEL_INFO_TX)))
|
||||
return -EINVAL;
|
||||
|
||||
return dev->netdev_ops->ndo_fill_metadata_dst(dev, skb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_fill_metadata_dst);
|
||||
|
||||
/**
|
||||
* __dev_get_by_name - find a device by its name
|
||||
* @net: the applicable net namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue