Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
6a5295a4
Commit
6a5295a4
authored
Jan 09, 2014
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into net-next-for-3.13
parents
80dd880d
56dee73e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
man/man8/ss.8
man/man8/ss.8
+1
-1
misc/ss.c
misc/ss.c
+36
-4
No files found.
man/man8/ss.8
View file @
6a5295a4
...
...
@@ -87,7 +87,7 @@ Currently the following families are supported: unix, inet, inet6, link, netlink
.B \-A QUERY, \-\-query=QUERY, \-\-socket=QUERY
List of socket tables to dump, separated by commas. The following identifiers
are understood: all, inet, tcp, udp, raw, unix, packet, netlink, unix_dgram,
unix_stream, packet_raw, packet_dgram.
unix_stream,
unix_seqpacket,
packet_raw, packet_dgram.
.TP
.B \-D FILE, \-\-diag=FILE
Do not display anything, just dump raw information about TCP sockets to FILE after applying filters. If FILE is - stdout is used.
...
...
misc/ss.c
View file @
6a5295a4
...
...
@@ -71,6 +71,7 @@ enum
RAW_DB
,
UNIX_DG_DB
,
UNIX_ST_DB
,
UNIX_SQ_DB
,
PACKET_DG_DB
,
PACKET_R_DB
,
NETLINK_DB
,
...
...
@@ -78,7 +79,7 @@ enum
};
#define PACKET_DBM ((1<<PACKET_DG_DB)|(1<<PACKET_R_DB))
#define UNIX_DBM ((1<<UNIX_DG_DB)|(1<<UNIX_ST_DB))
#define UNIX_DBM ((1<<UNIX_DG_DB)|(1<<UNIX_ST_DB)
|(1<<UNIX_SQ_DB)
)
#define ALL_DB ((1<<MAX_DB)-1)
enum
{
...
...
@@ -2114,6 +2115,25 @@ static void unix_list_free(struct unixstat *list)
}
}
static
const
char
*
unix_netid_name
(
int
type
)
{
const
char
*
netid
;
switch
(
type
)
{
case
SOCK_STREAM
:
netid
=
"u_str"
;
break
;
case
SOCK_SEQPACKET
:
netid
=
"u_seq"
;
break
;
case
SOCK_DGRAM
:
default:
netid
=
"u_dgr"
;
break
;
}
return
netid
;
}
static
void
unix_list_print
(
struct
unixstat
*
list
,
struct
filter
*
f
)
{
struct
unixstat
*
s
;
...
...
@@ -2126,6 +2146,8 @@ static void unix_list_print(struct unixstat *list, struct filter *f)
continue
;
if
(
s
->
type
==
SOCK_DGRAM
&&
!
(
f
->
dbs
&
(
1
<<
UNIX_DG_DB
)))
continue
;
if
(
s
->
type
==
SOCK_SEQPACKET
&&
!
(
f
->
dbs
&
(
1
<<
UNIX_SQ_DB
)))
continue
;
peer
=
"*"
;
if
(
s
->
peer
)
{
...
...
@@ -2156,7 +2178,7 @@ static void unix_list_print(struct unixstat *list, struct filter *f)
if
(
netid_width
)
printf
(
"%-*s "
,
netid_width
,
s
->
type
==
SOCK_STREAM
?
"u_str"
:
"u_dgr"
);
unix_netid_name
(
s
->
type
)
);
if
(
state_width
)
printf
(
"%-*s "
,
state_width
,
sstate_name
[
s
->
state
]);
printf
(
"%-6d %-6d "
,
s
->
rq
,
s
->
wq
);
...
...
@@ -2183,9 +2205,16 @@ static int unix_show_sock(struct nlmsghdr *nlh, struct filter *f)
parse_rtattr
(
tb
,
UNIX_DIAG_MAX
,
(
struct
rtattr
*
)(
r
+
1
),
nlh
->
nlmsg_len
-
NLMSG_LENGTH
(
sizeof
(
*
r
)));
if
(
r
->
udiag_type
==
SOCK_STREAM
&&
!
(
f
->
dbs
&
(
1
<<
UNIX_ST_DB
)))
return
0
;
if
(
r
->
udiag_type
==
SOCK_DGRAM
&&
!
(
f
->
dbs
&
(
1
<<
UNIX_DG_DB
)))
return
0
;
if
(
r
->
udiag_type
==
SOCK_SEQPACKET
&&
!
(
f
->
dbs
&
(
1
<<
UNIX_SQ_DB
)))
return
0
;
if
(
netid_width
)
printf
(
"%-*s "
,
netid_width
,
r
->
udiag_type
==
SOCK_STREAM
?
"u_str"
:
"u_dgr"
);
unix_netid_name
(
r
->
udiag_type
)
);
if
(
state_width
)
printf
(
"%-*s "
,
state_width
,
sstate_name
[
r
->
udiag_state
]);
...
...
@@ -3043,7 +3072,7 @@ static void _usage(FILE *dest)
" -f, --family=FAMILY display sockets of type FAMILY
\n
"
"
\n
"
" -A, --query=QUERY, --socket=QUERY
\n
"
" QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY]
\n
"
" QUERY := {all|inet|tcp|udp|raw|unix|
unix_dgram|unix_stream|unix_seqpacket|
packet|netlink}[,QUERY]
\n
"
"
\n
"
" -D, --diag=FILE Dump raw information about TCP sockets to FILE
\n
"
" -F, --filter=FILE read filter information from FILE
\n
"
...
...
@@ -3253,6 +3282,9 @@ int main(int argc, char *argv[])
}
else
if
(
strcasecmp
(
p
,
"unix_dgram"
)
==
0
||
strcmp
(
p
,
"u_dgr"
)
==
0
)
{
current_filter
.
dbs
|=
(
1
<<
UNIX_DG_DB
);
}
else
if
(
strcasecmp
(
p
,
"unix_seqpacket"
)
==
0
||
strcmp
(
p
,
"u_seq"
)
==
0
)
{
current_filter
.
dbs
|=
(
1
<<
UNIX_SQ_DB
);
}
else
if
(
strcmp
(
p
,
"packet"
)
==
0
)
{
current_filter
.
dbs
|=
PACKET_DBM
;
}
else
if
(
strcmp
(
p
,
"packet_raw"
)
==
0
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment