lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABAhCOQ_EYqsdrAH+aDKvK3h_s3cBfhrYsmAuqCeGkpgx3WUZg@mail.gmail.com>
Date: Tue, 15 Oct 2024 17:06:54 +0800
From: Xiao Liang <shaw.leon@...il.com>
To: nicolas.dichtel@...nd.com
Cc: Stephen Hemminger <stephen@...workplumber.org>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 iproute2 2/2] iplink: Fix link-netns id and link ifindex

On Tue, Oct 15, 2024 at 3:45 PM Nicolas Dichtel
<nicolas.dichtel@...nd.com> wrote:

> > @@ -618,20 +653,25 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
> >                       if (offload && name == dev)
> >                               dev = NULL;
> >               } else if (strcmp(*argv, "netns") == 0) {
> > +                     int pid;
> > +
> >                       NEXT_ARG();
> >                       if (netns != -1)
> >                               duparg("netns", *argv);
> >                       netns = netns_get_fd(*argv);
> > -                     if (netns >= 0) {
> > -                             open_fds_add(netns);
> > -                             addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_FD,
> > -                                       &netns, 4);
> > +                     if (netns < 0 && get_integer(&pid, *argv, 0) == 0) {
> > +                             char path[PATH_MAX];
> > +
> > +                             snprintf(path, sizeof(path), "/proc/%d/ns/net",
> > +                                      pid);
> > +                             netns = open(path, O_RDONLY);
> >                       }
> This chunk is added to allow the user to give a pid instead of a netns name.
> It's not directly related to the patch topic. Could you put in a separate patch?

Currently ip-link already accepts pid as netns argument, and passes to
kernel as IFLA_NET_NS_PID. This patch converts it to fd for
simplicity, so that it can be reused in later setns() call (before
opening RTNL in target netns).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ