[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190610161153.1f397e1a@hermes.lan>
Date: Mon, 10 Jun 2019 16:11:53 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Matteo Croce <mcroce@...hat.com>
Cc: netdev <netdev@...r.kernel.org>, David Ahern <dsahern@...nel.org>
Subject: Re: [PATCH iproute2 1/2] netns: switch netns in the child when
executing commands
On Tue, 11 Jun 2019 01:03:57 +0200
Matteo Croce <mcroce@...hat.com> wrote:
> On Tue, Jun 11, 2019 at 12:52 AM Matteo Croce <mcroce@...hat.com> wrote:
> >
> > On Tue, Jun 11, 2019 at 12:46 AM Stephen Hemminger
> > <stephen@...workplumber.org> wrote:
> > >
> > > On Tue, 11 Jun 2019 00:16:12 +0200
> > > Matteo Croce <mcroce@...hat.com> wrote:
> > >
> > > > + printf("\nnetns: %s\n", nsname);
> > > > + cmd_exec(argv[0], argv, true, nsname);
> > > > return 0;
> > >
> > > simple printf breaks JSON output.
> >
> > It was just moved from on_netns_label(). I will check how the json
> > output works when running doall and provide a similar behaviour.
> >
> > Anyway, I noticed that the VRF env should be reset but only in the
> > child. I'm adding a function pointer to cmd_exec which will
> > point to an hook which changes the netns when doing 'ip netns exec'
> > and reset the VRF on vrf exec.
> >
> > Regards,
> > --
> > Matteo Croce
> > per aspera ad upstream
>
> Hi Stephen,
>
> just checked, but it seems that netns exec in batch mode produces an
> invalid output anyway:
>
> # ip netns add n1
> # ip netns add n2
> # ip -all -json netns exec date
>
> netns: n2
> Tue 11 Jun 2019 12:55:11 AM CEST
>
> netns: n1
> Tue 11 Jun 2019 12:55:11 AM CEST
>
> Probably there is very little sense in using -all netns exec and json
> together, but worth noting it.
>
> Bye,
Thanks, just being paranoid about json output.
Powered by blists - more mailing lists