All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: RFC:  Allow 'ip' to run in daemon mode?
@ 2010-06-30  7:00 Stephen Hemminger
  2010-06-30 16:01 ` Ben Greear
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2010-06-30  7:00 UTC (permalink / raw)
  To: Ben Greear, NetDev; +Cc: Stephen Hemminger

write a new service rather than bloating the existing code or just use netlink or libnl

Ben Greear <greearb@candelatech.com> 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?
>
>Thanks,
>Ben
>
>-- 
>Ben Greear <greearb@candelatech.com>
>Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC:  Allow 'ip' to run in daemon mode?
  2010-06-30  7:00 RFC: Allow 'ip' to run in daemon mode? Stephen Hemminger
@ 2010-06-30 16:01 ` Ben Greear
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Greear @ 2010-06-30 16:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: NetDev, Stephen Hemminger

On 06/30/2010 12:00 AM, Stephen Hemminger wrote:
> write a new service rather than bloating the existing code or just use netlink or libnl

I find netlink code a pain to deal with, so I'd like to leverage
existing and ongoing support in iproute.

Would you at least consider the changes in 1) and 2)
so that the new project can continue to use iproute as upstream
w/out significant merge issues?  Those changes shouldn't
significantly add to the code, I believe.

Thanks,
Ben

>
> Ben Greear<greearb@candelatech.com>  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?
>>
>> Thanks,
>> Ben
>>
>> --
>> Ben Greear<greearb@candelatech.com>
>> Candela Technologies Inc  http://www.candelatech.com
> N�����r��y���b�X��ǧv�^�)޺{.n�+���z�^�)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC:  Allow 'ip' to run in daemon mode?
  2010-07-01 15:41   ` Ben Greear
@ 2010-07-01 16:35     ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2010-07-01 16:35 UTC (permalink / raw)
  To: Ben Greear; +Cc: Simon Horman, NetDev

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


-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC:  Allow 'ip' to run in daemon mode?
  2010-07-01  7:07 ` Simon Horman
@ 2010-07-01 15:41   ` Ben Greear
  2010-07-01 16:35     ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Greear @ 2010-07-01 15:41 UTC (permalink / raw)
  To: Simon Horman; +Cc: NetDev, Stephen Hemminger

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.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC:  Allow 'ip' to run in daemon mode?
  2010-06-29 15:34 Ben Greear
@ 2010-07-01  7:07 ` Simon Horman
  2010-07-01 15:41   ` Ben Greear
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2010-07-01  7:07 UTC (permalink / raw)
  To: Ben Greear; +Cc: NetDev, Stephen Hemminger

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?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RFC:  Allow 'ip' to run in daemon mode?
@ 2010-06-29 15:34 Ben Greear
  2010-07-01  7:07 ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Greear @ 2010-06-29 15:34 UTC (permalink / raw)
  To: NetDev; +Cc: Stephen Hemminger

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?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-01 16:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30  7:00 RFC: Allow 'ip' to run in daemon mode? Stephen Hemminger
2010-06-30 16:01 ` Ben Greear
  -- strict thread matches above, loose matches on Subject: below --
2010-06-29 15:34 Ben Greear
2010-07-01  7:07 ` Simon Horman
2010-07-01 15:41   ` Ben Greear
2010-07-01 16:35     ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.