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
89f634f9
Commit
89f634f9
authored
Feb 13, 2015
by
Vadim Kochan
Committed by
Stephen Hemminger
Feb 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ss: Replace pktstat struct by new sockstat struct
Signed-off-by:
Vadim Kochan
<
vadim4j@gmail.com
>
parent
055840f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
misc/ss.c
misc/ss.c
+12
-21
No files found.
misc/ss.c
View file @
89f634f9
...
...
@@ -693,6 +693,8 @@ static const char *sstate_namel[] = {
struct
sockstat
{
uint8_t
type
;
uint16_t
prot
;
inet_prefix
local
;
inet_prefix
remote
;
int
lport
;
...
...
@@ -2731,29 +2733,18 @@ static int unix_show(struct filter *f)
return
0
;
}
struct
pktstat
{
uint8_t
type
;
uint16_t
prot
;
uint32_t
iface
;
int
state
;
uint32_t
rq
;
uid_t
uid
;
ino_t
ino
;
};
static
int
packet_stats_print
(
struct
pktstat
*
s
,
const
struct
filter
*
f
)
static
int
packet_stats_print
(
struct
sockstat
*
s
,
const
struct
filter
*
f
)
{
char
*
buf
=
NULL
;
if
(
f
->
f
)
{
struct
sockstat
st
;
st
.
local
.
family
=
AF_PACKET
;
st
.
remote
.
family
=
AF_PACKET
;
st
.
rport
=
0
;
st
.
lport
=
s
->
iface
;
st
.
local
.
data
[
0
]
=
s
->
prot
;
st
.
remote
.
data
[
0
]
=
0
;
if
(
run_ssfilter
(
f
->
f
,
&
st
)
==
0
)
s
->
local
.
family
=
AF_PACKET
;
s
->
remote
.
family
=
AF_PACKET
;
s
->
rport
=
0
;
s
->
lport
=
s
->
iface
;
s
->
local
.
data
[
0
]
=
s
->
prot
;
s
->
remote
.
data
[
0
]
=
0
;
if
(
run_ssfilter
(
f
->
f
,
s
)
==
0
)
return
1
;
}
...
...
@@ -2802,7 +2793,7 @@ static int packet_show_sock(const struct sockaddr_nl *addr,
const
struct
filter
*
f
=
arg
;
struct
packet_diag_msg
*
r
=
NLMSG_DATA
(
nlh
);
struct
rtattr
*
tb
[
PACKET_DIAG_MAX
+
1
];
struct
pkt
stat
stat
=
{};
struct
sock
stat
stat
=
{};
parse_rtattr
(
tb
,
PACKET_DIAG_MAX
,
(
struct
rtattr
*
)(
r
+
1
),
nlh
->
nlmsg_len
-
NLMSG_LENGTH
(
sizeof
(
*
r
)));
...
...
@@ -2871,7 +2862,7 @@ static int packet_show_netlink(struct filter *f)
static
int
packet_show_line
(
char
*
buf
,
const
struct
filter
*
f
,
int
fam
)
{
unsigned
long
long
sk
;
struct
pkt
stat
stat
=
{};
struct
sock
stat
stat
=
{};
int
type
,
prot
,
iface
,
state
,
rq
,
uid
,
ino
;
sscanf
(
buf
,
"%llx %*d %d %x %d %d %u %u %u"
,
...
...
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