net.c revision 38ae88d332acd9f86a30d58158e306d795d98977
176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/* 276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl> 376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> 476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> 57987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman * Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl> 676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * All rights reserved. 776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Redistribution and use in source and binary forms, with or without 976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * modification, are permitted provided that the following conditions 1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * are met: 1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1. Redistributions of source code must retain the above copyright 1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * notice, this list of conditions and the following disclaimer. 1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 2. Redistributions in binary form must reproduce the above copyright 1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * notice, this list of conditions and the following disclaimer in the 1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * documentation and/or other materials provided with the distribution. 1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3. The name of the author may not be used to endorse or promote products 1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * derived from this software without specific prior written permission. 1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * $Id$ 3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */ 3276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h" 3476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/stat.h> 3676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/socket.h> 3776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/un.h> 38f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman 39f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#if defined(HAVE_SIN6_SCOPE_ID_LINUX) 40f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define in6_addr in6_addr_libc 41f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define ipv6_mreq ipv6_mreq_libc 42f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define sockaddr_in6 sockaddr_in6_libc 43f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#endif 44f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman 4576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <netinet/in.h> 468c7122c9519dfd46ea7c8c026eab6f7aed74cf21Wichert Akkerman#ifdef HAVE_NETINET_TCP_H 47bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#include <netinet/tcp.h> 48bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif 498c7122c9519dfd46ea7c8c026eab6f7aed74cf21Wichert Akkerman#ifdef HAVE_NETINET_UDP_H 508c7122c9519dfd46ea7c8c026eab6f7aed74cf21Wichert Akkerman#include <netinet/udp.h> 518c7122c9519dfd46ea7c8c026eab6f7aed74cf21Wichert Akkerman#endif 5276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <arpa/inet.h> 53f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#include <net/if.h> 5476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if defined(LINUX) 5576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <asm/types.h> 5676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC__ + __GLIBC_MINOR__ >= 3) 5776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman# include <netipx/ipx.h> 5876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#else 5976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman# include <linux/ipx.h> 6076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 6176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */ 6276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 63f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#if defined (__GLIBC__) && (((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)) || defined(HAVE_SIN6_SCOPE_ID_LINUX)) 64f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#if defined(HAVE_LINUX_IN6_H) 65f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#if defined(HAVE_SIN6_SCOPE_ID_LINUX) 66f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef in6_addr 67f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef ipv6_mreq 68f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef sockaddr_in6 69f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define in6_addr in6_addr_kernel 70f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define ipv6_mreq ipv6_mreq_kernel 71f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define sockaddr_in6 sockaddr_in6_kernel 72f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#endif 73505e176ded6376a1283093b334c2c6deb47916e7Wichert Akkerman#include <linux/in6.h> 74f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#if defined(HAVE_SIN6_SCOPE_ID_LINUX) 75f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef in6_addr 76f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef ipv6_mreq 77f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#undef sockaddr_in6 78f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define in6_addr in6_addr_libc 79f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define ipv6_mreq ipv6_mreq_libc 80f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#define sockaddr_in6 sockaddr_in6_kernel 81f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#endif 82505e176ded6376a1283093b334c2c6deb47916e7Wichert Akkerman#endif 832f473da12babff710bbe37c7f95be01fd00118f9Wichert Akkerman#endif 84505e176ded6376a1283093b334c2c6deb47916e7Wichert Akkerman 85f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#if defined(HAVE_SYS_UIO_H) 86f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#include <sys/uio.h> 87f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 88f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 89f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#if defined(HAVE_LINUX_NETLINK_H) 90f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#include <linux/netlink.h> 91f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 92f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 93f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#if defined(HAVE_LINUX_IF_PACKET_H) 94f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#include <linux/if_packet.h> 95f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 96f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 977987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(HAVE_LINUX_ICMP_H) 987987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#include <linux/icmp.h> 997987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 1007987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 10176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef PF_UNSPEC 10276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define PF_UNSPEC AF_UNSPEC 10376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 10476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 10516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#if UNIXWARE >= 7 10616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#define HAVE_SENDMSG 1 /* HACK - *FIXME* */ 10716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#endif 10816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 10976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX 11076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/* Under Linux these are enums so we can't test for them with ifdef. */ 11176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_EGP IPPROTO_EGP 11276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_PUP IPPROTO_PUP 11376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_IDP IPPROTO_IDP 11476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_IGMP IPPROTO_IGMP 11576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_RAW IPPROTO_RAW 11676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define IPPROTO_MAX IPPROTO_MAX 11776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 11876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 11976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat domains[] = { 12076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_UNSPEC, "PF_UNSPEC" }, 12176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_UNIX, "PF_UNIX" }, 12276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_INET, "PF_INET" }, 123f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_NETLINK 124f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { PF_NETLINK, "PF_NETLINK" }, 125f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 126f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_PACKET 127f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { PF_PACKET, "PF_PACKET" }, 128f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 129f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_INET6 130f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { PF_INET6, "PF_INET6" }, 131f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 132f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_ATMSVC 133f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { PF_ATMSVC, "PF_INET6" }, 134f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 135f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_INET6 136f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { PF_INET6, "PF_INET6" }, 137f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 13876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_LOCAL 13976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_LOCAL, "PS_LOCAL" }, 14076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 14176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_ISO 14276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_ISO, "PF_ISO" }, 14376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 14476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_AX25 14576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_AX25, "PF_AX25" }, 14676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 14776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_IPX 14876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_IPX, "PF_IPX" }, 14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_APPLETALK 15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_APPLETALK, "PF_APPLETALK" }, 15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_NETROM 15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_NETROM, "PF_NETROM" }, 15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_BRIDGE 15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_BRIDGE, "PF_BRIDGE" }, 15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_AAL5 16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_AAL5, "PF_AAL5" }, 16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_X25 16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_X25, "PF_X25" }, 16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_ROSE 16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_ROSE, "PF_ROSE" }, 16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_DECNET 16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_DECNET, "PF_DECNET" }, 17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 17176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_NETBEUI 17276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_NETBEUI, "PF_NETBEUI" }, 17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 17476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_IMPLINK 17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { PF_IMPLINK, "PF_IMPLINK" }, 17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 17776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 17876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 179f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstatic struct xlat addrfams[] = { 180f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_UNSPEC, "AF_UNSPEC" }, 181f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_UNIX, "AF_UNIX" }, 182f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_INET, "AF_INET" }, 183e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#ifdef AF_INET6 184f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_INET6, "AF_INET6" }, 185e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#endif 186f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_DECnet, "AF_DECnet" }, 187f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef PF_ATMSVC 188f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_ATMSVC, "AF_ATMSVC" }, 189f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 190e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#ifdef AF_PACKET 191f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_PACKET, "AF_PACKET" }, 192e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#endif 193e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#ifdef AF_NETLINK 194f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_NETLINK, "AF_NETLINK" }, 195e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#endif 196e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#ifdef AF_ISO 197f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_ISO, "AF_ISO" }, 198f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 199e4aafd4c4d5ecd3317419d1681ef5804dbf1333eWichert Akkerman#ifdef AF_IMPLINK 200f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { AF_IMPLINK, "AF_IMPLINK" }, 201f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 202f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { 0, NULL }, 203f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}; 20476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat socktypes[] = { 20576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_STREAM, "SOCK_STREAM" }, 20676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_DGRAM, "SOCK_DGRAM" }, 20776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOCK_RAW 20876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_RAW, "SOCK_RAW" }, 20976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOCK_SEQPACKET 21176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_SEQPACKET,"SOCK_SEQPACKET"}, 21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOCK_RDM 21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_RDM, "SOCK_RDM" }, 21576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOCK_PACKET 21776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SOCK_PACKET, "SOCK_PACKET" }, 21876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 221efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkermanstatic struct xlat socketlayers[] = { 2221e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#if defined(SOL_IP) 223efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_IP, "SOL_IP" }, 2241e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#endif 225efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_ICMP) 226efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_ICMP, "SOL_ICMP" }, 227efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 2281e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#if defined(SOL_TCP) 229efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_TCP, "SOL_TCP" }, 2301e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#endif 2311e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#if defined(SOL_UDP) 232efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_UDP, "SOL_UDP" }, 2331e4cb3466230aa8b4f2e8e8936b240c7b98db486John Hughes#endif 234efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_IPV6) 235efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_IPV6, "SOL_IPV6" }, 236efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 237efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_ICMPV6) 238efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_ICMPV6, "SOL_ICMPV6" }, 239efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 240efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_RAW) 241efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_RAW, "SOL_RAW" }, 242efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 243efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_IPX) 244efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_IPX, "SOL_IPX" }, 245efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 246efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_IPX) 247efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_IPX, "SOL_IPX" }, 248efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 249efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_AX25) 250efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_AX25, "SOL_AX25" }, 251efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 252efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_ATALK) 253efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_ATALK, "SOL_ATALK" }, 254efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 255efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_NETROM) 256efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_NETROM, "SOL_NETROM" }, 257efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 258efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_ROSE) 259efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_ROSE, "SOL_ROSE" }, 260efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 261efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_DECNET) 262efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_DECNET, "SOL_DECNET" }, 263efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 264efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_X25) 265efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_X25, "SOL_X25" }, 266efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 267efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_PACKET) 268efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_PACKET, "SOL_PACKET" }, 269efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 270efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_ATM) 271efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_ATM, "SOL_ATM" }, 272efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 273efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_AAL) 274efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_AAL, "SOL_AAL" }, 275efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 276efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#if defined(SOL_IRDA) 277efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman { SOL_IRDA, "SOL_IRDA" }, 278efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman#endif 2796156357814ce751cb0e82a88a4824c931b2e3d62John Hughes { SOL_SOCKET, "SOL_SOCKET" }, /* Never used! */ 280efdecacc5d7f91c17adb7cdb1dd7306ea6d22c9fWichert Akkerman}; 28193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes/*** WARNING: DANGER WILL ROBINSON: NOTE "socketlayers" array above 28293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes falls into "protocols" array below!!!! This is intended!!! ***/ 28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat protocols[] = { 28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_IP, "IPPROTO_IP" }, 28576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_ICMP, "IPPROTO_ICMP" }, 28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_TCP, "IPPROTO_TCP" }, 28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_UDP, "IPPROTO_UDP" }, 28876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_GGP 28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_GGP, "IPPROTO_GGP" }, 29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 29176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_EGP 29276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_EGP, "IPPROTO_EGP" }, 29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_PUP 29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_PUP, "IPPROTO_PUP" }, 29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 29776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_IDP 29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_IDP, "IPPROTO_IDP" }, 29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 30076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_IPV6 30176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_IPV6, "IPPROTO_IPV6" }, 30276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 30376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_ICMPV6 30476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_ICMPV6,"IPPROTO_ICMPV6"}, 30576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 30676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_IGMP 30776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_IGMP, "IPPROTO_IGMP" }, 30876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 30976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_HELLO 31076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_HELLO,"IPPROTO_HELLO" }, 31176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 31276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_ND 31376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_ND, "IPPROTO_ND" }, 31476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 31576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_RAW 31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_RAW, "IPPROTO_RAW" }, 31776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 31876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_MAX 31976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_MAX, "IPPROTO_MAX" }, 32076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 32176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef IPPROTO_IPIP 32276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPPROTO_IPIP, "IPPROTO_IPIP" }, 32376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 32476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 32576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 32676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat msg_flags[] = { 32776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_OOB, "MSG_OOB" }, 32876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_DONTROUTE 32976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_DONTROUTE,"MSG_DONTROUTE" }, 33076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 33176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_PEEK 33276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_PEEK, "MSG_PEEK" }, 33376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_CTRUNC 33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_CTRUNC, "MSG_CTRUNC" }, 33676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 33776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_PROXY 33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_PROXY, "MSG_PROXY" }, 33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_EOR 34176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_EOR, "MSG_EOR" }, 34276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef MSG_WAITALL 34476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { MSG_WAITALL, "MSG_WAITALL" }, 34576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 346f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_TRUNC 347f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_TRUNC, "MSG_TRUNC" }, 348f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 349f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_CTRUNC 350f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_CTRUNC, "MSG_CTRUNC" }, 351f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 352f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_ERRQUEUE 353f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_ERRQUEUE, "MSG_ERRQUEUE" }, 354f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 355f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_DONTWAIT 356f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_DONTWAIT, "MSG_DONTWAIT" }, 357f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 358f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_CONFIRM 359f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_CONFIRM, "MSG_CONFIRM" }, 360f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 361f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef MSG_PROBE 362f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { MSG_PROBE, "MSG_PROBE" }, 363f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 36476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 36576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 36676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 36776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat sockoptions[] = { 368f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef SO_PEERCRED 369f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { SO_PEERCRED, "SO_PEERCRED" }, 370f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 371f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef SO_PASSCRED 372f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { SO_PASSCRED, "SO_PASSCRED" }, 373f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 37476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_DEBUG 37576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_DEBUG, "SO_DEBUG" }, 37676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 37776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_REUSEADDR 37876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_REUSEADDR, "SO_REUSEADDR" }, 37976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 38076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_KEEPALIVE 38176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_KEEPALIVE, "SO_KEEPALIVE" }, 38276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 38376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_DONTROUTE 38476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_DONTROUTE, "SO_DONTROUTE" }, 38576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 38676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_BROADCAST 38776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_BROADCAST, "SO_BROADCAST" }, 38876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 38976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_LINGER 39076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_LINGER, "SO_LINGER" }, 39176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 39276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_OOBINLINE 39376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_OOBINLINE, "SO_OOBINLINE" }, 39476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 39576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_TYPE 39676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_TYPE, "SO_TYPE" }, 39776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 39876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_ERROR 39976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_ERROR, "SO_ERROR" }, 40076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 40176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_SNDBUF 40276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_SNDBUF, "SO_SNDBUF" }, 40376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 40476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_RCVBUF 40576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_RCVBUF, "SO_RCVBUF" }, 40676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 40776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_NO_CHECK 40876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_NO_CHECK, "SO_NO_CHECK" }, 40976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 41076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_PRIORITY 41176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_PRIORITY, "SO_PRIORITY" }, 41276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 41376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_ACCEPTCONN 41476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_ACCEPTCONN,"SO_ACCEPTCONN" }, 41576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 41676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_USELOOPBACK 41776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_USELOOPBACK,"SO_USELOOPBACK"}, 41876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 41976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_SNDLOWAT 42076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_SNDLOWAT, "SO_SNDLOWAT" }, 42176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 42276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_RCVLOWAT 42376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_RCVLOWAT, "SO_RCVLOWAT" }, 42476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 42576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_SNDTIMEO 42676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_SNDTIMEO, "SO_SNDTIMEO" }, 42776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 42876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_RCVTIMEO 42976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_RCVTIMEO, "SO_RCVTIMEO" }, 43076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 43176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_BSDCOMPAT 43276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_BSDCOMPAT, "SO_BSDCOMPAT" }, 43376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 43476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SO_REUSEPORT 43576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { SO_REUSEPORT, "SO_REUSEPORT" }, 43676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 43738ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_ORDREL 43838ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_ORDREL, "SO_ORDREL" }, 43976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 44038ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_IMASOCKET 44138ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_IMASOCKET, "SO_IMASOCKET" }, 44276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 44338ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_MGMT 44438ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_MGMT, "SO_MGMT" }, 44576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 44638ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_LISTENING 44738ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_LISTENING, "SO_LISTENING" }, 44838ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 44938ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_RDWR 45038ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_RDWR, "SO_RDWR" }, 45138ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 45238ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_SEMA 45338ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_SEMA, "SO_SEMA" }, 45438ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 45538ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_PARALLELSVR 45638ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_PARALLELSVR,"SO_PARALLELSVR"}, 45738ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 45838ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_PROTOTYPE 45938ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_PROTOTYPE, "SO_PROTOTYPE" }, 46038ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 46138ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_ALLRAW 46238ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_ALLRAW, "SO_ALLRAW" }, 46338ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 46438ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef SO_ICS 46538ae88d332acd9f86a30d58158e306d795d98977John Hughes { SO_ICS, "SO_ICS" }, 46676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 46776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 46876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 46976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 47093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#if !defined (SOL_IP) && defined (IPPROTO_IP) 47193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#define SOL_IP IPPROTO_IP 47293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 47393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 47476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IP 47576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat sockipoptions[] = { 47693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_TOS 4777987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_TOS, "IP_TOS" }, 47893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 47993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_TTL 4807987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_TTL, "IP_TTL" }, 48193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 48293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_HDRINCL 4837987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_HDRINCL, "IP_HDRINCL" }, 48476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 48593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_OPTIONS 4867987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_OPTIONS, "IP_OPTIONS" }, 4877987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 48893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_ROUTER_ALERT 4897987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_ROUTER_ALERT, "IP_ROUTER_ALERT" }, 49093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 49193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVOPTIONS 4927987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_RECVOPTIONS, "IP_RECVOPTIONS" }, 4937987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 49493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVOPTS 49593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_RECVOPTS, "IP_RECVOPTS" }, 49693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 49793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVRETOPTS 49893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_RECVRETOPTS, "IP_RECVRETOPTS" }, 49993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 50093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVDSTADDR 50193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_RECVDSTADDR, "IP_RECVDSTADDR" }, 50293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 50393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RETOPTS 5047987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_RETOPTS, "IP_RETOPTS" }, 50593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 50693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_PKTINFO 5077987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_PKTINFO, "IP_PKTINFO" }, 50893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 50993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_PKTOPTIONS 51093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_PKTOPTIONS, "IP_PKTOPTIONS" }, 51193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 51293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_MTU_DISCOVER 5137987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_MTU_DISCOVER, "IP_MTU_DISCOVER" }, 51493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 51593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVERR 5167987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_RECVERR, "IP_RECVERR" }, 51793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 51893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVTTL 5197987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_RECVTTL, "IP_RECRECVTTL" }, 52093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 52193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVTOS 5227987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_RECVTOS, "IP_RECRECVTOS" }, 52393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 52493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_MTU 5257987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_MTU, "IP_MTU" }, 5267987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 52793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_MULTICAST_IF 5287987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_MULTICAST_IF, "IP_MULTICAST_IF" }, 52993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 53093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_MULTICAST_TTL 5317987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_MULTICAST_TTL, "IP_MULTICAST_TTL" }, 53293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 53393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_MULTICAST_LOOP 5347987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_MULTICAST_LOOP, "IP_MULTICAST_LOOP" }, 53593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 53693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_ADD_MEMBERSHIP 5377987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_ADD_MEMBERSHIP, "IP_ADD_MEMBERSHIP" }, 53893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 53993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_DROP_MEMBERSHIP 5407987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { IP_DROP_MEMBERSHIP, "IP_DROP_MEMBERSHIP" }, 54193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 54293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_BROADCAST_IF 54393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_BROADCAST_IF, "IP_BROADCAST_IF" }, 54493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 54593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef IP_RECVIFINDEX 54693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes { IP_RECVIFINDEX, "IP_RECVIFINDEX" }, 54793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 5487987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { 0, NULL }, 54976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 55076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SOL_IP */ 55176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 55276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IPX 55376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat sockipxoptions[] = { 55476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { IPX_TYPE, "IPX_TYPE" }, 55576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 55676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 55776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SOL_IPX */ 55876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 5597987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_RAW 5607987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanstatic struct xlat sockrawoptions[] = { 5617987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_FILTER) 5627987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { ICMP_FILTER, "ICMP_FILTER" }, 5637987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 5647987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { 0, NULL }, 5657987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman}; 5667987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif /* SOL_RAW */ 5677987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 5687987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_PACKET 5697987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanstatic struct xlat sockpacketoptions[] = { 5707987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, 5717987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, 5727987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(PACKET_RECV_OUTPUT) 5737987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, 5747987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 5757987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(PACKET_RX_RING) 5767987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { PACKET_RX_RING, "PACKET_RX_RING" }, 5777987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 5787987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(PACKET_STATISTICS) 5797987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { PACKET_STATISTICS, "PACKET_STATISTICS" }, 5807987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 5817987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { 0, NULL }, 5827987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman}; 5837987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif /* SOL_PACKET */ 5847987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 58593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#if !defined (SOL_TCP) && defined (IPPROTO_TCP) 58693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#define SOL_TCP IPPROTO_TCP 58793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 58893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 58976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_TCP 59076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic struct xlat socktcpoptions[] = { 5918b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_NODELAY, "TCP_NODELAY" }, 5928b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_MAXSEG, "TCP_MAXSEG" }, 5937987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(TCP_CORK) 5948b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_CORK, "TCP_CORK" }, 5957987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 5968b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_KEEPIDLE) 5978b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_KEEPIDLE, "TCP_KEEPIDLE" }, 5988b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 5998b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_KEEPINTVL) 6008b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_KEEPINTVL, "TCP_KEEPINTVL" }, 6018b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6028b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_KEEPCNT) 6038b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_KEEPCNT, "TCP_KEEPCNT" }, 6048b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 60538ae88d332acd9f86a30d58158e306d795d98977John Hughes#if defined(TCP_NKEEP) 60638ae88d332acd9f86a30d58158e306d795d98977John Hughes { TCP_NKEEP, "TCP_NKEEP" }, 60738ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 6088b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_SYNCNT) 6098b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_SYNCNT, "TCP_SYNCNT" }, 6108b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6118b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_LINGER2) 6128b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_LINGER2, "TCP_LINGER2" }, 6138b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6148b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_DEFER_ACCEPT) 6158b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_DEFER_ACCEPT, "TCP_DEFER_ACCEPT" }, 6168b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6178b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_WINDOW_CLAMP) 6188b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_WINDOW_CLAMP, "TCP_WINDOW_CLAMP" }, 6198b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6208b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_INFO) 6218b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_INFO, "TCP_INFO" }, 6228b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6238b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#if defined(TCP_QUICKACK) 6248b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { TCP_QUICKACK, "TCP_QUICKACK" }, 6258b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman#endif 6268b8ff7c7800c70393c03b1a806be6daec6a0e068Wichert Akkerman { 0, NULL }, 62776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 62876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SOL_TCP */ 62976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 6307987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_RAW 6317987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanstatic struct xlat icmpfilterflags[] = { 6327987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_ECHOREPLY) 6337987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_ECHOREPLY), "ICMP_ECHOREPLY" }, 6347987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6357987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_DEST_UNREACH) 6367987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_DEST_UNREACH), "ICMP_DEST_UNREACH" }, 6377987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6387987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_SOURCE_QUENCH) 6397987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_SOURCE_QUENCH), "ICMP_SOURCE_QUENCH" }, 6407987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6417987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_REDIRECT) 6427987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_REDIRECT), "ICMP_REDIRECT" }, 6437987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6447987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_ECHO) 6457987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_ECHO), "ICMP_ECHO" }, 6467987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6477987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_TIME_EXCEEDED) 6487987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_TIME_EXCEEDED), "ICMP_TIME_EXCEEDED" }, 6497987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6507987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_PARAMETERPROB) 6517987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_PARAMETERPROB), "ICMP_PARAMETERPROB" }, 6527987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6537987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_TIMESTAMP) 6547987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_TIMESTAMP), "ICMP_TIMESTAMP" }, 6557987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6567987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_TIMESTAMPREPLY) 6577987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_TIMESTAMPREPLY), "ICMP_TIMESTAMPREPLY" }, 6587987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6597987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_INFO_REQUEST) 6607987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_INFO_REQUEST), "ICMP_INFO_REQUEST" }, 6617987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6627987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_INFO_REPLY) 6637987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_INFO_REPLY), "ICMP_INFO_REPLY" }, 6647987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6657987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_ADDRESS) 6667987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_ADDRESS), "ICMP_ADDRESS" }, 6677987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6687987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_ADDRESSREPLY) 6697987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { (1<<ICMP_ADDRESSREPLY), "ICMP_ADDRESSREPLY" }, 6707987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 6717987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman { 0, NULL }, 6727987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman}; 6737987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif /* SOL_RAW */ 6747987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 675b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(AF_PACKET) /* from e.g. linux/if_packet.h */ 676b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkermanstatic struct xlat af_packet_types[] = { 677b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_HOST) 678b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_HOST, "PACKET_HOST" }, 679b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 680b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_BROADCAST) 681b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_BROADCAST, "PACKET_BROADCAST" }, 682b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 683b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_MULTICAST) 684b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_MULTICAST, "PACKET_MULTICAST" }, 685b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 686b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_OTHERHOST) 687b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_OTHERHOST, "PACKET_OTHERHOST" }, 688b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 689b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_OUTGOING) 690b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_OUTGOING, "PACKET_OUTGOING" }, 691b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 692b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_LOOPBACK) 693b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_LOOPBACK, "PACKET_LOOPBACK" }, 694b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 695b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#if defined(PACKET_FASTROUTE) 696b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { PACKET_FASTROUTE, "PACKET_FASTROUTE" }, 697b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif 698b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman { 0, NULL }, 699b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman}; 700b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman#endif /* defined(AF_PACKET) */ 701b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman 70216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 70376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanvoid 704f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanprintsock(tcp, addr, addrlen) 70576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 70676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanlong addr; 707f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint addrlen; 70876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 709f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman union { 710f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman char pad[128]; 711f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr sa; 712f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_in sin; 713f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_un sau; 7149ce1a63eb20b069607c06f9645ac5a17b418a5f3Wichert Akkerman#ifdef HAVE_INET_NTOP 715f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_in6 sa6; 7169ce1a63eb20b069607c06f9645ac5a17b418a5f3Wichert Akkerman#endif 717f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#if defined(LINUX) && defined(AF_IPX) 718f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_ipx sipx; 719f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 720f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef AF_PACKET 721f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_ll ll; 72276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 723f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef AF_NETLINK 724f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman struct sockaddr_nl nl; 725f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 726f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } addrbuf; 727f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman char string_addr[100]; 72876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 72976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (addr == 0) { 73076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("NULL"); 73176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return; 73276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 73376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!verbose(tcp)) { 73476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", addr); 73576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return; 73676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 737f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if ((addrlen<2) || (addrlen>sizeof(addrbuf))) 738f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman addrlen=sizeof(addrbuf); 739f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 740f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (umoven(tcp, addr, addrlen, (char*)&addrbuf) < 0) { 74176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("{...}"); 74276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return; 74376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 744f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 7451fcb1d64ed13836334d100af9412f220efa1bbfaJohn Hughes tprintf("{sa_family="); 746f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printxval(addrfams, addrbuf.sa.sa_family, "AF_???"); 747f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 748f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 749f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman switch (addrbuf.sa.sa_family) { 75076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case AF_UNIX: 751f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (addrlen==2) { 752f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("<nil>"); 753f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } else if (addrbuf.sau.sun_path[0]) { 754fa30618c22c58ca26d9cb89bd297197ed99cc30fWichert Akkerman tprintf("path=\"%-.*s\"", addrlen-2, addrbuf.sau.sun_path); 755f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } else { 756fa30618c22c58ca26d9cb89bd297197ed99cc30fWichert Akkerman tprintf("path=@%-.*s", addrlen-3, addrbuf.sau.sun_path+1); 757f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 75876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 75976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case AF_INET: 7601fcb1d64ed13836334d100af9412f220efa1bbfaJohn Hughes tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")", 761f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman ntohs(addrbuf.sin.sin_port), inet_ntoa(addrbuf.sin.sin_addr)); 76276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 7639ce1a63eb20b069607c06f9645ac5a17b418a5f3Wichert Akkerman#ifdef HAVE_INET_NTOP 7649ce1a63eb20b069607c06f9645ac5a17b418a5f3Wichert Akkerman case AF_INET6: 765f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman inet_ntop(AF_INET6, &addrbuf.sa6.sin6_addr, string_addr, sizeof(string_addr)); 766f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman tprintf("sin6_port=htons(%u), inet_pton(AF_INET6, \"%s\", &sin6_addr), sin6_flowinfo=%u", 767f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman ntohs(addrbuf.sa6.sin6_port), string_addr, 768f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman addrbuf.sa6.sin6_flowinfo); 769f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#ifdef HAVE_SIN6_SCOPE_ID 770f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman { 771f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#if defined(HAVE_IF_INDEXTONAME) && defined(IN6_IS_ADDR_LINKLOCAL) && defined(IN6_IS_ADDR_MC_LINKLOCAL) 772f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman int numericscope = 0; 773f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman if (IN6_IS_ADDR_LINKLOCAL (&addrbuf.sa6.sin6_addr) 774f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman || IN6_IS_ADDR_MC_LINKLOCAL (&addrbuf.sa6.sin6_addr)) { 775f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman char scopebuf[IFNAMSIZ + 1]; 776f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman 777f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman if (if_indextoname (addrbuf.sa6.sin6_scope_id, scopebuf) == NULL) 778f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman numericscope++; 779f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman else 780f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman tprintf(", sin6_scope_id=if_nametoindex(\"%s\")", scopebuf); 781f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman } else 782f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman numericscope++; 783f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman 784f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman if (numericscope) 785f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#endif 786f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman tprintf(", sin6_scope_id=%u", addrbuf.sa6.sin6_scope_id); 787f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman } 788f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman#endif 789f185065a405794eaf6abc0dcf8345d9e6aa882f7Wichert Akkerman break; 7909ce1a63eb20b069607c06f9645ac5a17b418a5f3Wichert Akkerman#endif 791dbb440e5ae5d1a6be4eeda28088e8dfc9b195bacWichert Akkerman#if defined(AF_IPX) && defined(linux) 79276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case AF_IPX: 793f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { 79476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman int i; 7951fcb1d64ed13836334d100af9412f220efa1bbfaJohn Hughes tprintf("sipx_port=htons(%u), ", 796f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman ntohs(addrbuf.sipx.sipx_port)); 79776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* Yes, I know, this does not look too 79876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * strace-ish, but otherwise the IPX 79976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * addresses just look monstrous... 80076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Anyways, feel free if you don't like 80176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * this way.. :) 80276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */ 803f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%08lx:", (unsigned long)ntohl(addrbuf.sipx.sipx_network)); 80476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman for (i = 0; i<IPX_NODE_LEN; i++) 805f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%02x", addrbuf.sipx.sipx_node[i]); 806f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("/[%02x]", addrbuf.sipx.sipx_type); 807f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 808f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman break; 809f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* AF_IPX && linux */ 810f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef AF_PACKET 811f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman case AF_PACKET: 812f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman { 813f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman int i; 814b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman tprintf("proto=%#04x, if%d, pkttype=", 815f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman ntohs(addrbuf.ll.sll_protocol), 816b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman addrbuf.ll.sll_ifindex); 817b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman printxval(af_packet_types, addrbuf.ll.sll_pkttype, "?"); 818b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman tprintf(", addr(%d)={%d, ", 819f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman addrbuf.ll.sll_halen, 820f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman addrbuf.ll.sll_hatype); 821b0c598ff8d03a57627a5335448a8a60f0950f4f7Wichert Akkerman for (i=0; i<addrbuf.ll.sll_halen; i++) 822f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%02x", addrbuf.ll.sll_addr[i]); 82376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 82476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 825f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 826f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* AF_APACKET */ 827f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef AF_NETLINLK 828f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman case AF_NETLINK: 829f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("pid=%d, groups=%08x", addrbuf.nl.nl_pid, addrbuf.nl.nl_groups); 830f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman break; 831f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* AF_NETLINK */ 83276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* AF_AX25 AF_APPLETALK AF_NETROM AF_BRIDGE AF_AAL5 833f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman AF_X25 AF_ROSE etc. still need to be done */ 83476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 83576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman default: 8361fcb1d64ed13836334d100af9412f220efa1bbfaJohn Hughes tprintf("sa_data="); 83776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, (long) &((struct sockaddr *) addr)->sa_data, 838f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman sizeof addrbuf.sa.sa_data); 83976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 84076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 841f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("}"); 84276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 84376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 84476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if HAVE_SENDMSG 84576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 84676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void 84776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanprintmsghdr(tcp, addr) 84876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 84976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanlong addr; 85076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 85176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman struct msghdr msg; 85276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 8532e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman if (umove(tcp, addr, &msg) < 0) { 8542e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman tprintf("%#lx", addr); 8552e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman return; 8562e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman } 857f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("{msg_name(%d)=", msg.msg_namelen); 858f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printsock(tcp, (long)msg.msg_name, msg.msg_namelen); 859f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 860f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", msg_iov(%lu)=", (unsigned long)msg.msg_iovlen); 8611d08dcf46dd4b2cfe3e27723c05b0aec9955c591John Hughes tprint_iov(tcp, msg.msg_iovlen, (long) msg.msg_iov); 862f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 86376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_MSG_CONTROL 864f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen); 865f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (msg.msg_controllen) 866f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", msg_control=%#lx, ", (unsigned long) msg.msg_control); 867f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", msg_flags="); 868f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (printflags(msg_flags, msg.msg_flags)==0) 869f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("0"); 87076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#else /* !HAVE_MSG_CONTROL */ 871f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("msg_accrights=%#lx, msg_accrightslen=%u", 87276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (unsigned long) msg.msg_accrights, msg.msg_accrightslen); 87376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !HAVE_MSG_CONTROL */ 874f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("}"); 87576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 87676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 87776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* HAVE_SENDMSG */ 87876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 87976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 88076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_socket(tcp) 88176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 88276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 88376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 88476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(domains, tcp->u_arg[0], "PF_???"); 88576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 88676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(socktypes, tcp->u_arg[1], "SOCK_???"); 88776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 88876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman switch (tcp->u_arg[0]) { 88976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case PF_INET: 89076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); 89176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 89276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_IPX 89376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case PF_IPX: 89476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* BTW: I don't believe this.. */ 89576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("["); 89676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(domains, tcp->u_arg[2], "PF_???"); 89776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("]"); 89876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 89976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* PF_IPX */ 90076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman default: 90176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%lu", tcp->u_arg[2]); 90276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 90376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 90476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 90576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 90676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 90776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 90876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 909bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughessys_so_socket(tcp) 910bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughesstruct tcb *tcp; 911bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes{ 912bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes if (entering(tcp)) { 913bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes /* not sure really what these args are... but this 914bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes * is how truss prints it 915bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes */ 916bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes tprintf("%ld, %ld, %ld, ", 917bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]); 918bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes printpath(tcp, tcp->u_arg[3]); 919bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes tprintf(", %ld", tcp->u_arg[4]); 920bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes } 921bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes return 0; 922bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes} 923bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes 924bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughesint 925bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughessys_so_socketpair(tcp) 926bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughesstruct tcb *tcp; 927bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes{ 928bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes if (entering(tcp)) { 929bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes /* not sure what this arg is */ 930bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes tprintf("0x%lx", tcp->u_arg[0]); 931bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes } 932bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes return 0; 933bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes} 934bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughes 935bdf48f55f264a9cd2eb1b3cac8f1f87c1acad008John Hughesint 93676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_bind(tcp) 93776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 93876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 93976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 94076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 941f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]); 94276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu", tcp->u_arg[2]); 94376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 94476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 94576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 94676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 94776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 94876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_connect(tcp) 94976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 95076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 95176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return sys_bind(tcp); 95276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 95376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 95476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 95576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_listen(tcp) 95676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 95776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 95876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 95976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]); 96076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 96176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 96276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 96376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 96476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 96576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_accept(tcp) 96676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 96776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 96876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 96976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 97076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else if (!tcp->u_arg[2]) 97176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx, NULL", tcp->u_arg[1]); 97276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else { 97376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (tcp->u_arg[1] == 0 || syserror(tcp)) { 97476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 97576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 976f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]); 97776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 97876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 97976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printnum(tcp, tcp->u_arg[2], "%lu"); 98076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 98176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 98276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 98376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 98476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 98576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_send(tcp) 98676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 98776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 98876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 98976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 99076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); 99176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu, ", tcp->u_arg[2]); 99276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* flags */ 99376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[3]) == 0) 99476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 99576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 99676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 99776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 99876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 99976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 100076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_sendto(tcp) 100176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 100276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 100376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 100476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 100576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); 100676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu, ", tcp->u_arg[2]); 100776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* flags */ 100876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[3]) == 0) 100976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 101076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* to address */ 101176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 1012f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); 101376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* to length */ 101476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu", tcp->u_arg[5]); 101576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 101676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 101776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 101876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 101976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_SENDMSG 102076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 102176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 102276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_sendmsg(tcp) 102376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 102476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 102576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 102676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 102776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printmsghdr(tcp, tcp->u_arg[1]); 102876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* flags */ 102976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 103076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[2]) == 0) 103176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 103276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 103376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 103476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 103576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 103676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* HAVE_SENDMSG */ 103776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 103876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 103976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_recv(tcp) 104076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 104176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 104276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 104376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 104476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 104576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 104676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 104776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 104876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, tcp->u_arg[1], tcp->u_rval); 104976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 105076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu, ", tcp->u_arg[2]); 105176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[3]) == 0) 105276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 105376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 105476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 105576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 105676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 105776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 105876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_recvfrom(tcp) 105976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 106076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 106176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman int fromlen; 106276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 106376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 106476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 106576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 106676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) { 106776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx, %lu, %lu, %#lx, %#lx", 106876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3], 106976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tcp->u_arg[4], tcp->u_arg[5]); 107076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 107176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 107276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* buf */ 107376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, tcp->u_arg[1], tcp->u_rval); 107476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* len */ 107576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %lu, ", tcp->u_arg[2]); 107676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* flags */ 107776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[3]) == 0) 107876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 107976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* from address, len */ 108076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!tcp->u_arg[4] || !tcp->u_arg[5]) { 108176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (tcp->u_arg[4] == 0) 108276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", NULL"); 108376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 108476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %#lx", tcp->u_arg[4]); 108576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (tcp->u_arg[5] == 0) 108676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", NULL"); 108776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 108876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", %#lx", tcp->u_arg[5]); 108976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 109076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 109176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) { 109276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", {...}, [?]"); 109376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 109476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 109576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 1096f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]); 109776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* from length */ 109876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", [%u]", fromlen); 109976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 110076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 110176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 110276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 110376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_SENDMSG 110476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 110576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 110676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_recvmsg(tcp) 110776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 110876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 110976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 111076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 111176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 111276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp) || !verbose(tcp)) 111376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 111476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 111576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printmsghdr(tcp, tcp->u_arg[1]); 111676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* flags */ 111776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 111876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (printflags(msg_flags, tcp->u_arg[2]) == 0) 111976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("0"); 112076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 112176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 112276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 112376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 112476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* HAVE_SENDMSG */ 112576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 112676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 112776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_shutdown(tcp) 112876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 112976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 113076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 113176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]); 113276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman switch (tcp->u_arg[1]) { 113376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case 0: 113476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%s", " /* receive */"); 113576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 113676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case 1: 113776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%s", " /* send */"); 113876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 113976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case 2: 114076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%s", " /* send and receive */"); 114176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 114276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 114376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 114476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 114576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 114676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 114776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 114876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getsockname(tcp) 114976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 115076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 115176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return sys_accept(tcp); 115276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 115376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 115476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 115576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getpeername(tcp) 115676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 115776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 115876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return sys_accept(tcp); 115976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 116076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 116176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 116276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_pipe(tcp) 116376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 116476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 116576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 116676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if defined(LINUX) && !defined(SPARC) 116776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman int fds[2]; 116876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 116976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 117076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) { 117176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[0]); 117276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 117376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 117476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0) 117576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("[...]"); 117676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 117776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("[%u, %u]", fds[0], fds[1]); 117876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 11792e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman#elif defined(SPARC) || defined(SVR4) || defined(FREEBSD) 118076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) 118176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp)); 118276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 118376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 118476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 118576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 118676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 118776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_socketpair(tcp) 118876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 118976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 119076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX 119176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman int fds[2]; 119276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 119376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 119476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 119576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(domains, tcp->u_arg[0], "PF_???"); 119676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 119776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(socktypes, tcp->u_arg[1], "SOCK_???"); 119876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 119976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman switch (tcp->u_arg[0]) { 120076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case PF_INET: 120176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(protocols, tcp->u_arg[2], "IPPROTO_???"); 120276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 120376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef PF_IPX 120476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case PF_IPX: 120576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* BTW: I don't believe this.. */ 120676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("["); 120776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(domains, tcp->u_arg[2], "PF_???"); 120876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("]"); 120976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 121076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* PF_IPX */ 121176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman default: 12122e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman tprintf("%lu", tcp->u_arg[2]); 121376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 121476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 121576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 121676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) { 12172e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman tprintf(", %#lx", tcp->u_arg[3]); 121876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 121976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 122076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX 122176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0) 12222e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman tprintf(", [...]"); 122376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 122476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", [%u, %u]", fds[0], fds[1]); 122576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */ 12262e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman#if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD) 122776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp)); 12282e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman#endif /* SUNOS4 || SVR4 || FREEBSD */ 122976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 123076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 123176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 123276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 123376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 123476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getsockopt(tcp) 123576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 123676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 123776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 123876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%ld, ", tcp->u_arg[0]); 123993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes printxval(socketlayers, tcp->u_arg[1], "SOL_???"); 124093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf (", "); 124176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman switch (tcp->u_arg[1]) { 124276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case SOL_SOCKET: 124376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(sockoptions, tcp->u_arg[2], "SO_???"); 124476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 124576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IP 124676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case SOL_IP: 124776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(sockipoptions, tcp->u_arg[2], "IP_???"); 124876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 124976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 125076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IPX 125176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case SOL_IPX: 125276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(sockipxoptions, tcp->u_arg[2], "IPX_???"); 125376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 125476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 12557987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_PACKET 12567987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman case SOL_PACKET: 12577987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman printxval(sockpacketoptions, tcp->u_arg[2], "PACKET_???"); 12587987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman break; 12597987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 126076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_TCP 126176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case SOL_TCP: 126276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(socktcpoptions, tcp->u_arg[2], "TCP_???"); 126376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 126476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 126576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 126676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* SOL_AX25 SOL_ROSE SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 126776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * etc. still need work */ 126876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman default: 126993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf("%lu", tcp->u_arg[2]); 127076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 127176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 127276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 127393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes long len; 127493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes if (syserror(tcp) || umove (tcp, tcp->u_arg[4], &len) < 0) { 127593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf(", %#lx, %#lx", 127676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tcp->u_arg[3], tcp->u_arg[4]); 127776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 127876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 127993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 128093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes switch (tcp->u_arg[1]) { 128193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes case SOL_SOCKET: 128293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes switch (tcp->u_arg[2]) { 128393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#ifdef SO_LINGER 128493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes case SO_LINGER: 128593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes if (len == sizeof (struct linger)) { 128693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes struct linger linger; 128793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes if (umove (tcp, 128893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tcp->u_arg[3], 128993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes &linger) < 0) 129093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes break; 129193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf(", {onoff=%d, linger=%d}, " 129293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes "[%ld]", 129393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes linger.l_onoff, 129493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes linger.l_linger, 129593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes len); 129693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes return 0; 129793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 129893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes break; 129993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#endif 130093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 130193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes break; 130293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 130393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 130493f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf (", "); 130593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes if (len == sizeof (int)) { 130693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes printnum(tcp, tcp->u_arg[3], "%ld"); 130793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 130893f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes else { 130993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes printstr (tcp, tcp->u_arg[3], len); 131093f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 131193f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf(", [%ld]", len); 131276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 131376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 131476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 131576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 13167987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_FILTER) 13177987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanstatic void printicmpfilter(tcp, addr) 13187987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanstruct tcb *tcp; 13197987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkermanlong addr; 13207987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman{ 13217987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman struct icmp_filter filter; 13227987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 13237987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman if (!addr) { 13247987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf("NULL"); 13257987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman return; 13267987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman } 13277987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman if (syserror(tcp) || !verbose(tcp)) { 13287987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf("%#lx", addr); 13297987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman return; 13307987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman } 13317987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman if (umove(tcp, addr, &filter) < 0) { 13327987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf("{...}"); 13337987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman return; 13347987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman } 13357987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 13367987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf("~("); 13377987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman if (printflags(icmpfilterflags, ~filter.data) == 0) 13387987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf("0"); 13397987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman tprintf(")"); 13407987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman} 13417987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif /* ICMP_FILTER */ 13427987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman 134338ae88d332acd9f86a30d58158e306d795d98977John Hughesstatic int 134438ae88d332acd9f86a30d58158e306d795d98977John Hughesprintsockopt (tcp, level, name, addr, len) 134576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 134638ae88d332acd9f86a30d58158e306d795d98977John Hughesint level; 134738ae88d332acd9f86a30d58158e306d795d98977John Hughesint name; 134838ae88d332acd9f86a30d58158e306d795d98977John Hugheslong addr; 134938ae88d332acd9f86a30d58158e306d795d98977John Hughesint len; 135076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 135138ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(socketlayers, level, "SOL_??"); 135238ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf (", "); 135338ae88d332acd9f86a30d58158e306d795d98977John Hughes switch (level) { 135438ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_SOCKET: 135538ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(sockoptions, name, "SO_???"); 135638ae88d332acd9f86a30d58158e306d795d98977John Hughes switch (name) { 135793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes#if defined(SO_LINGER) 135838ae88d332acd9f86a30d58158e306d795d98977John Hughes case SO_LINGER: 135938ae88d332acd9f86a30d58158e306d795d98977John Hughes if (len == sizeof (struct linger)) { 136038ae88d332acd9f86a30d58158e306d795d98977John Hughes struct linger linger; 136138ae88d332acd9f86a30d58158e306d795d98977John Hughes if (umove (tcp, addr, &linger) < 0) 136238ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 136338ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf(", {onoff=%d, linger=%d}", 136438ae88d332acd9f86a30d58158e306d795d98977John Hughes linger.l_onoff, 136538ae88d332acd9f86a30d58158e306d795d98977John Hughes linger.l_linger); 136638ae88d332acd9f86a30d58158e306d795d98977John Hughes return 0; 136793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 136876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman break; 136938ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 137038ae88d332acd9f86a30d58158e306d795d98977John Hughes } 137138ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 137276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IP 137338ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_IP: 137438ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(sockipoptions, name, "IP_???"); 137538ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 137676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 137776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_IPX 137838ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_IPX: 137938ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(sockipxoptions, name, "IPX_???"); 138038ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 13817987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 13827987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_PACKET 138338ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_PACKET: 138438ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(sockpacketoptions, name, "PACKET_???"); 138538ae88d332acd9f86a30d58158e306d795d98977John Hughes /* TODO: decode packate_mreq for PACKET_*_MEMBERSHIP */ 138638ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 138776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 138876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SOL_TCP 138938ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_TCP: 139038ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(socktcpoptions, name, "TCP_???"); 139138ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 13927987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 13937987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#ifdef SOL_RAW 139438ae88d332acd9f86a30d58158e306d795d98977John Hughes case SOL_RAW: 139538ae88d332acd9f86a30d58158e306d795d98977John Hughes printxval(sockrawoptions, name, "RAW_???"); 139638ae88d332acd9f86a30d58158e306d795d98977John Hughes switch (name) { 13977987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#if defined(ICMP_FILTER) 139838ae88d332acd9f86a30d58158e306d795d98977John Hughes case ICMP_FILTER: 139938ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf(", "); 140038ae88d332acd9f86a30d58158e306d795d98977John Hughes printicmpfilter(tcp, addr); 140138ae88d332acd9f86a30d58158e306d795d98977John Hughes return 0; 14027987cdf192632516d6ba493b0a9943f5a3a7c362Wichert Akkerman#endif 140338ae88d332acd9f86a30d58158e306d795d98977John Hughes } 140438ae88d332acd9f86a30d58158e306d795d98977John Hughes break; 140576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 140676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 140776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* SOL_AX25 SOL_ATALK SOL_NETROM SOL_UDP SOL_DECNET SOL_X25 140876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * etc. still need work */ 140993f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 141038ae88d332acd9f86a30d58158e306d795d98977John Hughes default: 141138ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf("%u", name); 141238ae88d332acd9f86a30d58158e306d795d98977John Hughes } 141393f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 141438ae88d332acd9f86a30d58158e306d795d98977John Hughes /* default arg printing */ 141593f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 141638ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf (", "); 141793f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes 141838ae88d332acd9f86a30d58158e306d795d98977John Hughes if (len == sizeof (int)) { 141938ae88d332acd9f86a30d58158e306d795d98977John Hughes printnum(tcp, addr, "%ld"); 142038ae88d332acd9f86a30d58158e306d795d98977John Hughes } 142138ae88d332acd9f86a30d58158e306d795d98977John Hughes else { 142238ae88d332acd9f86a30d58158e306d795d98977John Hughes printstr (tcp, addr, len); 142338ae88d332acd9f86a30d58158e306d795d98977John Hughes } 142438ae88d332acd9f86a30d58158e306d795d98977John Hughes return 0; 142538ae88d332acd9f86a30d58158e306d795d98977John Hughes} 142638ae88d332acd9f86a30d58158e306d795d98977John Hughes 142738ae88d332acd9f86a30d58158e306d795d98977John Hughes 142838ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef HAVE_OPTHDR 142938ae88d332acd9f86a30d58158e306d795d98977John Hughes 143038ae88d332acd9f86a30d58158e306d795d98977John Hughesvoid 143138ae88d332acd9f86a30d58158e306d795d98977John Hughesprint_sock_optmgmt (tcp, addr, len) 143238ae88d332acd9f86a30d58158e306d795d98977John Hughesstruct tcb *tcp; 143338ae88d332acd9f86a30d58158e306d795d98977John Hugheslong addr; 143438ae88d332acd9f86a30d58158e306d795d98977John Hughesint len; 143538ae88d332acd9f86a30d58158e306d795d98977John Hughes{ 143638ae88d332acd9f86a30d58158e306d795d98977John Hughes int c = 0; 143738ae88d332acd9f86a30d58158e306d795d98977John Hughes struct opthdr hdr; 143838ae88d332acd9f86a30d58158e306d795d98977John Hughes 143938ae88d332acd9f86a30d58158e306d795d98977John Hughes while (len >= sizeof hdr) { 144038ae88d332acd9f86a30d58158e306d795d98977John Hughes if (umove(tcp, addr, &hdr) < 0) break; 144138ae88d332acd9f86a30d58158e306d795d98977John Hughes if (c++) { 144238ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf (", "); 144376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 144438ae88d332acd9f86a30d58158e306d795d98977John Hughes else if (len > hdr.len + sizeof hdr) { 144538ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf ("["); 144693f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes } 144738ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf ("{"); 144838ae88d332acd9f86a30d58158e306d795d98977John Hughes addr += sizeof hdr; 144938ae88d332acd9f86a30d58158e306d795d98977John Hughes len -= sizeof hdr; 145038ae88d332acd9f86a30d58158e306d795d98977John Hughes printsockopt (tcp, hdr.level, hdr.name, addr, hdr.len); 145138ae88d332acd9f86a30d58158e306d795d98977John Hughes addr += hdr.len; 145238ae88d332acd9f86a30d58158e306d795d98977John Hughes len -= hdr.len; 145338ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf ("}"); 145438ae88d332acd9f86a30d58158e306d795d98977John Hughes } 145538ae88d332acd9f86a30d58158e306d795d98977John Hughes if (len > 0) { 145638ae88d332acd9f86a30d58158e306d795d98977John Hughes if (c++) tprintf (", "); 145738ae88d332acd9f86a30d58158e306d795d98977John Hughes printstr (tcp, addr, len); 145838ae88d332acd9f86a30d58158e306d795d98977John Hughes } 145938ae88d332acd9f86a30d58158e306d795d98977John Hughes if (c > 1) tprintf ("]"); 146038ae88d332acd9f86a30d58158e306d795d98977John Hughes} 146138ae88d332acd9f86a30d58158e306d795d98977John Hughes 146238ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif 146338ae88d332acd9f86a30d58158e306d795d98977John Hughes 146438ae88d332acd9f86a30d58158e306d795d98977John Hughesint 146538ae88d332acd9f86a30d58158e306d795d98977John Hughessys_setsockopt(tcp) 146638ae88d332acd9f86a30d58158e306d795d98977John Hughesstruct tcb *tcp; 146738ae88d332acd9f86a30d58158e306d795d98977John Hughes{ 146838ae88d332acd9f86a30d58158e306d795d98977John Hughes if (entering(tcp)) { 146938ae88d332acd9f86a30d58158e306d795d98977John Hughes tprintf("%ld, ", tcp->u_arg[0]); 147038ae88d332acd9f86a30d58158e306d795d98977John Hughes printsockopt (tcp, tcp->u_arg[1], tcp->u_arg[2], 147138ae88d332acd9f86a30d58158e306d795d98977John Hughes tcp->u_arg[3], tcp->u_arg[4]); 147293f7fccaa60735509fd75ad22c8a97a8cd52f6bbJohn Hughes tprintf(", %lu", tcp->u_arg[4]); 147376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 147476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 147576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 147616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 147716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#if UNIXWARE >= 7 147816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 147916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstatic struct xlat sock_version[] = { 148016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_UW211_SVR4, "UW211_SVR4" }, 148116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_UW211_XPG4, "UW211_XPG4" }, 148216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_GEMINI_SVR4, "GEMINI_SVR4" }, 148316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_GEMINI_XPG4, "GEMINI_XPG4" }, 148416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_FP1_SVR4, "FP1_SVR4" }, 148516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { __NETLIB_FP1_XPG4, "FP1_XPG4" }, 148616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman { 0, NULL }, 148716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman}; 148816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 148916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 149016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 149116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermannetlib_call(tcp, func) 149216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 149316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint (*func) (); 149416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 149516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman if (entering(tcp)) { 149616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman int i; 149716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); 149816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf(", "); 149916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman --tcp->u_nargs; 150016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman for (i = 0; i < tcp->u_nargs; i++) 150116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tcp->u_arg[i] = tcp->u_arg[i + 1]; 150216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return func (tcp); 150316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 150416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 150516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 150616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return func (tcp); 150716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 150816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 150916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 151016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xsocket(tcp) 151116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 151216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 151316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_socket); 151416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 151516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 151616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 151716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xsocketpair(tcp) 151816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 151916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 152016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_socketpair); 152116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 152216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 152316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 152416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xbind(tcp) 152516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 152616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 152716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_bind); 152816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 152916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 153016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 153116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xconnect(tcp) 153216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 153316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 153416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_connect); 153516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 153616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 153716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 153816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xlisten(tcp) 153916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 154016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 154116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_listen); 154216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 154316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 154416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 154516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xaccept(tcp) 154616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 154716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 154816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_accept); 154916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 155016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 155116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 155216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xsendmsg(tcp) 155316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 155416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 155516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_sendmsg); 155616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 155716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 155816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 155916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xrecvmsg(tcp) 156016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 156116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 156216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_recvmsg); 156316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 156416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 156516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 156616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xgetsockaddr(tcp) 156716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 156816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 156916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman if (entering(tcp)) { 157016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); 157116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf(", "); 157216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman if (tcp->u_arg[1] == 0) { 157316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf ("LOCALNAME, "); 157416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 157516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman else if (tcp->u_arg[1] == 1) { 157616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf ("REMOTENAME, "); 157716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 157816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman else { 157916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf ("%ld, ", tcp->u_arg [1]); 158016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 158116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf ("%ld, ", tcp->u_arg [2]); 158216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 158316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman else { 158416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman if (tcp->u_arg[3] == 0 || syserror(tcp)) { 158516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf("%#lx", tcp->u_arg[3]); 158616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } else { 158716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman printsock(tcp, tcp->u_arg[3], tcp->u_arg[4]); 158816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 158916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman tprintf(", "); 159016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman printnum(tcp, tcp->u_arg[4], "%lu"); 159116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman } 159216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 159316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return 0; 159416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 159516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 159616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 159716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#if 0 159816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 159916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 160016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xsetsockaddr(tcp) 160116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 160216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 160316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_setsockaddr); 160416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 160516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 160616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#endif 160716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 160816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 160916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xgetsockopt(tcp) 161016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 161116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 161216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_getsockopt); 161316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 161416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 161516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 161616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xsetsockopt(tcp) 161716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 161816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 161916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_setsockopt); 162016a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 162116a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 162216a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanint 162316a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermansys_xshutdown(tcp) 162416a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkermanstruct tcb *tcp; 162516a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman{ 162616a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman return netlib_call (tcp, sys_shutdown); 162716a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman} 162816a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman 162916a03d2e97415afe6cf34172a0aea97a95a0b160Wichert Akkerman#endif 1630