Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
iproute2
iproute-Fix-Netid-value-for-multi-families-outp...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File iproute-Fix-Netid-value-for-multi-families-output.patch of Package iproute2
From: Pavel Emelyanov <xemul@parallels.com> Date: Tue, 28 Jan 2014 10:24:15 +0400 Subject: iproute: Fix Netid value for multi-families output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch-mainline: v3.14.0 Git-commit: 77a8ca81189197e8d5e75fe19951efd0aea337d5 References: bnc#879865 When requesting simultaneous output of TCP and UDP sockets the netid field shows "tcp" always. [root@xemvm1 iproute2]# ./misc/ss -a -tu Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp UNCONN 0 0 *:32713 *:* tcp UNCONN 0 0 *:bootpc *:* tcp UNCONN 0 0 :::57879 :::* tcp LISTEN 0 128 *:ssh *:* tcp ESTAB 0 48 1.2.3.5:ssh 1.2.3.4:45826 tcp ESTAB 0 0 1.2.3.5:ssh 1.2.3.4:45814 tcp LISTEN 0 128 :::ssh :::* While the 1st 3 sockets are UDP ones: [root@xemvm1 iproute2]# ./misc/ss -a -u State Recv-Q Send-Q Local Address:Port Peer Address:Port UNCONN 0 0 *:32713 *:* UNCONN 0 0 *:bootpc *:* UNCONN 0 0 :::57879 :::* Reported-by: François-Xavier Le Bail <fx.lebail@yahoo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Tested-by: François-Xavier Le Bail <fx.lebail@yahoo.com> --- misc/ss.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index 0e09603..ed1db17 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -1464,7 +1464,21 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, } } -static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f) +static char *proto_name(int protocol) +{ + switch (protocol) { + case IPPROTO_UDP: + return "udp"; + case IPPROTO_TCP: + return "tcp"; + case IPPROTO_DCCP: + return "dccp"; + } + + return "???"; +} + +static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f, int protocol) { struct rtattr * tb[INET_DIAG_MAX+1]; struct inet_diag_msg *r = NLMSG_DATA(nlh); @@ -1489,7 +1503,7 @@ static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f) return 0; if (netid_width) - printf("%-*s ", netid_width, "tcp"); + printf("%-*s ", netid_width, proto_name(protocol)); if (state_width) printf("%-*s ", state_width, sstate_name[s.state]); @@ -1764,7 +1778,7 @@ again: h = NLMSG_NEXT(h, status); continue; } - err = inet_show_sock(h, NULL); + err = inet_show_sock(h, NULL, protocol); if (err < 0) { close(fd); return err; @@ -1843,7 +1857,7 @@ static int tcp_show_netlink_file(struct filter *f) return -1; } - err = inet_show_sock(h, f); + err = inet_show_sock(h, f, IPPROTO_TCP); if (err < 0) return err; } -- 1.8.4.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor