lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Apr 2012 10:41:28 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Shan Wei <shanwei88@...il.com>
Cc:	xemul@...allels.com, NetDev <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/2] ss: implement -M option to get all memory
 information

On Wed, 25 Apr 2012 15:15:27 +0800
Shan Wei <shanwei88@...il.com> wrote:

> From: Shan Wei <davidshan@...cent.com>
> 
> INET_DIAG_SKMEMINFO is used to monitor socket memory information
> which contains more information than INET_DIAG_MEMINFO.
> 
> -m option is retained for old kernel that don't surpport INET_DIAG_SKMEMINFO.
> 
> 
> Signed-off-by: Shan Wei <davidshan@...cent.com>
> ---
>  misc/ss.c |   27 +++++++++++++++++++++++++--
>  1 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/misc/ss.c b/misc/ss.c
> index 5f70a26..3c8befd 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -45,6 +45,7 @@ int show_options = 0;
>  int show_details = 0;
>  int show_users = 0;
>  int show_mem = 0;
> +int show_skmem = 0;
>  int show_tcpinfo = 0;
>  
>  int netid_width;
> @@ -1410,6 +1411,19 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r)
>  			printf(" rcv_space:%d", info->tcpi_rcv_space);
>  
>  	}
> +
> +	if (tb[INET_DIAG_SKMEMINFO]) {
> +		const unsigned int *skmeminfo =  RTA_DATA(tb[INET_DIAG_SKMEMINFO]);
> +		printf(" skmem:(r%u,rb%u,t%u,tb%u,f%u,w%u,o%u)",
> +			skmeminfo[SK_MEMINFO_RMEM_ALLOC],
> +			skmeminfo[SK_MEMINFO_RCVBUF],
> +			skmeminfo[SK_MEMINFO_WMEM_ALLOC],
> +			skmeminfo[SK_MEMINFO_SNDBUF],
> +			skmeminfo[SK_MEMINFO_FWD_ALLOC],
> +			skmeminfo[SK_MEMINFO_WMEM_QUEUED],
> +			skmeminfo[SK_MEMINFO_OPTMEM]);
> +	}
> +
>  }
>  
>  static int tcp_show_sock(struct nlmsghdr *nlh, struct filter *f)
> @@ -1466,7 +1480,7 @@ static int tcp_show_sock(struct nlmsghdr *nlh, struct filter *f)
>  			printf("%08x", r->id.idiag_cookie[1]);
>   		printf("%08x", r->id.idiag_cookie[0]);
>  	}
> -	if (show_mem || show_tcpinfo) {
> +	if (show_mem || show_tcpinfo || show_skmem) {
>  		printf("\n\t");
>  		tcp_show_info(nlh, r);
>  	}
> @@ -1508,6 +1522,9 @@ static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
>  	if (show_mem)
>  		req.r.idiag_ext |= (1<<(INET_DIAG_MEMINFO-1));
>  
> +	if (show_skmem)
> +		req.r.idiag_ext |= (1<<(INET_DIAG_SKMEMINFO-1));
> +
>  	if (show_tcpinfo) {
>  		req.r.idiag_ext |= (1<<(INET_DIAG_INFO-1));
>  		req.r.idiag_ext |= (1<<(INET_DIAG_VEGASINFO-1));
> @@ -2581,6 +2598,8 @@ static void _usage(FILE *dest)
>  "   -o, --options       show timer information\n"
>  "   -e, --extended      show detailed socket information\n"
>  "   -m, --memory        show socket memory usage\n"
> +"   -M, --skmem         show socket memory information.\n"
> +"                       this option which will replace -m, is valid since Linux 3.3.\n"

Please don't add reference to kernel version.
Why does this need to be a new option? Maybe just do the right thing
if present in the netlink response?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ