2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/socket.h>
38 #include <netinet/in.h>
39 #include <arpa/inet.h>
41 #include <asm/types.h>
42 #if defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC__ + __GLIBC_MINOR__ >= 3)
43 # include <netipx/ipx.h>
45 # include <linux/ipx.h>
49 #if defined (__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
50 #if defined(HAVE_LINUX_IN6_H)
51 #include <linux/in6.h>
55 #if defined(HAVE_SYS_UIO_H)
59 #if defined(HAVE_LINUX_NETLINK_H)
60 #include <linux/netlink.h>
63 #if defined(HAVE_LINUX_IF_PACKET_H)
64 #include <linux/if_packet.h>
67 #if defined(HAVE_LINUX_ICMP_H)
68 #include <linux/icmp.h>
72 #define PF_UNSPEC AF_UNSPEC
76 /* Under Linux these are enums so we can't test for them with ifdef. */
77 #define IPPROTO_EGP IPPROTO_EGP
78 #define IPPROTO_PUP IPPROTO_PUP
79 #define IPPROTO_IDP IPPROTO_IDP
80 #define IPPROTO_IGMP IPPROTO_IGMP
81 #define IPPROTO_RAW IPPROTO_RAW
82 #define IPPROTO_MAX IPPROTO_MAX
85 static struct xlat domains[] = {
86 { PF_UNSPEC, "PF_UNSPEC" },
87 { PF_UNIX, "PF_UNIX" },
88 { PF_INET, "PF_INET" },
90 { PF_NETLINK, "PF_NETLINK" },
93 { PF_PACKET, "PF_PACKET" },
96 { PF_INET6, "PF_INET6" },
99 { PF_ATMSVC, "PF_INET6" },
102 { PF_INET6, "PF_INET6" },
105 { PF_LOCAL, "PS_LOCAL" },
108 { PF_ISO, "PF_ISO" },
111 { PF_AX25, "PF_AX25" },
114 { PF_IPX, "PF_IPX" },
117 { PF_APPLETALK, "PF_APPLETALK" },
120 { PF_NETROM, "PF_NETROM" },
123 { PF_BRIDGE, "PF_BRIDGE" },
126 { PF_AAL5, "PF_AAL5" },
129 { PF_X25, "PF_X25" },
132 { PF_ROSE, "PF_ROSE" },
135 { PF_DECNET, "PF_DECNET" },
138 { PF_NETBEUI, "PF_NETBEUI" },
141 { PF_IMPLINK, "PF_IMPLINK" },
145 static struct xlat addrfams[] = {
146 { AF_UNSPEC, "AF_UNSPEC" },
147 { AF_UNIX, "AF_UNIX" },
148 { AF_INET, "AF_INET" },
150 { AF_INET6, "AF_INET6" },
152 { AF_DECnet, "AF_DECnet" },
154 { AF_ATMSVC, "AF_ATMSVC" },
157 { AF_PACKET, "AF_PACKET" },
160 { AF_NETLINK, "AF_NETLINK" },
163 { AF_ISO, "AF_ISO" },
166 { AF_IMPLINK, "AF_IMPLINK" },
170 static struct xlat socktypes[] = {
171 { SOCK_STREAM, "SOCK_STREAM" },
172 { SOCK_DGRAM, "SOCK_DGRAM" },
174 { SOCK_RAW, "SOCK_RAW" },
176 #ifdef SOCK_SEQPACKET
177 { SOCK_SEQPACKET,"SOCK_SEQPACKET"},
180 { SOCK_RDM, "SOCK_RDM" },
183 { SOCK_PACKET, "SOCK_PACKET" },
187 static struct xlat protocols[] = {
188 { IPPROTO_IP, "IPPROTO_IP" },
189 { IPPROTO_ICMP, "IPPROTO_ICMP" },
190 { IPPROTO_TCP, "IPPROTO_TCP" },
191 { IPPROTO_UDP, "IPPROTO_UDP" },
193 { IPPROTO_GGP, "IPPROTO_GGP" },
196 { IPPROTO_EGP, "IPPROTO_EGP" },
199 { IPPROTO_PUP, "IPPROTO_PUP" },
202 { IPPROTO_IDP, "IPPROTO_IDP" },
205 { IPPROTO_IPV6, "IPPROTO_IPV6" },
207 #ifdef IPPROTO_ICMPV6
208 { IPPROTO_ICMPV6,"IPPROTO_ICMPV6"},
211 { IPPROTO_IGMP, "IPPROTO_IGMP" },
214 { IPPROTO_HELLO,"IPPROTO_HELLO" },
217 { IPPROTO_ND, "IPPROTO_ND" },
220 { IPPROTO_RAW, "IPPROTO_RAW" },
223 { IPPROTO_MAX, "IPPROTO_MAX" },
226 { IPPROTO_IPIP, "IPPROTO_IPIP" },
230 static struct xlat msg_flags[] = {
231 { MSG_OOB, "MSG_OOB" },
233 { MSG_DONTROUTE,"MSG_DONTROUTE" },
236 { MSG_PEEK, "MSG_PEEK" },
239 { MSG_CTRUNC, "MSG_CTRUNC" },
242 { MSG_PROXY, "MSG_PROXY" },
245 { MSG_EOR, "MSG_EOR" },
248 { MSG_WAITALL, "MSG_WAITALL" },
251 { MSG_TRUNC, "MSG_TRUNC" },
254 { MSG_CTRUNC, "MSG_CTRUNC" },
257 { MSG_ERRQUEUE, "MSG_ERRQUEUE" },
260 { MSG_DONTWAIT, "MSG_DONTWAIT" },
263 { MSG_CONFIRM, "MSG_CONFIRM" },
266 { MSG_PROBE, "MSG_PROBE" },
271 static struct xlat sockoptions[] = {
273 { SO_PEERCRED, "SO_PEERCRED" },
276 { SO_PASSCRED, "SO_PASSCRED" },
279 { SO_DEBUG, "SO_DEBUG" },
282 { SO_REUSEADDR, "SO_REUSEADDR" },
285 { SO_KEEPALIVE, "SO_KEEPALIVE" },
288 { SO_DONTROUTE, "SO_DONTROUTE" },
291 { SO_BROADCAST, "SO_BROADCAST" },
294 { SO_LINGER, "SO_LINGER" },
297 { SO_OOBINLINE, "SO_OOBINLINE" },
300 { SO_TYPE, "SO_TYPE" },
303 { SO_ERROR, "SO_ERROR" },
306 { SO_SNDBUF, "SO_SNDBUF" },
309 { SO_RCVBUF, "SO_RCVBUF" },
312 { SO_NO_CHECK, "SO_NO_CHECK" },
315 { SO_PRIORITY, "SO_PRIORITY" },
318 { SO_ACCEPTCONN,"SO_ACCEPTCONN" },
320 #ifdef SO_USELOOPBACK
321 { SO_USELOOPBACK,"SO_USELOOPBACK"},
324 { SO_SNDLOWAT, "SO_SNDLOWAT" },
327 { SO_RCVLOWAT, "SO_RCVLOWAT" },
330 { SO_SNDTIMEO, "SO_SNDTIMEO" },
333 { SO_RCVTIMEO, "SO_RCVTIMEO" },
336 { SO_BSDCOMPAT, "SO_BSDCOMPAT" },
339 { SO_REUSEPORT, "SO_REUSEPORT" },
342 { SO_RCVLOWAT, "SO_RCVLOWAT" },
345 { SO_SNDLOWAT, "SO_SNDLOWAT" },
348 { SO_RCVTIMEO, "SO_RCVTIMEO" },
351 { SO_SNDTIMEO, "SO_SNDTIMEO" },
357 static struct xlat sockipoptions[] = {
358 { IP_TOS, "IP_TOS" },
359 { IP_TTL, "IP_TTL" },
360 #if defined(IP_HDRINCL)
361 { IP_HDRINCL, "IP_HDRINCL" },
363 #if defined(IP_OPTIONS)
364 { IP_OPTIONS, "IP_OPTIONS" },
366 { IP_ROUTER_ALERT, "IP_ROUTER_ALERT" },
367 #if defined(IP_RECVOPTIONS)
368 { IP_RECVOPTIONS, "IP_RECVOPTIONS" },
370 { IP_RETOPTS, "IP_RETOPTS" },
371 { IP_PKTINFO, "IP_PKTINFO" },
372 { IP_PKTOPTIONS, "IP_PKTOPTIONS" },
373 { IP_MTU_DISCOVER, "IP_MTU_DISCOVER" },
374 { IP_MTU_DISCOVER, "IP_MTU_DISCOVER" },
375 { IP_RECVERR, "IP_RECVERR" },
376 { IP_RECVTTL, "IP_RECRECVTTL" },
377 { IP_RECVTOS, "IP_RECRECVTOS" },
379 { IP_MTU, "IP_MTU" },
381 { IP_MULTICAST_IF, "IP_MULTICAST_IF" },
382 { IP_MULTICAST_TTL, "IP_MULTICAST_TTL" },
383 { IP_MULTICAST_LOOP, "IP_MULTICAST_LOOP" },
384 { IP_ADD_MEMBERSHIP, "IP_ADD_MEMBERSHIP" },
385 { IP_DROP_MEMBERSHIP, "IP_DROP_MEMBERSHIP" },
391 static struct xlat sockipxoptions[] = {
392 { IPX_TYPE, "IPX_TYPE" },
398 static struct xlat sockrawoptions[] = {
399 #if defined(ICMP_FILTER)
400 { ICMP_FILTER, "ICMP_FILTER" },
407 static struct xlat sockpacketoptions[] = {
408 { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" },
409 { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"},
410 #if defined(PACKET_RECV_OUTPUT)
411 { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" },
413 #if defined(PACKET_RX_RING)
414 { PACKET_RX_RING, "PACKET_RX_RING" },
416 #if defined(PACKET_STATISTICS)
417 { PACKET_STATISTICS, "PACKET_STATISTICS" },
421 #endif /* SOL_PACKET */
424 static struct xlat socktcpoptions[] = {
425 { TCP_NODELAY, "TCP_NODELAY" },
426 { TCP_MAXSEG, "TCP_MAXSEG" },
427 #if defined(TCP_CORK)
428 { TCP_CORK, "TCP_CORK" },
435 static struct xlat icmpfilterflags[] = {
436 #if defined(ICMP_ECHOREPLY)
437 { (1<<ICMP_ECHOREPLY), "ICMP_ECHOREPLY" },
439 #if defined(ICMP_DEST_UNREACH)
440 { (1<<ICMP_DEST_UNREACH), "ICMP_DEST_UNREACH" },
442 #if defined(ICMP_SOURCE_QUENCH)
443 { (1<<ICMP_SOURCE_QUENCH), "ICMP_SOURCE_QUENCH" },
445 #if defined(ICMP_REDIRECT)
446 { (1<<ICMP_REDIRECT), "ICMP_REDIRECT" },
448 #if defined(ICMP_ECHO)
449 { (1<<ICMP_ECHO), "ICMP_ECHO" },
451 #if defined(ICMP_TIME_EXCEEDED)
452 { (1<<ICMP_TIME_EXCEEDED), "ICMP_TIME_EXCEEDED" },
454 #if defined(ICMP_PARAMETERPROB)
455 { (1<<ICMP_PARAMETERPROB), "ICMP_PARAMETERPROB" },
457 #if defined(ICMP_TIMESTAMP)
458 { (1<<ICMP_TIMESTAMP), "ICMP_TIMESTAMP" },
460 #if defined(ICMP_TIMESTAMPREPLY)
461 { (1<<ICMP_TIMESTAMPREPLY), "ICMP_TIMESTAMPREPLY" },
463 #if defined(ICMP_INFO_REQUEST)
464 { (1<<ICMP_INFO_REQUEST), "ICMP_INFO_REQUEST" },
466 #if defined(ICMP_INFO_REPLY)
467 { (1<<ICMP_INFO_REPLY), "ICMP_INFO_REPLY" },
469 #if defined(ICMP_ADDRESS)
470 { (1<<ICMP_ADDRESS), "ICMP_ADDRESS" },
472 #if defined(ICMP_ADDRESSREPLY)
473 { (1<<ICMP_ADDRESSREPLY), "ICMP_ADDRESSREPLY" },
480 printsock(tcp, addr, addrlen)
488 struct sockaddr_in sin;
489 struct sockaddr_un sau;
490 #ifdef HAVE_INET_NTOP
491 struct sockaddr_in6 sa6;
493 #if defined(LINUX) && defined(AF_IPX)
494 struct sockaddr_ipx sipx;
497 struct sockaddr_ll ll;
500 struct sockaddr_nl nl;
503 char string_addr[100];
510 tprintf("%#lx", addr);
513 if ((addrlen<2) || (addrlen>sizeof(addrbuf)))
514 addrlen=sizeof(addrbuf);
516 if (umoven(tcp, addr, addrlen, (char*)&addrbuf) < 0) {
521 tprintf("{sin_family=");
522 printxval(addrfams, addrbuf.sa.sa_family, "AF_???");
525 switch (addrbuf.sa.sa_family) {
529 } else if (addrbuf.sau.sun_path[0]) {
530 tprintf("path=\"%*.*s\"", addrlen-2, addrlen-2, addrbuf.sau.sun_path);
532 tprintf("path=@%*.*s", addrlen-3, addrlen-3, addrbuf.sau.sun_path+1);
536 tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")}",
537 ntohs(addrbuf.sin.sin_port), inet_ntoa(addrbuf.sin.sin_addr));
539 #ifdef HAVE_INET_NTOP
541 inet_ntop(AF_INET6, &addrbuf.sa6.sin6_addr, string_addr, sizeof(string_addr));
542 tprintf("sin6_port=htons(%u), inet_pton(AF_INET6, \"%s\", &sin6_addr), sin6_flowinfo=htonl(%u)}",
543 ntohs(addrbuf.sa6.sin6_port), string_addr, ntohl(addrbuf.sa6.sin6_flowinfo));
546 #if defined(AF_IPX) && defined(linux)
550 tprintf("{sipx_port=htons(%u), ",
551 ntohs(addrbuf.sipx.sipx_port));
552 /* Yes, I know, this does not look too
553 * strace-ish, but otherwise the IPX
554 * addresses just look monstrous...
555 * Anyways, feel free if you don't like
558 tprintf("%08lx:", (unsigned long)ntohl(addrbuf.sipx.sipx_network));
559 for (i = 0; i<IPX_NODE_LEN; i++)
560 tprintf("%02x", addrbuf.sipx.sipx_node[i]);
561 tprintf("/[%02x]", addrbuf.sipx.sipx_type);
564 #endif /* AF_IPX && linux */
569 tprintf("proto=%#04x, if%d, pkttype=%d, addr(%d)={%d, ",
570 ntohs(addrbuf.ll.sll_protocol),
571 addrbuf.ll.sll_ifindex,
572 addrbuf.ll.sll_pkttype,
573 addrbuf.ll.sll_halen,
574 addrbuf.ll.sll_hatype);
575 for (i=0; i<addrbuf.ll.sll_addr[i]; i++)
576 tprintf("%02x", addrbuf.ll.sll_addr[i]);
580 #endif /* AF_APACKET */
583 tprintf("pid=%d, groups=%08x", addrbuf.nl.nl_pid, addrbuf.nl.nl_groups);
585 #endif /* AF_NETLINK */
586 /* AF_AX25 AF_APPLETALK AF_NETROM AF_BRIDGE AF_AAL5
587 AF_X25 AF_ROSE etc. still need to be done */
590 tprintf("{sa_family=%u, sa_data=", addrbuf.sa.sa_family);
591 printstr(tcp, (long) &((struct sockaddr *) addr)->sa_data,
592 sizeof addrbuf.sa.sa_data);
601 printiovec(tcp, iovec, len)
609 iov = (struct iovec *) malloc(len * sizeof *iov);
611 fprintf(stderr, "No memory");
614 if (umoven(tcp, (long)iovec,
615 len * sizeof *iov, (char *) iov) < 0) {
616 tprintf("%#lx", (unsigned long)iovec);
619 for (i = 0; i < len; i++) {
623 printstr(tcp, (long) iov[i].iov_base,
625 tprintf(", %lu}", (unsigned long)iov[i].iov_len);
633 printmsghdr(tcp, addr)
639 if (umove(tcp, addr, &msg) < 0) {
640 tprintf("%#lx", addr);
643 tprintf("{msg_name(%d)=", msg.msg_namelen);
644 printsock(tcp, (long)msg.msg_name, msg.msg_namelen);
646 tprintf(", msg_iov(%lu)=", (unsigned long)msg.msg_iovlen);
647 printiovec(tcp, msg.msg_iov, msg.msg_iovlen);
649 #ifdef HAVE_MSG_CONTROL
650 tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen);
651 if (msg.msg_controllen)
652 tprintf(", msg_control=%#lx, ", (unsigned long) msg.msg_control);
653 tprintf(", msg_flags=");
654 if (printflags(msg_flags, msg.msg_flags)==0)
656 #else /* !HAVE_MSG_CONTROL */
657 tprintf("msg_accrights=%#lx, msg_accrightslen=%u",
658 (unsigned long) msg.msg_accrights, msg.msg_accrightslen);
659 #endif /* !HAVE_MSG_CONTROL */
663 #endif /* HAVE_SENDMSG */
670 printxval(domains, tcp->u_arg[0], "PF_???");
672 printxval(socktypes, tcp->u_arg[1], "SOCK_???");
674 switch (tcp->u_arg[0]) {
676 printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
680 /* BTW: I don't believe this.. */
682 printxval(domains, tcp->u_arg[2], "PF_???");
687 tprintf("%lu", tcp->u_arg[2]);
699 tprintf("%ld, ", tcp->u_arg[0]);
700 printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]);
701 tprintf(", %lu", tcp->u_arg[2]);
710 return sys_bind(tcp);
718 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
728 tprintf("%ld, ", tcp->u_arg[0]);
729 } else if (!tcp->u_arg[2])
730 tprintf("%#lx, NULL", tcp->u_arg[1]);
732 if (tcp->u_arg[1] == 0 || syserror(tcp)) {
733 tprintf("%#lx", tcp->u_arg[1]);
735 printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]);
738 printnum(tcp, tcp->u_arg[2], "%lu");
748 tprintf("%ld, ", tcp->u_arg[0]);
749 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
750 tprintf(", %lu, ", tcp->u_arg[2]);
752 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
763 tprintf("%ld, ", tcp->u_arg[0]);
764 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
765 tprintf(", %lu, ", tcp->u_arg[2]);
767 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
771 printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
773 tprintf(", %lu", tcp->u_arg[5]);
785 tprintf("%ld, ", tcp->u_arg[0]);
786 printmsghdr(tcp, tcp->u_arg[1]);
789 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
795 #endif /* HAVE_SENDMSG */
802 tprintf("%ld, ", tcp->u_arg[0]);
805 tprintf("%#lx", tcp->u_arg[1]);
807 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
809 tprintf(", %lu, ", tcp->u_arg[2]);
810 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
823 tprintf("%ld, ", tcp->u_arg[0]);
826 tprintf("%#lx, %lu, %lu, %#lx, %#lx",
827 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3],
828 tcp->u_arg[4], tcp->u_arg[5]);
832 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
834 tprintf(", %lu, ", tcp->u_arg[2]);
836 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
838 /* from address, len */
839 if (!tcp->u_arg[4] || !tcp->u_arg[5]) {
840 if (tcp->u_arg[4] == 0)
843 tprintf(", %#lx", tcp->u_arg[4]);
844 if (tcp->u_arg[5] == 0)
847 tprintf(", %#lx", tcp->u_arg[5]);
850 if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) {
851 tprintf(", {...}, [?]");
855 printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
857 tprintf(", [%u]", fromlen);
869 tprintf("%ld, ", tcp->u_arg[0]);
871 if (syserror(tcp) || !verbose(tcp))
872 tprintf("%#lx", tcp->u_arg[1]);
874 printmsghdr(tcp, tcp->u_arg[1]);
877 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
883 #endif /* HAVE_SENDMSG */
890 tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]);
891 switch (tcp->u_arg[1]) {
893 tprintf("%s", " /* receive */");
896 tprintf("%s", " /* send */");
899 tprintf("%s", " /* send and receive */");
910 return sys_accept(tcp);
917 return sys_accept(tcp);
925 #if defined(LINUX) && !defined(SPARC)
930 tprintf("%#lx", tcp->u_arg[0]);
933 if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
936 tprintf("[%u, %u]", fds[0], fds[1]);
938 #elif defined(SPARC) || defined(SVR4)
940 tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
954 printxval(domains, tcp->u_arg[0], "PF_???");
956 printxval(socktypes, tcp->u_arg[1], "SOCK_???");
958 switch (tcp->u_arg[0]) {
960 printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
964 /* BTW: I don't believe this.. */
966 printxval(domains, tcp->u_arg[2], "PF_???");
971 tprintf("%lu", tcp->u_arg[2]);
976 tprintf(", %#lx", tcp->u_arg[3]);
980 if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
983 tprintf(", [%u, %u]", fds[0], fds[1]);
986 tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp));
989 tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp));
1000 tprintf("%ld, ", tcp->u_arg[0]);
1001 switch (tcp->u_arg[1]) {
1003 tprintf("SOL_SOCKET, ");
1004 printxval(sockoptions, tcp->u_arg[2], "SO_???");
1009 tprintf("SOL_IP, ");
1010 printxval(sockipoptions, tcp->u_arg[2], "IP_???");
1016 tprintf("SOL_IPX, ");
1017 printxval(sockipxoptions, tcp->u_arg[2], "IPX_???");
1023 tprintf("SOL_PACKET, ");
1024 printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???");
1030 tprintf("SOL_TCP, ");
1031 printxval(socktcpoptions, tcp->u_arg[2], "TCP_???");
1036 /* SOL_AX25 SOL_ROSE SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25
1037 * etc. still need work */
1039 /* XXX - should know socket family here */
1040 printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
1041 tprintf(", %lu, ", tcp->u_arg[2]);
1045 if (syserror(tcp)) {
1046 tprintf("%#lx, %#lx",
1047 tcp->u_arg[3], tcp->u_arg[4]);
1050 printnum(tcp, tcp->u_arg[3], "%ld");
1052 printnum(tcp, tcp->u_arg[4], "%ld");
1057 #if defined(ICMP_FILTER)
1058 static void printicmpfilter(tcp, addr)
1062 struct icmp_filter filter;
1068 if (syserror(tcp) || !verbose(tcp)) {
1069 tprintf("%#lx", addr);
1072 if (umove(tcp, addr, &filter) < 0) {
1078 if (printflags(icmpfilterflags, ~filter.data) == 0)
1082 #endif /* ICMP_FILTER */
1088 if (entering(tcp)) {
1089 tprintf("%ld, ", tcp->u_arg[0]);
1090 switch (tcp->u_arg[1]) {
1092 tprintf("SOL_SOCKET, ");
1093 printxval(sockoptions, tcp->u_arg[2], "SO_???");
1095 printnum(tcp, tcp->u_arg[3], "%ld");
1096 tprintf(", %lu", tcp->u_arg[4]);
1100 tprintf("SOL_IP, ");
1101 printxval(sockipoptions, tcp->u_arg[2], "IP_???");
1103 printnum(tcp, tcp->u_arg[3], "%ld");
1104 tprintf(", %lu", tcp->u_arg[4]);
1109 tprintf("SOL_IPX, ");
1110 printxval(sockipxoptions, tcp->u_arg[2], "IPX_???");
1112 printnum(tcp, tcp->u_arg[3], "%ld");
1113 tprintf(", %lu", tcp->u_arg[4]);
1118 tprintf("SOL_PACKET, ");
1119 printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???");
1121 /* TODO: decode packate_mreq for PACKET_*_MEMBERSHIP */
1122 printnum(tcp, tcp->u_arg[3], "%ld");
1123 tprintf(", %lu", tcp->u_arg[4]);
1128 tprintf("SOL_TCP, ");
1129 printxval(socktcpoptions, tcp->u_arg[2], "TCP_???");
1131 printnum(tcp, tcp->u_arg[3], "%ld");
1132 tprintf(", %lu", tcp->u_arg[4]);
1137 tprintf("SOL_RAW, ");
1138 printxval(sockrawoptions, tcp->u_arg[2], "RAW_???");
1140 switch (tcp->u_arg[2]) {
1141 #if defined(ICMP_FILTER)
1143 printicmpfilter(tcp, tcp->u_arg[3]);
1147 printnum(tcp, tcp->u_arg[3], "%ld");
1150 tprintf(", %lu", tcp->u_arg[4]);
1154 /* SOL_AX25 SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25
1155 * etc. still need work */
1157 /* XXX - should know socket family here */
1158 printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
1159 tprintf("%lu, ", tcp->u_arg[2]);
1160 printnum(tcp, tcp->u_arg[3], "%ld");
1161 tprintf(", %lu", tcp->u_arg[4]);