netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
@ 2015-01-07 21:53 Vadim Kochan
  2015-01-07 22:13 ` Florian Westphal
  2015-01-07 23:08 ` Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: Vadim Kochan @ 2015-01-07 21:53 UTC (permalink / raw)
  To: netdev; +Cc: vadim4j

Hi,

I'd like to make possible to generate plot info about class hierarchy
with qdisc, filters, stats info, but I see that all this staffs are
printed to 'FILE *fp' which makes this hard to implement and seems to me
that it should be changed to be printed to 'char *s' (memory safety
should be considered by asprintf or similar), so this is a big change
but all this is possible and I ready to do it, but before do it I'd like
to ask if this could be acceptable as idea.

BUT maybe someone can advise me easier solution ?

Regards,

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-07 22:13 ` Florian Westphal
@ 2015-01-07 22:12   ` Vadim Kochan
  0 siblings, 0 replies; 7+ messages in thread
From: Vadim Kochan @ 2015-01-07 22:12 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Vadim Kochan, netdev

On Wed, Jan 07, 2015 at 11:13:09PM +0100, Florian Westphal wrote:
> Vadim Kochan <vadim4j@gmail.com> wrote:
> > I'd like to make possible to generate plot info about class hierarchy
> > with qdisc, filters, stats info, but I see that all this staffs are
> > printed to 'FILE *fp' which makes this hard to implement and seems to me
> > that it should be changed to be printed to 'char *s' (memory safety
> > should be considered by asprintf or similar), so this is a big change
> > but all this is possible and I ready to do it, but before do it I'd like
> > to ask if this could be acceptable as idea.
> > 
> > BUT maybe someone can advise me easier solution ?
> 
> Would fmemopen/open_memstream(3) do what you want?
I briefly looked on it, and it might help, THANKS A LOT!

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-07 21:53 iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE Vadim Kochan
@ 2015-01-07 22:13 ` Florian Westphal
  2015-01-07 22:12   ` Vadim Kochan
  2015-01-07 23:08 ` Stephen Hemminger
  1 sibling, 1 reply; 7+ messages in thread
From: Florian Westphal @ 2015-01-07 22:13 UTC (permalink / raw)
  To: Vadim Kochan; +Cc: netdev

Vadim Kochan <vadim4j@gmail.com> wrote:
> I'd like to make possible to generate plot info about class hierarchy
> with qdisc, filters, stats info, but I see that all this staffs are
> printed to 'FILE *fp' which makes this hard to implement and seems to me
> that it should be changed to be printed to 'char *s' (memory safety
> should be considered by asprintf or similar), so this is a big change
> but all this is possible and I ready to do it, but before do it I'd like
> to ask if this could be acceptable as idea.
> 
> BUT maybe someone can advise me easier solution ?

Would fmemopen/open_memstream(3) do what you want?

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-07 21:53 iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE Vadim Kochan
  2015-01-07 22:13 ` Florian Westphal
@ 2015-01-07 23:08 ` Stephen Hemminger
  2015-01-07 23:46   ` Vadim Kochan
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2015-01-07 23:08 UTC (permalink / raw)
  To: Vadim Kochan; +Cc: netdev

On Wed, 7 Jan 2015 23:53:31 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> Hi,
> 
> I'd like to make possible to generate plot info about class hierarchy
> with qdisc, filters, stats info, but I see that all this staffs are
> printed to 'FILE *fp' which makes this hard to implement and seems to me
> that it should be changed to be printed to 'char *s' (memory safety
> should be considered by asprintf or similar), so this is a big change
> but all this is possible and I ready to do it, but before do it I'd like
> to ask if this could be acceptable as idea.
> 
> BUT maybe someone can advise me easier solution ?
> 
> Regards,
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Rather than screen scraping tc command, why not use libmnl and get the
data you want programmatically.

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-07 23:08 ` Stephen Hemminger
@ 2015-01-07 23:46   ` Vadim Kochan
  2015-01-08  0:06     ` Thomas Graf
  0 siblings, 1 reply; 7+ messages in thread
From: Vadim Kochan @ 2015-01-07 23:46 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Vadim Kochan, netdev

On Wed, Jan 07, 2015 at 03:08:28PM -0800, Stephen Hemminger wrote:
> On Wed, 7 Jan 2015 23:53:31 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > Hi,
> > 
> > I'd like to make possible to generate plot info about class hierarchy
> > with qdisc, filters, stats info, but I see that all this staffs are
> > printed to 'FILE *fp' which makes this hard to implement and seems to me
> > that it should be changed to be printed to 'char *s' (memory safety
> > should be considered by asprintf or similar), so this is a big change
> > but all this is possible and I ready to do it, but before do it I'd like
> > to ask if this could be acceptable as idea.
> > 
> > BUT maybe someone can advise me easier solution ?
> > 
> > Regards,
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> Rather than screen scraping tc command, why not use libmnl and get the
> data you want programmatically.

I'd like to have text info from tc on screen and output on the other
data format to be the same, just only for this.

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-07 23:46   ` Vadim Kochan
@ 2015-01-08  0:06     ` Thomas Graf
  2015-01-08  1:02       ` Vadim Kochan
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Graf @ 2015-01-08  0:06 UTC (permalink / raw)
  To: Vadim Kochan; +Cc: Stephen Hemminger, netdev

On 01/08/15 at 01:46am, Vadim Kochan wrote:
> I'd like to have text info from tc on screen and output on the other
> data format to be the same, just only for this.

Look at:
https://github.com/tgraf/libnl/blob/master/src/nl-tctree-list.c

It shows how to use an API to retrieve the information you want and
allows to pretty print tc entries.

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

* Re: iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE
  2015-01-08  0:06     ` Thomas Graf
@ 2015-01-08  1:02       ` Vadim Kochan
  0 siblings, 0 replies; 7+ messages in thread
From: Vadim Kochan @ 2015-01-08  1:02 UTC (permalink / raw)
  To: Thomas Graf; +Cc: Vadim Kochan, Stephen Hemminger, netdev

On Thu, Jan 08, 2015 at 12:06:20AM +0000, Thomas Graf wrote:
> On 01/08/15 at 01:46am, Vadim Kochan wrote:
> > I'd like to have text info from tc on screen and output on the other
> > data format to be the same, just only for this.
> 
> Look at:
> https://github.com/tgraf/libnl/blob/master/src/nl-tctree-list.c
> 
> It shows how to use an API to retrieve the information you want and
> allows to pretty print tc entries.

OK, may be I am not clearly described what I am trying to do ...
So I think it might be useful to have an option in TC which would be
generate classes graph in plot format but keep the same text info as it
is printed on console by default. I just think to re-use the existing
code which prints that text info to console but use it for plot
generating. Do you think that this not right thing feature to be in TC
and it might better to have this separately from TC ?

Thanks,

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

end of thread, other threads:[~2015-01-08  1:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-07 21:53 iproute2 tc: Print qdisc, stats, class, filter info to string rather than FILE Vadim Kochan
2015-01-07 22:13 ` Florian Westphal
2015-01-07 22:12   ` Vadim Kochan
2015-01-07 23:08 ` Stephen Hemminger
2015-01-07 23:46   ` Vadim Kochan
2015-01-08  0:06     ` Thomas Graf
2015-01-08  1:02       ` Vadim Kochan

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).