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