Re: confusing kdump output

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 10 Oct 2007 15:46:03 -0400
On Sunday 08 July 2007 11:21:16 am Michiel Boland wrote:
> Hi. If a program does something like
> 
> setsockopt(sock, IPPROTO_TCP, TCP_NOPUSH, &onoff, sizeof onoff)
> 
> this is reported by kdump as
> 
> setsockopt(0x2a,0x6,SO_REUSEADDR,0x7fffffffe32c,0x4)
> 
> Note that it reports SO_REUSEADDR rather than TCP_NOPUSH. This is 
> confusing.
> 
> It's probably a bit useless to compile all possible printable socket 
> options into kdump, but at least it could be made to not print a symbolic 
> name if the level is, say, not SOL_SOCKET.

Try this:

Index: kdump.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/kdump/kdump.c,v
retrieving revision 1.37
diff -u -r1.37 kdump.c
--- kdump.c	10 Jul 2007 00:01:30 -0000	1.37
+++ kdump.c	10 Oct 2007 19:43:48 -0000
_at__at_ -532,10 +532,12 _at__at_
 				print_number(ip,narg,c);
 				(void)putchar(',');
 				sockoptlevelname((int)*ip, decimal);
-				ip++;
-				narg--;
-				(void)putchar(',');
-				sockoptname((int)*ip);
+				if ((int)*ip == SOL_SOCKET) {
+					ip++;
+					narg--;
+					(void)putchar(',');
+					sockoptname((int)*ip);
+				}
 				ip++;
 				narg--;
 #ifdef SYS_freebsd6_lseek

-- 
John Baldwin
Received on Wed Oct 10 2007 - 18:21:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:19 UTC