Message ID | 20180621163523.22053-1-gorcunov@virtuozzo.com |
---|---|
State | Accepted |
Series | "net: veth -- Don't force to create master peer index if no nsid" |
Commit | 829145e00df21cd93066f307590d5a9737aca50a |
Headers | show |
diff --git a/criu/net.c b/criu/net.c index b6315d129..6bc7a92da 100644 --- a/criu/net.c +++ b/criu/net.c @@ -1255,7 +1255,17 @@ static int veth_link_info(struct ns_id *ns, struct net_link *link, struct newlin peer_data = NLMSG_TAIL(&req->h); memset(&ifm, 0, sizeof(ifm)); - ifm.ifi_index = nde->peer_ifindex; + /* + * Peer index might lay on the node root net namespace, + * where the device index may be already borrowed by + * some other device, so we should ignore it. + * + * Still if peer is laying in some other net-namespace, + * we should recreate the device index as well as the + * as we do for the master peer end. + */ + if (nde->has_peer_nsid) + ifm.ifi_index = nde->peer_ifindex; addattr_l(&req->h, sizeof(*req), VETH_INFO_PEER, &ifm, sizeof(ifm)); veth_peer_info(link, req, ns, ns_fd);
Applied, thanks On Thu, Jun 21, 2018 at 07:35:23PM +0300, Cyrill Gorcunov wrote: > In case if master peer of veth device is laying inside > node root net-ns we should not request device index > but rather allow the kernel to number it automatically. > > When there is separate net-ns for master peer it should > be safe to request an index though. > > Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com> > --- > criu/net.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/criu/net.c b/criu/net.c > index b6315d129..6bc7a92da 100644 > --- a/criu/net.c > +++ b/criu/net.c > @@ -1255,7 +1255,17 @@ static int veth_link_info(struct ns_id *ns, struct net_link *link, struct newlin > peer_data = NLMSG_TAIL(&req->h); > memset(&ifm, 0, sizeof(ifm)); > > - ifm.ifi_index = nde->peer_ifindex; > + /* > + * Peer index might lay on the node root net namespace, > + * where the device index may be already borrowed by > + * some other device, so we should ignore it. > + * > + * Still if peer is laying in some other net-namespace, > + * we should recreate the device index as well as the > + * as we do for the master peer end. > + */ > + if (nde->has_peer_nsid) > + ifm.ifi_index = nde->peer_ifindex; > addattr_l(&req->h, sizeof(*req), VETH_INFO_PEER, &ifm, sizeof(ifm)); > > veth_peer_info(link, req, ns, ns_fd); > -- > 2.14.4 >
In case if master peer of veth device is laying inside node root net-ns we should not request device index but rather allow the kernel to number it automatically. When there is separate net-ns for master peer it should be safe to request an index though. Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com> --- criu/net.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)