confusing kdump output
John Baldwin
jhb at freebsd.org
Wed Oct 10 13:21:21 PDT 2007
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
@@ -532,10 +532,12 @@
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
More information about the freebsd-current
mailing list