From: Stephen Hemminger <shemminger@vyatta.com>
To: Ben Greear <greearb@candelatech.com>
Cc: Simon Horman <horms@verge.net.au>, NetDev <netdev@vger.kernel.org>
Subject: Re: RFC: Allow 'ip' to run in daemon mode?
Date: Thu, 1 Jul 2010 09:35:27 -0700 [thread overview]
Message-ID: <20100701093527.37b7d828@nehalam> (raw)
In-Reply-To: <4C2CB739.3020001@candelatech.com>
On Thu, 01 Jul 2010 08:41:45 -0700
Ben Greear <greearb@candelatech.com> wrote:
> On 07/01/2010 12:07 AM, Simon Horman wrote:
> > On Tue, Jun 29, 2010 at 08:34:41AM -0700, Ben Greear wrote:
> >> I'm considering modifying 'ip' to be able to run in daemon
> >> mode so that I can do lots of IP commands without having to
> >> pay the startup cost of iproute.
> >>
> >> The -batch option almost works, but it's hard to programatically
> >> figure out failure codes.
> >>
> >> I'm thinking about making these changes:
> >>
> >> 1) Move all of the error printing code into common methods (basically,
> >> wrap printf). In daemon mode this text can be sent back to the
> >> calling process, and in normal mode, it will be printed to stdout/stderr
> >> as it is currently.
> >>
> >> 2) Remove all or most calls to 'exit' and instead return error codes
> >> to the calling logic.
> >>
> >> 3) Add ability to listen on a unix socket for commands, basically treat
> >> them just like batch commands, one command per packet.
> >>
> >> 4) Return well formatted error code and text response to calling process
> >> over the unix socket, maybe something like:
> >>
> >> RV: [errno or equiv, zero for success]\n
> >> CMD: [ command string this relates to ]\n
> >> [ Optional free form text ]
> >>
> >>
> >> Does something like this have any chance of upstream inclusion?
> >
> > Hi Ben,
> >
> > can't you achieve as much by omitting 3) and using stdio (cleanly)?
> > Or in other words, fix batch mode rather than adding another mode.
> > Or are you worried about backwards-compatibility?
>
> I think the most of the work will be in steps 1 and 2. Adding a listening
> socket and dealing with that is probably 50-100 lines of code.
>
> I'd be happy to attempt steps 1, 2, and possibly 4 for standard iproute2.
> If the unix socket thing still isn't wanted, it would be relatively easy for me
> to carry a patch to enable it in my own code.
>
> I think a lot of folks are scraping the output of 'ip', so backwards compat of
> the error messages is a concern.
Use libnl and write a real service. Maybe even use json
--
next prev parent reply other threads:[~2010-07-01 16:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 15:34 RFC: Allow 'ip' to run in daemon mode? Ben Greear
2010-07-01 7:07 ` Simon Horman
2010-07-01 15:41 ` Ben Greear
2010-07-01 16:35 ` Stephen Hemminger [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-06-30 7:00 Stephen Hemminger
2010-06-30 16:01 ` Ben Greear
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100701093527.37b7d828@nehalam \
--to=shemminger@vyatta.com \
--cc=greearb@candelatech.com \
--cc=horms@verge.net.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).