Commit Graph

242 Commits

Author SHA1 Message Date
Eric Dumazet
a3fd8e58c1 ss: should support CONFIG_INET_UDP_DIAG=n kernels
ss -x currently fails if CONFIG_INET_UDP_DIAG=n or old kernels

Also close file descriptors while we are at it.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
2012-01-30 08:12:50 -08:00
Stephen Hemminger
f606236010 Fix unix socket diagnostic build
Get updated headers incorporated into build environment
and include required sock_diag.h.
2012-01-20 12:48:00 -08:00
Pavel Emelyanov
dfbaa90dec iproute: Dump unix sockets via netlink
Get the same info as from /proc file plus the peer inode.

Applies on top of new sock diag patch and udp diag patch.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-20 12:43:21 -08:00
Stephen Hemminger
cd70f3f522 libnetlink: remove unused junk callback
Both rtnl_talk and rtnl_dump had a callback for handling portions
of netlink message that do not match the correct pid or seq.
But this callback was never used by any part of iproute2 so remove
it.
2011-12-28 10:37:12 -08:00
Stephen Hemminger
6cf8398f5f libnetlink: change rtnl_send() to take void *
Avoid having to cast buffer being sent.
2011-12-23 10:41:50 -08:00
Eric Dumazet
719b958bbd ss: report ecnseen
Support ECNSEEN reporting in ss command.

ESTAB      0      0           10.170.73.123:4900
10.170.73.125:51001    uid:501 ino:385994 sk:f31e5f00
         mem:(r0,w0,f0,t0) ts sack ecn ecnseen bic wscale:8,8 rto:210
rtt:18.75/15 ato:40 cwnd:10 send 69.9Mbps rcv_space:32768

"ecn" means TCP session negociated ECN capability (TCP layer) at setup
time

"ecnseen" at least one frame with ECT(0) or ECT(1) or ECN (IP layer) was
received from peer.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2011-11-23 14:51:54 -08:00
Petr Šabata
16963ce6f0 Display closed UDP sockets on 'ss -ul'
This patch emulates 'netstat -ul' behavior, showing 'closed'
(state 07) UDP sockets when ss is called with '-ul' options.
Although dirty, this seems like the least invasive way to fix
it and shouldn't really break anything.

Signed-off-by: Petr Šabata <contyk@redhat.com>
2011-11-16 09:32:20 -08:00
Thomas Jarosch
788731b320 Fix unterminated readlink() buffer usage
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-13 08:16:56 -07:00
Thomas Jarosch
2bcc3c1629 Fix pipe I/O stream descriptor leak in init_service_resolver()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:10:03 -07:00
Petr Sabata
281d740691 iproute2: arpd - fix usage and manpage options
Signed-off-by: Petr Sabata <contyk@redhat.com>
2011-10-06 08:25:06 -07:00
Petr Sabata
7e8bd80e38 iproute2: lnstat - fix typos
Signed-off-by: Petr Sabata <contyk@redhat.com>
2011-10-06 08:25:05 -07:00
Petr Sabata
583de1498e iproute2: ss - fix missing parameters
Signed-off-by: Petr Sabata <contyk@redhat.com>
2011-10-06 08:25:04 -07:00
Dan McGee
9a230771c0 ensure uptime is initialized if /proc/uptime cannot be opened 2011-08-31 12:16:36 -07:00
Stephen Hemminger
18445b3e92 ss: check result of readlink
Don't ignore readlink failure.
2011-06-29 15:58:37 -07:00
Stephen Hemminger
dc484542a9 Fix set-never-used warning in ifstat 2011-06-29 15:58:12 -07:00
Eric Dumazet
df39de8d24 ss: fix autobound filter
Fixes following error. We currently provide garbage data to kernel, that
can abort the validation process or produce unexpected results.

$ ss -a autobound
State      Recv-Q Send-Q      Local Address:Port          Peer Address:Port
TCPDIAG answers: Invalid argument

After patch:

$ misc/ss -a autobound
State      Recv-Q Send-Q      Local Address:Port          Peer Address:Port
LISTEN     0      128                     *:44624                    *:*
ESTAB      0      0            192.168.1.21:47141        74.125.79.109:imaps

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2011-06-20 14:31:51 -07:00
Stephen Hemminger
8988b02ee1 Fix snprintf with non format
snprintf was being called with environment variable.
If variable had format string (like %s) then program would crash.
2011-04-12 14:23:27 -07:00
Eric Dumazet
a571587d0b iproute2: add 64bit support to ifstat
Le lundi 23 août 2010 à 10:33 -0700, Stephen Hemminger a écrit :

> I think this breaks the wraparound detection code in this command.
>
>

OK lets fix the bug only, before adding 64bit counters capabilities.

Thanks

[PATCH] iproute2: add 64bit arches support to ifstat

ifstat assumes IFLA_STATS fields are "unsigned long", but they are
__u32. This fix is needed to let ifstat run on 64bit arches.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2010-08-23 13:05:12 -07:00
Stephen Hemminger
daf7bd5c73 Use correct rt_link_statistics
In recent kernels, net_device_stats is not exposed and the code
shoulf have used rt_link_statistics.  Also, fix use of sprintf
with user supplied value.
2010-08-23 09:13:05 -07:00
Steve Fink
fbc0f876fa ss -p is much too slow
> On closer inspection, it appears that ss -p does a quadratic scan. It
> rescans every entry in /proc/*/fd/* repeatedly (once per listening
> port? per process? I don't remember what I figured out.)
>
> I humbly suggest that this is not a good idea.

Yep, this is junk.  Please give this patch a try:

ss: Avoid quadradic complexity with '-p'

Scan the process list of open sockets once, and store in a hash
table to be used by subsequent find_user() calls.

Reported-by: Steve Fink <sphink@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-07-31 19:31:12 -07:00
Stephen Hemminger
896ebd6c70 Fix warning about sprintf() and NSTAT_HIST
The environment variable could contain format characters, causing
problems. Better to just use it directly.
2009-12-26 10:21:13 -08:00
Andreas Henriksson
7a96e19977 iproute: make ss --help output to stdout
Peter Palfrader said in http://bugs.debian.org/545008 that
"--help output, if explicitly requested, should go to stdout, not stderr."
which this patch fixes.

Additionally, the exit code was adjusted to success if help was
explicitly requested.

(Syntax error still outputs to stderr and has the same exit code.)

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2009-12-26 10:05:27 -08:00
Mike Frysinger
a7a9ddbb67 arpd/ifstat/nstat/rtacct: use daemon()
A bunch of misc utils basically reimplement the daemon() function (the
whole fork/close/chdir/etc...).  Rather than do that, use daemon() as
that will work under nommu Linux systems that lack fork().

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-11-10 10:41:44 -08:00
Eric Dumazet
daf49fd614 ss: adds a space before congestion string
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2009-09-11 08:06:53 -07:00
Eric Dumazet
bbe3205336 ss: correct display of sk pointer
On 64bit arches, sk pointer was 32/32 reversed.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2009-09-11 08:06:07 -07:00
Li Yewang
a37b01c1f0 distinguish the inet and inet6 domain when loading the tcp_diag module
When load the tcp_diag module, and use "ss -f inet" command to show the socket
information of inet domain. But this command also shows the information of inet6
domain, but not only inet domain. and "ss -f inet6", "ss -4", "ss -6" have the
same problem.

Signed-off-by: Li Yewang <lyw@cn.fujitsu.com>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-09-17 22:05:02 -07:00
Li Yewang
f70d96a41b Fix the error of "ss -f inet -t"
when using the "ss -f inet -t" command to show the tcp socket information of
inet domain, we get the error message: "ss: no socket tables to show with such filter."

This patch can fix this bug.

Signed-off-by: Li Yewang <lyw@cn.fujitsu.com>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-09-17 22:05:00 -07:00
Stephen Hemminger
f309d0ae43 Add warning message when MAX_FIELDS reached
Don't just silently drop.
2008-06-30 11:57:13 -07:00
Stephen Hemminger
f493dc3009 Fix array out of bounds problem
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.
2008-06-30 10:37:28 -07:00
Yu Zhiguo
4ffc44ca7c Fix generic_proc_open() of command 'nstat' and 'rtacct'
Fix a bug of generic_proc_open(), so environment variables
(e.g. PROC_NET_SNMP, PROC_NET_RTACCT) can be used to specify procfile.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2008-06-23 14:04:29 -07:00
Stephen Hemminger
2d44be19cf timers are in user hz
The kernel timers are exposed in user hz not kernel hz
2008-06-20 12:40:03 -07:00
Stephen Hemminger
4c1db1310f use correct hz for rto,ato
The function get_hz() returns the psched hz value which is wrong
for anything other than tc usage. Should be user hz instead, but
kernel is broken (patch sent) and this code doesn't get hit on
current systems (netlink is used first).
2008-06-20 12:34:15 -07:00
Björn Steinbrink
69cae645b2 ss: Fix return value checks for net_*_open
In ss.c, generic_proc_open(), for which the net_*_open functions are just
convenient wrappers, uses fopen, so errors are signalled by a NULL return
value. Some checks were expecting negative values instead, fix them.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-04-03 08:24:04 -07:00
Mike Frysinger
418a217ad9 Do not strip binaries with install
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-04-01 11:26:47 -07:00
Stephen Hemminger
77aa4d03a7 Use netinet/tcp.h (with correction) rather than kernel headers
Fix the userspace header file rather than importing more
kernel headers.

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2007-12-31 10:41:18 -08:00
Stephen Hemminger
88de3e0fec remove outdated netbug script.
Haven't received a bug from this script in years.
And it has several race conditions, etc.

See http://bugs.debian.org/289541, http://bugs.debian.org/313540,
http://bugs.debian.org/313541, and http://bugs.debian.org/313544.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
2007-10-12 13:50:43 -07:00
Eric Dumazet
f50332c57a lnstat : force a flush before sleep
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>
2007-10-11 12:40:15 -07:00
Stephen Hemminger
ab01dbbb94 Fix ss to handle partial records.
Output from /proc may include partial records, so rather than
trying to be sexy and do own parsing, just use stdio.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
2007-07-18 15:31:29 +01:00
Stephen Hemminger
e7113c61cb ss: fix issues with signed inodes
Some parts of ss were incorrectly assuming inode number was int
not unsigned.
2007-07-10 18:26:54 -07:00
Thomas Hisch
892db6942a Fixes use of uninitialized string
store can be used uninitialized in generic_proc_open
if getenv(env) != NULL

Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
2007-03-05 17:35:06 -08:00
Stephen Hemminger
ae665a522b Remove trailing whitespace
Go through source files and remove all trailing whitespace

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
2006-12-05 10:10:22 -08:00
Stephen Hemminger
da7aea7946 Add ignore files to make using git easier
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
2006-08-08 12:04:38 -07:00
shemminger
49843e291d Set default count for lnstat 2006-03-10 23:19:03 +00:00
shemminger
351efcde4e Update header files to 2.6.14
Integrate support for DCCP and tcp_diag into ss
Add -batch to ip command
2005-09-01 19:21:50 +00:00
shemminger
7339c0bb74 Could you please apply this patch.
* Fix lnstat : First column should not be summed

Thank you

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
2005-09-01 18:11:03 +00:00
shemminger
737f15f6da Thomas's ematch fixes for lex.
Fix more GCC signedness warnings.
2005-07-08 22:08:47 +00:00
shemminger
f332d16924 Cleanup GCC4 warnings about signedness. 2005-07-05 22:37:15 +00:00
shemminger
52d5ac3fcb Fix build issues 2005-07-05 22:11:37 +00:00
shemminger
c4c9765e0b The symlink commands create absolute symlinks instead of relative.
This causes dangling links in case the package is installed using
DESTDIR. Some package managers will report this as an error.
2005-06-23 17:39:57 +00:00
shemminger
ea8fc1047d Netem support for reorder
Update include files and add support for TCP_CONG
2005-06-22 18:27:49 +00:00
osdl.net!shemminger
f5f1a6c583 Fix sum of first field (entries).
(Logical change 1.172)
2005-03-18 19:40:19 +00:00
osdl.net!shemminger
e796b9587a Fix compile warning.
(Logical change 1.172)
2005-03-18 19:40:19 +00:00
osdl.net!shemminger
4c74f032f6 need to sum all lines on smp machine.
(Logical change 1.171)
2005-03-16 23:29:15 +00:00
osdl.net!shemminger
627c228ef5 Style change
2005/03/10 12:26:43-08:00 net[shemminger]!shemminger
Import patch iproute-batch.1.050209.patch

(Logical change 1.164)
2005-03-14 19:04:49 +00:00
osdl.net!shemminger
b9de3ecf94 typo, extra /
(Logical change 1.133)
2005-01-19 00:23:53 +00:00
osdl.net!shemminger
c3f346b00a typo in ss
(Logical change 1.132)
2005-01-18 22:31:42 +00:00
8!tgraf
f22b6eba67 tb buffer initialization is now done in the parser
(Logical change 1.129)
2005-01-18 22:11:58 +00:00
5!tgraf
87bc1f03ad tb buffer initialization is now done in the parser
(Logical change 1.129)
2005-01-18 22:11:58 +00:00
11!tgraf
ebb4e4376a tb buffer initialization is now done in the parser
(Logical change 1.129)
2005-01-18 22:11:58 +00:00
osdl.net!shemminger
50772dc51a Add ip rule flush capabilty and fix all the prototype changes
because of that code rewrites the nlmsghdr.

(Logical change 1.106)
2004-12-07 21:48:29 +00:00
osdl.net!shemminger
64df4e3e31 Don't need this.
(Logical change 1.103)
2004-10-20 16:12:49 +00:00
osdl.net!shemminger
4677a54983 add const to find_field
(Logical change 1.102)
2004-10-19 20:47:13 +00:00
osdl.net!shemminger
0bb187ca0e Add const on strings and make sure not to crash
when there is no slash in argv[0]

(Logical change 1.102)
2004-10-19 20:47:13 +00:00
osdl.net!shemminger
07c3545572 Rename: misc/README.lnstat -> README.lnstat
}(Logical change 1.100)
2004-10-19 20:24:47 +00:00
osdl.net!shemminger
8b3c3abb63 Initial revision 2004-10-19 20:21:14 +00:00
osdl.net!shemminger
56fbc4f68c Delete: misc/rtstat.c
}(Logical change 1.98)
2004-10-19 20:21:14 +00:00
osdl.net!shemminger
9783e0d4f0 Add lnstat to replace rtstat.
(Logical change 1.98)
2004-10-19 20:21:14 +00:00
osdl.net!shemminger
056eb9d8dd (Logical change 1.98) 2004-10-19 20:21:14 +00:00
net[shemminger]!shemminger
b482ffa6a6 Import patch nstat.eml
(Logical change 1.97)
2004-10-19 20:02:59 +00:00
osdl.net!shemminger
bb6a21a4fc Fix build warnings on x86_64
(Logical change 1.92)
2004-10-06 23:17:10 +00:00
osdl.net!shemminger
63fe5f043e get rid of warning.
2004/09/28 12:01:02-07:00 osdl.net!shemminger
Update to rtstat.c from Robert Olsson

(Logical change 1.89)
2004-09-28 19:16:48 +00:00
osdl.net!shemminger
169b47a569 Some versions -ldb seem do need pthread.
(Logical change 1.87)
2004-09-28 18:56:27 +00:00
osdl.net!shemminger
b4b0b7d558 ss cleanup and enable full features.
(Logical change 1.80)
2004-09-28 18:14:03 +00:00
osdl.net!shemminger
6dc9f01634 make all filtering handles take const args.
(Logical change 1.77)
2004-08-31 17:45:21 +00:00
osdl.net!shemminger
1a5bad5aa4 fix matches that got introduced by last patch
(Logical change 1.54)
2004-07-07 17:06:35 +00:00
osdl.net!shemminger
17ce7fd51c add if_ether.h since it not in if.h on some systems.
(Logical change 1.52)
2004-07-06 21:01:44 +00:00
osdl.net!shemminger
11d1cad87c simplify make file.
(Logical change 1.34)
2004-06-25 21:20:20 +00:00
osdl.net!shemminger
adff36d765 Cleaner way to configure
(Logical change 1.33)
2004-06-25 21:14:22 +00:00
osdl.org!shemminger
ab61159aa0 GNU long options for ss
Pick up ephermal port list from /proc/sys/net/ipv4 rather than hard coded.

(Logical change 1.23)
2004-06-09 21:30:13 +00:00
osdl.org!shemminger
16efac57d0 Directory for db library set in top level makefile
(Logical change 1.21)
2004-06-09 21:28:46 +00:00
osdl.org!shemminger
d7e0809ee6 Switch to single fprintf for output
(Logical change 1.18)
2004-06-09 18:09:48 +00:00
osdl.org!shemminger
9f3ea25096 report rates in k=1000, and add gnu style options.
(Logical change 1.17)
2004-06-09 17:37:28 +00:00
osdl.org!shemminger
d25ad2901e Allow build on 2.4
(Logical change 1.16)
2004-06-08 23:50:43 +00:00
osdl.org!shemminger
36e3120900 Switch to db4.1
(Logical change 1.14)
2004-06-08 22:51:46 +00:00
osdl.org!shemminger
c0076e70b1 Don't force location of tmp
(Logical change 1.14)
2004-06-08 22:51:46 +00:00
osdl.org!shemminger
05e18118ec Cleanup display logic and add receive space values.
(Logical change 1.12)
2004-06-08 20:33:44 +00:00
osdl.org!shemminger
15a79f12cd TCPDIAG_VEGASINFO is not a #define, its an enum
(Logical change 1.7)
2004-06-04 18:39:32 +00:00
osdl.org!shemminger
43cc93e347 Get rid of warning
(Logical change 1.7)
2004-06-04 18:39:32 +00:00
osdl.org!shemminger
f1dfe7dec1 get rid of warning
(Logical change 1.6)
2004-06-02 20:22:08 +00:00
osdl.org!shemminger
7d105b5648 Build and constant cleanup
(Logical change 1.6)
2004-06-02 20:22:08 +00:00
osdl.org!shemminger
aba5acdfdb (Logical change 1.3) 2004-04-15 20:56:59 +00:00
osdl.org!shemminger
86fdf0e47b Initial revision 2004-04-15 20:56:59 +00:00