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 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 119 | static const struct xlat domains[] = { |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 120 | #ifdef PF_AAL5 |
| 121 | { PF_AAL5, "PF_AAL5" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 122 | #endif |
| 123 | #ifdef PF_APPLETALK |
| 124 | { PF_APPLETALK, "PF_APPLETALK" }, |
| 125 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 126 | #ifdef PF_ASH |
| 127 | { PF_ASH, "PF_ASH" }, |
| 128 | #endif |
| 129 | #ifdef PF_ATMPVC |
| 130 | { PF_ATMPVC, "PF_ATMPVC" }, |
| 131 | #endif |
| 132 | #ifdef PF_ATMSVC |
| 133 | { PF_ATMSVC, "PF_ATMSVC" }, |
| 134 | #endif |
| 135 | #ifdef PF_AX25 |
| 136 | { PF_AX25, "PF_AX25" }, |
| 137 | #endif |
| 138 | #ifdef PF_BLUETOOTH |
| 139 | { PF_BLUETOOTH, "PF_BLUETOOTH" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 140 | #endif |
| 141 | #ifdef PF_BRIDGE |
| 142 | { PF_BRIDGE, "PF_BRIDGE" }, |
| 143 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 144 | #ifdef PF_DECnet |
| 145 | { PF_DECnet, "PF_DECnet" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 146 | #endif |
| 147 | #ifdef PF_DECNET |
| 148 | { PF_DECNET, "PF_DECNET" }, |
| 149 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 150 | #ifdef PF_ECONET |
| 151 | { PF_ECONET, "PF_ECONET" }, |
| 152 | #endif |
| 153 | #ifdef PF_FILE |
| 154 | { PF_FILE, "PF_FILE" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 155 | #endif |
| 156 | #ifdef PF_IMPLINK |
| 157 | { PF_IMPLINK, "PF_IMPLINK" }, |
| 158 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 159 | #ifdef PF_INET |
| 160 | { PF_INET, "PF_INET" }, |
| 161 | #endif |
| 162 | #ifdef PF_INET6 |
| 163 | { PF_INET6, "PF_INET6" }, |
| 164 | #endif |
| 165 | #ifdef PF_IPX |
| 166 | { PF_IPX, "PF_IPX" }, |
| 167 | #endif |
| 168 | #ifdef PF_IRDA |
| 169 | { PF_IRDA, "PF_IRDA" }, |
| 170 | #endif |
| 171 | #ifdef PF_ISO |
| 172 | { PF_ISO, "PF_ISO" }, |
| 173 | #endif |
| 174 | #ifdef PF_KEY |
| 175 | { PF_KEY, "PF_KEY" }, |
| 176 | #endif |
| 177 | #ifdef PF_UNIX |
| 178 | { PF_UNIX, "PF_UNIX" }, |
| 179 | #endif |
| 180 | #ifdef PF_LOCAL |
| 181 | { PF_LOCAL, "PF_LOCAL" }, |
| 182 | #endif |
| 183 | #ifdef PF_NETBEUI |
| 184 | { PF_NETBEUI, "PF_NETBEUI" }, |
| 185 | #endif |
| 186 | #ifdef PF_NETLINK |
| 187 | { PF_NETLINK, "PF_NETLINK" }, |
| 188 | #endif |
| 189 | #ifdef PF_NETROM |
| 190 | { PF_NETROM, "PF_NETROM" }, |
| 191 | #endif |
| 192 | #ifdef PF_PACKET |
| 193 | { PF_PACKET, "PF_PACKET" }, |
| 194 | #endif |
| 195 | #ifdef PF_PPPOX |
| 196 | { PF_PPPOX, "PF_PPPOX" }, |
| 197 | #endif |
| 198 | #ifdef PF_ROSE |
| 199 | { PF_ROSE, "PF_ROSE" }, |
| 200 | #endif |
| 201 | #ifdef PF_ROUTE |
| 202 | { PF_ROUTE, "PF_ROUTE" }, |
| 203 | #endif |
| 204 | #ifdef PF_SECURITY |
| 205 | { PF_SECURITY, "PF_SECURITY" }, |
| 206 | #endif |
| 207 | #ifdef PF_SNA |
| 208 | { PF_SNA, "PF_SNA" }, |
| 209 | #endif |
| 210 | #ifdef PF_UNSPEC |
| 211 | { PF_UNSPEC, "PF_UNSPEC" }, |
| 212 | #endif |
| 213 | #ifdef PF_WANPIPE |
| 214 | { PF_WANPIPE, "PF_WANPIPE" }, |
| 215 | #endif |
| 216 | #ifdef PF_X25 |
| 217 | { PF_X25, "PF_X25" }, |
| 218 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 219 | { 0, NULL }, |
| 220 | }; |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 221 | const struct xlat addrfams[] = { |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 222 | #ifdef AF_APPLETALK |
| 223 | { AF_APPLETALK, "AF_APPLETALK" }, |
| 224 | #endif |
| 225 | #ifdef AF_ASH |
| 226 | { AF_ASH, "AF_ASH" }, |
| 227 | #endif |
| 228 | #ifdef AF_ATMPVC |
| 229 | { AF_ATMPVC, "AF_ATMPVC" }, |
| 230 | #endif |
| 231 | #ifdef AF_ATMSVC |
| 232 | { AF_ATMSVC, "AF_ATMSVC" }, |
| 233 | #endif |
| 234 | #ifdef AF_AX25 |
| 235 | { AF_AX25, "AF_AX25" }, |
| 236 | #endif |
| 237 | #ifdef AF_BLUETOOTH |
| 238 | { AF_BLUETOOTH, "AF_BLUETOOTH" }, |
| 239 | #endif |
| 240 | #ifdef AF_BRIDGE |
| 241 | { AF_BRIDGE, "AF_BRIDGE" }, |
| 242 | #endif |
| 243 | #ifdef AF_DECnet |
| 244 | { AF_DECnet, "AF_DECnet" }, |
| 245 | #endif |
| 246 | #ifdef AF_ECONET |
| 247 | { AF_ECONET, "AF_ECONET" }, |
| 248 | #endif |
| 249 | #ifdef AF_FILE |
| 250 | { AF_FILE, "AF_FILE" }, |
| 251 | #endif |
| 252 | #ifdef AF_IMPLINK |
| 253 | { AF_IMPLINK, "AF_IMPLINK" }, |
| 254 | #endif |
| 255 | #ifdef AF_INET |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 256 | { AF_INET, "AF_INET" }, |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 257 | #endif |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 258 | #ifdef AF_INET6 |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 259 | { AF_INET6, "AF_INET6" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 260 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 261 | #ifdef AF_IPX |
| 262 | { AF_IPX, "AF_IPX" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 263 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 264 | #ifdef AF_IRDA |
| 265 | { AF_IRDA, "AF_IRDA" }, |
Wichert Akkerman | e4aafd4 | 1999-11-26 09:54:08 +0000 | [diff] [blame] | 266 | #endif |
| 267 | #ifdef AF_ISO |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 268 | { AF_ISO, "AF_ISO" }, |
| 269 | #endif |
Roland McGrath | 5a8146a | 2004-06-04 02:24:14 +0000 | [diff] [blame] | 270 | #ifdef AF_KEY |
| 271 | { AF_KEY, "AF_KEY" }, |
| 272 | #endif |
| 273 | #ifdef AF_UNIX |
| 274 | { AF_UNIX, "AF_UNIX" }, |
| 275 | #endif |
| 276 | #ifdef AF_LOCAL |
| 277 | { AF_LOCAL, "AF_LOCAL" }, |
| 278 | #endif |
| 279 | #ifdef AF_NETBEUI |
| 280 | { AF_NETBEUI, "AF_NETBEUI" }, |
| 281 | #endif |
| 282 | #ifdef AF_NETLINK |
| 283 | { AF_NETLINK, "AF_NETLINK" }, |
| 284 | #endif |
| 285 | #ifdef AF_NETROM |
| 286 | { AF_NETROM, "AF_NETROM" }, |
| 287 | #endif |
| 288 | #ifdef AF_PACKET |
| 289 | { AF_PACKET, "AF_PACKET" }, |
| 290 | #endif |
| 291 | #ifdef AF_PPPOX |
| 292 | { AF_PPPOX, "AF_PPPOX" }, |
| 293 | #endif |
| 294 | #ifdef AF_ROSE |
| 295 | { AF_ROSE, "AF_ROSE" }, |
| 296 | #endif |
| 297 | #ifdef AF_ROUTE |
| 298 | { AF_ROUTE, "AF_ROUTE" }, |
| 299 | #endif |
| 300 | #ifdef AF_SECURITY |
| 301 | { AF_SECURITY, "AF_SECURITY" }, |
| 302 | #endif |
| 303 | #ifdef AF_SNA |
| 304 | { AF_SNA, "AF_SNA" }, |
| 305 | #endif |
| 306 | #ifdef AF_UNSPEC |
| 307 | { AF_UNSPEC, "AF_UNSPEC" }, |
| 308 | #endif |
| 309 | #ifdef AF_WANPIPE |
| 310 | { AF_WANPIPE, "AF_WANPIPE" }, |
| 311 | #endif |
| 312 | #ifdef AF_X25 |
| 313 | { AF_X25, "AF_X25" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 314 | #endif |
| 315 | { 0, NULL }, |
| 316 | }; |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 317 | static const struct xlat socktypes[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 318 | { SOCK_STREAM, "SOCK_STREAM" }, |
| 319 | { SOCK_DGRAM, "SOCK_DGRAM" }, |
| 320 | #ifdef SOCK_RAW |
| 321 | { SOCK_RAW, "SOCK_RAW" }, |
| 322 | #endif |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 323 | #ifdef SOCK_RDM |
| 324 | { SOCK_RDM, "SOCK_RDM" }, |
| 325 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 326 | #ifdef SOCK_SEQPACKET |
| 327 | { SOCK_SEQPACKET,"SOCK_SEQPACKET"}, |
| 328 | #endif |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 329 | #ifdef SOCK_DCCP |
| 330 | { SOCK_DCCP, "SOCK_DCCP" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 331 | #endif |
| 332 | #ifdef SOCK_PACKET |
| 333 | { SOCK_PACKET, "SOCK_PACKET" }, |
| 334 | #endif |
| 335 | { 0, NULL }, |
| 336 | }; |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 337 | const struct xlat sock_type_flags[] = { |
| 338 | #ifdef SOCK_CLOEXEC |
| 339 | { SOCK_CLOEXEC, "SOCK_CLOEXEC" }, |
| 340 | #endif |
| 341 | #ifdef SOCK_NONBLOCK |
| 342 | { SOCK_NONBLOCK,"SOCK_NONBLOCK" }, |
| 343 | #endif |
| 344 | { 0, NULL }, |
| 345 | }; |
| 346 | #ifndef SOCK_TYPE_MASK |
| 347 | # define SOCK_TYPE_MASK 0xf |
| 348 | #endif |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 349 | static const struct xlat socketlayers[] = { |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 350 | #if defined(SOL_IP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 351 | { SOL_IP, "SOL_IP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 352 | #endif |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 353 | #if defined(SOL_ICMP) |
| 354 | { SOL_ICMP, "SOL_ICMP" }, |
| 355 | #endif |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 356 | #if defined(SOL_TCP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 357 | { SOL_TCP, "SOL_TCP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 358 | #endif |
| 359 | #if defined(SOL_UDP) |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 360 | { SOL_UDP, "SOL_UDP" }, |
John Hughes | 1e4cb34 | 2001-03-06 09:25:46 +0000 | [diff] [blame] | 361 | #endif |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 362 | #if defined(SOL_IPV6) |
| 363 | { SOL_IPV6, "SOL_IPV6" }, |
| 364 | #endif |
| 365 | #if defined(SOL_ICMPV6) |
| 366 | { SOL_ICMPV6, "SOL_ICMPV6" }, |
| 367 | #endif |
| 368 | #if defined(SOL_RAW) |
| 369 | { SOL_RAW, "SOL_RAW" }, |
| 370 | #endif |
| 371 | #if defined(SOL_IPX) |
| 372 | { SOL_IPX, "SOL_IPX" }, |
| 373 | #endif |
| 374 | #if defined(SOL_IPX) |
| 375 | { SOL_IPX, "SOL_IPX" }, |
| 376 | #endif |
| 377 | #if defined(SOL_AX25) |
| 378 | { SOL_AX25, "SOL_AX25" }, |
| 379 | #endif |
| 380 | #if defined(SOL_ATALK) |
| 381 | { SOL_ATALK, "SOL_ATALK" }, |
| 382 | #endif |
| 383 | #if defined(SOL_NETROM) |
| 384 | { SOL_NETROM, "SOL_NETROM" }, |
| 385 | #endif |
| 386 | #if defined(SOL_ROSE) |
| 387 | { SOL_ROSE, "SOL_ROSE" }, |
| 388 | #endif |
| 389 | #if defined(SOL_DECNET) |
| 390 | { SOL_DECNET, "SOL_DECNET" }, |
| 391 | #endif |
| 392 | #if defined(SOL_X25) |
| 393 | { SOL_X25, "SOL_X25" }, |
| 394 | #endif |
| 395 | #if defined(SOL_PACKET) |
| 396 | { SOL_PACKET, "SOL_PACKET" }, |
| 397 | #endif |
| 398 | #if defined(SOL_ATM) |
| 399 | { SOL_ATM, "SOL_ATM" }, |
| 400 | #endif |
| 401 | #if defined(SOL_AAL) |
| 402 | { SOL_AAL, "SOL_AAL" }, |
| 403 | #endif |
| 404 | #if defined(SOL_IRDA) |
| 405 | { SOL_IRDA, "SOL_IRDA" }, |
| 406 | #endif |
John Hughes | 6156357 | 2001-03-27 16:47:36 +0000 | [diff] [blame] | 407 | { SOL_SOCKET, "SOL_SOCKET" }, /* Never used! */ |
Wichert Akkerman | efdecac | 2000-11-26 03:59:21 +0000 | [diff] [blame] | 408 | }; |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 409 | /*** WARNING: DANGER WILL ROBINSON: NOTE "socketlayers" array above |
| 410 | falls into "protocols" array below!!!! This is intended!!! ***/ |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 411 | static const struct xlat protocols[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 412 | { IPPROTO_IP, "IPPROTO_IP" }, |
| 413 | { IPPROTO_ICMP, "IPPROTO_ICMP" }, |
| 414 | { IPPROTO_TCP, "IPPROTO_TCP" }, |
| 415 | { IPPROTO_UDP, "IPPROTO_UDP" }, |
| 416 | #ifdef IPPROTO_GGP |
| 417 | { IPPROTO_GGP, "IPPROTO_GGP" }, |
| 418 | #endif |
| 419 | #ifdef IPPROTO_EGP |
| 420 | { IPPROTO_EGP, "IPPROTO_EGP" }, |
| 421 | #endif |
| 422 | #ifdef IPPROTO_PUP |
| 423 | { IPPROTO_PUP, "IPPROTO_PUP" }, |
| 424 | #endif |
| 425 | #ifdef IPPROTO_IDP |
| 426 | { IPPROTO_IDP, "IPPROTO_IDP" }, |
| 427 | #endif |
| 428 | #ifdef IPPROTO_IPV6 |
| 429 | { IPPROTO_IPV6, "IPPROTO_IPV6" }, |
| 430 | #endif |
| 431 | #ifdef IPPROTO_ICMPV6 |
| 432 | { IPPROTO_ICMPV6,"IPPROTO_ICMPV6"}, |
| 433 | #endif |
| 434 | #ifdef IPPROTO_IGMP |
| 435 | { IPPROTO_IGMP, "IPPROTO_IGMP" }, |
| 436 | #endif |
| 437 | #ifdef IPPROTO_HELLO |
| 438 | { IPPROTO_HELLO,"IPPROTO_HELLO" }, |
| 439 | #endif |
| 440 | #ifdef IPPROTO_ND |
| 441 | { IPPROTO_ND, "IPPROTO_ND" }, |
| 442 | #endif |
| 443 | #ifdef IPPROTO_RAW |
| 444 | { IPPROTO_RAW, "IPPROTO_RAW" }, |
| 445 | #endif |
| 446 | #ifdef IPPROTO_MAX |
| 447 | { IPPROTO_MAX, "IPPROTO_MAX" }, |
| 448 | #endif |
| 449 | #ifdef IPPROTO_IPIP |
| 450 | { IPPROTO_IPIP, "IPPROTO_IPIP" }, |
| 451 | #endif |
| 452 | { 0, NULL }, |
| 453 | }; |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 454 | static const struct xlat msg_flags[] = { |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 455 | { MSG_OOB, "MSG_OOB" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 456 | #ifdef MSG_DONTROUTE |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 457 | { MSG_DONTROUTE, "MSG_DONTROUTE" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 458 | #endif |
| 459 | #ifdef MSG_PEEK |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 460 | { MSG_PEEK, "MSG_PEEK" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 461 | #endif |
| 462 | #ifdef MSG_CTRUNC |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 463 | { MSG_CTRUNC, "MSG_CTRUNC" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 464 | #endif |
| 465 | #ifdef MSG_PROXY |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 466 | { MSG_PROXY, "MSG_PROXY" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 467 | #endif |
| 468 | #ifdef MSG_EOR |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 469 | { MSG_EOR, "MSG_EOR" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 470 | #endif |
| 471 | #ifdef MSG_WAITALL |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 472 | { MSG_WAITALL, "MSG_WAITALL" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 473 | #endif |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 474 | #ifdef MSG_TRUNC |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 475 | { MSG_TRUNC, "MSG_TRUNC" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 476 | #endif |
| 477 | #ifdef MSG_CTRUNC |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 478 | { MSG_CTRUNC, "MSG_CTRUNC" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 479 | #endif |
| 480 | #ifdef MSG_ERRQUEUE |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 481 | { MSG_ERRQUEUE, "MSG_ERRQUEUE" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 482 | #endif |
| 483 | #ifdef MSG_DONTWAIT |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 484 | { MSG_DONTWAIT, "MSG_DONTWAIT" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 485 | #endif |
| 486 | #ifdef MSG_CONFIRM |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 487 | { MSG_CONFIRM, "MSG_CONFIRM" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 488 | #endif |
| 489 | #ifdef MSG_PROBE |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 490 | { MSG_PROBE, "MSG_PROBE" }, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 491 | #endif |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 492 | #ifdef MSG_FIN |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 493 | { MSG_FIN, "MSG_FIN" }, |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 494 | #endif |
| 495 | #ifdef MSG_SYN |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 496 | { MSG_SYN, "MSG_SYN" }, |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 497 | #endif |
| 498 | #ifdef MSG_RST |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 499 | { MSG_RST, "MSG_RST" }, |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 500 | #endif |
| 501 | #ifdef MSG_NOSIGNAL |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 502 | { MSG_NOSIGNAL, "MSG_NOSIGNAL" }, |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 503 | #endif |
| 504 | #ifdef MSG_MORE |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 505 | { MSG_MORE, "MSG_MORE" }, |
Roland McGrath | 05e5e79 | 2004-04-14 02:53:54 +0000 | [diff] [blame] | 506 | #endif |
Roland McGrath | 71d3d66 | 2007-08-07 01:00:26 +0000 | [diff] [blame] | 507 | #ifdef MSG_CMSG_CLOEXEC |
| 508 | { MSG_CMSG_CLOEXEC, "MSG_CMSG_CLOEXEC" }, |
| 509 | #endif |
| 510 | { 0, NULL }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 511 | }; |
| 512 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 513 | static const struct xlat sockoptions[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 514 | #ifdef SO_ACCEPTCONN |
Roland McGrath | 1bf4373 | 2004-08-31 07:16:14 +0000 | [diff] [blame] | 515 | { SO_ACCEPTCONN, "SO_ACCEPTCONN" }, |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 516 | #endif |
| 517 | #ifdef SO_ALLRAW |
| 518 | { SO_ALLRAW, "SO_ALLRAW" }, |
| 519 | #endif |
Roland McGrath | 1bf4373 | 2004-08-31 07:16:14 +0000 | [diff] [blame] | 520 | #ifdef SO_ATTACH_FILTER |
| 521 | { SO_ATTACH_FILTER, "SO_ATTACH_FILTER" }, |
| 522 | #endif |
| 523 | #ifdef SO_BINDTODEVICE |
| 524 | { SO_BINDTODEVICE, "SO_BINDTODEVICE" }, |
| 525 | #endif |
| 526 | #ifdef SO_BROADCAST |
| 527 | { SO_BROADCAST, "SO_BROADCAST" }, |
| 528 | #endif |
| 529 | #ifdef SO_BSDCOMPAT |
| 530 | { SO_BSDCOMPAT, "SO_BSDCOMPAT" }, |
| 531 | #endif |
| 532 | #ifdef SO_DEBUG |
| 533 | { SO_DEBUG, "SO_DEBUG" }, |
| 534 | #endif |
| 535 | #ifdef SO_DETACH_FILTER |
| 536 | { SO_DETACH_FILTER, "SO_DETACH_FILTER" }, |
| 537 | #endif |
| 538 | #ifdef SO_DONTROUTE |
| 539 | { SO_DONTROUTE, "SO_DONTROUTE" }, |
| 540 | #endif |
| 541 | #ifdef SO_ERROR |
| 542 | { SO_ERROR, "SO_ERROR" }, |
| 543 | #endif |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 544 | #ifdef SO_ICS |
| 545 | { SO_ICS, "SO_ICS" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 546 | #endif |
Roland McGrath | 1bf4373 | 2004-08-31 07:16:14 +0000 | [diff] [blame] | 547 | #ifdef SO_IMASOCKET |
| 548 | { SO_IMASOCKET, "SO_IMASOCKET" }, |
| 549 | #endif |
| 550 | #ifdef SO_KEEPALIVE |
| 551 | { SO_KEEPALIVE, "SO_KEEPALIVE" }, |
| 552 | #endif |
| 553 | #ifdef SO_LINGER |
| 554 | { SO_LINGER, "SO_LINGER" }, |
| 555 | #endif |
| 556 | #ifdef SO_LISTENING |
| 557 | { SO_LISTENING, "SO_LISTENING" }, |
| 558 | #endif |
| 559 | #ifdef SO_MGMT |
| 560 | { SO_MGMT, "SO_MGMT" }, |
| 561 | #endif |
| 562 | #ifdef SO_NO_CHECK |
| 563 | { SO_NO_CHECK, "SO_NO_CHECK" }, |
| 564 | #endif |
| 565 | #ifdef SO_OOBINLINE |
| 566 | { SO_OOBINLINE, "SO_OOBINLINE" }, |
| 567 | #endif |
| 568 | #ifdef SO_ORDREL |
| 569 | { SO_ORDREL, "SO_ORDREL" }, |
| 570 | #endif |
| 571 | #ifdef SO_PARALLELSVR |
| 572 | { SO_PARALLELSVR, "SO_PARALLELSVR" }, |
| 573 | #endif |
| 574 | #ifdef SO_PASSCRED |
| 575 | { SO_PASSCRED, "SO_PASSCRED" }, |
| 576 | #endif |
| 577 | #ifdef SO_PEERCRED |
| 578 | { SO_PEERCRED, "SO_PEERCRED" }, |
| 579 | #endif |
| 580 | #ifdef SO_PEERNAME |
| 581 | { SO_PEERNAME, "SO_PEERNAME" }, |
| 582 | #endif |
| 583 | #ifdef SO_PEERSEC |
| 584 | { SO_PEERSEC, "SO_PEERSEC" }, |
| 585 | #endif |
| 586 | #ifdef SO_PRIORITY |
| 587 | { SO_PRIORITY, "SO_PRIORITY" }, |
| 588 | #endif |
| 589 | #ifdef SO_PROTOTYPE |
| 590 | { SO_PROTOTYPE, "SO_PROTOTYPE" }, |
| 591 | #endif |
| 592 | #ifdef SO_RCVBUF |
| 593 | { SO_RCVBUF, "SO_RCVBUF" }, |
| 594 | #endif |
| 595 | #ifdef SO_RCVLOWAT |
| 596 | { SO_RCVLOWAT, "SO_RCVLOWAT" }, |
| 597 | #endif |
| 598 | #ifdef SO_RCVTIMEO |
| 599 | { SO_RCVTIMEO, "SO_RCVTIMEO" }, |
| 600 | #endif |
| 601 | #ifdef SO_RDWR |
| 602 | { SO_RDWR, "SO_RDWR" }, |
| 603 | #endif |
| 604 | #ifdef SO_REUSEADDR |
| 605 | { SO_REUSEADDR, "SO_REUSEADDR" }, |
| 606 | #endif |
| 607 | #ifdef SO_REUSEPORT |
| 608 | { SO_REUSEPORT, "SO_REUSEPORT" }, |
| 609 | #endif |
| 610 | #ifdef SO_SECURITY_AUTHENTICATION |
| 611 | { SO_SECURITY_AUTHENTICATION,"SO_SECURITY_AUTHENTICATION"}, |
| 612 | #endif |
| 613 | #ifdef SO_SECURITY_ENCRYPTION_NETWORK |
| 614 | { SO_SECURITY_ENCRYPTION_NETWORK,"SO_SECURITY_ENCRYPTION_NETWORK"}, |
| 615 | #endif |
| 616 | #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT |
| 617 | { SO_SECURITY_ENCRYPTION_TRANSPORT,"SO_SECURITY_ENCRYPTION_TRANSPORT"}, |
| 618 | #endif |
| 619 | #ifdef SO_SEMA |
| 620 | { SO_SEMA, "SO_SEMA" }, |
| 621 | #endif |
| 622 | #ifdef SO_SNDBUF |
| 623 | { SO_SNDBUF, "SO_SNDBUF" }, |
| 624 | #endif |
| 625 | #ifdef SO_SNDLOWAT |
| 626 | { SO_SNDLOWAT, "SO_SNDLOWAT" }, |
| 627 | #endif |
| 628 | #ifdef SO_SNDTIMEO |
| 629 | { SO_SNDTIMEO, "SO_SNDTIMEO" }, |
| 630 | #endif |
| 631 | #ifdef SO_TIMESTAMP |
| 632 | { SO_TIMESTAMP, "SO_TIMESTAMP" }, |
| 633 | #endif |
| 634 | #ifdef SO_TYPE |
| 635 | { SO_TYPE, "SO_TYPE" }, |
| 636 | #endif |
| 637 | #ifdef SO_USELOOPBACK |
| 638 | { SO_USELOOPBACK, "SO_USELOOPBACK" }, |
| 639 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 640 | { 0, NULL }, |
| 641 | }; |
| 642 | |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 643 | #if !defined (SOL_IP) && defined (IPPROTO_IP) |
| 644 | #define SOL_IP IPPROTO_IP |
| 645 | #endif |
| 646 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 647 | #ifdef SOL_IP |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 648 | static const struct xlat sockipoptions[] = { |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 649 | #ifdef IP_TOS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 650 | { IP_TOS, "IP_TOS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 651 | #endif |
| 652 | #ifdef IP_TTL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 653 | { IP_TTL, "IP_TTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 654 | #endif |
| 655 | #ifdef IP_HDRINCL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 656 | { IP_HDRINCL, "IP_HDRINCL" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 657 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 658 | #ifdef IP_OPTIONS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 659 | { IP_OPTIONS, "IP_OPTIONS" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 660 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 661 | #ifdef IP_ROUTER_ALERT |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 662 | { IP_ROUTER_ALERT, "IP_ROUTER_ALERT" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 663 | #endif |
| 664 | #ifdef IP_RECVOPTIONS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 665 | { IP_RECVOPTIONS, "IP_RECVOPTIONS" }, |
| 666 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 667 | #ifdef IP_RECVOPTS |
| 668 | { IP_RECVOPTS, "IP_RECVOPTS" }, |
| 669 | #endif |
| 670 | #ifdef IP_RECVRETOPTS |
| 671 | { IP_RECVRETOPTS, "IP_RECVRETOPTS" }, |
| 672 | #endif |
| 673 | #ifdef IP_RECVDSTADDR |
| 674 | { IP_RECVDSTADDR, "IP_RECVDSTADDR" }, |
| 675 | #endif |
| 676 | #ifdef IP_RETOPTS |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 677 | { IP_RETOPTS, "IP_RETOPTS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 678 | #endif |
| 679 | #ifdef IP_PKTINFO |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 680 | { IP_PKTINFO, "IP_PKTINFO" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 681 | #endif |
| 682 | #ifdef IP_PKTOPTIONS |
| 683 | { IP_PKTOPTIONS, "IP_PKTOPTIONS" }, |
| 684 | #endif |
| 685 | #ifdef IP_MTU_DISCOVER |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 686 | { IP_MTU_DISCOVER, "IP_MTU_DISCOVER" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 687 | #endif |
| 688 | #ifdef IP_RECVERR |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 689 | { IP_RECVERR, "IP_RECVERR" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 690 | #endif |
| 691 | #ifdef IP_RECVTTL |
Roland McGrath | 04ac03a | 2005-07-04 23:30:27 +0000 | [diff] [blame] | 692 | { IP_RECVTTL, "IP_RECVTTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 693 | #endif |
| 694 | #ifdef IP_RECVTOS |
Roland McGrath | 04ac03a | 2005-07-04 23:30:27 +0000 | [diff] [blame] | 695 | { IP_RECVTOS, "IP_RECVTOS" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 696 | #endif |
| 697 | #ifdef IP_MTU |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 698 | { IP_MTU, "IP_MTU" }, |
| 699 | #endif |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 700 | #ifdef IP_MULTICAST_IF |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 701 | { IP_MULTICAST_IF, "IP_MULTICAST_IF" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 702 | #endif |
| 703 | #ifdef IP_MULTICAST_TTL |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 704 | { IP_MULTICAST_TTL, "IP_MULTICAST_TTL" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 705 | #endif |
| 706 | #ifdef IP_MULTICAST_LOOP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 707 | { IP_MULTICAST_LOOP, "IP_MULTICAST_LOOP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 708 | #endif |
| 709 | #ifdef IP_ADD_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 710 | { IP_ADD_MEMBERSHIP, "IP_ADD_MEMBERSHIP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 711 | #endif |
| 712 | #ifdef IP_DROP_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 713 | { IP_DROP_MEMBERSHIP, "IP_DROP_MEMBERSHIP" }, |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 714 | #endif |
| 715 | #ifdef IP_BROADCAST_IF |
| 716 | { IP_BROADCAST_IF, "IP_BROADCAST_IF" }, |
| 717 | #endif |
| 718 | #ifdef IP_RECVIFINDEX |
| 719 | { IP_RECVIFINDEX, "IP_RECVIFINDEX" }, |
| 720 | #endif |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 721 | #ifdef IP_MSFILTER |
| 722 | { IP_MSFILTER, "IP_MSFILTER" }, |
| 723 | #endif |
| 724 | #ifdef MCAST_MSFILTER |
| 725 | { MCAST_MSFILTER, "MCAST_MSFILTER" }, |
| 726 | #endif |
| 727 | #ifdef IP_FREEBIND |
| 728 | { IP_FREEBIND, "IP_FREEBIND" }, |
| 729 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 730 | { 0, NULL }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 731 | }; |
| 732 | #endif /* SOL_IP */ |
| 733 | |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 734 | #ifdef SOL_IPV6 |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 735 | static const struct xlat sockipv6options[] = { |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 736 | #ifdef IPV6_ADDRFORM |
| 737 | { IPV6_ADDRFORM, "IPV6_ADDRFORM" }, |
| 738 | #endif |
| 739 | #ifdef MCAST_FILTER |
| 740 | { MCAST_FILTER, "MCAST_FILTER" }, |
| 741 | #endif |
| 742 | #ifdef IPV6_PKTOPTIONS |
| 743 | { IPV6_PKTOPTIONS, "IPV6_PKTOPTIONS" }, |
| 744 | #endif |
| 745 | #ifdef IPV6_MTU |
| 746 | { IPV6_MTU, "IPV6_MTU" }, |
| 747 | #endif |
| 748 | #ifdef IPV6_V6ONLY |
| 749 | { IPV6_V6ONLY, "IPV6_V6ONLY" }, |
| 750 | #endif |
| 751 | #ifdef IPV6_PKTINFO |
| 752 | { IPV6_PKTINFO, "IPV6_PKTINFO" }, |
| 753 | #endif |
| 754 | #ifdef IPV6_HOPLIMIT |
| 755 | { IPV6_HOPLIMIT, "IPV6_HOPLIMIT" }, |
| 756 | #endif |
| 757 | #ifdef IPV6_RTHDR |
| 758 | { IPV6_RTHDR, "IPV6_RTHDR" }, |
| 759 | #endif |
| 760 | #ifdef IPV6_HOPOPTS |
| 761 | { IPV6_HOPOPTS, "IPV6_HOPOPTS" }, |
| 762 | #endif |
| 763 | #ifdef IPV6_DSTOPTS |
| 764 | { IPV6_DSTOPTS, "IPV6_DSTOPTS" }, |
| 765 | #endif |
| 766 | #ifdef IPV6_FLOWINFO |
| 767 | { IPV6_FLOWINFO, "IPV6_FLOWINFO" }, |
| 768 | #endif |
| 769 | #ifdef IPV6_UNICAST_HOPS |
| 770 | { IPV6_UNICAST_HOPS, "IPV6_UNICAST_HOPS" }, |
| 771 | #endif |
| 772 | #ifdef IPV6_MULTICAST_HOPS |
| 773 | { IPV6_MULTICAST_HOPS, "IPV6_MULTICAST_HOPS" }, |
| 774 | #endif |
| 775 | #ifdef IPV6_MULTICAST_LOOP |
| 776 | { IPV6_MULTICAST_LOOP, "IPV6_MULTICAST_LOOP" }, |
| 777 | #endif |
| 778 | #ifdef IPV6_MULTICAST_IF |
| 779 | { IPV6_MULTICAST_IF, "IPV6_MULTICAST_IF" }, |
| 780 | #endif |
| 781 | #ifdef IPV6_MTU_DISCOVER |
| 782 | { IPV6_MTU_DISCOVER, "IPV6_MTU_DISCOVER" }, |
| 783 | #endif |
| 784 | #ifdef IPV6_RECVERR |
| 785 | { IPV6_RECVERR, "IPV6_RECVERR" }, |
| 786 | #endif |
| 787 | #ifdef IPV6_FLOWINFO_SEND |
| 788 | { IPV6_FLOWINFO_SEND, "IPV6_FLOWINFO_SEND" }, |
| 789 | #endif |
Roland McGrath | c0b9e37 | 2005-07-04 23:33:38 +0000 | [diff] [blame] | 790 | #ifdef IPV6_ADD_MEMBERSHIP |
| 791 | { IPV6_ADD_MEMBERSHIP, "IPV6_ADD_MEMBERSHIP" }, |
| 792 | #endif |
| 793 | #ifdef IPV6_DROP_MEMBERSHIP |
| 794 | { IPV6_DROP_MEMBERSHIP, "IPV6_DROP_MEMBERSHIP" }, |
| 795 | #endif |
| 796 | #ifdef IPV6_ROUTER_ALERT |
| 797 | { IPV6_ROUTER_ALERT, "IPV6_ROUTER_ALERT" }, |
| 798 | #endif |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 799 | { 0, NULL }, |
| 800 | }; |
| 801 | #endif /* SOL_IPV6 */ |
| 802 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 803 | #ifdef SOL_IPX |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 804 | static const struct xlat sockipxoptions[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 805 | { IPX_TYPE, "IPX_TYPE" }, |
| 806 | { 0, NULL }, |
| 807 | }; |
| 808 | #endif /* SOL_IPX */ |
| 809 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 810 | #ifdef SOL_RAW |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 811 | static const struct xlat sockrawoptions[] = { |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 812 | #if defined(ICMP_FILTER) |
| 813 | { ICMP_FILTER, "ICMP_FILTER" }, |
| 814 | #endif |
| 815 | { 0, NULL }, |
| 816 | }; |
| 817 | #endif /* SOL_RAW */ |
| 818 | |
| 819 | #ifdef SOL_PACKET |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 820 | static const struct xlat sockpacketoptions[] = { |
Roland McGrath | c294b8f | 2007-11-01 21:37:33 +0000 | [diff] [blame] | 821 | #ifdef PACKET_ADD_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 822 | { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, |
Roland McGrath | c294b8f | 2007-11-01 21:37:33 +0000 | [diff] [blame] | 823 | #endif |
| 824 | #ifdef PACKET_DROP_MEMBERSHIP |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 825 | { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, |
Roland McGrath | c294b8f | 2007-11-01 21:37:33 +0000 | [diff] [blame] | 826 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 827 | #if defined(PACKET_RECV_OUTPUT) |
| 828 | { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, |
| 829 | #endif |
| 830 | #if defined(PACKET_RX_RING) |
| 831 | { PACKET_RX_RING, "PACKET_RX_RING" }, |
| 832 | #endif |
| 833 | #if defined(PACKET_STATISTICS) |
| 834 | { PACKET_STATISTICS, "PACKET_STATISTICS" }, |
| 835 | #endif |
Dmitry V. Levin | ca75bd6 | 2009-11-13 12:51:04 +0000 | [diff] [blame] | 836 | #if defined(PACKET_COPY_THRESH) |
| 837 | { PACKET_COPY_THRESH, "PACKET_COPY_THRESH" }, |
| 838 | #endif |
| 839 | #if defined(PACKET_AUXDATA) |
| 840 | { PACKET_AUXDATA, "PACKET_AUXDATA" }, |
| 841 | #endif |
| 842 | #if defined(PACKET_ORIGDEV) |
| 843 | { PACKET_ORIGDEV, "PACKET_ORIGDEV" }, |
| 844 | #endif |
| 845 | #if defined(PACKET_VERSION) |
| 846 | { PACKET_VERSION, "PACKET_VERSION" }, |
| 847 | #endif |
| 848 | #if defined(PACKET_HDRLEN) |
| 849 | { PACKET_HDRLEN, "PACKET_HDRLEN" }, |
| 850 | #endif |
| 851 | #if defined(PACKET_RESERVE) |
| 852 | { PACKET_RESERVE, "PACKET_RESERVE" }, |
| 853 | #endif |
| 854 | #if defined(PACKET_TX_RING) |
| 855 | { PACKET_TX_RING, "PACKET_TX_RING" }, |
| 856 | #endif |
| 857 | #if defined(PACKET_LOSS) |
| 858 | { PACKET_LOSS, "PACKET_LOSS" }, |
| 859 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 860 | { 0, NULL }, |
| 861 | }; |
| 862 | #endif /* SOL_PACKET */ |
| 863 | |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 864 | #if !defined (SOL_TCP) && defined (IPPROTO_TCP) |
| 865 | #define SOL_TCP IPPROTO_TCP |
| 866 | #endif |
| 867 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 868 | #ifdef SOL_TCP |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 869 | static const struct xlat socktcpoptions[] = { |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 870 | { TCP_NODELAY, "TCP_NODELAY" }, |
| 871 | { TCP_MAXSEG, "TCP_MAXSEG" }, |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 872 | #if defined(TCP_CORK) |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 873 | { TCP_CORK, "TCP_CORK" }, |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 874 | #endif |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 875 | #if defined(TCP_KEEPIDLE) |
| 876 | { TCP_KEEPIDLE, "TCP_KEEPIDLE" }, |
| 877 | #endif |
| 878 | #if defined(TCP_KEEPINTVL) |
| 879 | { TCP_KEEPINTVL, "TCP_KEEPINTVL" }, |
| 880 | #endif |
| 881 | #if defined(TCP_KEEPCNT) |
| 882 | { TCP_KEEPCNT, "TCP_KEEPCNT" }, |
| 883 | #endif |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 884 | #if defined(TCP_NKEEP) |
| 885 | { TCP_NKEEP, "TCP_NKEEP" }, |
| 886 | #endif |
Wichert Akkerman | 8b8ff7c | 2001-12-27 22:27:30 +0000 | [diff] [blame] | 887 | #if defined(TCP_SYNCNT) |
| 888 | { TCP_SYNCNT, "TCP_SYNCNT" }, |
| 889 | #endif |
| 890 | #if defined(TCP_LINGER2) |
| 891 | { TCP_LINGER2, "TCP_LINGER2" }, |
| 892 | #endif |
| 893 | #if defined(TCP_DEFER_ACCEPT) |
| 894 | { TCP_DEFER_ACCEPT, "TCP_DEFER_ACCEPT" }, |
| 895 | #endif |
| 896 | #if defined(TCP_WINDOW_CLAMP) |
| 897 | { TCP_WINDOW_CLAMP, "TCP_WINDOW_CLAMP" }, |
| 898 | #endif |
| 899 | #if defined(TCP_INFO) |
| 900 | { TCP_INFO, "TCP_INFO" }, |
| 901 | #endif |
| 902 | #if defined(TCP_QUICKACK) |
| 903 | { TCP_QUICKACK, "TCP_QUICKACK" }, |
| 904 | #endif |
| 905 | { 0, NULL }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 906 | }; |
| 907 | #endif /* SOL_TCP */ |
| 908 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 909 | #ifdef SOL_RAW |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 910 | static const struct xlat icmpfilterflags[] = { |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 911 | #if defined(ICMP_ECHOREPLY) |
| 912 | { (1<<ICMP_ECHOREPLY), "ICMP_ECHOREPLY" }, |
| 913 | #endif |
| 914 | #if defined(ICMP_DEST_UNREACH) |
| 915 | { (1<<ICMP_DEST_UNREACH), "ICMP_DEST_UNREACH" }, |
| 916 | #endif |
| 917 | #if defined(ICMP_SOURCE_QUENCH) |
| 918 | { (1<<ICMP_SOURCE_QUENCH), "ICMP_SOURCE_QUENCH" }, |
| 919 | #endif |
| 920 | #if defined(ICMP_REDIRECT) |
| 921 | { (1<<ICMP_REDIRECT), "ICMP_REDIRECT" }, |
| 922 | #endif |
| 923 | #if defined(ICMP_ECHO) |
| 924 | { (1<<ICMP_ECHO), "ICMP_ECHO" }, |
| 925 | #endif |
| 926 | #if defined(ICMP_TIME_EXCEEDED) |
| 927 | { (1<<ICMP_TIME_EXCEEDED), "ICMP_TIME_EXCEEDED" }, |
| 928 | #endif |
| 929 | #if defined(ICMP_PARAMETERPROB) |
| 930 | { (1<<ICMP_PARAMETERPROB), "ICMP_PARAMETERPROB" }, |
| 931 | #endif |
| 932 | #if defined(ICMP_TIMESTAMP) |
| 933 | { (1<<ICMP_TIMESTAMP), "ICMP_TIMESTAMP" }, |
| 934 | #endif |
| 935 | #if defined(ICMP_TIMESTAMPREPLY) |
| 936 | { (1<<ICMP_TIMESTAMPREPLY), "ICMP_TIMESTAMPREPLY" }, |
| 937 | #endif |
| 938 | #if defined(ICMP_INFO_REQUEST) |
| 939 | { (1<<ICMP_INFO_REQUEST), "ICMP_INFO_REQUEST" }, |
| 940 | #endif |
| 941 | #if defined(ICMP_INFO_REPLY) |
| 942 | { (1<<ICMP_INFO_REPLY), "ICMP_INFO_REPLY" }, |
| 943 | #endif |
| 944 | #if defined(ICMP_ADDRESS) |
| 945 | { (1<<ICMP_ADDRESS), "ICMP_ADDRESS" }, |
| 946 | #endif |
| 947 | #if defined(ICMP_ADDRESSREPLY) |
| 948 | { (1<<ICMP_ADDRESSREPLY), "ICMP_ADDRESSREPLY" }, |
| 949 | #endif |
| 950 | { 0, NULL }, |
| 951 | }; |
| 952 | #endif /* SOL_RAW */ |
| 953 | |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 954 | #if defined(AF_PACKET) /* from e.g. linux/if_packet.h */ |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 955 | static const struct xlat af_packet_types[] = { |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 956 | #if defined(PACKET_HOST) |
| 957 | { PACKET_HOST, "PACKET_HOST" }, |
| 958 | #endif |
| 959 | #if defined(PACKET_BROADCAST) |
| 960 | { PACKET_BROADCAST, "PACKET_BROADCAST" }, |
| 961 | #endif |
| 962 | #if defined(PACKET_MULTICAST) |
| 963 | { PACKET_MULTICAST, "PACKET_MULTICAST" }, |
| 964 | #endif |
| 965 | #if defined(PACKET_OTHERHOST) |
| 966 | { PACKET_OTHERHOST, "PACKET_OTHERHOST" }, |
| 967 | #endif |
| 968 | #if defined(PACKET_OUTGOING) |
| 969 | { PACKET_OUTGOING, "PACKET_OUTGOING" }, |
| 970 | #endif |
| 971 | #if defined(PACKET_LOOPBACK) |
| 972 | { PACKET_LOOPBACK, "PACKET_LOOPBACK" }, |
| 973 | #endif |
| 974 | #if defined(PACKET_FASTROUTE) |
| 975 | { PACKET_FASTROUTE, "PACKET_FASTROUTE" }, |
| 976 | #endif |
| 977 | { 0, NULL }, |
| 978 | }; |
| 979 | #endif /* defined(AF_PACKET) */ |
| 980 | |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 981 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 982 | void |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 983 | printsock(struct tcb *tcp, long addr, int addrlen) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 984 | { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 985 | union { |
| 986 | char pad[128]; |
| 987 | struct sockaddr sa; |
| 988 | struct sockaddr_in sin; |
| 989 | struct sockaddr_un sau; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 990 | #ifdef HAVE_INET_NTOP |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 991 | struct sockaddr_in6 sa6; |
| 992 | #endif |
| 993 | #if defined(LINUX) && defined(AF_IPX) |
| 994 | struct sockaddr_ipx sipx; |
| 995 | #endif |
| 996 | #ifdef AF_PACKET |
| 997 | struct sockaddr_ll ll; |
| 998 | #endif |
| 999 | #ifdef AF_NETLINK |
| 1000 | struct sockaddr_nl nl; |
| 1001 | #endif |
| 1002 | } addrbuf; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 1003 | char string_addr[100]; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1004 | |
| 1005 | if (addr == 0) { |
| 1006 | tprintf("NULL"); |
| 1007 | return; |
| 1008 | } |
| 1009 | if (!verbose(tcp)) { |
| 1010 | tprintf("%#lx", addr); |
| 1011 | return; |
| 1012 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1013 | |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 1014 | if (addrlen < 2 || addrlen > sizeof(addrbuf)) |
| 1015 | addrlen = sizeof(addrbuf); |
| 1016 | |
| 1017 | memset(&addrbuf, 0, sizeof(addrbuf)); |
| 1018 | if (umoven(tcp, addr, addrlen, addrbuf.pad) < 0) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1019 | tprintf("{...}"); |
| 1020 | return; |
| 1021 | } |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 1022 | addrbuf.pad[sizeof(addrbuf.pad) - 1] = '\0'; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1023 | |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 1024 | tprintf("{sa_family="); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1025 | printxval(addrfams, addrbuf.sa.sa_family, "AF_???"); |
| 1026 | tprintf(", "); |
| 1027 | |
| 1028 | switch (addrbuf.sa.sa_family) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1029 | case AF_UNIX: |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 1030 | if (addrlen == 2) { |
| 1031 | tprintf("NULL"); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1032 | } else if (addrbuf.sau.sun_path[0]) { |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 1033 | tprintf("path="); |
Dmitry V. Levin | 16fbe97 | 2007-10-13 21:03:17 +0000 | [diff] [blame] | 1034 | printpathn(tcp, addr + 2, strlen(addrbuf.sau.sun_path)); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1035 | } else { |
Dmitry V. Levin | b6c32f4 | 2007-10-08 23:31:19 +0000 | [diff] [blame] | 1036 | tprintf("path=@"); |
Dmitry V. Levin | 16fbe97 | 2007-10-13 21:03:17 +0000 | [diff] [blame] | 1037 | printpathn(tcp, addr + 3, strlen(addrbuf.sau.sun_path + 1)); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1038 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1039 | break; |
| 1040 | case AF_INET: |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 1041 | tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1042 | ntohs(addrbuf.sin.sin_port), inet_ntoa(addrbuf.sin.sin_addr)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1043 | break; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 1044 | #ifdef HAVE_INET_NTOP |
| 1045 | case AF_INET6: |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1046 | 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] | 1047 | tprintf("sin6_port=htons(%u), inet_pton(AF_INET6, \"%s\", &sin6_addr), sin6_flowinfo=%u", |
| 1048 | ntohs(addrbuf.sa6.sin6_port), string_addr, |
| 1049 | addrbuf.sa6.sin6_flowinfo); |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1050 | #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 1051 | { |
| 1052 | #if defined(HAVE_IF_INDEXTONAME) && defined(IN6_IS_ADDR_LINKLOCAL) && defined(IN6_IS_ADDR_MC_LINKLOCAL) |
| 1053 | int numericscope = 0; |
| 1054 | if (IN6_IS_ADDR_LINKLOCAL (&addrbuf.sa6.sin6_addr) |
| 1055 | || IN6_IS_ADDR_MC_LINKLOCAL (&addrbuf.sa6.sin6_addr)) { |
| 1056 | char scopebuf[IFNAMSIZ + 1]; |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1057 | |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 1058 | if (if_indextoname (addrbuf.sa6.sin6_scope_id, scopebuf) == NULL) |
| 1059 | numericscope++; |
| 1060 | else |
| 1061 | tprintf(", sin6_scope_id=if_nametoindex(\"%s\")", scopebuf); |
| 1062 | } else |
| 1063 | numericscope++; |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1064 | |
Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 1065 | if (numericscope) |
| 1066 | #endif |
| 1067 | tprintf(", sin6_scope_id=%u", addrbuf.sa6.sin6_scope_id); |
| 1068 | } |
| 1069 | #endif |
| 1070 | break; |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 1071 | #endif |
Wichert Akkerman | dbb440e | 1999-05-11 15:06:44 +0000 | [diff] [blame] | 1072 | #if defined(AF_IPX) && defined(linux) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1073 | case AF_IPX: |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1074 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1075 | int i; |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 1076 | tprintf("sipx_port=htons(%u), ", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1077 | ntohs(addrbuf.sipx.sipx_port)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1078 | /* Yes, I know, this does not look too |
| 1079 | * strace-ish, but otherwise the IPX |
| 1080 | * addresses just look monstrous... |
| 1081 | * Anyways, feel free if you don't like |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1082 | * this way.. :) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1083 | */ |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1084 | tprintf("%08lx:", (unsigned long)ntohl(addrbuf.sipx.sipx_network)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1085 | for (i = 0; i<IPX_NODE_LEN; i++) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1086 | tprintf("%02x", addrbuf.sipx.sipx_node[i]); |
| 1087 | tprintf("/[%02x]", addrbuf.sipx.sipx_type); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1088 | } |
| 1089 | break; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1090 | #endif /* AF_IPX && linux */ |
| 1091 | #ifdef AF_PACKET |
| 1092 | case AF_PACKET: |
| 1093 | { |
| 1094 | int i; |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 1095 | tprintf("proto=%#04x, if%d, pkttype=", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1096 | ntohs(addrbuf.ll.sll_protocol), |
Wichert Akkerman | b0c598f | 2002-04-01 12:48:06 +0000 | [diff] [blame] | 1097 | addrbuf.ll.sll_ifindex); |
| 1098 | printxval(af_packet_types, addrbuf.ll.sll_pkttype, "?"); |
| 1099 | tprintf(", addr(%d)={%d, ", |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1100 | addrbuf.ll.sll_halen, |
| 1101 | addrbuf.ll.sll_hatype); |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1102 | for (i=0; i<addrbuf.ll.sll_halen; i++) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1103 | tprintf("%02x", addrbuf.ll.sll_addr[i]); |
| 1104 | } |
| 1105 | break; |
| 1106 | |
| 1107 | #endif /* AF_APACKET */ |
Roland McGrath | 36ef1bc | 2003-11-06 23:41:23 +0000 | [diff] [blame] | 1108 | #ifdef AF_NETLINK |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1109 | case AF_NETLINK: |
| 1110 | tprintf("pid=%d, groups=%08x", addrbuf.nl.nl_pid, addrbuf.nl.nl_groups); |
| 1111 | break; |
| 1112 | #endif /* AF_NETLINK */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1113 | /* AF_AX25 AF_APPLETALK AF_NETROM AF_BRIDGE AF_AAL5 |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1114 | AF_X25 AF_ROSE etc. still need to be done */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1115 | |
| 1116 | default: |
John Hughes | 1fcb1d6 | 2001-09-18 15:56:53 +0000 | [diff] [blame] | 1117 | tprintf("sa_data="); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1118 | printstr(tcp, (long) &((struct sockaddr *) addr)->sa_data, |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1119 | sizeof addrbuf.sa.sa_data); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1120 | break; |
| 1121 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1122 | tprintf("}"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1123 | } |
| 1124 | |
| 1125 | #if HAVE_SENDMSG |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1126 | static const struct xlat scmvals[] = { |
| 1127 | #ifdef SCM_RIGHTS |
| 1128 | { SCM_RIGHTS, "SCM_RIGHTS" }, |
| 1129 | #endif |
| 1130 | #ifdef SCM_CREDENTIALS |
| 1131 | { SCM_CREDENTIALS, "SCM_CREDENTIALS" }, |
| 1132 | #endif |
| 1133 | { 0, NULL } |
| 1134 | }; |
| 1135 | |
| 1136 | static void |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 1137 | printcmsghdr(struct tcb *tcp, unsigned long addr, unsigned long len) |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1138 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1139 | struct cmsghdr *cmsg = len < sizeof(struct cmsghdr) ? |
| 1140 | NULL : malloc(len); |
| 1141 | if (cmsg == NULL || umoven(tcp, addr, len, (char *) cmsg) < 0) { |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1142 | tprintf(", msg_control=%#lx", addr); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1143 | free(cmsg); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1144 | return; |
| 1145 | } |
| 1146 | |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 1147 | tprintf(", {cmsg_len=%u, cmsg_level=", (unsigned) cmsg->cmsg_len); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1148 | printxval(socketlayers, cmsg->cmsg_level, "SOL_???"); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1149 | tprintf(", cmsg_type="); |
| 1150 | |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1151 | if (cmsg->cmsg_level == SOL_SOCKET) { |
| 1152 | unsigned long cmsg_len; |
Roland McGrath | 96ad7b8 | 2005-02-02 03:11:32 +0000 | [diff] [blame] | 1153 | |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1154 | printxval(scmvals, cmsg->cmsg_type, "SCM_???"); |
| 1155 | cmsg_len = (len < cmsg->cmsg_len) ? len : cmsg->cmsg_len; |
| 1156 | |
| 1157 | if (cmsg->cmsg_type == SCM_RIGHTS |
| 1158 | && CMSG_LEN(sizeof(int)) <= cmsg_len) { |
| 1159 | int *fds = (int *) CMSG_DATA (cmsg); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1160 | int first = 1; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1161 | |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1162 | tprintf(", {"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1163 | while ((char *) fds < ((char *) cmsg + cmsg_len)) { |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1164 | if (!first) |
| 1165 | tprintf(", "); |
| 1166 | tprintf("%d", *fds++); |
| 1167 | first = 0; |
| 1168 | } |
| 1169 | tprintf("}}"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1170 | free(cmsg); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1171 | return; |
| 1172 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1173 | if (cmsg->cmsg_type == SCM_CREDENTIALS |
| 1174 | && CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) { |
| 1175 | struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg); |
| 1176 | |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1177 | tprintf("{pid=%ld, uid=%ld, gid=%ld}}", |
| 1178 | (long)uc->pid, (long)uc->uid, (long)uc->gid); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1179 | free(cmsg); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1180 | return; |
| 1181 | } |
| 1182 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 1183 | free(cmsg); |
Roland McGrath | 5077082 | 2004-10-06 22:11:51 +0000 | [diff] [blame] | 1184 | tprintf(", ...}"); |
| 1185 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1186 | |
| 1187 | static void |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1188 | do_msghdr(struct tcb *tcp, struct msghdr *msg) |
| 1189 | { |
| 1190 | tprintf("{msg_name(%d)=", msg->msg_namelen); |
| 1191 | printsock(tcp, (long)msg->msg_name, msg->msg_namelen); |
| 1192 | |
| 1193 | tprintf(", msg_iov(%lu)=", (unsigned long)msg->msg_iovlen); |
| 1194 | tprint_iov(tcp, (unsigned long)msg->msg_iovlen, |
| 1195 | (unsigned long)msg->msg_iov); |
| 1196 | |
| 1197 | #ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL |
| 1198 | tprintf(", msg_controllen=%lu", (unsigned long)msg->msg_controllen); |
| 1199 | if (msg->msg_controllen) |
| 1200 | printcmsghdr(tcp, (unsigned long) msg->msg_control, |
| 1201 | msg->msg_controllen); |
| 1202 | tprintf(", msg_flags="); |
| 1203 | printflags(msg_flags, msg->msg_flags, "MSG_???"); |
| 1204 | #else /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */ |
| 1205 | tprintf("msg_accrights=%#lx, msg_accrightslen=%u", |
| 1206 | (unsigned long) msg->msg_accrights, msg->msg_accrightslen); |
| 1207 | #endif /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */ |
| 1208 | tprintf("}"); |
| 1209 | } |
| 1210 | |
| 1211 | static void |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1212 | printmsghdr(tcp, addr) |
| 1213 | struct tcb *tcp; |
| 1214 | long addr; |
| 1215 | { |
| 1216 | struct msghdr msg; |
| 1217 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1218 | if (umove(tcp, addr, &msg) < 0) { |
| 1219 | tprintf("%#lx", addr); |
| 1220 | return; |
| 1221 | } |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1222 | do_msghdr(tcp, &msg); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1223 | } |
| 1224 | |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1225 | #ifdef LINUX |
| 1226 | static void |
| 1227 | printmmsghdr(struct tcb *tcp, long addr) |
| 1228 | { |
| 1229 | struct mmsghdr { |
| 1230 | struct msghdr msg_hdr; |
| 1231 | unsigned msg_len; |
| 1232 | } mmsg; |
| 1233 | |
| 1234 | if (umove(tcp, addr, &mmsg) < 0) { |
| 1235 | tprintf("%#lx", addr); |
| 1236 | return; |
| 1237 | } |
| 1238 | tprintf("{"); |
| 1239 | do_msghdr(tcp, &mmsg.msg_hdr); |
| 1240 | tprintf(", %u}", mmsg.msg_len); |
| 1241 | } |
| 1242 | #endif |
| 1243 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1244 | #endif /* HAVE_SENDMSG */ |
| 1245 | |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 1246 | /* |
| 1247 | * low bits of the socket type define real socket type, |
| 1248 | * other bits are socket type flags. |
| 1249 | */ |
| 1250 | static void |
| 1251 | tprint_sock_type(struct tcb *tcp, int flags) |
| 1252 | { |
| 1253 | const char *str = xlookup(socktypes, flags & SOCK_TYPE_MASK); |
| 1254 | |
| 1255 | if (str) |
| 1256 | { |
| 1257 | tprintf("%s", str); |
| 1258 | flags &= ~SOCK_TYPE_MASK; |
| 1259 | if (!flags) |
| 1260 | return; |
| 1261 | tprintf("|"); |
| 1262 | } |
| 1263 | printflags(sock_type_flags, flags, "SOCK_???"); |
| 1264 | } |
| 1265 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1266 | int |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 1267 | sys_socket(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1268 | { |
| 1269 | if (entering(tcp)) { |
| 1270 | printxval(domains, tcp->u_arg[0], "PF_???"); |
| 1271 | tprintf(", "); |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 1272 | tprint_sock_type(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1273 | tprintf(", "); |
| 1274 | switch (tcp->u_arg[0]) { |
| 1275 | case PF_INET: |
Roland McGrath | 8758e54 | 2003-06-23 23:39:59 +0000 | [diff] [blame] | 1276 | #ifdef PF_INET6 |
| 1277 | case PF_INET6: |
| 1278 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1279 | printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); |
| 1280 | break; |
| 1281 | #ifdef PF_IPX |
| 1282 | case PF_IPX: |
| 1283 | /* BTW: I don't believe this.. */ |
| 1284 | tprintf("["); |
| 1285 | printxval(domains, tcp->u_arg[2], "PF_???"); |
| 1286 | tprintf("]"); |
| 1287 | break; |
| 1288 | #endif /* PF_IPX */ |
| 1289 | default: |
| 1290 | tprintf("%lu", tcp->u_arg[2]); |
| 1291 | break; |
| 1292 | } |
| 1293 | } |
| 1294 | return 0; |
| 1295 | } |
| 1296 | |
Dmitry V. Levin | b9fe011 | 2006-12-13 16:59:44 +0000 | [diff] [blame] | 1297 | #ifdef SVR4 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1298 | int |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 1299 | sys_so_socket(tcp) |
| 1300 | struct tcb *tcp; |
| 1301 | { |
| 1302 | if (entering(tcp)) { |
| 1303 | /* not sure really what these args are... but this |
| 1304 | * is how truss prints it |
| 1305 | */ |
| 1306 | tprintf("%ld, %ld, %ld, ", |
| 1307 | tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]); |
| 1308 | printpath(tcp, tcp->u_arg[3]); |
| 1309 | tprintf(", %ld", tcp->u_arg[4]); |
| 1310 | } |
| 1311 | return 0; |
| 1312 | } |
| 1313 | |
| 1314 | int |
| 1315 | sys_so_socketpair(tcp) |
| 1316 | struct tcb *tcp; |
| 1317 | { |
| 1318 | if (entering(tcp)) { |
Denys Vlasenko | 5ae2b7c | 2009-02-27 20:32:52 +0000 | [diff] [blame] | 1319 | /* not sure what this arg is */ |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 1320 | tprintf("0x%lx", tcp->u_arg[0]); |
| 1321 | } |
| 1322 | return 0; |
| 1323 | } |
Dmitry V. Levin | b9fe011 | 2006-12-13 16:59:44 +0000 | [diff] [blame] | 1324 | #endif /* SVR4 */ |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 1325 | |
| 1326 | int |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1327 | sys_bind(tcp) |
| 1328 | struct tcb *tcp; |
| 1329 | { |
| 1330 | if (entering(tcp)) { |
| 1331 | tprintf("%ld, ", tcp->u_arg[0]); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1332 | printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1333 | tprintf(", %lu", tcp->u_arg[2]); |
| 1334 | } |
| 1335 | return 0; |
| 1336 | } |
| 1337 | |
| 1338 | int |
| 1339 | sys_connect(tcp) |
| 1340 | struct tcb *tcp; |
| 1341 | { |
| 1342 | return sys_bind(tcp); |
| 1343 | } |
| 1344 | |
| 1345 | int |
| 1346 | sys_listen(tcp) |
| 1347 | struct tcb *tcp; |
| 1348 | { |
| 1349 | if (entering(tcp)) { |
| 1350 | tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]); |
| 1351 | } |
| 1352 | return 0; |
| 1353 | } |
| 1354 | |
Paolo Bonzini | 705ff10 | 2009-08-14 12:34:05 +0200 | [diff] [blame] | 1355 | static int |
| 1356 | do_accept(struct tcb *tcp, int flags_arg) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1357 | { |
| 1358 | if (entering(tcp)) { |
| 1359 | tprintf("%ld, ", tcp->u_arg[0]); |
Paolo Bonzini | 705ff10 | 2009-08-14 12:34:05 +0200 | [diff] [blame] | 1360 | return 0; |
| 1361 | } |
| 1362 | if (!tcp->u_arg[2]) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1363 | tprintf("%#lx, NULL", tcp->u_arg[1]); |
| 1364 | else { |
Dmitry V. Levin | 2fc6615 | 2009-01-01 22:47:51 +0000 | [diff] [blame] | 1365 | int len; |
| 1366 | if (tcp->u_arg[1] == 0 || syserror(tcp) |
| 1367 | || umove (tcp, tcp->u_arg[2], &len) < 0) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1368 | tprintf("%#lx", tcp->u_arg[1]); |
| 1369 | } else { |
Dmitry V. Levin | 2fc6615 | 2009-01-01 22:47:51 +0000 | [diff] [blame] | 1370 | printsock(tcp, tcp->u_arg[1], len); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1371 | } |
| 1372 | tprintf(", "); |
Dmitry V. Levin | 2fc6615 | 2009-01-01 22:47:51 +0000 | [diff] [blame] | 1373 | printnum_int(tcp, tcp->u_arg[2], "%u"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1374 | } |
Paolo Bonzini | 705ff10 | 2009-08-14 12:34:05 +0200 | [diff] [blame] | 1375 | if (flags_arg >= 0) { |
| 1376 | tprintf(", "); |
| 1377 | printflags(sock_type_flags, tcp->u_arg[flags_arg], |
| 1378 | "SOCK_???"); |
| 1379 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1380 | return 0; |
| 1381 | } |
| 1382 | |
| 1383 | int |
Paolo Bonzini | 705ff10 | 2009-08-14 12:34:05 +0200 | [diff] [blame] | 1384 | sys_accept(struct tcb *tcp) |
| 1385 | { |
| 1386 | return do_accept(tcp, -1); |
| 1387 | } |
| 1388 | |
| 1389 | #ifdef LINUX |
| 1390 | int |
| 1391 | sys_accept4(struct tcb *tcp) |
| 1392 | { |
| 1393 | return do_accept(tcp, 3); |
| 1394 | } |
| 1395 | #endif |
| 1396 | |
| 1397 | int |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1398 | sys_send(tcp) |
| 1399 | struct tcb *tcp; |
| 1400 | { |
| 1401 | if (entering(tcp)) { |
| 1402 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1403 | printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
| 1404 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 1405 | /* flags */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1406 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1407 | } |
| 1408 | return 0; |
| 1409 | } |
| 1410 | |
| 1411 | int |
| 1412 | sys_sendto(tcp) |
| 1413 | struct tcb *tcp; |
| 1414 | { |
| 1415 | if (entering(tcp)) { |
| 1416 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1417 | printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); |
| 1418 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 1419 | /* flags */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1420 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1421 | /* to address */ |
| 1422 | tprintf(", "); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1423 | printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1424 | /* to length */ |
| 1425 | tprintf(", %lu", tcp->u_arg[5]); |
| 1426 | } |
| 1427 | return 0; |
| 1428 | } |
| 1429 | |
| 1430 | #ifdef HAVE_SENDMSG |
| 1431 | |
| 1432 | int |
| 1433 | sys_sendmsg(tcp) |
| 1434 | struct tcb *tcp; |
| 1435 | { |
| 1436 | if (entering(tcp)) { |
| 1437 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1438 | printmsghdr(tcp, tcp->u_arg[1]); |
| 1439 | /* flags */ |
| 1440 | tprintf(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1441 | printflags(msg_flags, tcp->u_arg[2], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1442 | } |
| 1443 | return 0; |
| 1444 | } |
| 1445 | |
| 1446 | #endif /* HAVE_SENDMSG */ |
| 1447 | |
| 1448 | int |
| 1449 | sys_recv(tcp) |
| 1450 | struct tcb *tcp; |
| 1451 | { |
| 1452 | if (entering(tcp)) { |
| 1453 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1454 | } else { |
| 1455 | if (syserror(tcp)) |
| 1456 | tprintf("%#lx", tcp->u_arg[1]); |
| 1457 | else |
| 1458 | printstr(tcp, tcp->u_arg[1], tcp->u_rval); |
| 1459 | |
| 1460 | tprintf(", %lu, ", tcp->u_arg[2]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1461 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1462 | } |
| 1463 | return 0; |
| 1464 | } |
| 1465 | |
| 1466 | int |
| 1467 | sys_recvfrom(tcp) |
| 1468 | struct tcb *tcp; |
| 1469 | { |
| 1470 | int fromlen; |
| 1471 | |
| 1472 | if (entering(tcp)) { |
| 1473 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1474 | } else { |
| 1475 | if (syserror(tcp)) { |
| 1476 | tprintf("%#lx, %lu, %lu, %#lx, %#lx", |
| 1477 | tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3], |
| 1478 | tcp->u_arg[4], tcp->u_arg[5]); |
| 1479 | return 0; |
| 1480 | } |
| 1481 | /* buf */ |
| 1482 | printstr(tcp, tcp->u_arg[1], tcp->u_rval); |
| 1483 | /* len */ |
| 1484 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 1485 | /* flags */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1486 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1487 | /* from address, len */ |
| 1488 | if (!tcp->u_arg[4] || !tcp->u_arg[5]) { |
| 1489 | if (tcp->u_arg[4] == 0) |
| 1490 | tprintf(", NULL"); |
| 1491 | else |
| 1492 | tprintf(", %#lx", tcp->u_arg[4]); |
| 1493 | if (tcp->u_arg[5] == 0) |
| 1494 | tprintf(", NULL"); |
| 1495 | else |
| 1496 | tprintf(", %#lx", tcp->u_arg[5]); |
| 1497 | return 0; |
| 1498 | } |
| 1499 | if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) { |
| 1500 | tprintf(", {...}, [?]"); |
| 1501 | return 0; |
| 1502 | } |
| 1503 | tprintf(", "); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1504 | printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1505 | /* from length */ |
| 1506 | tprintf(", [%u]", fromlen); |
| 1507 | } |
| 1508 | return 0; |
| 1509 | } |
| 1510 | |
| 1511 | #ifdef HAVE_SENDMSG |
| 1512 | |
| 1513 | int |
| 1514 | sys_recvmsg(tcp) |
| 1515 | struct tcb *tcp; |
| 1516 | { |
| 1517 | if (entering(tcp)) { |
| 1518 | tprintf("%ld, ", tcp->u_arg[0]); |
| 1519 | } else { |
| 1520 | if (syserror(tcp) || !verbose(tcp)) |
| 1521 | tprintf("%#lx", tcp->u_arg[1]); |
| 1522 | else |
| 1523 | printmsghdr(tcp, tcp->u_arg[1]); |
| 1524 | /* flags */ |
| 1525 | tprintf(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1526 | printflags(msg_flags, tcp->u_arg[2], "MSG_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1527 | } |
| 1528 | return 0; |
| 1529 | } |
| 1530 | |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1531 | #ifdef LINUX |
| 1532 | int |
| 1533 | sys_recvmmsg(struct tcb *tcp) |
| 1534 | { |
Dmitry V. Levin | e659103 | 2010-03-29 20:45:48 +0400 | [diff] [blame] | 1535 | static char str[128]; |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1536 | if (entering(tcp)) { |
Dmitry V. Levin | e659103 | 2010-03-29 20:45:48 +0400 | [diff] [blame] | 1537 | |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1538 | tprintf("%ld, ", tcp->u_arg[0]); |
Dmitry V. Levin | e659103 | 2010-03-29 20:45:48 +0400 | [diff] [blame] | 1539 | if (verbose(tcp)) { |
| 1540 | sprint_timespec(str, tcp, tcp->u_arg[4]); |
| 1541 | tcp->auxstr = strdup(str); |
| 1542 | } else { |
| 1543 | tprintf("%#lx, %ld, ", tcp->u_arg[1], tcp->u_arg[2]); |
| 1544 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
| 1545 | tprintf(", "); |
| 1546 | print_timespec(tcp, tcp->u_arg[4]); |
| 1547 | } |
| 1548 | return 0; |
| 1549 | } else { |
| 1550 | if (verbose(tcp)) { |
| 1551 | if (syserror(tcp)) |
| 1552 | tprintf("%#lx", tcp->u_arg[1]); |
| 1553 | else |
| 1554 | printmmsghdr(tcp, tcp->u_arg[1]); |
| 1555 | tprintf(", %ld, ", tcp->u_arg[2]); |
| 1556 | /* flags */ |
| 1557 | printflags(msg_flags, tcp->u_arg[3], "MSG_???"); |
| 1558 | /* timeout on entrance */ |
| 1559 | tprintf(", %s", tcp->auxstr ? tcp->auxstr : "{...}"); |
| 1560 | free((void *) tcp->auxstr); |
| 1561 | tcp->auxstr = NULL; |
| 1562 | } |
| 1563 | if (syserror(tcp)) |
| 1564 | return 0; |
| 1565 | if (tcp->u_rval == 0) { |
| 1566 | tcp->auxstr = "Timeout"; |
| 1567 | return RVAL_STR; |
| 1568 | } |
| 1569 | if (!verbose(tcp)) |
| 1570 | return 0; |
| 1571 | /* timeout on exit */ |
| 1572 | strcpy(str, "left "); |
| 1573 | sprint_timespec(str + strlen(str), tcp, tcp->u_arg[4]); |
| 1574 | tcp->auxstr = str; |
| 1575 | return RVAL_STR; |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1576 | } |
Andreas Schwab | 0873f29 | 2010-02-12 21:39:12 +0100 | [diff] [blame] | 1577 | } |
| 1578 | #endif |
| 1579 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1580 | #endif /* HAVE_SENDMSG */ |
| 1581 | |
| 1582 | int |
| 1583 | sys_shutdown(tcp) |
| 1584 | struct tcb *tcp; |
| 1585 | { |
| 1586 | if (entering(tcp)) { |
| 1587 | tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]); |
| 1588 | switch (tcp->u_arg[1]) { |
| 1589 | case 0: |
| 1590 | tprintf("%s", " /* receive */"); |
| 1591 | break; |
| 1592 | case 1: |
| 1593 | tprintf("%s", " /* send */"); |
| 1594 | break; |
| 1595 | case 2: |
| 1596 | tprintf("%s", " /* send and receive */"); |
| 1597 | break; |
| 1598 | } |
| 1599 | } |
| 1600 | return 0; |
| 1601 | } |
| 1602 | |
| 1603 | int |
| 1604 | sys_getsockname(tcp) |
| 1605 | struct tcb *tcp; |
| 1606 | { |
| 1607 | return sys_accept(tcp); |
| 1608 | } |
| 1609 | |
| 1610 | int |
| 1611 | sys_getpeername(tcp) |
| 1612 | struct tcb *tcp; |
| 1613 | { |
| 1614 | return sys_accept(tcp); |
| 1615 | } |
| 1616 | |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 1617 | static int |
| 1618 | do_pipe(struct tcb *tcp, int flags_arg) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1619 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1620 | if (exiting(tcp)) { |
| 1621 | if (syserror(tcp)) { |
| 1622 | tprintf("%#lx", tcp->u_arg[0]); |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 1623 | } else { |
| 1624 | #if defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64) |
| 1625 | int fds[2]; |
| 1626 | |
| 1627 | if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0) |
| 1628 | tprintf("[...]"); |
| 1629 | else |
| 1630 | tprintf("[%u, %u]", fds[0], fds[1]); |
Roland McGrath | 6d1a65c | 2004-07-12 07:44:08 +0000 | [diff] [blame] | 1631 | #elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(FREEBSD) || defined(IA64) |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 1632 | tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp)); |
| 1633 | #else |
| 1634 | tprintf("%#lx", tcp->u_arg[0]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1635 | #endif |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 1636 | } |
| 1637 | if (flags_arg >= 0) { |
| 1638 | tprintf(", "); |
| 1639 | printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???"); |
| 1640 | } |
| 1641 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1642 | return 0; |
| 1643 | } |
| 1644 | |
| 1645 | int |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 1646 | sys_pipe(struct tcb *tcp) |
| 1647 | { |
| 1648 | return do_pipe(tcp, -1); |
| 1649 | } |
| 1650 | |
| 1651 | #ifdef LINUX |
| 1652 | int |
| 1653 | sys_pipe2(struct tcb *tcp) |
| 1654 | { |
| 1655 | return do_pipe(tcp, 1); |
| 1656 | } |
| 1657 | #endif |
| 1658 | |
| 1659 | int |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 1660 | sys_socketpair(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1661 | { |
| 1662 | #ifdef LINUX |
| 1663 | int fds[2]; |
| 1664 | #endif |
| 1665 | |
| 1666 | if (entering(tcp)) { |
| 1667 | printxval(domains, tcp->u_arg[0], "PF_???"); |
| 1668 | tprintf(", "); |
Dmitry V. Levin | 8a550d7 | 2008-11-10 17:21:23 +0000 | [diff] [blame] | 1669 | tprint_sock_type(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1670 | tprintf(", "); |
| 1671 | switch (tcp->u_arg[0]) { |
| 1672 | case PF_INET: |
| 1673 | printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); |
| 1674 | break; |
| 1675 | #ifdef PF_IPX |
| 1676 | case PF_IPX: |
| 1677 | /* BTW: I don't believe this.. */ |
| 1678 | tprintf("["); |
| 1679 | printxval(domains, tcp->u_arg[2], "PF_???"); |
| 1680 | tprintf("]"); |
| 1681 | break; |
| 1682 | #endif /* PF_IPX */ |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1683 | default: |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1684 | tprintf("%lu", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1685 | break; |
| 1686 | } |
| 1687 | } else { |
| 1688 | if (syserror(tcp)) { |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1689 | tprintf(", %#lx", tcp->u_arg[3]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1690 | return 0; |
| 1691 | } |
| 1692 | #ifdef LINUX |
| 1693 | if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0) |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 1694 | tprintf(", [...]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1695 | else |
| 1696 | tprintf(", [%u, %u]", fds[0], fds[1]); |
| 1697 | #endif /* LINUX */ |
Wichert Akkerman | 2e4ffe5 | 2000-09-03 23:57:48 +0000 | [diff] [blame] | 1698 | #if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1699 | tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp)); |
Wichert Akkerman | 2e4ffe5 | 2000-09-03 23:57:48 +0000 | [diff] [blame] | 1700 | #endif /* SUNOS4 || SVR4 || FREEBSD */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1701 | } |
| 1702 | return 0; |
| 1703 | } |
| 1704 | |
| 1705 | int |
Dmitry V. Levin | 3128919 | 2009-11-06 18:05:40 +0000 | [diff] [blame] | 1706 | sys_getsockopt(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1707 | { |
| 1708 | if (entering(tcp)) { |
| 1709 | tprintf("%ld, ", tcp->u_arg[0]); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1710 | printxval(socketlayers, tcp->u_arg[1], "SOL_???"); |
| 1711 | tprintf (", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1712 | switch (tcp->u_arg[1]) { |
| 1713 | case SOL_SOCKET: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1714 | printxval(sockoptions, tcp->u_arg[2], "SO_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1715 | break; |
| 1716 | #ifdef SOL_IP |
| 1717 | case SOL_IP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1718 | printxval(sockipoptions, tcp->u_arg[2], "IP_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1719 | break; |
| 1720 | #endif |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 1721 | #ifdef SOL_IPV6 |
| 1722 | case SOL_IPV6: |
| 1723 | printxval(sockipv6options, tcp->u_arg[2], "IPV6_???"); |
| 1724 | break; |
| 1725 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1726 | #ifdef SOL_IPX |
| 1727 | case SOL_IPX: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1728 | printxval(sockipxoptions, tcp->u_arg[2], "IPX_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1729 | break; |
| 1730 | #endif |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1731 | #ifdef SOL_PACKET |
| 1732 | case SOL_PACKET: |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1733 | printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1734 | break; |
| 1735 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1736 | #ifdef SOL_TCP |
| 1737 | case SOL_TCP: |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1738 | printxval(socktcpoptions, tcp->u_arg[2], "TCP_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1739 | break; |
| 1740 | #endif |
| 1741 | |
| 1742 | /* SOL_AX25 SOL_ROSE SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 |
| 1743 | * etc. still need work */ |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1744 | default: |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1745 | tprintf("%lu", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1746 | break; |
| 1747 | } |
Dmitry V. Levin | 3128919 | 2009-11-06 18:05:40 +0000 | [diff] [blame] | 1748 | tprintf (", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1749 | } else { |
Roland McGrath | fc544db | 2005-02-02 02:48:57 +0000 | [diff] [blame] | 1750 | int len; |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1751 | if (syserror(tcp) || umove (tcp, tcp->u_arg[4], &len) < 0) { |
Dmitry V. Levin | 3128919 | 2009-11-06 18:05:40 +0000 | [diff] [blame] | 1752 | tprintf("%#lx, %#lx", |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1753 | tcp->u_arg[3], tcp->u_arg[4]); |
| 1754 | return 0; |
| 1755 | } |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1756 | |
| 1757 | switch (tcp->u_arg[1]) { |
| 1758 | case SOL_SOCKET: |
| 1759 | switch (tcp->u_arg[2]) { |
| 1760 | #ifdef SO_LINGER |
| 1761 | case SO_LINGER: |
Denys Vlasenko | 5ae2b7c | 2009-02-27 20:32:52 +0000 | [diff] [blame] | 1762 | if (len == sizeof (struct linger)) { |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1763 | struct linger linger; |
| 1764 | if (umove (tcp, |
| 1765 | tcp->u_arg[3], |
| 1766 | &linger) < 0) |
| 1767 | break; |
Dmitry V. Levin | 3128919 | 2009-11-06 18:05:40 +0000 | [diff] [blame] | 1768 | tprintf("{onoff=%d, linger=%d}, " |
Roland McGrath | 96ad7b8 | 2005-02-02 03:11:32 +0000 | [diff] [blame] | 1769 | "[%d]", |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1770 | linger.l_onoff, |
| 1771 | linger.l_linger, |
| 1772 | len); |
| 1773 | return 0; |
| 1774 | } |
| 1775 | break; |
| 1776 | #endif |
| 1777 | } |
| 1778 | break; |
Dmitry V. Levin | ca75bd6 | 2009-11-13 12:51:04 +0000 | [diff] [blame] | 1779 | case SOL_PACKET: |
| 1780 | switch (tcp->u_arg[2]) { |
| 1781 | #ifdef PACKET_STATISTICS |
| 1782 | case PACKET_STATISTICS: |
| 1783 | if (len == sizeof(struct tpacket_stats)) { |
| 1784 | struct tpacket_stats stats; |
| 1785 | if (umove (tcp, |
| 1786 | tcp->u_arg[3], |
| 1787 | &stats) < 0) |
| 1788 | break; |
| 1789 | tprintf("{packets=%u, drops=%u}, " |
| 1790 | "[%d]", |
| 1791 | stats.tp_packets, |
| 1792 | stats.tp_drops, |
| 1793 | len); |
| 1794 | return 0; |
| 1795 | } |
| 1796 | break; |
| 1797 | #endif |
| 1798 | } |
| 1799 | break; |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1800 | } |
| 1801 | |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1802 | if (len == sizeof (int)) { |
Dmitry V. Levin | 3128919 | 2009-11-06 18:05:40 +0000 | [diff] [blame] | 1803 | printnum_int(tcp, tcp->u_arg[3], "%d"); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1804 | } |
| 1805 | else { |
| 1806 | printstr (tcp, tcp->u_arg[3], len); |
| 1807 | } |
Roland McGrath | fc544db | 2005-02-02 02:48:57 +0000 | [diff] [blame] | 1808 | tprintf(", [%d]", len); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1809 | } |
| 1810 | return 0; |
| 1811 | } |
| 1812 | |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1813 | #if defined(ICMP_FILTER) |
| 1814 | static void printicmpfilter(tcp, addr) |
| 1815 | struct tcb *tcp; |
| 1816 | long addr; |
| 1817 | { |
| 1818 | struct icmp_filter filter; |
| 1819 | |
| 1820 | if (!addr) { |
| 1821 | tprintf("NULL"); |
| 1822 | return; |
| 1823 | } |
| 1824 | if (syserror(tcp) || !verbose(tcp)) { |
| 1825 | tprintf("%#lx", addr); |
| 1826 | return; |
| 1827 | } |
| 1828 | if (umove(tcp, addr, &filter) < 0) { |
| 1829 | tprintf("{...}"); |
| 1830 | return; |
| 1831 | } |
| 1832 | |
| 1833 | tprintf("~("); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1834 | printflags(icmpfilterflags, ~filter.data, "ICMP_???"); |
Wichert Akkerman | 7987cdf | 2000-07-05 16:05:39 +0000 | [diff] [blame] | 1835 | tprintf(")"); |
| 1836 | } |
| 1837 | #endif /* ICMP_FILTER */ |
| 1838 | |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1839 | static int |
| 1840 | printsockopt (tcp, level, name, addr, len) |
| 1841 | struct tcb *tcp; |
| 1842 | int level; |
| 1843 | int name; |
| 1844 | long addr; |
| 1845 | int len; |
| 1846 | { |
| 1847 | printxval(socketlayers, level, "SOL_??"); |
| 1848 | tprintf (", "); |
| 1849 | switch (level) { |
| 1850 | case SOL_SOCKET: |
| 1851 | printxval(sockoptions, name, "SO_???"); |
| 1852 | switch (name) { |
| 1853 | #if defined(SO_LINGER) |
| 1854 | case SO_LINGER: |
| 1855 | if (len == sizeof (struct linger)) { |
| 1856 | struct linger linger; |
| 1857 | if (umove (tcp, addr, &linger) < 0) |
| 1858 | break; |
| 1859 | tprintf(", {onoff=%d, linger=%d}", |
| 1860 | linger.l_onoff, |
| 1861 | linger.l_linger); |
| 1862 | return 0; |
| 1863 | } |
| 1864 | break; |
| 1865 | #endif |
| 1866 | } |
| 1867 | break; |
| 1868 | #ifdef SOL_IP |
| 1869 | case SOL_IP: |
| 1870 | printxval(sockipoptions, name, "IP_???"); |
| 1871 | break; |
| 1872 | #endif |
Roland McGrath | 4f6ba69 | 2004-08-31 07:01:26 +0000 | [diff] [blame] | 1873 | #ifdef SOL_IPV6 |
| 1874 | case SOL_IPV6: |
| 1875 | printxval(sockipv6options, name, "IPV6_???"); |
| 1876 | break; |
| 1877 | #endif |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1878 | #ifdef SOL_IPX |
| 1879 | case SOL_IPX: |
| 1880 | printxval(sockipxoptions, name, "IPX_???"); |
| 1881 | break; |
| 1882 | #endif |
| 1883 | #ifdef SOL_PACKET |
| 1884 | case SOL_PACKET: |
| 1885 | printxval(sockpacketoptions, name, "PACKET_???"); |
| 1886 | /* TODO: decode packate_mreq for PACKET_*_MEMBERSHIP */ |
Dmitry V. Levin | ca75bd6 | 2009-11-13 12:51:04 +0000 | [diff] [blame] | 1887 | switch (name) { |
| 1888 | #ifdef PACKET_RX_RING |
| 1889 | case PACKET_RX_RING: |
| 1890 | #endif |
| 1891 | #ifdef PACKET_TX_RING |
| 1892 | case PACKET_TX_RING: |
| 1893 | #endif |
| 1894 | #if defined(PACKET_RX_RING) || defined(PACKET_TX_RING) |
| 1895 | if (len == sizeof(struct tpacket_req)) { |
| 1896 | struct tpacket_req req; |
| 1897 | if (umove(tcp, addr, &req) < 0) |
| 1898 | break; |
| 1899 | tprintf(", {block_size=%u, block_nr=%u, frame_size=%u, frame_nr=%u}", |
| 1900 | req.tp_block_size, |
| 1901 | req.tp_block_nr, |
| 1902 | req.tp_frame_size, |
| 1903 | req.tp_frame_nr); |
| 1904 | return 0; |
| 1905 | } |
| 1906 | break; |
| 1907 | #endif /* PACKET_RX_RING || PACKET_TX_RING */ |
| 1908 | } |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1909 | break; |
| 1910 | #endif |
| 1911 | #ifdef SOL_TCP |
| 1912 | case SOL_TCP: |
| 1913 | printxval(socktcpoptions, name, "TCP_???"); |
| 1914 | break; |
| 1915 | #endif |
| 1916 | #ifdef SOL_RAW |
| 1917 | case SOL_RAW: |
| 1918 | printxval(sockrawoptions, name, "RAW_???"); |
| 1919 | switch (name) { |
| 1920 | #if defined(ICMP_FILTER) |
| 1921 | case ICMP_FILTER: |
| 1922 | tprintf(", "); |
| 1923 | printicmpfilter(tcp, addr); |
| 1924 | return 0; |
| 1925 | #endif |
| 1926 | } |
| 1927 | break; |
| 1928 | #endif |
| 1929 | |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1930 | /* SOL_AX25 SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1931 | * etc. still need work */ |
| 1932 | |
| 1933 | default: |
| 1934 | tprintf("%u", name); |
| 1935 | } |
| 1936 | |
| 1937 | /* default arg printing */ |
| 1938 | |
| 1939 | tprintf (", "); |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 1940 | |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1941 | if (len == sizeof (int)) { |
Roland McGrath | 9814a94 | 2005-07-04 23:28:10 +0000 | [diff] [blame] | 1942 | printnum_int (tcp, addr, "%d"); |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1943 | } |
| 1944 | else { |
| 1945 | printstr (tcp, addr, len); |
| 1946 | } |
| 1947 | return 0; |
| 1948 | } |
| 1949 | |
| 1950 | |
Roland McGrath | c3ca0d8 | 2003-01-14 07:53:38 +0000 | [diff] [blame] | 1951 | #ifdef HAVE_STRUCT_OPTHDR |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1952 | |
| 1953 | void |
| 1954 | print_sock_optmgmt (tcp, addr, len) |
| 1955 | struct tcb *tcp; |
| 1956 | long addr; |
| 1957 | int len; |
| 1958 | { |
| 1959 | int c = 0; |
| 1960 | struct opthdr hdr; |
| 1961 | |
John Hughes | 2c4e3a8 | 2002-05-24 10:19:44 +0000 | [diff] [blame] | 1962 | while (len >= (int) sizeof hdr) { |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1963 | if (umove(tcp, addr, &hdr) < 0) break; |
| 1964 | if (c++) { |
| 1965 | tprintf (", "); |
| 1966 | } |
| 1967 | else if (len > hdr.len + sizeof hdr) { |
| 1968 | tprintf ("["); |
| 1969 | } |
| 1970 | tprintf ("{"); |
| 1971 | addr += sizeof hdr; |
| 1972 | len -= sizeof hdr; |
| 1973 | printsockopt (tcp, hdr.level, hdr.name, addr, hdr.len); |
John Hughes | 2c4e3a8 | 2002-05-24 10:19:44 +0000 | [diff] [blame] | 1974 | if (hdr.len > 0) { |
| 1975 | addr += hdr.len; |
| 1976 | len -= hdr.len; |
| 1977 | } |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1978 | tprintf ("}"); |
| 1979 | } |
| 1980 | if (len > 0) { |
| 1981 | if (c++) tprintf (", "); |
| 1982 | printstr (tcp, addr, len); |
| 1983 | } |
| 1984 | if (c > 1) tprintf ("]"); |
| 1985 | } |
| 1986 | |
| 1987 | #endif |
| 1988 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1989 | int |
| 1990 | sys_setsockopt(tcp) |
| 1991 | struct tcb *tcp; |
| 1992 | { |
| 1993 | if (entering(tcp)) { |
| 1994 | tprintf("%ld, ", tcp->u_arg[0]); |
John Hughes | 38ae88d | 2002-05-23 11:48:58 +0000 | [diff] [blame] | 1995 | printsockopt (tcp, tcp->u_arg[1], tcp->u_arg[2], |
| 1996 | tcp->u_arg[3], tcp->u_arg[4]); |
John Hughes | 93f7fcc | 2002-05-22 15:46:49 +0000 | [diff] [blame] | 1997 | tprintf(", %lu", tcp->u_arg[4]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1998 | } |
| 1999 | return 0; |
| 2000 | } |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 2001 | |
| 2002 | #if UNIXWARE >= 7 |
| 2003 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 2004 | static const struct xlat sock_version[] = { |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 2005 | { __NETLIB_UW211_SVR4, "UW211_SVR4" }, |
| 2006 | { __NETLIB_UW211_XPG4, "UW211_XPG4" }, |
| 2007 | { __NETLIB_GEMINI_SVR4, "GEMINI_SVR4" }, |
| 2008 | { __NETLIB_GEMINI_XPG4, "GEMINI_XPG4" }, |
| 2009 | { __NETLIB_FP1_SVR4, "FP1_SVR4" }, |
| 2010 | { __NETLIB_FP1_XPG4, "FP1_XPG4" }, |
| 2011 | { 0, NULL }, |
| 2012 | }; |
| 2013 | |
| 2014 | |
| 2015 | int |
| 2016 | netlib_call(tcp, func) |
| 2017 | struct tcb *tcp; |
| 2018 | int (*func) (); |
| 2019 | { |
| 2020 | if (entering(tcp)) { |
| 2021 | int i; |
| 2022 | printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); |
| 2023 | tprintf(", "); |
| 2024 | --tcp->u_nargs; |
| 2025 | for (i = 0; i < tcp->u_nargs; i++) |
| 2026 | tcp->u_arg[i] = tcp->u_arg[i + 1]; |
| 2027 | return func (tcp); |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 2028 | |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 2029 | } |
| 2030 | |
| 2031 | return func (tcp); |
| 2032 | } |
| 2033 | |
| 2034 | int |
| 2035 | sys_xsocket(tcp) |
| 2036 | struct tcb *tcp; |
| 2037 | { |
| 2038 | return netlib_call (tcp, sys_socket); |
| 2039 | } |
| 2040 | |
| 2041 | int |
| 2042 | sys_xsocketpair(tcp) |
| 2043 | struct tcb *tcp; |
| 2044 | { |
| 2045 | return netlib_call (tcp, sys_socketpair); |
| 2046 | } |
| 2047 | |
| 2048 | int |
| 2049 | sys_xbind(tcp) |
| 2050 | struct tcb *tcp; |
| 2051 | { |
| 2052 | return netlib_call (tcp, sys_bind); |
| 2053 | } |
| 2054 | |
| 2055 | int |
| 2056 | sys_xconnect(tcp) |
| 2057 | struct tcb *tcp; |
| 2058 | { |
| 2059 | return netlib_call (tcp, sys_connect); |
| 2060 | } |
| 2061 | |
| 2062 | int |
| 2063 | sys_xlisten(tcp) |
| 2064 | struct tcb *tcp; |
| 2065 | { |
| 2066 | return netlib_call (tcp, sys_listen); |
| 2067 | } |
| 2068 | |
| 2069 | int |
| 2070 | sys_xaccept(tcp) |
| 2071 | struct tcb *tcp; |
| 2072 | { |
| 2073 | return netlib_call (tcp, sys_accept); |
| 2074 | } |
| 2075 | |
| 2076 | int |
| 2077 | sys_xsendmsg(tcp) |
| 2078 | struct tcb *tcp; |
| 2079 | { |
| 2080 | return netlib_call (tcp, sys_sendmsg); |
| 2081 | } |
| 2082 | |
| 2083 | int |
| 2084 | sys_xrecvmsg(tcp) |
| 2085 | struct tcb *tcp; |
| 2086 | { |
| 2087 | return netlib_call (tcp, sys_recvmsg); |
| 2088 | } |
| 2089 | |
| 2090 | int |
| 2091 | sys_xgetsockaddr(tcp) |
| 2092 | struct tcb *tcp; |
| 2093 | { |
| 2094 | if (entering(tcp)) { |
| 2095 | printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); |
| 2096 | tprintf(", "); |
| 2097 | if (tcp->u_arg[1] == 0) { |
| 2098 | tprintf ("LOCALNAME, "); |
| 2099 | } |
| 2100 | else if (tcp->u_arg[1] == 1) { |
| 2101 | tprintf ("REMOTENAME, "); |
| 2102 | } |
| 2103 | else { |
| 2104 | tprintf ("%ld, ", tcp->u_arg [1]); |
| 2105 | } |
| 2106 | tprintf ("%ld, ", tcp->u_arg [2]); |
Roland McGrath | 6d2b349 | 2002-12-30 00:51:30 +0000 | [diff] [blame] | 2107 | } |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 2108 | else { |
| 2109 | if (tcp->u_arg[3] == 0 || syserror(tcp)) { |
| 2110 | tprintf("%#lx", tcp->u_arg[3]); |
| 2111 | } else { |
| 2112 | printsock(tcp, tcp->u_arg[3], tcp->u_arg[4]); |
| 2113 | } |
| 2114 | tprintf(", "); |
| 2115 | printnum(tcp, tcp->u_arg[4], "%lu"); |
| 2116 | } |
| 2117 | |
| 2118 | return 0; |
| 2119 | |
| 2120 | } |
| 2121 | |
Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 2122 | int |
| 2123 | sys_xgetsockopt(tcp) |
| 2124 | struct tcb *tcp; |
| 2125 | { |
| 2126 | return netlib_call (tcp, sys_getsockopt); |
| 2127 | } |
| 2128 | |
| 2129 | int |
| 2130 | sys_xsetsockopt(tcp) |
| 2131 | struct tcb *tcp; |
| 2132 | { |
| 2133 | return netlib_call (tcp, sys_setsockopt); |
| 2134 | } |
| 2135 | |
| 2136 | int |
| 2137 | sys_xshutdown(tcp) |
| 2138 | struct tcb *tcp; |
| 2139 | { |
| 2140 | return netlib_call (tcp, sys_shutdown); |
| 2141 | } |
| 2142 | |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 2143 | #endif /* UNIXWARE */ |