Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1 | /* |
| 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> |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 5 | * Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 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. |
| 18 | * |
| 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. |
| 29 | * |
| 30 | * $Id$ |
| 31 | */ |
| 32 | |
| 33 | #include "defs.h" |
| 34 | |
| 35 | #include <sys/stat.h> |
| 36 | #include <sys/socket.h> |
| 37 | #include <sys/un.h> |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 38 | |
| 39 | #if defined(HAVE_SIN6_SCOPE_ID_LINUX) |
| 40 | #define in6_addr in6_addr_libc |
| 41 | #define ipv6_mreq ipv6_mreq_libc |
| 42 | #define sockaddr_in6 sockaddr_in6_libc |
| 43 | #endif |
| 44 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 45 | #include <netinet/in.h> |
Wichert Akkerman | 8c7122c | 2001-02-16 19:59:55 +0000 | [diff] [blame] | 46 | #ifdef HAVE_NETINET_TCP_H |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 47 | #include <netinet/tcp.h> |
| 48 | #endif |
Wichert Akkerman | 8c7122c | 2001-02-16 19:59:55 +0000 | [diff] [blame] | 49 | #ifdef HAVE_NETINET_UDP_H |
| 50 | #include <netinet/udp.h> |
| 51 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 52 | #include <arpa/inet.h> |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 53 | #include <net/if.h> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 54 | #if defined(LINUX) |
| 55 | #include <asm/types.h> |
| 56 | #if defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC__ + __GLIBC_MINOR__ >= 3) |
| 57 | # include <netipx/ipx.h> |
| 58 | #else |
| 59 | # include <linux/ipx.h> |
| 60 | #endif |
| 61 | #endif /* LINUX */ |
| 62 | |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 63 | #if defined (__GLIBC__) && (((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)) || defined(HAVE_SIN6_SCOPE_ID_LINUX)) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 64 | #if defined(HAVE_LINUX_IN6_H) |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 65 | #if defined(HAVE_SIN6_SCOPE_ID_LINUX) |
| 66 | #undef in6_addr |
| 67 | #undef ipv6_mreq |
| 68 | #undef sockaddr_in6 |
| 69 | #define in6_addr in6_addr_kernel |
| 70 | #define ipv6_mreq ipv6_mreq_kernel |
| 71 | #define sockaddr_in6 sockaddr_in6_kernel |
| 72 | #endif |
Wichert Akkerman | 505e176 | 1999-11-01 19:39:08 +0000 | [diff] [blame] | 73 | #include <linux/in6.h> |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 74 | #if defined(HAVE_SIN6_SCOPE_ID_LINUX) |
| 75 | #undef in6_addr |
| 76 | #undef ipv6_mreq |
| 77 | #undef sockaddr_in6 |
| 78 | #define in6_addr in6_addr_libc |
| 79 | #define ipv6_mreq ipv6_mreq_libc |
| 80 | #define sockaddr_in6 sockaddr_in6_kernel |
| 81 | #endif |
Wichert Akkerman | 505e176 | 1999-11-01 19:39:08 +0000 | [diff] [blame] | 82 | #endif |
Wichert Akkerman | 2f473da | 1999-11-01 19:53:31 +0000 | [diff] [blame] | 83 | #endif |
Wichert Akkerman | 505e176 | 1999-11-01 19:39:08 +0000 | [diff] [blame] | 84 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 85 | #if defined(HAVE_SYS_UIO_H) |
| 86 | #include <sys/uio.h> |
| 87 | #endif |
| 88 | |
| 89 | #if defined(HAVE_LINUX_NETLINK_H) |
| 90 | #include <linux/netlink.h> |
| 91 | #endif |
| 92 | |
| 93 | #if defined(HAVE_LINUX_IF_PACKET_H) |
| 94 | #include <linux/if_packet.h> |
| 95 | #endif |
| 96 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 97 | #if defined(HAVE_LINUX_ICMP_H) |
| 98 | #include <linux/icmp.h> |
| 99 | #endif |
| 100 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 101 | #ifndef PF_UNSPEC |
| 102 | #define PF_UNSPEC AF_UNSPEC |
| 103 | #endif |
| 104 | |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 105 | #if UNIXWARE >= 7 |
| 106 | #define HAVE_SENDMSG 1 /* HACK - *FIXME* */ |
| 107 | #endif |
| 108 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 109 | #ifdef LINUX |
| 110 | /* Under Linux these are enums so we can't test for them with ifdef. */ |
| 111 | #define IPPROTO_EGP IPPROTO_EGP |
| 112 | #define IPPROTO_PUP IPPROTO_PUP |
| 113 | #define IPPROTO_IDP IPPROTO_IDP |
| 114 | #define IPPROTO_IGMP IPPROTO_IGMP |
| 115 | #define IPPROTO_RAW IPPROTO_RAW |
| 116 | #define IPPROTO_MAX IPPROTO_MAX |
| 117 | #endif |
| 118 | |
| 119 | static struct xlat domains[] = { |
| 120 | { PF_UNSPEC, "PF_UNSPEC" }, |
| 121 | { PF_UNIX, "PF_UNIX" }, |
| 122 | { PF_INET, "PF_INET" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 123 | #ifdef PF_NETLINK |
| 124 | { PF_NETLINK, "PF_NETLINK" }, |
| 125 | #endif |
| 126 | #ifdef PF_PACKET |
| 127 | { PF_PACKET, "PF_PACKET" }, |
| 128 | #endif |
| 129 | #ifdef PF_INET6 |
| 130 | { PF_INET6, "PF_INET6" }, |
| 131 | #endif |
| 132 | #ifdef PF_ATMSVC |
| 133 | { PF_ATMSVC, "PF_INET6" }, |
| 134 | #endif |
| 135 | #ifdef PF_INET6 |
| 136 | { PF_INET6, "PF_INET6" }, |
| 137 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 138 | #ifdef PF_LOCAL |
| 139 | { PF_LOCAL, "PS_LOCAL" }, |
| 140 | #endif |
| 141 | #ifdef PF_ISO |
| 142 | { PF_ISO, "PF_ISO" }, |
| 143 | #endif |
| 144 | #ifdef PF_AX25 |
| 145 | { PF_AX25, "PF_AX25" }, |
| 146 | #endif |
| 147 | #ifdef PF_IPX |
| 148 | { PF_IPX, "PF_IPX" }, |
| 149 | #endif |
| 150 | #ifdef PF_APPLETALK |
| 151 | { PF_APPLETALK, "PF_APPLETALK" }, |
| 152 | #endif |
| 153 | #ifdef PF_NETROM |
| 154 | { PF_NETROM, "PF_NETROM" }, |
| 155 | #endif |
| 156 | #ifdef PF_BRIDGE |
| 157 | { PF_BRIDGE, "PF_BRIDGE" }, |
| 158 | #endif |
| 159 | #ifdef PF_AAL5 |
| 160 | { PF_AAL5, "PF_AAL5" }, |
| 161 | #endif |
| 162 | #ifdef PF_X25 |
| 163 | { PF_X25, "PF_X25" }, |
| 164 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 165 | #ifdef PF_ROSE |
| 166 | { PF_ROSE, "PF_ROSE" }, |
| 167 | #endif |
| 168 | #ifdef PF_DECNET |
| 169 | { PF_DECNET, "PF_DECNET" }, |
| 170 | #endif |
| 171 | #ifdef PF_NETBEUI |
| 172 | { PF_NETBEUI, "PF_NETBEUI" }, |
| 173 | #endif |
| 174 | #ifdef PF_IMPLINK |
| 175 | { PF_IMPLINK, "PF_IMPLINK" }, |
| 176 | #endif |
| 177 | { 0, NULL }, |
| 178 | }; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 179 | static struct xlat addrfams[] = { |
| 180 | { AF_UNSPEC, "AF_UNSPEC" }, |
| 181 | { AF_UNIX, "AF_UNIX" }, |
| 182 | { AF_INET, "AF_INET" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 183 | #ifdef AF_INET6 |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 184 | { AF_INET6, "AF_INET6" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 185 | #endif |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 186 | { AF_DECnet, "AF_DECnet" }, |
| 187 | #ifdef PF_ATMSVC |
| 188 | { AF_ATMSVC, "AF_ATMSVC" }, |
| 189 | #endif |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 190 | #ifdef AF_PACKET |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 191 | { AF_PACKET, "AF_PACKET" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 192 | #endif |
| 193 | #ifdef AF_NETLINK |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 194 | { AF_NETLINK, "AF_NETLINK" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 195 | #endif |
| 196 | #ifdef AF_ISO |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 197 | { AF_ISO, "AF_ISO" }, |
| 198 | #endif |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 199 | #ifdef AF_IMPLINK |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 200 | { AF_IMPLINK, "AF_IMPLINK" }, |
| 201 | #endif |
| 202 | { 0, NULL }, |
| 203 | }; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 204 | static struct xlat socktypes[] = { |
| 205 | { SOCK_STREAM, "SOCK_STREAM" }, |
| 206 | { SOCK_DGRAM, "SOCK_DGRAM" }, |
| 207 | #ifdef SOCK_RAW |
| 208 | { SOCK_RAW, "SOCK_RAW" }, |
| 209 | #endif |
| 210 | #ifdef SOCK_SEQPACKET |
| 211 | { SOCK_SEQPACKET,"SOCK_SEQPACKET"}, |
| 212 | #endif |
| 213 | #ifdef SOCK_RDM |
| 214 | { SOCK_RDM, "SOCK_RDM" }, |
| 215 | #endif |
| 216 | #ifdef SOCK_PACKET |
| 217 | { SOCK_PACKET, "SOCK_PACKET" }, |
| 218 | #endif |
| 219 | { 0, NULL }, |
| 220 | }; |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 221 | static struct xlat socketlayers[] = { |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 222 | #if defined(SOL_IP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 223 | { SOL_IP, "SOL_IP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 224 | #endif |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 225 | #if defined(SOL_ICMP) |
| 226 | { SOL_ICMP, "SOL_ICMP" }, |
| 227 | #endif |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 228 | #if defined(SOL_TCP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 229 | { SOL_TCP, "SOL_TCP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 230 | #endif |
| 231 | #if defined(SOL_UDP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 232 | { SOL_UDP, "SOL_UDP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 233 | #endif |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 234 | #if defined(SOL_IPV6) |
| 235 | { SOL_IPV6, "SOL_IPV6" }, |
| 236 | #endif |
| 237 | #if defined(SOL_ICMPV6) |
| 238 | { SOL_ICMPV6, "SOL_ICMPV6" }, |
| 239 | #endif |
| 240 | #if defined(SOL_RAW) |
| 241 | { SOL_RAW, "SOL_RAW" }, |
| 242 | #endif |
| 243 | #if defined(SOL_IPX) |
| 244 | { SOL_IPX, "SOL_IPX" }, |
| 245 | #endif |
| 246 | #if defined(SOL_IPX) |
| 247 | { SOL_IPX, "SOL_IPX" }, |
| 248 | #endif |
| 249 | #if defined(SOL_AX25) |
| 250 | { SOL_AX25, "SOL_AX25" }, |
| 251 | #endif |
| 252 | #if defined(SOL_ATALK) |
| 253 | { SOL_ATALK, "SOL_ATALK" }, |
| 254 | #endif |
| 255 | #if defined(SOL_NETROM) |
| 256 | { SOL_NETROM, "SOL_NETROM" }, |
| 257 | #endif |
| 258 | #if defined(SOL_ROSE) |
| 259 | { SOL_ROSE, "SOL_ROSE" }, |
| 260 | #endif |
| 261 | #if defined(SOL_DECNET) |
| 262 | { SOL_DECNET, "SOL_DECNET" }, |
| 263 | #endif |
| 264 | #if defined(SOL_X25) |
| 265 | { SOL_X25, "SOL_X25" }, |
| 266 | #endif |
| 267 | #if defined(SOL_PACKET) |
| 268 | { SOL_PACKET, "SOL_PACKET" }, |
| 269 | #endif |
| 270 | #if defined(SOL_ATM) |
| 271 | { SOL_ATM, "SOL_ATM" }, |
| 272 | #endif |
| 273 | #if defined(SOL_AAL) |
| 274 | { SOL_AAL, "SOL_AAL" }, |
| 275 | #endif |
| 276 | #if defined(SOL_IRDA) |
| 277 | { SOL_IRDA, "SOL_IRDA" }, |
| 278 | #endif |
John Hughes | 6156357 | 2001-03-27 16:47:36 +0000 | [diff] [blame] | 279 | { SOL_SOCKET, "SOL_SOCKET" }, /* Never used! */ |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 280 | }; |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 281 | /*** WARNING: DANGER WILL ROBINSON: NOTE "socketlayers" array above |
| 282 | falls into "protocols" array below!!!! This is intended!!! ***/ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 283 | static struct xlat protocols[] = { |
| 284 | { IPPROTO_IP, "IPPROTO_IP" }, |
| 285 | { IPPROTO_ICMP, "IPPROTO_ICMP" }, |
| 286 | { IPPROTO_TCP, "IPPROTO_TCP" }, |
| 287 | { IPPROTO_UDP, "IPPROTO_UDP" }, |
| 288 | #ifdef IPPROTO_GGP |
| 289 | { IPPROTO_GGP, "IPPROTO_GGP" }, |
| 290 | #endif |
| 291 | #ifdef IPPROTO_EGP |
| 292 | { IPPROTO_EGP, "IPPROTO_EGP" }, |
| 293 | #endif |
| 294 | #ifdef IPPROTO_PUP |
| 295 | { IPPROTO_PUP, "IPPROTO_PUP" }, |
| 296 | #endif |
| 297 | #ifdef IPPROTO_IDP |
| 298 | { IPPROTO_IDP, "IPPROTO_IDP" }, |
| 299 | #endif |
| 300 | #ifdef IPPROTO_IPV6 |
| 301 | { IPPROTO_IPV6, "IPPROTO_IPV6" }, |
| 302 | #endif |
| 303 | #ifdef IPPROTO_ICMPV6 |
| 304 | { IPPROTO_ICMPV6,"IPPROTO_ICMPV6"}, |
| 305 | #endif |
| 306 | #ifdef IPPROTO_IGMP |
| 307 | { IPPROTO_IGMP, "IPPROTO_IGMP" }, |
| 308 | #endif |
| 309 | #ifdef IPPROTO_HELLO |
| 310 | { IPPROTO_HELLO,"IPPROTO_HELLO" }, |
| 311 | #endif |
| 312 | #ifdef IPPROTO_ND |
| 313 | { IPPROTO_ND, "IPPROTO_ND" }, |
| 314 | #endif |
| 315 | #ifdef IPPROTO_RAW |
| 316 | { IPPROTO_RAW, "IPPROTO_RAW" }, |
| 317 | #endif |
| 318 | #ifdef IPPROTO_MAX |
| 319 | { IPPROTO_MAX, "IPPROTO_MAX" }, |
| 320 | #endif |
| 321 | #ifdef IPPROTO_IPIP |
| 322 | { IPPROTO_IPIP, "IPPROTO_IPIP" }, |
| 323 | #endif |
| 324 | { 0, NULL }, |
| 325 | }; |
| 326 | static struct xlat msg_flags[] = { |
| 327 | { MSG_OOB, "MSG_OOB" }, |
| 328 | #ifdef MSG_DONTROUTE |
| 329 | { MSG_DONTROUTE,"MSG_DONTROUTE" }, |
| 330 | #endif |
| 331 | #ifdef MSG_PEEK |
| 332 | { MSG_PEEK, "MSG_PEEK" }, |
| 333 | #endif |
| 334 | #ifdef MSG_CTRUNC |
| 335 | { MSG_CTRUNC, "MSG_CTRUNC" }, |
| 336 | #endif |
| 337 | #ifdef MSG_PROXY |
| 338 | { MSG_PROXY, "MSG_PROXY" }, |
| 339 | #endif |
| 340 | #ifdef MSG_EOR |
| 341 | { MSG_EOR, "MSG_EOR" }, |
| 342 | #endif |
| 343 | #ifdef MSG_WAITALL |
| 344 | { MSG_WAITALL, "MSG_WAITALL" }, |
| 345 | #endif |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 346 | #ifdef MSG_TRUNC |
| 347 | { MSG_TRUNC, "MSG_TRUNC" }, |
| 348 | #endif |
| 349 | #ifdef MSG_CTRUNC |
| 350 | { MSG_CTRUNC, "MSG_CTRUNC" }, |
| 351 | #endif |
| 352 | #ifdef MSG_ERRQUEUE |
| 353 | { MSG_ERRQUEUE, "MSG_ERRQUEUE" }, |
| 354 | #endif |
| 355 | #ifdef MSG_DONTWAIT |
| 356 | { MSG_DONTWAIT, "MSG_DONTWAIT" }, |
| 357 | #endif |
| 358 | #ifdef MSG_CONFIRM |
| 359 | { MSG_CONFIRM, "MSG_CONFIRM" }, |
| 360 | #endif |
| 361 | #ifdef MSG_PROBE |
| 362 | { MSG_PROBE, "MSG_PROBE" }, |
| 363 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 364 | { 0, NULL }, |
| 365 | }; |
| 366 | |
| 367 | static struct xlat sockoptions[] = { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 368 | #ifdef SO_PEERCRED |
| 369 | { SO_PEERCRED, "SO_PEERCRED" }, |
| 370 | #endif |
| 371 | #ifdef SO_PASSCRED |
| 372 | { SO_PASSCRED, "SO_PASSCRED" }, |
| 373 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 374 | #ifdef SO_DEBUG |
| 375 | { SO_DEBUG, "SO_DEBUG" }, |
| 376 | #endif |
| 377 | #ifdef SO_REUSEADDR |
| 378 | { SO_REUSEADDR, "SO_REUSEADDR" }, |
| 379 | #endif |
| 380 | #ifdef SO_KEEPALIVE |
| 381 | { SO_KEEPALIVE, "SO_KEEPALIVE" }, |
| 382 | #endif |
| 383 | #ifdef SO_DONTROUTE |
| 384 | { SO_DONTROUTE, "SO_DONTROUTE" }, |
| 385 | #endif |
| 386 | #ifdef SO_BROADCAST |
| 387 | { SO_BROADCAST, "SO_BROADCAST" }, |
| 388 | #endif |
| 389 | #ifdef SO_LINGER |
| 390 | { SO_LINGER, "SO_LINGER" }, |
| 391 | #endif |
| 392 | #ifdef SO_OOBINLINE |
| 393 | { SO_OOBINLINE, "SO_OOBINLINE" }, |
| 394 | #endif |
| 395 | #ifdef SO_TYPE |
| 396 | { SO_TYPE, "SO_TYPE" }, |
| 397 | #endif |
| 398 | #ifdef SO_ERROR |
| 399 | { SO_ERROR, "SO_ERROR" }, |
| 400 | #endif |
| 401 | #ifdef SO_SNDBUF |
| 402 | { SO_SNDBUF, "SO_SNDBUF" }, |
| 403 | #endif |
| 404 | #ifdef SO_RCVBUF |
| 405 | { SO_RCVBUF, "SO_RCVBUF" }, |
| 406 | #endif |
| 407 | #ifdef SO_NO_CHECK |
| 408 | { SO_NO_CHECK, "SO_NO_CHECK" }, |
| 409 | #endif |
| 410 | #ifdef SO_PRIORITY |
| 411 | { SO_PRIORITY, "SO_PRIORITY" }, |
| 412 | #endif |
| 413 | #ifdef SO_ACCEPTCONN |
| 414 | { SO_ACCEPTCONN,"SO_ACCEPTCONN" }, |
| 415 | #endif |
| 416 | #ifdef SO_USELOOPBACK |
| 417 | { SO_USELOOPBACK,"SO_USELOOPBACK"}, |
| 418 | #endif |
| 419 | #ifdef SO_SNDLOWAT |
| 420 | { SO_SNDLOWAT, "SO_SNDLOWAT" }, |
| 421 | #endif |
| 422 | #ifdef SO_RCVLOWAT |
| 423 | { SO_RCVLOWAT, "SO_RCVLOWAT" }, |
| 424 | #endif |
| 425 | #ifdef SO_SNDTIMEO |
| 426 | { SO_SNDTIMEO, "SO_SNDTIMEO" }, |
| 427 | #endif |
| 428 | #ifdef SO_RCVTIMEO |
| 429 | { SO_RCVTIMEO, "SO_RCVTIMEO" }, |
| 430 | #endif |
| 431 | #ifdef SO_BSDCOMPAT |
| 432 | { SO_BSDCOMPAT, "SO_BSDCOMPAT" }, |
| 433 | #endif |
| 434 | #ifdef SO_REUSEPORT |
| 435 | { SO_REUSEPORT, "SO_REUSEPORT" }, |
| 436 | #endif |
| 437 | #ifdef SO_RCVLOWAT |
| 438 | { SO_RCVLOWAT, "SO_RCVLOWAT" }, |
| 439 | #endif |
| 440 | #ifdef SO_SNDLOWAT |
| 441 | { SO_SNDLOWAT, "SO_SNDLOWAT" }, |
| 442 | #endif |
| 443 | #ifdef SO_RCVTIMEO |
| 444 | { SO_RCVTIMEO, "SO_RCVTIMEO" }, |
| 445 | #endif |
| 446 | #ifdef SO_SNDTIMEO |
| 447 | { SO_SNDTIMEO, "SO_SNDTIMEO" }, |
| 448 | #endif |
| 449 | { 0, NULL }, |
| 450 | }; |
| 451 | |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 452 | #if !defined (SOL_IP) && defined (IPPROTO_IP) |
| 453 | #define SOL_IP IPPROTO_IP |
| 454 | #endif |
| 455 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 456 | #ifdef SOL_IP |
| 457 | static struct xlat sockipoptions[] = { |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 458 | #ifdef IP_TOS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 459 | { IP_TOS, "IP_TOS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 460 | #endif |
| 461 | #ifdef IP_TTL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 462 | { IP_TTL, "IP_TTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 463 | #endif |
| 464 | #ifdef IP_HDRINCL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 465 | { IP_HDRINCL, "IP_HDRINCL" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 466 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 467 | #ifdef IP_OPTIONS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 468 | { IP_OPTIONS, "IP_OPTIONS" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 469 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 470 | #ifdef IP_ROUTER_ALERT |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 471 | { IP_ROUTER_ALERT, "IP_ROUTER_ALERT" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 472 | #endif |
| 473 | #ifdef IP_RECVOPTIONS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 474 | { IP_RECVOPTIONS, "IP_RECVOPTIONS" }, |
| 475 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 476 | #ifdef IP_RECVOPTS |
| 477 | { IP_RECVOPTS, "IP_RECVOPTS" }, |
| 478 | #endif |
| 479 | #ifdef IP_RECVRETOPTS |
| 480 | { IP_RECVRETOPTS, "IP_RECVRETOPTS" }, |
| 481 | #endif |
| 482 | #ifdef IP_RECVDSTADDR |
| 483 | { IP_RECVDSTADDR, "IP_RECVDSTADDR" }, |
| 484 | #endif |
| 485 | #ifdef IP_RETOPTS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 486 | { IP_RETOPTS, "IP_RETOPTS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 487 | #endif |
| 488 | #ifdef IP_PKTINFO |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 489 | { IP_PKTINFO, "IP_PKTINFO" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 490 | #endif |
| 491 | #ifdef IP_PKTOPTIONS |
| 492 | { IP_PKTOPTIONS, "IP_PKTOPTIONS" }, |
| 493 | #endif |
| 494 | #ifdef IP_MTU_DISCOVER |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 495 | { IP_MTU_DISCOVER, "IP_MTU_DISCOVER" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 496 | #endif |
| 497 | #ifdef IP_RECVERR |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 498 | { IP_RECVERR, "IP_RECVERR" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 499 | #endif |
| 500 | #ifdef IP_RECVTTL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 501 | { IP_RECVTTL, "IP_RECRECVTTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 502 | #endif |
| 503 | #ifdef IP_RECVTOS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 504 | { IP_RECVTOS, "IP_RECRECVTOS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 505 | #endif |
| 506 | #ifdef IP_MTU |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 507 | { IP_MTU, "IP_MTU" }, |
| 508 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 509 | #ifdef IP_MULTICAST_IF |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 510 | { IP_MULTICAST_IF, "IP_MULTICAST_IF" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 511 | #endif |
| 512 | #ifdef IP_MULTICAST_TTL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 513 | { IP_MULTICAST_TTL, "IP_MULTICAST_TTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 514 | #endif |
| 515 | #ifdef IP_MULTICAST_LOOP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 516 | { IP_MULTICAST_LOOP, "IP_MULTICAST_LOOP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 517 | #endif |
| 518 | #ifdef IP_ADD_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 519 | { IP_ADD_MEMBERSHIP, "IP_ADD_MEMBERSHIP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 520 | #endif |
| 521 | #ifdef IP_DROP_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 522 | { IP_DROP_MEMBERSHIP, "IP_DROP_MEMBERSHIP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 523 | #endif |
| 524 | #ifdef IP_BROADCAST_IF |
| 525 | { IP_BROADCAST_IF, "IP_BROADCAST_IF" }, |
| 526 | #endif |
| 527 | #ifdef IP_RECVIFINDEX |
| 528 | { IP_RECVIFINDEX, "IP_RECVIFINDEX" }, |
| 529 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 530 | { 0, NULL }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 531 | }; |
| 532 | #endif /* SOL_IP */ |
| 533 | |
| 534 | #ifdef SOL_IPX |
| 535 | static struct xlat sockipxoptions[] = { |
| 536 | { IPX_TYPE, "IPX_TYPE" }, |
| 537 | { 0, NULL }, |
| 538 | }; |
| 539 | #endif /* SOL_IPX */ |
| 540 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 541 | #ifdef SOL_RAW |
| 542 | static struct xlat sockrawoptions[] = { |
| 543 | #if defined(ICMP_FILTER) |
| 544 | { ICMP_FILTER, "ICMP_FILTER" }, |
| 545 | #endif |
| 546 | { 0, NULL }, |
| 547 | }; |
| 548 | #endif /* SOL_RAW */ |
| 549 | |
| 550 | #ifdef SOL_PACKET |
| 551 | static struct xlat sockpacketoptions[] = { |
| 552 | { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, |
| 553 | { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, |
| 554 | #if defined(PACKET_RECV_OUTPUT) |
| 555 | { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, |
| 556 | #endif |
| 557 | #if defined(PACKET_RX_RING) |
| 558 | { PACKET_RX_RING, "PACKET_RX_RING" }, |
| 559 | #endif |
| 560 | #if defined(PACKET_STATISTICS) |
| 561 | { PACKET_STATISTICS, "PACKET_STATISTICS" }, |
| 562 | #endif |
| 563 | { 0, NULL }, |
| 564 | }; |
| 565 | #endif /* SOL_PACKET */ |
| 566 | |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 567 | #if !defined (SOL_TCP) && defined (IPPROTO_TCP) |
| 568 | #define SOL_TCP IPPROTO_TCP |
| 569 | #endif |
| 570 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 571 | #ifdef SOL_TCP |
| 572 | static struct xlat socktcpoptions[] = { |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 573 | { TCP_NODELAY, "TCP_NODELAY" }, |
| 574 | { TCP_MAXSEG, "TCP_MAXSEG" }, |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 575 | #if defined(TCP_CORK) |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 576 | { TCP_CORK, "TCP_CORK" }, |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 577 | #endif |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 578 | #if defined(TCP_KEEPIDLE) |
| 579 | { TCP_KEEPIDLE, "TCP_KEEPIDLE" }, |
| 580 | #endif |
| 581 | #if defined(TCP_KEEPINTVL) |
| 582 | { TCP_KEEPINTVL, "TCP_KEEPINTVL" }, |
| 583 | #endif |
| 584 | #if defined(TCP_KEEPCNT) |
| 585 | { TCP_KEEPCNT, "TCP_KEEPCNT" }, |
| 586 | #endif |
| 587 | #if defined(TCP_SYNCNT) |
| 588 | { TCP_SYNCNT, "TCP_SYNCNT" }, |
| 589 | #endif |
| 590 | #if defined(TCP_LINGER2) |
| 591 | { TCP_LINGER2, "TCP_LINGER2" }, |
| 592 | #endif |
| 593 | #if defined(TCP_DEFER_ACCEPT) |
| 594 | { TCP_DEFER_ACCEPT, "TCP_DEFER_ACCEPT" }, |
| 595 | #endif |
| 596 | #if defined(TCP_WINDOW_CLAMP) |
| 597 | { TCP_WINDOW_CLAMP, "TCP_WINDOW_CLAMP" }, |
| 598 | #endif |
| 599 | #if defined(TCP_INFO) |
| 600 | { TCP_INFO, "TCP_INFO" }, |
| 601 | #endif |
| 602 | #if defined(TCP_QUICKACK) |
| 603 | { TCP_QUICKACK, "TCP_QUICKACK" }, |
| 604 | #endif |
| 605 | { 0, NULL }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 606 | }; |
| 607 | #endif /* SOL_TCP */ |
| 608 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 609 | #ifdef SOL_RAW |
| 610 | static struct xlat icmpfilterflags[] = { |
| 611 | #if defined(ICMP_ECHOREPLY) |
| 612 | { (1<<ICMP_ECHOREPLY), "ICMP_ECHOREPLY" }, |
| 613 | #endif |
| 614 | #if defined(ICMP_DEST_UNREACH) |
| 615 | { (1<<ICMP_DEST_UNREACH), "ICMP_DEST_UNREACH" }, |
| 616 | #endif |
| 617 | #if defined(ICMP_SOURCE_QUENCH) |
| 618 | { (1<<ICMP_SOURCE_QUENCH), "ICMP_SOURCE_QUENCH" }, |
| 619 | #endif |
| 620 | #if defined(ICMP_REDIRECT) |
| 621 | { (1<<ICMP_REDIRECT), "ICMP_REDIRECT" }, |
| 622 | #endif |
| 623 | #if defined(ICMP_ECHO) |
| 624 | { (1<<ICMP_ECHO), "ICMP_ECHO" }, |
| 625 | #endif |
| 626 | #if defined(ICMP_TIME_EXCEEDED) |
| 627 | { (1<<ICMP_TIME_EXCEEDED), "ICMP_TIME_EXCEEDED" }, |
| 628 | #endif |
| 629 | #if defined(ICMP_PARAMETERPROB) |
| 630 | { (1<<ICMP_PARAMETERPROB), "ICMP_PARAMETERPROB" }, |
| 631 | #endif |
| 632 | #if defined(ICMP_TIMESTAMP) |
| 633 | { (1<<ICMP_TIMESTAMP), "ICMP_TIMESTAMP" }, |
| 634 | #endif |
| 635 | #if defined(ICMP_TIMESTAMPREPLY) |
| 636 | { (1<<ICMP_TIMESTAMPREPLY), "ICMP_TIMESTAMPREPLY" }, |
| 637 | #endif |
| 638 | #if defined(ICMP_INFO_REQUEST) |
| 639 | { (1<<ICMP_INFO_REQUEST), "ICMP_INFO_REQUEST" }, |
| 640 | #endif |
| 641 | #if defined(ICMP_INFO_REPLY) |
| 642 | { (1<<ICMP_INFO_REPLY), "ICMP_INFO_REPLY" }, |
| 643 | #endif |
| 644 | #if defined(ICMP_ADDRESS) |
| 645 | { (1<<ICMP_ADDRESS), "ICMP_ADDRESS" }, |
| 646 | #endif |
| 647 | #if defined(ICMP_ADDRESSREPLY) |
| 648 | { (1<<ICMP_ADDRESSREPLY), "ICMP_ADDRESSREPLY" }, |
| 649 | #endif |
| 650 | { 0, NULL }, |
| 651 | }; |
| 652 | #endif /* SOL_RAW */ |
| 653 | |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 654 | #if defined(AF_PACKET) /* from e.g. linux/if_packet.h */ |
| 655 | static struct xlat af_packet_types[] = { |
| 656 | #if defined(PACKET_HOST) |
| 657 | { PACKET_HOST, "PACKET_HOST" }, |
| 658 | #endif |
| 659 | #if defined(PACKET_BROADCAST) |
| 660 | { PACKET_BROADCAST, "PACKET_BROADCAST" }, |
| 661 | #endif |
| 662 | #if defined(PACKET_MULTICAST) |
| 663 | { PACKET_MULTICAST, "PACKET_MULTICAST" }, |
| 664 | #endif |
| 665 | #if defined(PACKET_OTHERHOST) |
| 666 | { PACKET_OTHERHOST, "PACKET_OTHERHOST" }, |
| 667 | #endif |
| 668 | #if defined(PACKET_OUTGOING) |
| 669 | { PACKET_OUTGOING, "PACKET_OUTGOING" }, |
| 670 | #endif |
| 671 | #if defined(PACKET_LOOPBACK) |
| 672 | { PACKET_LOOPBACK, "PACKET_LOOPBACK" }, |
| 673 | #endif |
| 674 | #if defined(PACKET_FASTROUTE) |
| 675 | { PACKET_FASTROUTE, "PACKET_FASTROUTE" }, |
| 676 | #endif |
| 677 | { 0, NULL }, |
| 678 | }; |
| 679 | #endif /* defined(AF_PACKET) */ |
| 680 | |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 681 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 682 | void |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 683 | printsock(tcp, addr, addrlen) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 684 | struct tcb *tcp; |
| 685 | long addr; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 686 | int addrlen; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 687 | { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 688 | union { |
| 689 | char pad[128]; |
| 690 | struct sockaddr sa; |
| 691 | struct sockaddr_in sin; |
| 692 | struct sockaddr_un sau; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 693 | #ifdef HAVE_INET_NTOP |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 694 | struct sockaddr_in6 sa6; |
| 695 | #endif |
| 696 | #if defined(LINUX) && defined(AF_IPX) |
| 697 | struct sockaddr_ipx sipx; |
| 698 | #endif |
| 699 | #ifdef AF_PACKET |
| 700 | struct sockaddr_ll ll; |
| 701 | #endif |
| 702 | #ifdef AF_NETLINK |
| 703 | struct sockaddr_nl nl; |
| 704 | #endif |
| 705 | } addrbuf; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 706 | char string_addr[100]; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 707 | |
| 708 | if (addr == 0) { |
| 709 | tprintf("NULL"); |
| 710 | return; |
| 711 | } |
| 712 | if (!verbose(tcp)) { |
| 713 | tprintf("%#lx", addr); |
| 714 | return; |
| 715 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 716 | if ((addrlen<2) || (addrlen>sizeof(addrbuf))) |
| 717 | addrlen=sizeof(addrbuf); |
| 718 | |
| 719 | if (umoven(tcp, addr, addrlen, (char*)&addrbuf) < 0) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 720 | tprintf("{...}"); |
| 721 | return; |
| 722 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 723 | |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 724 | tprintf("{sa_family="); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 725 | printxval(addrfams, addrbuf.sa.sa_family, "AF_???"); |
| 726 | tprintf(", "); |
| 727 | |
| 728 | switch (addrbuf.sa.sa_family) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 729 | case AF_UNIX: |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 730 | if (addrlen==2) { |
| 731 | tprintf("<nil>"); |
| 732 | } else if (addrbuf.sau.sun_path[0]) { |
Wichert Akkerman | fa30618 | 2001-02-21 16:42:26 +0000 | [diff] [blame] | 733 | tprintf("path=\"%-.*s\"", addrlen-2, addrbuf.sau.sun_path); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 734 | } else { |
Wichert Akkerman | fa30618 | 2001-02-21 16:42:26 +0000 | [diff] [blame] | 735 | tprintf("path=@%-.*s", addrlen-3, addrbuf.sau.sun_path+1); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 736 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 737 | break; |
| 738 | case AF_INET: |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 739 | tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 740 | ntohs(addrbuf.sin.sin_port), inet_ntoa(addrbuf.sin.sin_addr)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 741 | break; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 742 | #ifdef HAVE_INET_NTOP |
| 743 | case AF_INET6: |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 744 | inet_ntop(AF_INET6, &addrbuf.sa6.sin6_addr, string_addr, sizeof(string_addr)); |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 745 | tprintf("sin6_port=htons(%u), inet_pton(AF_INET6, \"%s\", &sin6_addr), sin6_flowinfo=%u", |
| 746 | ntohs(addrbuf.sa6.sin6_port), string_addr, |
| 747 | addrbuf.sa6.sin6_flowinfo); |
| 748 | #ifdef HAVE_SIN6_SCOPE_ID |
| 749 | { |
| 750 | #if defined(HAVE_IF_INDEXTONAME) && defined(IN6_IS_ADDR_LINKLOCAL) && defined(IN6_IS_ADDR_MC_LINKLOCAL) |
| 751 | int numericscope = 0; |
| 752 | if (IN6_IS_ADDR_LINKLOCAL (&addrbuf.sa6.sin6_addr) |
| 753 | || IN6_IS_ADDR_MC_LINKLOCAL (&addrbuf.sa6.sin6_addr)) { |
| 754 | char scopebuf[IFNAMSIZ + 1]; |
| 755 | |
| 756 | if (if_indextoname (addrbuf.sa6.sin6_scope_id, scopebuf) == NULL) |
| 757 | numericscope++; |
| 758 | else |
| 759 | tprintf(", sin6_scope_id=if_nametoindex(\"%s\")", scopebuf); |
| 760 | } else |
| 761 | numericscope++; |
| 762 | |
| 763 | if (numericscope) |
| 764 | #endif |
| 765 | tprintf(", sin6_scope_id=%u", addrbuf.sa6.sin6_scope_id); |
| 766 | } |
| 767 | #endif |
| 768 | break; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 769 | #endif |
Wichert Akkerman | dbb440e | 1999-05-11 15:06:44 +0000 | [diff] [blame] | 770 | #if defined(AF_IPX) && defined(linux) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 771 | case AF_IPX: |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 772 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 773 | int i; |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 774 | tprintf("sipx_port=htons(%u), ", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 775 | ntohs(addrbuf.sipx.sipx_port)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 776 | /* Yes, I know, this does not look too |
| 777 | * strace-ish, but otherwise the IPX |
| 778 | * addresses just look monstrous... |
| 779 | * Anyways, feel free if you don't like |
| 780 | * this way.. :) |
| 781 | */ |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 782 | tprintf("%08lx:", (unsigned long)ntohl(addrbuf.sipx.sipx_network)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 783 | for (i = 0; i<IPX_NODE_LEN; i++) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 784 | tprintf("%02x", addrbuf.sipx.sipx_node[i]); |
| 785 | tprintf("/[%02x]", addrbuf.sipx.sipx_type); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 786 | } |
| 787 | break; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 788 | #endif /* AF_IPX && linux */ |
| 789 | #ifdef AF_PACKET |
| 790 | case AF_PACKET: |
| 791 | { |
| 792 | int i; |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 793 | tprintf("proto=%#04x, if%d, pkttype=", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 794 | ntohs(addrbuf.ll.sll_protocol), |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 795 | addrbuf.ll.sll_ifindex); |
| 796 | printxval(af_packet_types, addrbuf.ll.sll_pkttype, "?"); |
| 797 | tprintf(", addr(%d)={%d, ", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 798 | addrbuf.ll.sll_halen, |
| 799 | addrbuf.ll.sll_hatype); |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 800 | for (i=0; i<addrbuf.ll.sll_halen; i++) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 801 | tprintf("%02x", addrbuf.ll.sll_addr[i]); |
| 802 | } |
| 803 | break; |
| 804 | |
| 805 | #endif /* AF_APACKET */ |
| 806 | #ifdef AF_NETLINLK |
| 807 | case AF_NETLINK: |
| 808 | tprintf("pid=%d, groups=%08x", addrbuf.nl.nl_pid, addrbuf.nl.nl_groups); |
| 809 | break; |
| 810 | #endif /* AF_NETLINK */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 811 | /* AF_AX25 AF_APPLETALK AF_NETROM AF_BRIDGE AF_AAL5 |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 812 | AF_X25 AF_ROSE etc. still need to be done */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 813 | |
| 814 | default: |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 815 | tprintf("sa_data="); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 816 | printstr(tcp, (long) &((struct sockaddr *) addr)->sa_data, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 817 | sizeof addrbuf.sa.sa_data); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 818 | break; |
| 819 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 820 | tprintf("}"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 821 | } |
| 822 | |
| 823 | #if HAVE_SENDMSG |
| 824 | |
| 825 | static void |
| 826 | printmsghdr(tcp, addr) |
| 827 | struct tcb *tcp; |
| 828 | long addr; |
| 829 | { |
| 830 | struct msghdr msg; |
| 831 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 832 | if (umove(tcp, addr, &msg) < 0) { |
| 833 | tprintf("%#lx", addr); |
| 834 | return; |
| 835 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 836 | tprintf("{msg_name(%d)=", msg.msg_namelen); |
| 837 | printsock(tcp, (long)msg.msg_name, msg.msg_namelen); |
| 838 | |
| 839 | tprintf(", msg_iov(%lu)=", (unsigned long)msg.msg_iovlen); |
John Hughes | 1d08dcf | 2001-07-10 13:48:44 +0000 | [diff] [blame] | 840 | tprint_iov(tcp, msg.msg_iovlen, (long) msg.msg_iov); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 841 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 842 | #ifdef HAVE_MSG_CONTROL |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 843 | tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen); |
| 844 | if (msg.msg_controllen) |
| 845 | tprintf(", msg_control=%#lx, ", (unsigned long) msg.msg_control); |
| 846 | tprintf(", msg_flags="); |
| 847 | if (printflags(msg_flags, msg.msg_flags)==0) |
| 848 | tprintf("0"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 849 | #else /* !HAVE_MSG_CONTROL */ |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 850 | tprintf("msg_accrights=%#lx, msg_accrightslen=%u", |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 851 | (unsigned long) msg.msg_accrights, msg.msg_accrightslen); |
| 852 | #endif /* !HAVE_MSG_CONTROL */ |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 853 | tprintf("}"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 854 | } |
| 855 | |
| 856 | #endif /* HAVE_SENDMSG */ |
| 857 | |
| 858 | int |
| 859 | sys_socket(tcp) |
| 860 | struct tcb *tcp; |
| 861 | { |
| 862 | if (entering(tcp)) { |
| 863 | printxval(domains, tcp->u_arg[0], "PF_???"); |
| 864 | tprintf(", "); |
| 865 | printxval(socktypes, tcp->u_arg[1], "SOCK_???"); |
| 866 | tprintf(", "); |
| 867 | switch (tcp->u_arg[0]) { |
| 868 | case PF_INET: |
| 869 | printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); |
| 870 | break; |
| 871 | #ifdef PF_IPX |
| 872 | case PF_IPX: |
| 873 | /* BTW: I don't believe this.. */ |
| 874 | tprintf("["); |
| 875 | printxval(domains, tcp->u_arg[2], "PF_???"); |
| 876 | tprintf("]"); |
| 877 | break; |
| 878 | #endif /* PF_IPX */ |
| 879 | default: |
| 880 | tprintf("%lu", tcp->u_arg[2]); |
| 881 | break; |
| 882 | } |
| 883 | } |
| 884 | return 0; |
| 885 | } |
| 886 | |
| 887 | int |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 888 | sys_so_socket(tcp) |
| 889 | struct tcb *tcp; |
| 890 | { |
| 891 | if (entering(tcp)) { |
| 892 | /* not sure really what these args are... but this |
| 893 | * is how truss prints it |
| 894 | */ |
| 895 | tprintf("%ld, %ld, %ld, ", |
| 896 | tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]); |
| 897 | printpath(tcp, tcp->u_arg[3]); |
| 898 | tprintf(", %ld", tcp->u_arg[4]); |
| 899 | } |
| 900 | return 0; |
| 901 | } |
| 902 | |
| 903 | int |
| 904 | sys_so_socketpair(tcp) |
| 905 | struct tcb *tcp; |
| 906 | { |
| 907 | if (entering(tcp)) { |
| 908 | /* not sure what this arg is */ |
| 909 | tprintf("0x%lx", tcp->u_arg[0]); |
| 910 | } |
| 911 | return 0; |
| 912 | } |
| 913 | |
| 914 | int |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 915 | sys_bind(tcp) |
| 916 | struct tcb *tcp; |
| 917 | { |
| 918 | if (entering(tcp)) { |
| 919 | tprintf("%ld, ", tcp->u_arg[0]); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 920 | printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 921 | tprintf(", %lu", tcp->u_arg[2]); |
| 922 | } |
| 923 | return 0; |
| 924 | } |
| 925 | |
| 926 | int |
| 927 | sys_connect(tcp) |
| 928 | struct tcb *tcp; |
| 929 | { |
| 930 | return sys_bind(tcp); |
| 931 | } |
| 932 | |
| 933 | int |
| 934 | sys_listen(tcp) |
| 935 | struct tcb *tcp; |
| 936 | { |
| 937 | if (entering(tcp)) { |
| 938 | tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]); |
| 939 | } |
| 940 | return 0; |
| 941 | } |
| 942 | |
| 943 | int |
| 944 | sys_accept(tcp) |
| 945 | struct tcb *tcp; |
| 946 | { |
| 947 | if (entering(tcp)) { |
| 948 | tprintf("%ld, ", tcp->u_arg[0]); |
| 949 | } else if (!tcp->u_arg[2]) |
| 950 | tprintf("%#lx, NULL", tcp->u_arg[1]); |
| 951 | else { |
| 952 | if (tcp->u_arg[1] == 0 || syserror(tcp)) { |
| 953 | tprintf("%#lx", tcp->u_arg[1]); |
| 954 | } else { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 955 | printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 956 | } |
| 957 | tprintf(", "); |
| 958 | printnum(tcp, tcp->u_arg[2], "%lu"); |
| 959 | } |
| 960 | return 0; |
| 961 | } |
| 962 | |
| 963 | int |
| 964 | sys_send(tcp) |
| 965 | struct tcb *tcp; |
| 966 | { |
| 967 | if (entering(tcp)) { |
| 968 | tprintf("%ld, ", tcp->u_arg[0]); |
| 969 | printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
| 970 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 971 | /* flags */ |
| 972 | if (printflags(msg_flags, tcp->u_arg[3]) == 0) |
| 973 | tprintf("0"); |
| 974 | } |
| 975 | return 0; |
| 976 | } |
| 977 | |
| 978 | int |
| 979 | sys_sendto(tcp) |
| 980 | struct tcb *tcp; |
| 981 | { |
| 982 | if (entering(tcp)) { |
| 983 | tprintf("%ld, ", tcp->u_arg[0]); |
| 984 | printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
| 985 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 986 | /* flags */ |
| 987 | if (printflags(msg_flags, tcp->u_arg[3]) == 0) |
| 988 | tprintf("0"); |
| 989 | /* to address */ |
| 990 | tprintf(", "); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 991 | printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 992 | /* to length */ |
| 993 | tprintf(", %lu", tcp->u_arg[5]); |
| 994 | } |
| 995 | return 0; |
| 996 | } |
| 997 | |
| 998 | #ifdef HAVE_SENDMSG |
| 999 | |
| 1000 | int |
| 1001 | sys_sendmsg(tcp) |
| 1002 | struct tcb *tcp; |
| 1003 | { |
| 1004 | if (entering(tcp)) { |
| 1005 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1006 | printmsghdr(tcp, tcp->u_arg[1]); |
| 1007 | /* flags */ |
| 1008 | tprintf(", "); |
| 1009 | if (printflags(msg_flags, tcp->u_arg[2]) == 0) |
| 1010 | tprintf("0"); |
| 1011 | } |
| 1012 | return 0; |
| 1013 | } |
| 1014 | |
| 1015 | #endif /* HAVE_SENDMSG */ |
| 1016 | |
| 1017 | int |
| 1018 | sys_recv(tcp) |
| 1019 | struct tcb *tcp; |
| 1020 | { |
| 1021 | if (entering(tcp)) { |
| 1022 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1023 | } else { |
| 1024 | if (syserror(tcp)) |
| 1025 | tprintf("%#lx", tcp->u_arg[1]); |
| 1026 | else |
| 1027 | printstr(tcp, tcp->u_arg[1], tcp->u_rval); |
| 1028 | |
| 1029 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 1030 | if (printflags(msg_flags, tcp->u_arg[3]) == 0) |
| 1031 | tprintf("0"); |
| 1032 | } |
| 1033 | return 0; |
| 1034 | } |
| 1035 | |
| 1036 | int |
| 1037 | sys_recvfrom(tcp) |
| 1038 | struct tcb *tcp; |
| 1039 | { |
| 1040 | int fromlen; |
| 1041 | |
| 1042 | if (entering(tcp)) { |
| 1043 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1044 | } else { |
| 1045 | if (syserror(tcp)) { |
| 1046 | tprintf("%#lx, %lu, %lu, %#lx, %#lx", |
| 1047 | tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3], |
| 1048 | tcp->u_arg[4], tcp->u_arg[5]); |
| 1049 | return 0; |
| 1050 | } |
| 1051 | /* buf */ |
| 1052 | printstr(tcp, tcp->u_arg[1], tcp->u_rval); |
| 1053 | /* len */ |
| 1054 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 1055 | /* flags */ |
| 1056 | if (printflags(msg_flags, tcp->u_arg[3]) == 0) |
| 1057 | tprintf("0"); |
| 1058 | /* from address, len */ |
| 1059 | if (!tcp->u_arg[4] || !tcp->u_arg[5]) { |
| 1060 | if (tcp->u_arg[4] == 0) |
| 1061 | tprintf(", NULL"); |
| 1062 | else |
| 1063 | tprintf(", %#lx", tcp->u_arg[4]); |
| 1064 | if (tcp->u_arg[5] == 0) |
| 1065 | tprintf(", NULL"); |
| 1066 | else |
| 1067 | tprintf(", %#lx", tcp->u_arg[5]); |
| 1068 | return 0; |
| 1069 | } |
| 1070 | if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) { |
| 1071 | tprintf(", {...}, [?]"); |
| 1072 | return 0; |
| 1073 | } |
| 1074 | tprintf(", "); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1075 | printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1076 | /* from length */ |
| 1077 | tprintf(", [%u]", fromlen); |
| 1078 | } |
| 1079 | return 0; |
| 1080 | } |
| 1081 | |
| 1082 | #ifdef HAVE_SENDMSG |
| 1083 | |
| 1084 | int |
| 1085 | sys_recvmsg(tcp) |
| 1086 | struct tcb *tcp; |
| 1087 | { |
| 1088 | if (entering(tcp)) { |
| 1089 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1090 | } else { |
| 1091 | if (syserror(tcp) || !verbose(tcp)) |
| 1092 | tprintf("%#lx", tcp->u_arg[1]); |
| 1093 | else |
| 1094 | printmsghdr(tcp, tcp->u_arg[1]); |
| 1095 | /* flags */ |
| 1096 | tprintf(", "); |
| 1097 | if (printflags(msg_flags, tcp->u_arg[2]) == 0) |
| 1098 | tprintf("0"); |
| 1099 | } |
| 1100 | return 0; |
| 1101 | } |
| 1102 | |
| 1103 | #endif /* HAVE_SENDMSG */ |
| 1104 | |
| 1105 | int |
| 1106 | sys_shutdown(tcp) |
| 1107 | struct tcb *tcp; |
| 1108 | { |
| 1109 | if (entering(tcp)) { |
| 1110 | tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]); |
| 1111 | switch (tcp->u_arg[1]) { |
| 1112 | case 0: |
| 1113 | tprintf("%s", " /* receive */"); |
| 1114 | break; |
| 1115 | case 1: |
| 1116 | tprintf("%s", " /* send */"); |
| 1117 | break; |
| 1118 | case 2: |
| 1119 | tprintf("%s", " /* send and receive */"); |
| 1120 | break; |
| 1121 | } |
| 1122 | } |
| 1123 | return 0; |
| 1124 | } |
| 1125 | |
| 1126 | int |
| 1127 | sys_getsockname(tcp) |
| 1128 | struct tcb *tcp; |
| 1129 | { |
| 1130 | return sys_accept(tcp); |
| 1131 | } |
| 1132 | |
| 1133 | int |
| 1134 | sys_getpeername(tcp) |
| 1135 | struct tcb *tcp; |
| 1136 | { |
| 1137 | return sys_accept(tcp); |
| 1138 | } |
| 1139 | |
| 1140 | int |
| 1141 | sys_pipe(tcp) |
| 1142 | struct tcb *tcp; |
| 1143 | { |
| 1144 | |
| 1145 | #if defined(LINUX) && !defined(SPARC) |
| 1146 | int fds[2]; |
| 1147 | |
| 1148 | if (exiting(tcp)) { |
| 1149 | if (syserror(tcp)) { |
| 1150 | tprintf("%#lx", tcp->u_arg[0]); |
| 1151 | return 0; |
| 1152 | } |
| 1153 | if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0) |
| 1154 | tprintf("[...]"); |
| 1155 | else |
| 1156 | tprintf("[%u, %u]", fds[0], fds[1]); |
| 1157 | } |
Wichert Akkerman | 2e4ffe5 | 2000-09-03 23:57:48 +0000 | [diff] [blame] | 1158 | #elif defined(SPARC) || defined(SVR4) || defined(FREEBSD) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1159 | if (exiting(tcp)) |
| 1160 | tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1161 | #endif |
| 1162 | return 0; |
| 1163 | } |
| 1164 | |
| 1165 | int |
| 1166 | sys_socketpair(tcp) |
| 1167 | struct tcb *tcp; |
| 1168 | { |
| 1169 | #ifdef LINUX |
| 1170 | int fds[2]; |
| 1171 | #endif |
| 1172 | |
| 1173 | if (entering(tcp)) { |
| 1174 | printxval(domains, tcp->u_arg[0], "PF_???"); |
| 1175 | tprintf(", "); |
| 1176 | printxval(socktypes, tcp->u_arg[1], "SOCK_???"); |
| 1177 | tprintf(", "); |
| 1178 | switch (tcp->u_arg[0]) { |
| 1179 | case PF_INET: |
| 1180 | printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); |
| 1181 | break; |
| 1182 | #ifdef PF_IPX |
| 1183 | case PF_IPX: |
| 1184 | /* BTW: I don't believe this.. */ |
| 1185 | tprintf("["); |
| 1186 | printxval(domains, tcp->u_arg[2], "PF_???"); |
| 1187 | tprintf("]"); |
| 1188 | break; |
| 1189 | #endif /* PF_IPX */ |
| 1190 | default: |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1191 | tprintf("%lu", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1192 | break; |
| 1193 | } |
| 1194 | } else { |
| 1195 | if (syserror(tcp)) { |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1196 | tprintf(", %#lx", tcp->u_arg[3]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1197 | return 0; |
| 1198 | } |
| 1199 | #ifdef LINUX |
| 1200 | if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0) |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1201 | tprintf(", [...]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1202 | else |
| 1203 | tprintf(", [%u, %u]", fds[0], fds[1]); |
| 1204 | #endif /* LINUX */ |
Wichert Akkerman | 2e4ffe5 | 2000-09-03 23:57:48 +0000 | [diff] [blame] | 1205 | #if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1206 | tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp)); |
Wichert Akkerman | 2e4ffe5 | 2000-09-03 23:57:48 +0000 | [diff] [blame] | 1207 | #endif /* SUNOS4 || SVR4 || FREEBSD */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1208 | } |
| 1209 | return 0; |
| 1210 | } |
| 1211 | |
| 1212 | int |
| 1213 | sys_getsockopt(tcp) |
| 1214 | struct tcb *tcp; |
| 1215 | { |
| 1216 | if (entering(tcp)) { |
| 1217 | tprintf("%ld, ", tcp->u_arg[0]); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1218 | printxval(socketlayers, tcp->u_arg[1], "SOL_???"); |
| 1219 | tprintf (", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1220 | switch (tcp->u_arg[1]) { |
| 1221 | case SOL_SOCKET: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1222 | printxval(sockoptions, tcp->u_arg[2], "SO_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1223 | break; |
| 1224 | #ifdef SOL_IP |
| 1225 | case SOL_IP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1226 | printxval(sockipoptions, tcp->u_arg[2], "IP_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1227 | break; |
| 1228 | #endif |
| 1229 | #ifdef SOL_IPX |
| 1230 | case SOL_IPX: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1231 | printxval(sockipxoptions, tcp->u_arg[2], "IPX_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1232 | break; |
| 1233 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1234 | #ifdef SOL_PACKET |
| 1235 | case SOL_PACKET: |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1236 | printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1237 | break; |
| 1238 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1239 | #ifdef SOL_TCP |
| 1240 | case SOL_TCP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1241 | printxval(socktcpoptions, tcp->u_arg[2], "TCP_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1242 | break; |
| 1243 | #endif |
| 1244 | |
| 1245 | /* SOL_AX25 SOL_ROSE SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 |
| 1246 | * etc. still need work */ |
| 1247 | default: |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1248 | tprintf("%lu", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1249 | break; |
| 1250 | } |
| 1251 | } else { |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1252 | long len; |
| 1253 | if (syserror(tcp) || umove (tcp, tcp->u_arg[4], &len) < 0) { |
| 1254 | tprintf(", %#lx, %#lx", |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1255 | tcp->u_arg[3], tcp->u_arg[4]); |
| 1256 | return 0; |
| 1257 | } |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1258 | |
| 1259 | switch (tcp->u_arg[1]) { |
| 1260 | case SOL_SOCKET: |
| 1261 | switch (tcp->u_arg[2]) { |
| 1262 | #ifdef SO_LINGER |
| 1263 | case SO_LINGER: |
| 1264 | if (len == sizeof (struct linger)) { |
| 1265 | struct linger linger; |
| 1266 | if (umove (tcp, |
| 1267 | tcp->u_arg[3], |
| 1268 | &linger) < 0) |
| 1269 | break; |
| 1270 | tprintf(", {onoff=%d, linger=%d}, " |
| 1271 | "[%ld]", |
| 1272 | linger.l_onoff, |
| 1273 | linger.l_linger, |
| 1274 | len); |
| 1275 | return 0; |
| 1276 | } |
| 1277 | break; |
| 1278 | #endif |
| 1279 | } |
| 1280 | break; |
| 1281 | } |
| 1282 | |
| 1283 | tprintf (", "); |
| 1284 | if (len == sizeof (int)) { |
| 1285 | printnum(tcp, tcp->u_arg[3], "%ld"); |
| 1286 | } |
| 1287 | else { |
| 1288 | printstr (tcp, tcp->u_arg[3], len); |
| 1289 | } |
| 1290 | tprintf(", [%ld]", len); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1291 | } |
| 1292 | return 0; |
| 1293 | } |
| 1294 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1295 | #if defined(ICMP_FILTER) |
| 1296 | static void printicmpfilter(tcp, addr) |
| 1297 | struct tcb *tcp; |
| 1298 | long addr; |
| 1299 | { |
| 1300 | struct icmp_filter filter; |
| 1301 | |
| 1302 | if (!addr) { |
| 1303 | tprintf("NULL"); |
| 1304 | return; |
| 1305 | } |
| 1306 | if (syserror(tcp) || !verbose(tcp)) { |
| 1307 | tprintf("%#lx", addr); |
| 1308 | return; |
| 1309 | } |
| 1310 | if (umove(tcp, addr, &filter) < 0) { |
| 1311 | tprintf("{...}"); |
| 1312 | return; |
| 1313 | } |
| 1314 | |
| 1315 | tprintf("~("); |
| 1316 | if (printflags(icmpfilterflags, ~filter.data) == 0) |
| 1317 | tprintf("0"); |
| 1318 | tprintf(")"); |
| 1319 | } |
| 1320 | #endif /* ICMP_FILTER */ |
| 1321 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1322 | int |
| 1323 | sys_setsockopt(tcp) |
| 1324 | struct tcb *tcp; |
| 1325 | { |
| 1326 | if (entering(tcp)) { |
| 1327 | tprintf("%ld, ", tcp->u_arg[0]); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1328 | printxval(socketlayers, tcp->u_arg[1], "IPPROTO_???"); |
| 1329 | tprintf (", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1330 | switch (tcp->u_arg[1]) { |
| 1331 | case SOL_SOCKET: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1332 | printxval(sockoptions, tcp->u_arg[2], "SO_???"); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1333 | switch (tcp->u_arg[2]) { |
| 1334 | #if defined(SO_LINGER) |
| 1335 | case SO_LINGER: |
| 1336 | if (tcp->u_arg[4] == sizeof (struct linger)) { |
| 1337 | struct linger linger; |
| 1338 | if (umove (tcp, |
| 1339 | tcp->u_arg[3], |
| 1340 | &linger) < 0) |
| 1341 | break; |
| 1342 | tprintf(", {onoff=%d, linger=%d}, %lu", |
| 1343 | linger.l_onoff, |
| 1344 | linger.l_linger, |
| 1345 | tcp->u_arg[4]); |
| 1346 | return 0; |
| 1347 | } |
| 1348 | break; |
| 1349 | #endif |
| 1350 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1351 | break; |
| 1352 | #ifdef SOL_IP |
| 1353 | case SOL_IP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1354 | printxval(sockipoptions, tcp->u_arg[2], "IP_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1355 | break; |
| 1356 | #endif |
| 1357 | #ifdef SOL_IPX |
| 1358 | case SOL_IPX: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1359 | printxval(sockipxoptions, tcp->u_arg[2], "IPX_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1360 | break; |
| 1361 | #endif |
| 1362 | #ifdef SOL_PACKET |
| 1363 | case SOL_PACKET: |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1364 | printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1365 | /* TODO: decode packate_mreq for PACKET_*_MEMBERSHIP */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1366 | break; |
| 1367 | #endif |
| 1368 | #ifdef SOL_TCP |
| 1369 | case SOL_TCP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1370 | printxval(socktcpoptions, tcp->u_arg[2], "TCP_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1371 | break; |
| 1372 | #endif |
| 1373 | #ifdef SOL_RAW |
| 1374 | case SOL_RAW: |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1375 | printxval(sockrawoptions, tcp->u_arg[2], "RAW_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1376 | switch (tcp->u_arg[2]) { |
| 1377 | #if defined(ICMP_FILTER) |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1378 | case ICMP_FILTER: |
| 1379 | tprintf(", "); |
| 1380 | printicmpfilter(tcp, tcp->u_arg[3]); |
| 1381 | tprintf(", %lu", tcp->u_arg[4]); |
| 1382 | return 0; |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1383 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1384 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1385 | break; |
| 1386 | #endif |
| 1387 | |
| 1388 | /* SOL_AX25 SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 |
| 1389 | * etc. still need work */ |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1390 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1391 | default: |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1392 | tprintf("%lu", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1393 | } |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame^] | 1394 | |
| 1395 | /* default arg printing */ |
| 1396 | |
| 1397 | tprintf (", "); |
| 1398 | |
| 1399 | if (tcp->u_arg[4] == sizeof (int)) { |
| 1400 | printnum(tcp, tcp->u_arg[3], "%ld"); |
| 1401 | } |
| 1402 | else { |
| 1403 | printstr (tcp, tcp->u_arg[3], tcp->u_arg[4]); |
| 1404 | } |
| 1405 | |
| 1406 | tprintf(", %lu", tcp->u_arg[4]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1407 | } |
| 1408 | return 0; |
| 1409 | } |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 1410 | |
| 1411 | #if UNIXWARE >= 7 |
| 1412 | |
| 1413 | static struct xlat sock_version[] = { |
| 1414 | { __NETLIB_UW211_SVR4, "UW211_SVR4" }, |
| 1415 | { __NETLIB_UW211_XPG4, "UW211_XPG4" }, |
| 1416 | { __NETLIB_GEMINI_SVR4, "GEMINI_SVR4" }, |
| 1417 | { __NETLIB_GEMINI_XPG4, "GEMINI_XPG4" }, |
| 1418 | { __NETLIB_FP1_SVR4, "FP1_SVR4" }, |
| 1419 | { __NETLIB_FP1_XPG4, "FP1_XPG4" }, |
| 1420 | { 0, NULL }, |
| 1421 | }; |
| 1422 | |
| 1423 | |
| 1424 | int |
| 1425 | netlib_call(tcp, func) |
| 1426 | struct tcb *tcp; |
| 1427 | int (*func) (); |
| 1428 | { |
| 1429 | if (entering(tcp)) { |
| 1430 | int i; |
| 1431 | printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); |
| 1432 | tprintf(", "); |
| 1433 | --tcp->u_nargs; |
| 1434 | for (i = 0; i < tcp->u_nargs; i++) |
| 1435 | tcp->u_arg[i] = tcp->u_arg[i + 1]; |
| 1436 | return func (tcp); |
| 1437 | |
| 1438 | } |
| 1439 | |
| 1440 | return func (tcp); |
| 1441 | } |
| 1442 | |
| 1443 | int |
| 1444 | sys_xsocket(tcp) |
| 1445 | struct tcb *tcp; |
| 1446 | { |
| 1447 | return netlib_call (tcp, sys_socket); |
| 1448 | } |
| 1449 | |
| 1450 | int |
| 1451 | sys_xsocketpair(tcp) |
| 1452 | struct tcb *tcp; |
| 1453 | { |
| 1454 | return netlib_call (tcp, sys_socketpair); |
| 1455 | } |
| 1456 | |
| 1457 | int |
| 1458 | sys_xbind(tcp) |
| 1459 | struct tcb *tcp; |
| 1460 | { |
| 1461 | return netlib_call (tcp, sys_bind); |
| 1462 | } |
| 1463 | |
| 1464 | int |
| 1465 | sys_xconnect(tcp) |
| 1466 | struct tcb *tcp; |
| 1467 | { |
| 1468 | return netlib_call (tcp, sys_connect); |
| 1469 | } |
| 1470 | |
| 1471 | int |
| 1472 | sys_xlisten(tcp) |
| 1473 | struct tcb *tcp; |
| 1474 | { |
| 1475 | return netlib_call (tcp, sys_listen); |
| 1476 | } |
| 1477 | |
| 1478 | int |
| 1479 | sys_xaccept(tcp) |
| 1480 | struct tcb *tcp; |
| 1481 | { |
| 1482 | return netlib_call (tcp, sys_accept); |
| 1483 | } |
| 1484 | |
| 1485 | int |
| 1486 | sys_xsendmsg(tcp) |
| 1487 | struct tcb *tcp; |
| 1488 | { |
| 1489 | return netlib_call (tcp, sys_sendmsg); |
| 1490 | } |
| 1491 | |
| 1492 | int |
| 1493 | sys_xrecvmsg(tcp) |
| 1494 | struct tcb *tcp; |
| 1495 | { |
| 1496 | return netlib_call (tcp, sys_recvmsg); |
| 1497 | } |
| 1498 | |
| 1499 | int |
| 1500 | sys_xgetsockaddr(tcp) |
| 1501 | struct tcb *tcp; |
| 1502 | { |
| 1503 | if (entering(tcp)) { |
| 1504 | printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); |
| 1505 | tprintf(", "); |
| 1506 | if (tcp->u_arg[1] == 0) { |
| 1507 | tprintf ("LOCALNAME, "); |
| 1508 | } |
| 1509 | else if (tcp->u_arg[1] == 1) { |
| 1510 | tprintf ("REMOTENAME, "); |
| 1511 | } |
| 1512 | else { |
| 1513 | tprintf ("%ld, ", tcp->u_arg [1]); |
| 1514 | } |
| 1515 | tprintf ("%ld, ", tcp->u_arg [2]); |
| 1516 | } |
| 1517 | else { |
| 1518 | if (tcp->u_arg[3] == 0 || syserror(tcp)) { |
| 1519 | tprintf("%#lx", tcp->u_arg[3]); |
| 1520 | } else { |
| 1521 | printsock(tcp, tcp->u_arg[3], tcp->u_arg[4]); |
| 1522 | } |
| 1523 | tprintf(", "); |
| 1524 | printnum(tcp, tcp->u_arg[4], "%lu"); |
| 1525 | } |
| 1526 | |
| 1527 | return 0; |
| 1528 | |
| 1529 | } |
| 1530 | |
| 1531 | #if 0 |
| 1532 | |
| 1533 | int |
| 1534 | sys_xsetsockaddr(tcp) |
| 1535 | struct tcb *tcp; |
| 1536 | { |
| 1537 | return netlib_call (tcp, sys_setsockaddr); |
| 1538 | } |
| 1539 | |
| 1540 | #endif |
| 1541 | |
| 1542 | int |
| 1543 | sys_xgetsockopt(tcp) |
| 1544 | struct tcb *tcp; |
| 1545 | { |
| 1546 | return netlib_call (tcp, sys_getsockopt); |
| 1547 | } |
| 1548 | |
| 1549 | int |
| 1550 | sys_xsetsockopt(tcp) |
| 1551 | struct tcb *tcp; |
| 1552 | { |
| 1553 | return netlib_call (tcp, sys_setsockopt); |
| 1554 | } |
| 1555 | |
| 1556 | int |
| 1557 | sys_xshutdown(tcp) |
| 1558 | struct tcb *tcp; |
| 1559 | { |
| 1560 | return netlib_call (tcp, sys_shutdown); |
| 1561 | } |
| 1562 | |
| 1563 | #endif |