@@ -454,6 +454,20 @@ static void veth_dellink(struct net_device *dev)
unregister_netdevice(peer);
}
+struct net_device *veth_get_peer(struct net_device *veth)
+{
+ struct veth_priv *priv = netdev_priv(veth);
+
+ return priv->peer;
+}
+
+void veth_set_peer(struct net_device *veth, struct net_device *peer)
+{
+ struct veth_priv *priv = netdev_priv(veth);
+
+ priv->peer = peer;
+}
+
static const struct nla_policy veth_policy[VETH_INFO_MAX + 1];
static struct rtnl_link_ops veth_link_ops = {
@@ -9,4 +9,9 @@ enum {
#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
};
+#ifdef __KERNEL__
+struct net_device *veth_get_peer(struct net_device *veth);
+void veth_set_peer(struct net_device *veth, struct net_device *peer);
+#endif
+
#endif
This is needed for C/R. For checkpoint, we need to be able to follow the link from one veth device to its peer. For restart, we need to be able to link two veth devices we've restored to re-establish their relationship. Signed-off-by: Dan Smith <danms@us.ibm.com> Cc: netdev@vger.kernel.org --- drivers/net/veth.c | 14 ++++++++++++++ include/linux/veth.h | 5 +++++ 2 files changed, 19 insertions(+), 0 deletions(-)