summaryrefslogtreecommitdiffstats
path: root/misc/lnstat.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: refactor help messagesMatteo Croce2019-05-201-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every tool in the iproute2 package have one or more function to show an help message to the user. Some of these functions print the help line by line with a series of printf call, e.g. ip/xfrm_state.c does 60 fprintf calls. If we group all the calls to a single one and just concatenate strings, we save a lot of libc calls and thus object size. The size difference of the compiled binaries calculated with bloat-o-meter is: ip/ip: add/remove: 0/0 grow/shrink: 5/15 up/down: 103/-4796 (-4693) Total: Before=672591, After=667898, chg -0.70% ip/rtmon: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-54 (-54) Total: Before=48879, After=48825, chg -0.11% tc/tc: add/remove: 0/2 grow/shrink: 31/10 up/down: 882/-6133 (-5251) Total: Before=351912, After=346661, chg -1.49% bridge/bridge: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-459 (-459) Total: Before=70502, After=70043, chg -0.65% misc/lnstat: add/remove: 0/1 grow/shrink: 1/0 up/down: 48/-486 (-438) Total: Before=9960, After=9522, chg -4.40% tipc/tipc: add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-62 (-44) Total: Before=79182, After=79138, chg -0.06% While at it, indent some strings which were starting at column 0, and use tabs where possible, to have a consistent style across helps. Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* Replace malloc && memset by callocPhil Sutter2016-07-201-4/+2
| | | | | | | | | This only replaces occurrences where the newly allocated memory is cleared completely afterwards, as in other cases it is a theoretical performance hit although code would be cleaner this way. Signed-off-by: Phil Sutter <phil@nwl.cc> Acked-by: David Ahern <dsa@cumulusnetworks.com>
* misc: fix style issuesStephen Hemminger2016-03-211-12/+8
| | | | More checkpatch spring cleaning
* lnstat: fix header displaying mechanismPhil Sutter2015-11-231-5/+3
| | | | | | | | | | | | The algorithm depends on the loop counter ('i') to increment by one in each iteration. Though if running endlessly (count==0), the counter was not incremented at all. Also change formatting of the header printing conditional a bit so it's hopefully easier to read. Fixes: e7e2913 ("lnstat: run indefinitely by default") Signed-off-by: Phil Sutter <phil@nwl.cc>
* lnstat: describe -s option in help outputPhil Sutter2015-11-231-1/+4
| | | | Signed-off-by: Phil Sutter <phil@nwl.cc>
* misc: cleanup extra whitespaceStephen Hemminger2015-10-231-1/+0
| | | | No blank lines at end of file
* provide common json output formatterStephen Hemminger2015-08-231-14/+8
| | | | | Formatting JSON is moderately painful. Provide a simple API to do the syntax formatting.
* lnstat: dump to stdout, not stderrPavel Šimerda2015-04-201-1/+1
| | | | | | | | See also: * https://bugzilla.redhat.com/show_bug.cgi?id=736332 Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
* lnstat: run indefinitely by defaultPavel Šimerda2015-04-201-3/+5
| | | | | | | | See also: * https://bugzilla.redhat.com/show_bug.cgi?id=977845 Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
* whitespace cleanupStephen Hemminger2014-12-201-4/+4
| | | | Remove all trailing whitespace and space before tabs.
* Fix non-literal string format warningsStephen Hemminger2014-05-291-10/+6
| | | | | | The lnstat program was building a format string, then using it. This was safe, but simpler to just use format character * to get width.
* lnstat: add json output formatStephen Hemminger2013-09-241-67/+104
|
* iproute2 patch against GCC 4.8.0Kamil Rytarowski2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | | Hello! I'm attaching a patch [1] "Feed GCC 4.8.0 against new warning that is shipped with -Wall: -Wsizeof-pointer-memaccess.". More details: http://gcc.gnu.org/gcc-4.8/porting_to.html Regards, [1] 0001-Feed-GCC-4.8.0-against-new-warning-that-is-shipped-w.patch >From 1f3ea01fe2ff61cbbca6474f7d9903a0756a4f44 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski <n54@gmx.com> Date: Fri, 3 May 2013 18:43:38 +0200 Subject: [PATCH] Feed GCC 4.8.0 against new warning that is shipped with -Wall: -Wsizeof-pointer-memaccess.
* iproute2: lnstat - fix typosPetr Sabata2011-10-061-2/+2
| | | | Signed-off-by: Petr Sabata <contyk@redhat.com>
* Add warning message when MAX_FIELDS reachedStephen Hemminger2008-06-301-2/+12
| | | | Don't just silently drop.
* Fix array out of bounds problemStephen Hemminger2008-06-301-2/+5
| | | | | | | The current kernel generates 71 possible header fields, but MAX_FIELDS in lnstat is only 64. This leads to referencing outside of the array. To fix, increase size of array and chop off parsing at MAX_FIELDS - 1.
* lnstat : force a flush before sleepEric Dumazet2007-10-111-0/+1
| | | | | | | | | | | Hi Stephen This small patch allows to use lnstat/rtstat with a pipe output, without a full bufferisation. Thank you Eric Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
* Remove trailing whitespaceStephen Hemminger2006-12-051-8/+8
| | | | | | Go through source files and remove all trailing whitespace Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
* Set default count for lnstatshemminger2006-03-101-1/+1
|
* Fix compile warning.osdl.net!shemminger2005-03-181-2/+3
| | | | (Logical change 1.172)
* Style changeosdl.net!shemminger2005-03-141-1/+1
| | | | | | | 2005/03/10 12:26:43-08:00 net[shemminger]!shemminger Import patch iproute-batch.1.050209.patch (Logical change 1.164)
* Add const on strings and make sure not to crashosdl.net!shemminger2004-10-191-0/+336
| | | | | | when there is no slash in argv[0] (Logical change 1.102)
* Initial revisionosdl.net!shemminger2004-10-191-336/+0
|
* (Logical change 1.98)osdl.net!shemminger2004-10-191-0/+336