mirror of
https://repo.or.cz/socat.git
synced 2024-12-23 07:52:32 +00:00
merged 1.7.0.0; fixed a few minor bugs
This commit is contained in:
commit
8222b731a4
106 changed files with 12729 additions and 2911 deletions
124
CHANGES
124
CHANGES
|
@ -27,6 +27,130 @@ new features:
|
||||||
|
|
||||||
new form of FD address with output/input fd numbers
|
new form of FD address with output/input fd numbers
|
||||||
|
|
||||||
|
####################### V 1.7.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
new address types SCTP-CONNECT and SCTP-LISTEN implement SCTP stream
|
||||||
|
mode for IPv4 and IPv6; new address options sctp-maxseg and
|
||||||
|
sctp-nodelay (suggested by David A. Madore; thanks to Jonathan Brannan
|
||||||
|
for providing an initial patch)
|
||||||
|
|
||||||
|
new address "INTERFACE" for transparent network interface handling
|
||||||
|
(suggested by Stuart Nicholson)
|
||||||
|
|
||||||
|
added generic socket addresses: SOCKET-CONNECT, SOCKET-LISTEN,
|
||||||
|
SOCKET-SENDTO, SOCKET-RECVFROM, SOCKET-RECV, SOCKET-DATAGRAM allow
|
||||||
|
protocol independent socket handling; all parameters are explicitely
|
||||||
|
specified as numbers or hex data
|
||||||
|
|
||||||
|
added address options ioctl-void, ioctl-int, ioctl-intp, ioctl-string,
|
||||||
|
ioctl-bin for generic ioctl() calls.
|
||||||
|
|
||||||
|
added address options setsockopt-int, setsockopt-bin, and
|
||||||
|
setsockopt-string for generic setsockopt() calls
|
||||||
|
|
||||||
|
option so-type now only affects the socket() and socketpair() calls,
|
||||||
|
not the name resolution. so-type and so-prototype can now be applied to
|
||||||
|
all socket based addresses.
|
||||||
|
|
||||||
|
new address option "escape" allows to break a socat instance even when
|
||||||
|
raw terminal mode prevents ^C etc. (feature suggested by Guido Trotter)
|
||||||
|
|
||||||
|
socat sets environment variables SOCAT_VERSION, SOCAT_PID, SOCAT_PPID
|
||||||
|
for use in executed scripts
|
||||||
|
|
||||||
|
socat sets environment variables SOCAT_SOCKADDR, SOCAT_SOCKPORT,
|
||||||
|
SOCAT_PEERADDR, SOCAT_PEERPORT in LISTEN type addresses (feature
|
||||||
|
suggested by Ed Sawicki)
|
||||||
|
|
||||||
|
socat receives all ancillary messages with each received packet on
|
||||||
|
datagram related addresses. The messages are logged in raw form with
|
||||||
|
debug level, and broken down with info level. note: each type of
|
||||||
|
ancillary message must be enabled by appropriate address options.
|
||||||
|
|
||||||
|
socat provides the contents of ancillary messages received on RECVFROM
|
||||||
|
addresses in appropriate environment variables:
|
||||||
|
SOCAT_TIMESTAMP, SOCAT_IP_DSTADDR, SOCAT_IP_IF, SOCAT_IP_LOCADDR,
|
||||||
|
SOCAT_IP_OPTIONS, SOCAT_IP_TOS, SOCAT_IP_TTL, SOCAT_IPV6_DSTADDR,
|
||||||
|
SOCAT_IPV6_HOPLIMIT, SOCAT_IPV6_TCLASS
|
||||||
|
|
||||||
|
the following address options were added to enable ancillary messages:
|
||||||
|
so-timestamp, ip-pktinfo (not BSD), ip-recvdstaddr (BSD), ip-recverr,
|
||||||
|
ip-recvif (BSD), ip-recvopts, ip-recvtos, ip-recvttl, ipv6-recvdstopts,
|
||||||
|
ipv6-recverr, ipv6-recvhoplimit, ipv6-recvhopopts, ipv6-recvpathmtu,
|
||||||
|
ipv6-recvpktinfo, ipv6-recvrthdr, ipv6-recvtclass
|
||||||
|
|
||||||
|
new address options ipv6-tclass and ipv6-unicast-hops set the related
|
||||||
|
socket options.
|
||||||
|
|
||||||
|
STREAMS (UNIX System V STREAMS) can be configured with the new address
|
||||||
|
options i-pop-all and i-push (thanks to Michal Rysavy for providing a
|
||||||
|
patch)
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
some raw IP and UNIX datagram modes failed on BSD systems
|
||||||
|
|
||||||
|
when UDP-LISTEN continued to listen after packet dropped by, e.g.,
|
||||||
|
range option, the old listen socket would not be closed but a new one
|
||||||
|
created. open sockets could accumulate.
|
||||||
|
|
||||||
|
there was a bug in ip*-recv with bind option: it did not bind, and
|
||||||
|
with the first received packet an error occurred:
|
||||||
|
socket_init(): unknown address family 0
|
||||||
|
test: RAWIP4RECVBIND
|
||||||
|
|
||||||
|
RECVFROM addresses with FORK option hung after processing the first
|
||||||
|
packet. test: UDP4RECVFROM_FORK
|
||||||
|
|
||||||
|
corrected a few mistakes that caused compiler warnings on 64bit hosts
|
||||||
|
(thanks to Jonathan Brannan e.a. for providing a patch)
|
||||||
|
|
||||||
|
EXEC and SYSTEM with stderr injected socat messages into the data
|
||||||
|
stream. test: EXECSTDERRLOG
|
||||||
|
|
||||||
|
when the EXEC address got a string with consecutive spaces it created
|
||||||
|
additional empty arguments (thanks to Olivier Hervieu for reporting
|
||||||
|
this bug). test: EXECSPACES
|
||||||
|
|
||||||
|
in ignoreeof polling mode socat also blocked data transfer in the other
|
||||||
|
direction during the 1s wait intervalls (thanks to Jorgen Cederlof for
|
||||||
|
reporting this bug)
|
||||||
|
|
||||||
|
corrected alphabetical order of options (proxy-auth)
|
||||||
|
|
||||||
|
some minor corrections
|
||||||
|
|
||||||
|
improved test.sh script: more stable timing, corrections for BSD
|
||||||
|
|
||||||
|
replaced the select() calls by poll() to cleanly fix the problems with
|
||||||
|
many file descriptors already open
|
||||||
|
|
||||||
|
socat option -lf did not log to file but to stderr
|
||||||
|
|
||||||
|
socat did not compile on Solaris when configured without termios
|
||||||
|
feature (thanks to Pavan Gadi for reporting this bug)
|
||||||
|
|
||||||
|
porting:
|
||||||
|
socat compiles and runs on AIX with gcc (thanks to Andi Mather for his
|
||||||
|
help)
|
||||||
|
|
||||||
|
socat compiles and runs on Cygwin (thanks to Jan Just Keijser for his
|
||||||
|
help)
|
||||||
|
|
||||||
|
socat compiles and runs on HP-UX with gcc (thanks to Michal Rysavy for
|
||||||
|
his help)
|
||||||
|
|
||||||
|
socat compiles and runs on MacOS X (thanks to Camillo Lugaresi for his
|
||||||
|
help)
|
||||||
|
|
||||||
|
further changes:
|
||||||
|
filan -s prefixes output with FD number if more than one FD
|
||||||
|
|
||||||
|
Makefile now supports datarootdir (thanks to Camillo Lugaresi for
|
||||||
|
providing the patch)
|
||||||
|
|
||||||
|
cleanup in xio-unix.c
|
||||||
|
|
||||||
####################### V 1.6.0.1:
|
####################### V 1.6.0.1:
|
||||||
|
|
||||||
new features:
|
new features:
|
||||||
|
|
195
Config/Makefile.AIX-5-3
Normal file
195
Config/Makefile.AIX-5-3
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = cc -qlanglvl=extc89
|
||||||
|
CCOPTS = $(CCOPT)
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lbsd -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = ./install-sh -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html doc/socat-genericsocket.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
195
Config/Makefile.Cygwin-1-5-25
Normal file
195
Config/Makefile.Cygwin-1-5-25
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html doc/socat-genericsocket.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
|
@ -1,5 +1,5 @@
|
||||||
# source: Makefile.FreeBSD-6-1
|
# source: Makefile.in
|
||||||
# Copyright Gerhard Rieger 2001-2006
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
# note: @...@ forms are filled in by configure script
|
# note: @...@ forms are filled in by configure script
|
||||||
|
@ -15,7 +15,8 @@ exec_prefix = ${prefix}
|
||||||
|
|
||||||
BINDEST = ${exec_prefix}/bin
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
MANDEST = ${prefix}/man
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
srcdir = .
|
srcdir = .
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ SYSDEFS = -D_LONGLONG
|
||||||
CPPFLAGS = -I.
|
CPPFLAGS = -I.
|
||||||
#0 INCLS = -I. @V_INCL@
|
#0 INCLS = -I. @V_INCL@
|
||||||
DEFS = -DHAVE_CONFIG_H
|
DEFS = -DHAVE_CONFIG_H
|
||||||
LIBS = -lwrap -lutil -lreadline -lssl
|
LIBS = -lwrap -lutil -lreadline -lssl
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
INSTALL = /usr/bin/install -c
|
INSTALL = /usr/bin/install -c
|
||||||
|
@ -44,13 +45,16 @@ XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
xio-rawip.c \
|
xio-rawip.c \
|
||||||
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
xio-pty.c xio-openssl.c \
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
XIOOBJS = $(XIOSRCS:.c=.o)
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
UTLOBJS = $(UTLSRCS:.c=.o)
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
OFILES = $(CFILES:.c=.o)
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
@ -59,29 +63,43 @@ PROGS = socat procan filan
|
||||||
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
xio-system.h xio-termios.h xio-readline.h \
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
xio-pty.h xio-openssl.h \
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
proxy.sh socks4a-echo.sh testcert.conf
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
|
||||||
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
|
||||||
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
all: progs
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
progs: $(PROGS)
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
@ -91,7 +109,7 @@ depend: $(CFILES) $(HFILES)
|
||||||
socat: socat.o libxio.a
|
socat: socat.o libxio.a
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
procan: $(PROCAN_OBJS)
|
procan: $(PROCAN_OBJS)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
@ -108,17 +126,17 @@ doc: doc/xio.help
|
||||||
strip: progs
|
strip: progs
|
||||||
strip $(PROGS)
|
strip $(PROGS)
|
||||||
|
|
||||||
install: progs doc/socat.1
|
install: progs $(srcdir)/doc/socat.1
|
||||||
mkdir -p $(DESTDIR)$(BINDEST)
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(BINDEST)/socat
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
rm -f $(DESTDIR)$(BINDEST)/procat
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
rm -f $(DESTDIR)$(BINDEST)/filan
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
|
195
Config/Makefile.Linux-2-6-24
Normal file
195
Config/Makefile.Linux-2-6-24
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lssl
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
195
Config/Makefile.MacOSX-10-5
Normal file
195
Config/Makefile.MacOSX-10-5
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__DYNAMIC__
|
||||||
|
CPPFLAGS = -I. -I/usr/local/include
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lresolv -lreadline -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE -L/usr/local/lib $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE -L/usr/local/lib $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html doc/socat-genericsocket.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
195
Config/Makefile.NetBSD-4-0
Normal file
195
Config/Makefile.NetBSD-4-0
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lssl
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
195
Config/Makefile.OpenBSD-4-3
Normal file
195
Config/Makefile.OpenBSD-4-3
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=5
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lcurses -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
195
Config/Makefile.SunOS-5-10
Normal file
195
Config/Makefile.SunOS-5-10
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# source: Makefile.in
|
||||||
|
# Copyright Gerhard Rieger 2001-2008
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
datarootdir = ${prefix}/share
|
||||||
|
MANDEST = ${datarootdir}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I. -I/usr/sfw/include
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lrt -lsocket -lnsl -lresolv -lreadline -lcurses -L/usr/sfw/lib -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = ./install-sh -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h
|
||||||
|
|
||||||
|
all: progs doc
|
||||||
|
|
||||||
|
scmclean: gitclean
|
||||||
|
|
||||||
|
gitclean: distclean docclean
|
||||||
|
rm -f Makefile.bak configure
|
||||||
|
|
||||||
|
doc: doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
rm -f doc/socat.1 doc/socat.html
|
||||||
|
|
||||||
|
doc/socat.1: doc/socat.yo
|
||||||
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
|
doc/socat.html: doc/socat.yo
|
||||||
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs $(srcdir)/doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procan
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
523
Config/config.AIX-5-3.h
Normal file
523
Config/config.AIX-5-3.h
Normal file
|
@ -0,0 +1,523 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_READLINE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_HISTORY_H */
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
/* #undef HAVE_LIBREADLINE */
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
/* #undef HAVE_TERMIOS_ISPEED */
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
/* #undef ISPEED_OFFSET */
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
/* #undef HAVE_OPENPTY */
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTC 1
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 8
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 10
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
/* #undef HAVE_HOSTS_ALLOW_TABLE */
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_MODE_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_PID_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_UID_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_GID_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_TIME_T 0 /* unknown, taking default */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_SCTP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
/* #undef WITH_READLINE */
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
/* #undef WITH_LIBWRAP */
|
||||||
|
/* #undef HAVE_TCPD_H */
|
||||||
|
/* #undef HAVE_LIBWRAP */
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
522
Config/config.Cygwin-1-5-25.h
Normal file
522
Config/config.Cygwin-1-5-25.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
/* #undef HAVE_GETADDRINFO */
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
/* #undef HAVE_IF_INDEXTONAME */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
#define HAVE_PTY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IP6_H */
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
/* #undef HAVE_ARPA_NAMESER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
/* #undef HAVE_RESOLV_H */
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
/* #undef HAVE_NET_IF_DL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
/* #undef HAVE_STRUCT_IPV6_MREQ */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
/* #undef HAVE_IP6_SOCKADDR */
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 7
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_GID_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 3 /* int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
/* #undef WITH_IP6 */
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
/* #undef WITH_SCTP */
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
|
@ -1,6 +1,6 @@
|
||||||
/* config.h. Generated by configure. */
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
/* source: Config/config.FreeBSD-6-1.h */
|
/* source: config.h.in */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __config_h_included
|
#ifndef __config_h_included
|
||||||
|
@ -108,6 +108,9 @@
|
||||||
/* Define if you have the memrchr function. */
|
/* Define if you have the memrchr function. */
|
||||||
/* #undef HAVE_MEMRCHR */
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
/* Define if you have the sigaction function */
|
/* Define if you have the sigaction function */
|
||||||
#define HAVE_SIGACTION 1
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
@ -225,9 +228,24 @@
|
||||||
/* Define if you have the <net/if.h> header file. */
|
/* Define if you have the <net/if.h> header file. */
|
||||||
#define HAVE_NET_IF_H 1
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
/* Define if you have the <linux/if_tun.h> header file. */
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
/* #undef HAVE_LINUX_IF_TUN_H */
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
/* Define if you have the <sys/utsname.h> header file. */
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
#define HAVE_SYS_UTSNAME_H 1
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
@ -276,6 +294,12 @@
|
||||||
/* fdset may have component fds_bits or __fds_bits */
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
#define HAVE_FDS_BITS 1
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
/* Define if your struct termios has component c_ispeed */
|
/* Define if your struct termios has component c_ispeed */
|
||||||
#define HAVE_TERMIOS_ISPEED 1
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
@ -314,7 +338,7 @@
|
||||||
/* Define if you have struct ifreq.ifr_index */
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
||||||
|
|
||||||
/* Define if you have struct ifreq.ifr_ifindex */
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
/* Define if your struct sockaddr has sa_len */
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
@ -335,12 +359,21 @@
|
||||||
/* define if your struct msghdr has msg_flag */
|
/* define if your struct msghdr has msg_flag */
|
||||||
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
#define HAVE_STRUCT_IP_IP_HL 1
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
/* Define if you have the setenv function */
|
/* Define if you have the setenv function */
|
||||||
#define HAVE_SETENV 1
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
/* Define if you have the flock function */
|
/* Define if you have the flock function */
|
||||||
#define HAVE_FLOCK 1
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
@ -434,7 +467,7 @@
|
||||||
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
#define HAVE_TYPEOF_RLIM_MAX 7 /* long long */
|
#define HAVE_TYPEOF_RLIM_MAX 7 /* long long */
|
||||||
|
|
||||||
|
@ -457,8 +490,11 @@
|
||||||
#define WITH_IP4 1
|
#define WITH_IP4 1
|
||||||
#define WITH_IP6 1
|
#define WITH_IP6 1
|
||||||
#define WITH_RAWIP 1
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
#define WITH_TCP 1
|
#define WITH_TCP 1
|
||||||
#define WITH_UDP 1
|
#define WITH_UDP 1
|
||||||
|
#define WITH_SCTP 1
|
||||||
#define WITH_LISTEN 1
|
#define WITH_LISTEN 1
|
||||||
#define WITH_SOCKS4 1
|
#define WITH_SOCKS4 1
|
||||||
#define WITH_SOCKS4A 1
|
#define WITH_SOCKS4A 1
|
||||||
|
@ -470,6 +506,7 @@
|
||||||
#define WITH_PTY 1
|
#define WITH_PTY 1
|
||||||
#define WITH_EXT2 1
|
#define WITH_EXT2 1
|
||||||
#define WITH_OPENSSL 1
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
/* #undef WITH_FIPS */
|
/* #undef WITH_FIPS */
|
||||||
/* #undef OPENSSL_FIPS */
|
/* #undef OPENSSL_FIPS */
|
||||||
#define WITH_LIBWRAP 1
|
#define WITH_LIBWRAP 1
|
||||||
|
|
522
Config/config.Linux-2-6-24.h
Normal file
522
Config/config.Linux-2-6-24.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
#define HAVE_MEMRCHR 1
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
#define HAVE_PTY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
/* #undef HAVE_NET_IF_DL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
#define HAVE_LINUX_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
#define HAVE_LINUX_ERRQUEUE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
#define HAVE_LINUX_IF_TUN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
#define HAVE_NETPACKET_PACKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
#define HAVE_NETINET_IF_ETHER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
#define HAVE_LINUX_FS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
#define HAVE_LINUX_EXT2_FS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 13
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
#define HAVE_STRUCT_IP_MREQN 1
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_IFINDEX 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
#define HAVE_STRUCT_IN_PKTINFO 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SIGHANDLER 1
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
#define HAVE_FORMAT_Z 1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 9
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_ABSTRACT_UNIXSOCKET 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
#define WITH_INTERFACE 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_SCTP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
#define WITH_TUN 1
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
522
Config/config.MacOSX-10-5.h
Normal file
522
Config/config.MacOSX-10-5.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#define HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 12
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_MODE_T 2 /* unsigned short */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 3 /* int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 8 /* unsigned long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
/* #undef HAVE_PROC_DIR */
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
/* #undef WITH_SCTP */
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
522
Config/config.NetBSD-4-0.h
Normal file
522
Config/config.NetBSD-4-0.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#define HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_READLINE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_HISTORY_H */
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
/* #undef HAVE_LIBREADLINE */
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 7 /* long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
/* #undef WITH_SCTP */
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
/* #undef WITH_READLINE */
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
522
Config/config.OpenBSD-4-3.h
Normal file
522
Config/config.OpenBSD-4-3.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
#define HAVE_MEMRCHR 1
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#define HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
/* #undef HAVE_STRUCT_IOVEC */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
/* #undef HAVE_GRANTPT */
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
/* #undef HAVE_UNLOCKPT */
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
/* #undef HAVE_PTSNAME */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 8 /* unsigned long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
/* #undef HAVE_PROC_DIR */
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
/* #undef WITH_SCTP */
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
522
Config/config.SunOS-5-10.h
Normal file
522
Config/config.SunOS-5-10.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* source: config.h.in */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#define HAVE_IF_INDEXTONAME 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#define HAVE_NET_IF_DL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_TYPES_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_ERRQUEUE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
/* #undef HAVE_NETPACKET_PACKET_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
/* #undef HAVE_NETINET_IF_ETHER_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#define HAVE_TYPE_SA_FAMILY_T 1
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
/* #undef HAVE_TERMIOS_ISPEED */
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
/* #undef ISPEED_OFFSET */
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROL */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROLLEN */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGFLAGS */
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#define HAVE_STRUCT_CMSGHDR 1
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
/* #undef HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
/* #undef HAVE_OPENPTY */
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 9
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_PID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_UID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_GID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_GENERICSOCKET 1
|
||||||
|
/* #undef WITH_INTERFACE */
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_SCTP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
#define WITH_STREAMS 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
38
EXAMPLES
38
EXAMPLES
|
@ -37,6 +37,16 @@ $ socat -,raw,echo=0 tcp:172.16.181.130:2023
|
||||||
// replace /bin/login by /bin/bash when using SSL client authentication, can be
|
// replace /bin/login by /bin/bash when using SSL client authentication, can be
|
||||||
// run without root then
|
// run without root then
|
||||||
|
|
||||||
|
// this is a cool trick, proposed by Christophe Lohr, to dump communications to
|
||||||
|
// two files; it would also work for other manipulations (recode, compress...)
|
||||||
|
// and it might also work with netcat ;-)
|
||||||
|
$ socat TCP-LISTEN:5555 SYSTEM:'tee l2r | socat - "TCP:remote:5555" | tee r2l'
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// emergence solution because usleep(1) is not always available
|
||||||
|
// this will "sleep" for 0.1s
|
||||||
|
$ socat -T 0.1 pipe pipe
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// a very primitive HTTP/1.0 echo server (problems: sends reply headers before
|
// a very primitive HTTP/1.0 echo server (problems: sends reply headers before
|
||||||
// request; hangs if client does not shutdown - HTTP keep-alive)
|
// request; hangs if client does not shutdown - HTTP keep-alive)
|
||||||
|
@ -45,6 +55,11 @@ $ socat -,raw,echo=0 tcp:172.16.181.130:2023
|
||||||
// incoming data back to client
|
// incoming data back to client
|
||||||
$ socat TCP-LISTEN:8000,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type\: text/plain; echo; cat"
|
$ socat TCP-LISTEN:8000,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type\: text/plain; echo; cat"
|
||||||
|
|
||||||
|
// a less primitive HTTP echo server that sends back not only the reqest but
|
||||||
|
// also server and client address and port. Might have portability issues with
|
||||||
|
// echo
|
||||||
|
./socat -T 1 -d -d tcp-l:10081,reuseaddr,fork,crlf system:"echo -e \"\\\"HTTP/1.0 200 OK\\\nDocumentType: text/html\\\n\\\n<html>date: \$\(date\)<br>server:\$SOCAT_SOCKADDR:\$SOCAT_SOCKPORT<br>client: \$SOCAT_PEERADDR:\$SOCAT_PEERPORT\\\n<pre>\\\"\"; cat; echo -e \"\\\"\\\n</pre></html>\\\"\""
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// for communicating with an attached modem, I had reasonable results with
|
// for communicating with an attached modem, I had reasonable results with
|
||||||
// following command line. Required privileges depend on device mode.
|
// following command line. Required privileges depend on device mode.
|
||||||
|
@ -285,6 +300,29 @@ $ socat -d -d -d -d - udp-datagram:224.0.0.2:6666,bind=:6666,ip-add-membership=2
|
||||||
// packets leave via wrong interface (set route: ...)
|
// packets leave via wrong interface (set route: ...)
|
||||||
// socket bound to specific address
|
// socket bound to specific address
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// GENERIC FUNCTION CALLS
|
||||||
|
|
||||||
|
// ioctl(): open CD drive (given value valid on Linux)
|
||||||
|
// on my Linux system I find in /usr/include/linux/cdrom.h the define:
|
||||||
|
// #define CDROMEJECT 0x5309 /* Ejects the cdrom media */
|
||||||
|
// the following command makes something like ioctl(fd, CDROMEJECT, NULL)
|
||||||
|
// (don't care about the read error):
|
||||||
|
$ socat /dev/cdrom,o-nonblock,ioctl-void=0x5309 -
|
||||||
|
|
||||||
|
// setsockopt(): SO_REUSEADDR
|
||||||
|
// the following command performs - beyond lots of overhead - something like:
|
||||||
|
// myint=1; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &myint, sizeof(myint))
|
||||||
|
$ socat -u udp-recv:7777,setsockopt-int=1:2:1 -
|
||||||
|
// setsockopt(): SO_BINDTODEVICE
|
||||||
|
|
||||||
|
// ways to apply SO_BINDTODEVICE without using the special socat address option
|
||||||
|
// so-bindtodevice:
|
||||||
|
// with string argument:
|
||||||
|
$ sudo ./socat tcp-l:7777,setsockopt-string=1:25:eth0 pipe
|
||||||
|
// with binary argument:
|
||||||
|
$ sudo ./socat tcp-l:7777,setsockopt-bin=1:25:x6574683000 pipe
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
// not tested, just ideas, or have problems
|
// not tested, just ideas, or have problems
|
||||||
|
|
44
Makefile.in
44
Makefile.in
|
@ -15,6 +15,7 @@ exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
BINDEST = @bindir@
|
BINDEST = @bindir@
|
||||||
|
|
||||||
|
datarootdir = @datarootdir@
|
||||||
MANDEST = @mandir@
|
MANDEST = @mandir@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
@ -44,10 +45,12 @@ XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
xiolayer.c xioshutdown.c xioclose.c xioexit.c xiosocketpair.c \
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c xiosocketpair.c \
|
||||||
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-socks5.c xio-proxy.c xio-udp.c \
|
xio-socket.c xio-interface.c xio-listen.c xio-unix.c \
|
||||||
xio-rawip.c \
|
xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
|
||||||
|
xio-sctp.c xio-rawip.c \
|
||||||
|
xio-socks.c xio-socks5.c xio-proxy.c xio-udp.c \
|
||||||
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
xio-pty.c xio-openssl.c \
|
xio-pty.c xio-openssl.c xio-streams.c\
|
||||||
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c \
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c \
|
||||||
xio-nop.c xio-test.c
|
xio-nop.c xio-test.c
|
||||||
XIOOBJS = $(XIOSRCS:.c=.o)
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
@ -60,27 +63,28 @@ PROGS = socat procan filan
|
||||||
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
|
||||||
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
xio-socket.h xio-interface.h xio-listen.h xio-unix.h \
|
||||||
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-socks5.h xio-proxy.h xio-progcall.h xio-exec.h \
|
xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h \
|
||||||
|
xio-socks.h xio-socks5.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
xio-system.h xio-termios.h xio-readline.h \
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
xio-pty.h xio-openssl.h \
|
xio-pty.h xio-openssl.h xio-streams.h \
|
||||||
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h \
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h \
|
||||||
xiosigchld.h xiostatic.h xio-nop.h xio-test.h
|
xiosigchld.h xiostatic.h xio-nop.h xio-test.h
|
||||||
|
|
||||||
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html doc/socat-genericsocket.html
|
||||||
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
proxy.sh socks4a-echo.sh testcert.conf
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
#OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
|
||||||
# Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
|
||||||
# Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
# Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
Config/Makefile.NetBSD-4-0 Config/config.NetBSD-4-0.h \
|
||||||
# Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
Config/Makefile.OpenBSD-4-3 Config/config.OpenBSD-4-3.h \
|
||||||
# Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
Config/Makefile.AIX-5-3 Config/config.AIX-5-3.h \
|
||||||
# Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
Config/Makefile.Cygwin-1-5-25 Config/config.Cygwin-1-5-25.h \
|
||||||
# Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
Config/Makefile.MacOSX-10-5 Config/config.MacOSX-10-5.h
|
||||||
|
|
||||||
|
|
||||||
all: progs doc
|
all: progs doc
|
||||||
|
|
||||||
|
@ -98,7 +102,7 @@ doc/socat.1: doc/socat.yo
|
||||||
yodl2man -o $@ $+
|
yodl2man -o $@ $+
|
||||||
|
|
||||||
doc/socat.html: doc/socat.yo
|
doc/socat.html: doc/socat.yo
|
||||||
yodl2html -o $@ $+
|
cd doc; yodl2html -o socat.html socat.yo; cd ..
|
||||||
|
|
||||||
progs: $(PROGS)
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
@ -125,13 +129,13 @@ doc: doc/xio.help
|
||||||
strip: progs
|
strip: progs
|
||||||
strip $(PROGS)
|
strip $(PROGS)
|
||||||
|
|
||||||
install: progs doc/socat.1
|
install: progs $(srcdir)/doc/socat.1
|
||||||
mkdir -p $(DESTDIR)$(BINDEST)
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(BINDEST)/socat
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
|
39
README
39
README
|
@ -45,28 +45,27 @@ distributions.
|
||||||
platforms
|
platforms
|
||||||
---------
|
---------
|
||||||
|
|
||||||
socat 1.6.0 was compiled and more or less successfully tested under the
|
socat 1.7.0 was compiled and more or less successfully tested under the
|
||||||
following operating systems:
|
following operating systems:
|
||||||
|
|
||||||
SuSE Linux 10.1 on x86
|
Debian lenny/sid on x86, kernel 2.6.24
|
||||||
AIX 5.2 on PPC with gcc
|
|
||||||
Solaris 9 on Sparc with gcc
|
|
||||||
FreeBSD 6.1 on x86
|
FreeBSD 6.1 on x86
|
||||||
HP-UX B 11.11 on PA-RISC with gcc
|
NetBSD4.0 on x86
|
||||||
|
OpenBSD 4.3 on x86
|
||||||
|
OpenSolaris 10 on x86 with gcc
|
||||||
|
Mac OS X 10.5.5 on iMac G5, with libreadline
|
||||||
|
HP-UX 11.23
|
||||||
|
AIX 5.3 on 64bit Power4 with gcc
|
||||||
|
Cygwin 1.5.25 on i686
|
||||||
|
|
||||||
tests on Tru64 can no longer be performed because HP testdrive has taken down
|
tests on Tru64 can no longer be performed because HP testdrive has taken down
|
||||||
these hosts.
|
these hosts.
|
||||||
|
|
||||||
tests on Mac OS X can no longer be performed because the Sourceforge
|
|
||||||
compilefarm was discontinued.
|
|
||||||
|
|
||||||
tests on NetBSD and OpenBSD can no longer be performed for the above reasons.
|
|
||||||
|
|
||||||
Some versions of socat have been reported to successfully compile under older
|
Some versions of socat have been reported to successfully compile under older
|
||||||
Linux versions back to RedHat 2.1 (kernel 1.2.13, gcc 2.7.0), under AIX 4.1 and
|
Linux versions back to RedHat 2.1 (kernel 1.2.13, gcc 2.7.0), under AIX 4.1 and
|
||||||
4.3, SunOS 5.7-5.8, FreeBSD 4.2 - 4.9, MacOS X 10.1, Cygwin, Solaris 8 on x86,
|
4.3, SunOS 5.7-5.8, FreeBSD 4.2 - 4.9, MacOS X 10.1, Cygwin, Solaris 8 on x86,
|
||||||
OSR 5.0.6, NetBSD 1.6.1 and 2.0.2, OpenBSD 3.4 and 3.8, Tru64 5.1B, and Mac OS
|
OSR 5.0.6, NetBSD 1.6.1 and 2.0.2, OpenBSD 3.4 and 3.8, Tru64 5.1B, Mac OS X
|
||||||
X 10.1-10.2.
|
10.1-10.2, and HP-UX 11
|
||||||
|
|
||||||
It might well compile and run under other UNIX like operating systems.
|
It might well compile and run under other UNIX like operating systems.
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ install
|
||||||
|
|
||||||
Get the tarball and extract it:
|
Get the tarball and extract it:
|
||||||
gtar xzf socat.tar.gz
|
gtar xzf socat.tar.gz
|
||||||
cd socat-1.6.0.1
|
cd socat-1.7.0.0
|
||||||
./configure
|
./configure
|
||||||
make
|
make
|
||||||
su
|
su
|
||||||
|
@ -180,12 +179,24 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sfw/lib
|
||||||
For some shell scripts, it is preferable to have /usr/xpg4/bin at a prominent
|
For some shell scripts, it is preferable to have /usr/xpg4/bin at a prominent
|
||||||
position in $PATH.
|
position in $PATH.
|
||||||
|
|
||||||
|
With the default compiler define _GNU_SOURCE, the CMSG_* macros are not
|
||||||
|
available, and therefore ancillary messages cannot be used. To enable these try
|
||||||
|
the following:
|
||||||
|
After running ./configure, edit Makefile and replace "-D_GNU_SOURCE" with
|
||||||
|
"-D_XPG4_2 -D__EXTENSIONS__" and run make
|
||||||
|
|
||||||
|
|
||||||
platform specifics - hp-ux
|
platform specifics - hp-ux
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
Ancillary messages cannot be compiled in with socat: both struct msghdr and
|
||||||
|
strutc cmsghdr are required. Compiling with -D_XOPEN_SOURCE_EXTENDED provides
|
||||||
|
struct msghdr but disables struct cmsghdr while -D_OPEN_SOURCE disables struct
|
||||||
|
msghdr but disables struct cmsghdr. Please contact socat development if you
|
||||||
|
know a solution.
|
||||||
|
|
||||||
Shutting down the write channel of a UNIX domain socket does not seem to
|
Shutting down the write channel of a UNIX domain socket does not seem to
|
||||||
trigger an EOF on the other socket. This makes problems with the exec and
|
trigger an EOF on the peer socket. This makes problems with the exec and
|
||||||
system addresses.
|
system addresses.
|
||||||
|
|
||||||
This OS provides the type "long long", but not the strtoll() function to read
|
This OS provides the type "long long", but not the strtoll() function to read
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
"2.0.0-b1"
|
"2.0.0-b2"
|
||||||
|
|
4
compat.h
4
compat.h
|
@ -604,6 +604,10 @@
|
||||||
# define NETDB_INTERNAL h_NETDB_INTERNAL
|
# define NETDB_INTERNAL h_NETDB_INTERNAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INET_ADDRSTRLEN
|
||||||
|
# define INET_ADDRSTRLEN sizeof(struct sockaddr_in)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_PROTOTYPE_HSTRERROR
|
#if !HAVE_PROTOTYPE_HSTRERROR
|
||||||
/* with MacOSX this is char * */
|
/* with MacOSX this is char * */
|
||||||
extern const char *hstrerror(int);
|
extern const char *hstrerror(int);
|
||||||
|
|
41
config.h.in
41
config.h.in
|
@ -1,5 +1,5 @@
|
||||||
/* source: config.h.in */
|
/* source: config.h.in */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __config_h_included
|
#ifndef __config_h_included
|
||||||
|
@ -107,6 +107,9 @@
|
||||||
/* Define if you have the memrchr function. */
|
/* Define if you have the memrchr function. */
|
||||||
#undef HAVE_MEMRCHR
|
#undef HAVE_MEMRCHR
|
||||||
|
|
||||||
|
/* Define if you have the if_indextoname function. */
|
||||||
|
#undef HAVE_IF_INDEXTONAME
|
||||||
|
|
||||||
/* Define if you have the sigaction function */
|
/* Define if you have the sigaction function */
|
||||||
#undef HAVE_SIGACTION
|
#undef HAVE_SIGACTION
|
||||||
|
|
||||||
|
@ -224,9 +227,24 @@
|
||||||
/* Define if you have the <net/if.h> header file. */
|
/* Define if you have the <net/if.h> header file. */
|
||||||
#undef HAVE_NET_IF_H
|
#undef HAVE_NET_IF_H
|
||||||
|
|
||||||
|
/* Define if you have the <net/if_dl.h> header file. */
|
||||||
|
#undef HAVE_NET_IF_DL_H
|
||||||
|
|
||||||
|
/* Define if you have the <linux/types.h> header file. */
|
||||||
|
#undef HAVE_LINUX_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the <linux/errqueue.h> header file. */
|
||||||
|
#undef HAVE_LINUX_ERRQUEUE_H
|
||||||
|
|
||||||
/* Define if you have the <linux/if_tun.h> header file. */
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
#undef HAVE_LINUX_IF_TUN_H
|
#undef HAVE_LINUX_IF_TUN_H
|
||||||
|
|
||||||
|
/* Define if you have the <netpacket/packet.h> header file. */
|
||||||
|
#undef HAVE_NETPACKET_PACKET_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||||
|
#undef HAVE_NETINET_IF_ETHER_H
|
||||||
|
|
||||||
/* Define if you have the <sys/utsname.h> header file. */
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
#undef HAVE_SYS_UTSNAME_H
|
#undef HAVE_SYS_UTSNAME_H
|
||||||
|
|
||||||
|
@ -275,6 +293,12 @@
|
||||||
/* fdset may have component fds_bits or __fds_bits */
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
#undef HAVE_FDS_BITS
|
#undef HAVE_FDS_BITS
|
||||||
|
|
||||||
|
/* Define if you have the sa_family_t */
|
||||||
|
#undef HAVE_TYPE_SA_FAMILY_T
|
||||||
|
|
||||||
|
/* define if your struct sigaction has sa_sigaction */
|
||||||
|
#undef HAVE_STRUCT_SIGACTION_SA_SIGACTION
|
||||||
|
|
||||||
/* Define if your struct termios has component c_ispeed */
|
/* Define if your struct termios has component c_ispeed */
|
||||||
#undef HAVE_TERMIOS_ISPEED
|
#undef HAVE_TERMIOS_ISPEED
|
||||||
|
|
||||||
|
@ -313,7 +337,7 @@
|
||||||
/* Define if you have struct ifreq.ifr_index */
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
#undef HAVE_STRUCT_IFREQ_IFR_INDEX
|
#undef HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
|
|
||||||
/* Define if you have struct ifreq.ifr_ifindex */
|
/* Define if you have struct ifreq.ifr_ifindex; not on HPUX */
|
||||||
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
|
|
||||||
/* Define if your struct sockaddr has sa_len */
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
@ -334,12 +358,21 @@
|
||||||
/* define if your struct msghdr has msg_flag */
|
/* define if your struct msghdr has msg_flag */
|
||||||
#undef HAVE_STRUCT_MSGHDR_MSGFLAGS
|
#undef HAVE_STRUCT_MSGHDR_MSGFLAGS
|
||||||
|
|
||||||
|
/* define if you have struct cmsghdr */
|
||||||
|
#undef HAVE_STRUCT_CMSGHDR
|
||||||
|
|
||||||
|
/* define if you have struct in_pktinfo */
|
||||||
|
#undef HAVE_STRUCT_IN_PKTINFO
|
||||||
|
|
||||||
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
#undef HAVE_STRUCT_IP_IP_HL
|
#undef HAVE_STRUCT_IP_IP_HL
|
||||||
|
|
||||||
/* Define if you have the setenv function */
|
/* Define if you have the setenv function */
|
||||||
#undef HAVE_SETENV
|
#undef HAVE_SETENV
|
||||||
|
|
||||||
|
/* Define if you have the unsetenv function. not on HP-UX */
|
||||||
|
#undef HAVE_UNSETENV
|
||||||
|
|
||||||
/* Define if you have the flock function */
|
/* Define if you have the flock function */
|
||||||
#undef HAVE_FLOCK
|
#undef HAVE_FLOCK
|
||||||
|
|
||||||
|
@ -458,8 +491,11 @@
|
||||||
#undef WITH_IP4
|
#undef WITH_IP4
|
||||||
#undef WITH_IP6
|
#undef WITH_IP6
|
||||||
#undef WITH_RAWIP
|
#undef WITH_RAWIP
|
||||||
|
#undef WITH_GENERICSOCKET
|
||||||
|
#undef WITH_INTERFACE
|
||||||
#undef WITH_TCP
|
#undef WITH_TCP
|
||||||
#undef WITH_UDP
|
#undef WITH_UDP
|
||||||
|
#undef WITH_SCTP
|
||||||
#undef WITH_LISTEN
|
#undef WITH_LISTEN
|
||||||
#undef WITH_SOCKS4
|
#undef WITH_SOCKS4
|
||||||
#undef WITH_SOCKS4A
|
#undef WITH_SOCKS4A
|
||||||
|
@ -473,6 +509,7 @@
|
||||||
#undef WITH_PTY
|
#undef WITH_PTY
|
||||||
#undef WITH_EXT2
|
#undef WITH_EXT2
|
||||||
#undef WITH_OPENSSL
|
#undef WITH_OPENSSL
|
||||||
|
#define WITH_STREAMS 1
|
||||||
#undef WITH_FIPS
|
#undef WITH_FIPS
|
||||||
#undef OPENSSL_FIPS
|
#undef OPENSSL_FIPS
|
||||||
#undef WITH_LIBWRAP
|
#undef WITH_LIBWRAP
|
||||||
|
|
282
configure.in
282
configure.in
|
@ -55,13 +55,26 @@ AC_CHECK_HEADERS(pwd.h grp.h stdint.h sys/types.h sys/poll.h sys/socket.h sys/ui
|
||||||
AC_CHECK_HEADERS(pty.h)
|
AC_CHECK_HEADERS(pty.h)
|
||||||
AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h)
|
AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h)
|
||||||
AC_CHECK_HEADERS(netinet6/in6.h) # found on OpenBSD, used for IPV6_*
|
AC_CHECK_HEADERS(netinet6/in6.h) # found on OpenBSD, used for IPV6_*
|
||||||
AC_CHECK_HEADERS(arpa/nameser.h resolv.h)
|
AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT
|
||||||
AC_CHECK_HEADERS(termios.h net/if.h linux/if_tun.h)
|
#if HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif]) # Mac OS X requires including sys/socket.h
|
||||||
|
AC_CHECK_HEADERS(arpa/nameser.h)
|
||||||
|
|
||||||
|
AC_HEADER_RESOLV()
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(termios.h linux/if_tun.h)
|
||||||
|
AC_CHECK_HEADERS(net/if_dl.h)
|
||||||
|
AC_CHECK_HEADERS(linux/types.h linux/errqueue.h)
|
||||||
AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
|
AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
|
||||||
AC_CHECK_HEADERS(util.h libutil.h sys/stropts.h regex.h)
|
AC_CHECK_HEADERS(util.h libutil.h sys/stropts.h regex.h)
|
||||||
AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
|
AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
|
||||||
|
|
||||||
|
|
||||||
|
dnl Link libresolv if necessary (for Mac OS X)
|
||||||
|
AC_SEARCH_LIBS([res_9_init], [resolv])
|
||||||
|
|
||||||
|
|
||||||
dnl Check for extra socket library (for Solaris)
|
dnl Check for extra socket library (for Solaris)
|
||||||
AC_CHECK_FUNC(hstrerror, , AC_CHECK_LIB(resolv, hstrerror, [LIBS="$LIBS -lresolv"; AC_DEFINE(HAVE_HSTRERROR)]))
|
AC_CHECK_FUNC(hstrerror, , AC_CHECK_LIB(resolv, hstrerror, [LIBS="$LIBS -lresolv"; AC_DEFINE(HAVE_HSTRERROR)]))
|
||||||
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
|
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
|
||||||
|
@ -201,7 +214,11 @@ AC_ARG_ENABLE(ip6, [ --disable-ip6 disable IPv6 support],
|
||||||
if test "$WITH_IP6"; then
|
if test "$WITH_IP6"; then
|
||||||
AC_CHECK_HEADERS([netinet/ip6.h],
|
AC_CHECK_HEADERS([netinet/ip6.h],
|
||||||
[AC_DEFINE(HAVE_NETINET_IP6_H) AC_DEFINE(WITH_IP6)],
|
[AC_DEFINE(HAVE_NETINET_IP6_H) AC_DEFINE(WITH_IP6)],
|
||||||
[AC_MSG_WARN([include file netinet/ip6.h not found, disabling IP6])])
|
[AC_MSG_WARN([include file netinet/ip6.h not found, disabling IP6])],
|
||||||
|
[AC_INCLUDES_DEFAULT
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#endif])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to include raw IP support)
|
AC_MSG_CHECKING(whether to include raw IP support)
|
||||||
|
@ -212,6 +229,36 @@ AC_ARG_ENABLE(rawip, [ --disable-rawip disable raw IP support],
|
||||||
esac],
|
esac],
|
||||||
[AC_DEFINE(WITH_RAWIP) AC_MSG_RESULT(yes)])
|
[AC_DEFINE(WITH_RAWIP) AC_MSG_RESULT(yes)])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether to include generic socket support)
|
||||||
|
AC_ARG_ENABLE(rawsocket, [ --disable-genericsocket disable generic socket support],
|
||||||
|
[case "$enableval" in
|
||||||
|
no) AC_MSG_RESULT(no);;
|
||||||
|
*) AC_DEFINE(WITH_GENERICSOCKET) AC_MSG_RESULT(yes);;
|
||||||
|
esac],
|
||||||
|
[AC_DEFINE(WITH_GENERICSOCKET) AC_MSG_RESULT(yes)])
|
||||||
|
AC_MSG_CHECKING(whether to include raw network interface support)
|
||||||
|
AC_ARG_ENABLE(interface, [ --disable-interface disable network interface support],
|
||||||
|
[case "$enableval" in
|
||||||
|
no) AC_MSG_RESULT(no); WITH_INTERFACE= ;;
|
||||||
|
*) AC_MSG_RESULT(yes); WITH_INTERFACE=1 ;;
|
||||||
|
esac],
|
||||||
|
[AC_MSG_RESULT(yes); WITH_INTERFACE=1 ])
|
||||||
|
if test "$WITH_INTERFACE"; then
|
||||||
|
AC_CHECK_HEADER(netpacket/packet.h,
|
||||||
|
AC_DEFINE(HAVE_NETPACKET_PACKET_H),
|
||||||
|
[WITH_INTERFACE=;
|
||||||
|
AC_MSG_WARN([include file netpacket/packet.h not found, disabling interface])])
|
||||||
|
fi
|
||||||
|
if test "$WITH_INTERFACE"; then
|
||||||
|
AC_CHECK_HEADER(netinet/if_ether.h,
|
||||||
|
AC_DEFINE(HAVE_NETINET_IF_ETHER_H),
|
||||||
|
[WITH_INTERFACE=;
|
||||||
|
AC_MSG_WARN([include file netinet/if_ether.h not found, disabling interface])])
|
||||||
|
fi
|
||||||
|
if test "$WITH_INTERFACE"; then
|
||||||
|
AC_DEFINE(WITH_INTERFACE)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to include TCP support)
|
AC_MSG_CHECKING(whether to include TCP support)
|
||||||
AC_ARG_ENABLE(tcp, [ --disable-tcp disable TCP support],
|
AC_ARG_ENABLE(tcp, [ --disable-tcp disable TCP support],
|
||||||
[case "$enableval" in
|
[case "$enableval" in
|
||||||
|
@ -228,6 +275,30 @@ AC_ARG_ENABLE(udp, [ --disable-udp disable UDP support],
|
||||||
esac],
|
esac],
|
||||||
[AC_DEFINE(WITH_UDP) AC_MSG_RESULT(yes)])
|
[AC_DEFINE(WITH_UDP) AC_MSG_RESULT(yes)])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether to include SCTP support)
|
||||||
|
AC_ARG_ENABLE(sctp, [ --disable-sctp disable SCTP support],
|
||||||
|
[case "$enableval" in
|
||||||
|
no) AC_MSG_RESULT(no); WITH_SCTP= ;;
|
||||||
|
*) AC_MSG_RESULT(yes); WITH_SCTP=1 ;;
|
||||||
|
esac],
|
||||||
|
[AC_MSG_RESULT(yes); WITH_SCTP=1 ])
|
||||||
|
|
||||||
|
if test -n "$WITH_SCTP"; then
|
||||||
|
AC_MSG_CHECKING(for IPPROTO_SCTP)
|
||||||
|
AC_CACHE_VAL(sc_cv_define_ipproto_sctp,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>],
|
||||||
|
[IPPROTO_SCTP;],
|
||||||
|
[sc_cv_define_ipproto_sctp=yes],
|
||||||
|
[sc_cv_define_ipproto_sctp=no])])
|
||||||
|
AC_MSG_RESULT($sc_cv_define_ipproto_sctp)
|
||||||
|
if test $sc_cv_define_ipproto_sctp = yes; then
|
||||||
|
AC_DEFINE(WITH_SCTP)
|
||||||
|
else
|
||||||
|
AC_MSG_WARN([IPPROTO_SCTP undefined, disabling SCTP support])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to include listen support)
|
AC_MSG_CHECKING(whether to include listen support)
|
||||||
AC_ARG_ENABLE(listen, [ --disable-listen disable listen support],
|
AC_ARG_ENABLE(listen, [ --disable-listen disable listen support],
|
||||||
[case "$enableval" in
|
[case "$enableval" in
|
||||||
|
@ -300,93 +371,56 @@ AC_ARG_ENABLE(readline, [ --disable-readline disable readline support],
|
||||||
esac],
|
esac],
|
||||||
[AC_MSG_RESULT(yes); WITH_READLINE=1 ])
|
[AC_MSG_RESULT(yes); WITH_READLINE=1 ])
|
||||||
|
|
||||||
# check if we find the components of GNU readline
|
|
||||||
if test -n "$WITH_READLINE"; then
|
if test -n "$WITH_READLINE"; then
|
||||||
# first, we need to find the include file <readline.h>
|
CPPFLAGS_ORIG=$CPPFLAGS
|
||||||
AC_MSG_NOTICE(checking for components of readline)
|
CFLAGS_ORIG=$CFLAGS
|
||||||
#AC_CHECK_HEADERS(readline/readline.h readline/history.h)
|
LIBS_ORIG=$LIBS
|
||||||
AC_CACHE_VAL(sc_cv_have_readline_h,
|
sc_usable_readline_found=
|
||||||
[AC_TRY_COMPILE([#include <stdio.h> /* FreeBSD needs "FILE *" */
|
|
||||||
#include <readline/readline.h>
|
for D in "" "/usr/local" "/opt/local" "/sw" "/opt/freeware" "/usr/sfw"; do
|
||||||
#include <readline/history.h>],[;],
|
if test -n "$D" ; then
|
||||||
[sc_cv_have_readline_h=yes; READLINE_ROOT=""; ],
|
CPPFLAGS="$CPPFLAGS -I$D/include"
|
||||||
[sc_cv_have_readline_h=no
|
CFLAGS="$CFLAGS -L$D/lib"
|
||||||
for D in "/sw" "/usr/local" "/opt/freeware" "/usr/sfw"; do
|
DLOC="in location $D"
|
||||||
I="$D/include"
|
else
|
||||||
i="$I/readline/readline.h"
|
DLOC="in default location"
|
||||||
if test -r "$i"; then
|
fi
|
||||||
#V_INCL="$V_INCL -I$I/"
|
AC_MSG_CHECKING(for usable readline $DLOC)
|
||||||
CPPFLAGS="$CPPFLAGS -I$I"
|
|
||||||
AC_MSG_NOTICE(found $i)
|
# Some systems require -lcurses, some require -lncurses.
|
||||||
sc_cv_have_readline_h=yes; READLINE_ROOT="$D"
|
# Mac OS X 10.4 (and others) ships with libedit masquerading as readline,
|
||||||
break;
|
# but it doesn't work well with socat. It can be recognized by the absence
|
||||||
fi
|
# of append_history.
|
||||||
done])
|
|
||||||
])
|
for L in "" "-lcurses" "-lncurses"; do
|
||||||
if test "$sc_cv_have_readline_h" = "yes"; then
|
LIBS="$LIBS_ORIG -lreadline $L"
|
||||||
AC_DEFINE(HAVE_READLINE_READLINE_H)
|
AC_TRY_LINK(
|
||||||
AC_DEFINE(HAVE_READLINE_HISTORY_H)
|
[ #include <stdio.h>
|
||||||
fi
|
#include <readline/readline.h>
|
||||||
AC_MSG_NOTICE(checked for readline.h... $sc_cv_have_readline_h)
|
#include <readline/history.h>],
|
||||||
fi # end checking for readline.h
|
[ readline(NULL);
|
||||||
#
|
append_history(0, NULL); ],
|
||||||
if test -n "$WITH_READLINE" -a "$sc_cv_have_readline_h" = yes; then
|
[ sc_usable_readline_found=1
|
||||||
# next, we search for the readline library (libreadline.*)
|
break ])
|
||||||
AC_MSG_CHECKING(for libreadline)
|
done
|
||||||
AC_CACHE_VAL(sc_cv_have_libreadline,
|
|
||||||
[ LIBS0="$LIBS"
|
if test -n "$sc_usable_readline_found"; then
|
||||||
if test -n "$READLINE_ROOT"; then
|
AC_MSG_RESULT(yes)
|
||||||
L="$READLINE_ROOT/lib"; LIBS="$LIBS0 -L$L -lreadline"
|
AC_DEFINE(HAVE_READLINE_READLINE_H,1)
|
||||||
else
|
AC_DEFINE(HAVE_READLINE_HISTORY_H,1)
|
||||||
LIBS="$LIBS0 -lreadline"
|
AC_DEFINE(HAVE_LIBREADLINE,1)
|
||||||
fi
|
AC_DEFINE(WITH_READLINE,1)
|
||||||
AC_TRY_LINK([#include <stdio.h> /* FreeBSD needs FILE * */
|
break
|
||||||
#include <readline/readline.h>
|
else
|
||||||
#include <readline/history.h>],
|
AC_MSG_RESULT(no)
|
||||||
[readline(NULL)],
|
CPPFLAGS=$CPPFLAGS_ORIG
|
||||||
[sc_cv_have_libreadline='yes'],
|
CFLAGS=$CFLAGS_ORIG
|
||||||
[sc_cv_have_libreadline='no'
|
LIBS=$LIBS_ORIG
|
||||||
LIBS1="$LIBS"
|
fi
|
||||||
LIBS="$LIBS -lcurses"
|
done
|
||||||
AC_TRY_LINK([#include <stdio.h> /* FreeBSD needs FILE * */
|
|
||||||
#include <readline/readline.h>
|
if test -z "$sc_usable_readline_found"; then
|
||||||
#include <readline/history.h>],
|
AC_MSG_WARN([no suitable version of readline found; perhaps you need to install a newer version])
|
||||||
[readline(NULL)],
|
|
||||||
[sc_cv_have_libreadline='yes'],
|
|
||||||
[sc_cv_have_libreadline='no'
|
|
||||||
LIBS="$LIBS1 -lncurses" # eg for SuSE52
|
|
||||||
AC_TRY_LINK([#include <stdio.h> /* FreeBSD needs FILE * */
|
|
||||||
#include <readline/readline.h>
|
|
||||||
#include <readline/history.h>],
|
|
||||||
[readline(NULL)],
|
|
||||||
[sc_cv_have_libreadline='yes'],
|
|
||||||
[sc_cv_have_libreadline='no'])
|
|
||||||
])]
|
|
||||||
)
|
|
||||||
if test "$sc_cv_have_libreadline" != 'yes'; then
|
|
||||||
LIBS="$LIBS0"
|
|
||||||
fi
|
|
||||||
]
|
|
||||||
#! missing libcurses dependency; missing freeware places
|
|
||||||
# # we test if libcurses is available and if it can be used without further libs
|
|
||||||
# AC_CHECK_LIB(ncurses, main, , AC_CHECK_LIB(curses, main)) # some Linux work with this
|
|
||||||
# # we test if readline can be used without further libs
|
|
||||||
# AC_CHECK_LIB(readline, readline)
|
|
||||||
# # we see if using_history() is already in $LIBS; if not, we try it with curses
|
|
||||||
# AC_CHECK_FUNC(using_history, , AC_CHECK_LIB(history, using_history,,, -lcurses))
|
|
||||||
#fi
|
|
||||||
)
|
|
||||||
if test "$sc_cv_have_libreadline" = 'yes'; then
|
|
||||||
AC_DEFINE(HAVE_LIBREADLINE)
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($sc_cv_have_libreadline)
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test -n "$WITH_READLINE"; then
|
|
||||||
if test "$sc_cv_have_readline_h" = "yes" -a "$sc_cv_have_libreadline" = "yes"; then
|
|
||||||
AC_DEFINE(WITH_READLINE)
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([not all components of readline found, disabling it]);
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -577,13 +611,14 @@ AC_ARG_ENABLE(tun, [ --disable-tun disable TUN/TAP support],
|
||||||
esac],
|
esac],
|
||||||
[AC_MSG_RESULT(yes); WITH_TUN=1 ])
|
[AC_MSG_RESULT(yes); WITH_TUN=1 ])
|
||||||
|
|
||||||
|
#
|
||||||
|
if ! test "$ac_cv_header_linux_if_tun_h" = 'yes'; then
|
||||||
|
AC_MSG_WARN(include file linux/if_tun.h not found, disabling TUN)
|
||||||
|
WITH_TUN=
|
||||||
|
fi
|
||||||
#
|
#
|
||||||
if test -n "$WITH_TUN"; then
|
if test -n "$WITH_TUN"; then
|
||||||
if test `uname` != Linux; then
|
AC_DEFINE(WITH_TUN)
|
||||||
AC_MSG_NOTICE(only on Linux)
|
|
||||||
else
|
|
||||||
AC_DEFINE(WITH_TUN)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to include system call tracing)
|
AC_MSG_CHECKING(whether to include system call tracing)
|
||||||
|
@ -654,6 +689,7 @@ AC_FUNC_STRFTIME
|
||||||
AC_CHECK_FUNCS(putenv select poll socket strdup strerror strstr strtod strtol)
|
AC_CHECK_FUNCS(putenv select poll socket strdup strerror strstr strtod strtol)
|
||||||
AC_CHECK_FUNCS(strtoul uname getpgid getsid getaddrinfo)
|
AC_CHECK_FUNCS(strtoul uname getpgid getsid getaddrinfo)
|
||||||
AC_CHECK_FUNCS(getipnodebyname setgroups inet_aton memrchr)
|
AC_CHECK_FUNCS(getipnodebyname setgroups inet_aton memrchr)
|
||||||
|
AC_CHECK_FUNCS(if_indextoname)
|
||||||
|
|
||||||
AC_CHECK_FUNCS(grantpt unlockpt ptsname)
|
AC_CHECK_FUNCS(grantpt unlockpt ptsname)
|
||||||
|
|
||||||
|
@ -807,6 +843,27 @@ AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FDS_BITS)],
|
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FDS_BITS)],
|
||||||
[AC_MSG_RESULT(no);])
|
[AC_MSG_RESULT(no);])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for sa_family_t)
|
||||||
|
AC_CACHE_VAL(sc_cv_type_sa_family_t,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>],[sa_family_t s;],
|
||||||
|
[sc_cv_type_sa_family_t=yes],
|
||||||
|
[sc_cv_type_sa_family_t=no])])
|
||||||
|
if test $sc_cv_type_sa_family_t = yes; then
|
||||||
|
AC_DEFINE(HAVE_TYPE_SA_FAMILY_T)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($sc_cv_type_sa_family_t)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for struct sigaction.sa_sigaction)
|
||||||
|
AC_CACHE_VAL(sc_cv_struct_sigaction_sa_sigaction,
|
||||||
|
[AC_TRY_COMPILE([#include <signal.h>],[struct sigaction s;s.sa_sigaction=0;],
|
||||||
|
[sc_cv_struct_sigaction_sa_sigaction=yes],
|
||||||
|
[sc_cv_struct_sigaction_sa_sigaction=no])])
|
||||||
|
if test $sc_cv_struct_sigaction_sa_sigaction = yes; then
|
||||||
|
AC_DEFINE(HAVE_STRUCT_SIGACTION_SA_SIGACTION)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($sc_cv_struct_sigaction_sa_sigaction)
|
||||||
|
|
||||||
### struct termios .c_ispeed
|
### struct termios .c_ispeed
|
||||||
AC_MSG_CHECKING(for termios.c_ispeed)
|
AC_MSG_CHECKING(for termios.c_ispeed)
|
||||||
AC_CACHE_VAL(sc_cv_termios_ispeed,
|
AC_CACHE_VAL(sc_cv_termios_ispeed,
|
||||||
|
@ -1082,6 +1139,32 @@ if test $sc_cv_struct_msghdr_msgflags = yes; then
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($sc_cv_struct_msghdr_msgflags)
|
AC_MSG_RESULT($sc_cv_struct_msghdr_msgflags)
|
||||||
|
|
||||||
|
dnl check for struct cmsghdr
|
||||||
|
AC_MSG_CHECKING(for struct cmsghdr)
|
||||||
|
AC_CACHE_VAL(sc_cv_struct_cmsghdr,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <net/if.h>],[struct cmsghdr s;],
|
||||||
|
[sc_cv_struct_cmsghdr=yes],
|
||||||
|
[sc_cv_struct_cmsghdr=no])])
|
||||||
|
if test $sc_cv_struct_cmsghdr = yes; then
|
||||||
|
AC_DEFINE(HAVE_STRUCT_CMSGHDR)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($sc_cv_struct_cmsghdr)
|
||||||
|
|
||||||
|
dnl check for struct in_pktinfo
|
||||||
|
AC_MSG_CHECKING(for struct in_pktinfo)
|
||||||
|
AC_CACHE_VAL(sc_cv_struct_in_pktinfo,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>],[struct in_pktinfo s;],
|
||||||
|
[sc_cv_struct_in_pktinfo=yes],
|
||||||
|
[sc_cv_struct_in_pktinfo=no])])
|
||||||
|
if test $sc_cv_struct_in_pktinfo = yes; then
|
||||||
|
AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($sc_cv_struct_in_pktinfo)
|
||||||
|
|
||||||
dnl check for ip_hl in struct ip
|
dnl check for ip_hl in struct ip
|
||||||
AC_MSG_CHECKING(for struct ip.ip_hl)
|
AC_MSG_CHECKING(for struct ip.ip_hl)
|
||||||
AC_CACHE_VAL(sc_cv_struct_ip_ip_hl,
|
AC_CACHE_VAL(sc_cv_struct_ip_ip_hl,
|
||||||
|
@ -1153,6 +1236,9 @@ dnl Search for setenv()
|
||||||
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
|
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
|
||||||
AC_CHECK_LIB(isode, setenv, [LIBS="-lisode $LIBS"]))
|
AC_CHECK_LIB(isode, setenv, [LIBS="-lisode $LIBS"]))
|
||||||
|
|
||||||
|
dnl Search for unsetenv()
|
||||||
|
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV))
|
||||||
|
|
||||||
|
|
||||||
dnl Run time checks
|
dnl Run time checks
|
||||||
|
|
||||||
|
@ -1196,7 +1282,11 @@ AC_CACHE_CHECK(shift offset of $1, $2,
|
||||||
if (n==0) {fprintf(stderr,"$1 is 0 (impossible!)\n"); exit(1);}
|
if (n==0) {fprintf(stderr,"$1 is 0 (impossible!)\n"); exit(1);}
|
||||||
i=0; while (!(n&1)) {
|
i=0; while (!(n&1)) {
|
||||||
n>>=1; ++i; }
|
n>>=1; ++i; }
|
||||||
fprintf(f, "%u", i);
|
if (3<<i == $1) {
|
||||||
|
fprintf(f, "%u", i);
|
||||||
|
} else {
|
||||||
|
fprintf(f, "-1"); /* anticipate result of xioinitialize assert */
|
||||||
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1317,7 +1407,7 @@ AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_blksize, HAVE_TYP
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_blocks, HAVE_TYPEOF_ST64_BLOCKS, sc_cv_type_stat64_stblocks_basic)
|
AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_blocks, HAVE_TYPEOF_ST64_BLOCKS, sc_cv_type_stat64_stblocks_basic)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/time.h>], struct timeval, tv_usec, HAVE_TYPEOF_STRUCT_TIMEVAL_TVUSEC, sc_cv_type_struct_timeval_tvusec)
|
AC_TYPEOF_COMPONENT([#include <sys/time.h>], struct timeval, tv_usec, HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC, sc_cv_type_struct_timeval_tv_usec)
|
||||||
|
|
||||||
AC_TYPEOF_COMPONENT([#include <sys/types.h>
|
AC_TYPEOF_COMPONENT([#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
1
dalan.c
1
dalan.c
|
@ -68,6 +68,7 @@ void dalan_init(void) {
|
||||||
|
|
||||||
/* read data description from line, write result to data; do not write
|
/* read data description from line, write result to data; do not write
|
||||||
so much data that *p exceeds n !
|
so much data that *p exceeds n !
|
||||||
|
p must be initialized to 0.
|
||||||
return 0 on success,
|
return 0 on success,
|
||||||
-1 if the data was cut due to n limit,
|
-1 if the data was cut due to n limit,
|
||||||
1 if a syntax error occurred
|
1 if a syntax error occurred
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
<!-- $Revision: 1.1 $ $Date: 2007/03/06 20:42:56 $ -->
|
table {
|
||||||
<html><head>
|
empty-cells:show;
|
||||||
<title>dest-unreach.org stylesheet</title>
|
}
|
||||||
<style type="text/css">
|
|
||||||
.frame { border-style:solid; border-width:4px; border-color:black; }
|
.frame { border-style:solid; border-width:4px; border-color:black; }
|
||||||
.shell { font-family:Courier;
|
.shell { font-family:Courier;
|
||||||
padding:2px; padding-left:6px; padding-right:6px;
|
padding:2px; padding-left:6px; padding-right:6px;
|
||||||
border-style:solid; border-width:1px; border-color:gray;
|
border-style:solid; border-width:1px; border-color:gray;
|
||||||
color:lightgreen; background-color:black;
|
color:lightgreen; background-color:black;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -240,8 +240,7 @@ interfaces. This membership cannot be dropped on Linux.
|
||||||
sockets without exception accept packets that are directly addressed to them;
|
sockets without exception accept packets that are directly addressed to them;
|
||||||
the multi- and broadcast receiving features are just extensions to the normal
|
the multi- and broadcast receiving features are just extensions to the normal
|
||||||
functionality. socat has no way to find out if an incoming packet is addressed
|
functionality. socat has no way to find out if an incoming packet is addressed
|
||||||
to a unicast, multicast or broadcast address. Please contact the author if you
|
to a unicast, multicast, or broadcast address.</p>
|
||||||
know how the target address can be determined.</p>
|
|
||||||
|
|
||||||
<p>Authentication or encryption are not available.</p>
|
<p>Authentication or encryption are not available.</p>
|
||||||
|
|
||||||
|
|
630
doc/socat.yo
630
doc/socat.yo
|
@ -10,7 +10,7 @@ def(Filan)(0)(bf(Filan))
|
||||||
def(procan)(0)(bf(procan))
|
def(procan)(0)(bf(procan))
|
||||||
def(Procan)(0)(bf(Procan))
|
def(Procan)(0)(bf(Procan))
|
||||||
|
|
||||||
manpage(socat)(1)(Feb 2008)(socat)()
|
manpage(socat)(1)(Oct 2008)()()
|
||||||
|
|
||||||
whenhtml(
|
whenhtml(
|
||||||
label(CONTENTS)
|
label(CONTENTS)
|
||||||
|
@ -127,7 +127,8 @@ dit(bf(tt(-lf))tt( <logfile>))
|
||||||
dit(bf(tt(-ls)))
|
dit(bf(tt(-ls)))
|
||||||
Writes messages to stderr (this is the default).
|
Writes messages to stderr (this is the default).
|
||||||
label(option_lp)dit(bf(tt(-lp))tt(<progname>))
|
label(option_lp)dit(bf(tt(-lp))tt(<progname>))
|
||||||
Overrides the program name printed in error messages.
|
Overrides the program name printed in error messages and used for
|
||||||
|
constructing environment variable names.
|
||||||
dit(bf(tt(-lu)))
|
dit(bf(tt(-lu)))
|
||||||
Extends the timestamp of error messages to microsecond resolution. Does not
|
Extends the timestamp of error messages to microsecond resolution. Does not
|
||||||
work when logging to syslog.
|
work when logging to syslog.
|
||||||
|
@ -347,6 +348,15 @@ label(ADDRESS_IP_SENDTO)dit(bf(tt(IP-SENDTO:<host>:<protocol>)))
|
||||||
link(IP-RECV)(ADDRESS_IP_RECV),
|
link(IP-RECV)(ADDRESS_IP_RECV),
|
||||||
link(UDP-SENDTO)(ADDRESS_UDP_SENDTO)
|
link(UDP-SENDTO)(ADDRESS_UDP_SENDTO)
|
||||||
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO)
|
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO)
|
||||||
|
label(ADDRESS_INTERFACE)dit(bf(tt(INTERFACE:<interface>)))
|
||||||
|
Communicate with a network connected on an interface using raw packets
|
||||||
|
including link level data. link(<interface>)(TYPE_INTERFACE) is the name of
|
||||||
|
the network interface. Currently only available on Linux.
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET) nl()
|
||||||
|
Useful options:
|
||||||
|
link(pf)(OPTION_PROTOCOL_FAMILY)
|
||||||
|
link(type)(OPTION_SO_TYPE)nl()
|
||||||
|
See also: link(ip-recv)(ADDRESS_IP_RECV)
|
||||||
label(ADDRESS_IP4_SENDTO)dit(bf(tt(IP4-SENDTO:<host>:<protocol>)))
|
label(ADDRESS_IP4_SENDTO)dit(bf(tt(IP4-SENDTO:<host>:<protocol>)))
|
||||||
Like link(IP-SENDTO)(ADDRESS_IP_SENDTO), but always uses IPv4.nl()
|
Like link(IP-SENDTO)(ADDRESS_IP_SENDTO), but always uses IPv4.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4) nl()
|
||||||
|
@ -364,6 +374,7 @@ label(ADDRESS_IP_DATAGRAM)dit(bf(tt(IP-DATAGRAM:<address>:<protocol>)))
|
||||||
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
||||||
link(IP4)(GROUP_IP4), link(IP6)(GROUP_IP6), link(RANGE)(GROUP_RANGE) nl()
|
link(IP4)(GROUP_IP4), link(IP6)(GROUP_IP6), link(RANGE)(GROUP_RANGE) nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
link(range)(OPTION_RANGE),
|
link(range)(OPTION_RANGE),
|
||||||
link(tcpwrap)(OPTION_TCPWRAPPERS),
|
link(tcpwrap)(OPTION_TCPWRAPPERS),
|
||||||
link(broadcast)(OPTION_SO_BROADCAST),
|
link(broadcast)(OPTION_SO_BROADCAST),
|
||||||
|
@ -373,7 +384,6 @@ label(ADDRESS_IP_DATAGRAM)dit(bf(tt(IP-DATAGRAM:<address>:<protocol>)))
|
||||||
link(ip-add-membership)(OPTION_IP_ADD_MEMBERSHIP),
|
link(ip-add-membership)(OPTION_IP_ADD_MEMBERSHIP),
|
||||||
link(ttl)(OPTION_TTL),
|
link(ttl)(OPTION_TTL),
|
||||||
link(tos)(OPTION_TOS),
|
link(tos)(OPTION_TOS),
|
||||||
link(bind)(OPTION_BIND),
|
|
||||||
link(pf)(OPTION_PROTOCOL_FAMILY)nl()
|
link(pf)(OPTION_PROTOCOL_FAMILY)nl()
|
||||||
See also:
|
See also:
|
||||||
link(IP4-DATAGRAM)(ADDRESS_IP4_DATAGRAM),
|
link(IP4-DATAGRAM)(ADDRESS_IP4_DATAGRAM),
|
||||||
|
@ -599,6 +609,209 @@ label(ADDRESS_READLINE)dit(bf(tt(READLINE)))
|
||||||
link(noecho)(OPTION_NOECHO)nl()
|
link(noecho)(OPTION_NOECHO)nl()
|
||||||
See also:
|
See also:
|
||||||
link(STDIO)(ADDRESS_STDIO)
|
link(STDIO)(ADDRESS_STDIO)
|
||||||
|
label(ADDRESS_SCTP_CONNECT)dit(bf(tt(SCTP-CONNECT:<host>:<port>)))
|
||||||
|
Establishes an SCTP stream connection to the specified <host> [link(IP
|
||||||
|
address)(TYPE_IP_ADDRESS)] and <port> [link(TCP service)(TYPE_TCP_SERVICE)]
|
||||||
|
using TCP/IP version 4 or 6 depending on address specification, name
|
||||||
|
resolution, or option link(pf)(OPTION_PROTOCOL_FAMILY) (link(example)(EXAMPLE_SCTP_OPENSSL_IP6)).nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
|
link(pf)(OPTION_PROTOCOL_FAMILY),
|
||||||
|
link(connect-timeout)(OPTION_CONNECT_TIMEOUT),
|
||||||
|
link(tos)(OPTION_TOS),
|
||||||
|
link(mtudiscover)(OPTION_MTUDISCOVER),
|
||||||
|
link(sctp-maxseg)(OPTION_SCTP_MAXSEG),
|
||||||
|
link(sctp-nodelay)(OPTION_SCTP_NODELAY),
|
||||||
|
link(nonblock)(OPTION_NONBLOCK),
|
||||||
|
link(sourceport)(OPTION_SOURCEPORT),
|
||||||
|
link(retry)(OPTION_RETRY),
|
||||||
|
link(readbytes)(OPTION_READBYTES)nl()
|
||||||
|
See also:
|
||||||
|
link(SCTP4-CONNECT)(ADDRESS_SCTP4_CONNECT),
|
||||||
|
link(SCTP6-CONNECT)(ADDRESS_SCTP6_CONNECT),
|
||||||
|
link(SCTP-LISTEN)(ADDRESS_SCTP_LISTEN),
|
||||||
|
link(TCP-CONNECT)(ADDRESS_TCP_CONNECT)
|
||||||
|
label(ADDRESS_SCTP4_CONNECT)dit(bf(tt(SCTP4-CONNECT:<host>:<port>)))
|
||||||
|
Like link(SCTP-CONNECT)(ADDRESS_SCTP_CONNECT), but only supports IPv4 protocol.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(SCTP)(GROUP_SCTP),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
label(ADDRESS_SCTP6_CONNECT)dit(bf(tt(SCTP6-CONNECT:<host>:<port>)))
|
||||||
|
Like link(SCTP-CONNECT)(ADDRESS_SCTP_CONNECT), but only supports IPv6 protocol.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
label(ADDRESS_SCTP_LISTEN)dit(bf(tt(SCTP-LISTEN:<port>)))
|
||||||
|
Listens on <port> [link(TCP service)(TYPE_TCP_SERVICE)] and accepts a
|
||||||
|
TCP/IP connection. The IP version is 4 or the one specified with
|
||||||
|
address option link(pf)(OPTION_PROTOCOL_FAMILY), socat option
|
||||||
|
(link(-4)(option_4), link(-6)(option_6)), or environment variable link(SOCAT_DEFAULT_LISTEN_IP)(ENV_SOCAT_DEFAULT_LISTEN_IP).
|
||||||
|
Note that opening
|
||||||
|
this address usually blocks until a client connects.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
Useful options:
|
||||||
|
link(crnl)(OPTION_CRNL),
|
||||||
|
link(fork)(OPTION_FORK),
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
|
link(range)(OPTION_RANGE),
|
||||||
|
link(tcpwrap)(OPTION_TCPWRAPPERS),
|
||||||
|
link(pf)(OPTION_PROTOCOL_FAMILY),
|
||||||
|
link(backlog)(OPTION_BACKLOG),
|
||||||
|
link(sctp-maxseg)(OPTION_SCTP_MAXSEG),
|
||||||
|
link(sctp-nodelay)(OPTION_SCTP_NODELAY),
|
||||||
|
link(su)(OPTION_SUBSTUSER),
|
||||||
|
link(reuseaddr)(OPTION_REUSEADDR),
|
||||||
|
link(retry)(OPTION_RETRY),
|
||||||
|
link(cool-write)(OPTION_COOL_WRITE)nl()
|
||||||
|
See also:
|
||||||
|
link(SCTP4-LISTEN)(ADDRESS_SCTP4_LISTEN),
|
||||||
|
link(SCTP6-LISTEN)(ADDRESS_SCTP6_LISTEN),
|
||||||
|
link(TCP-LISTEN)(ADDRESS_TCP_LISTEN),
|
||||||
|
link(SCTP-CONNECT)(ADDRESS_SCTP_CONNECT)
|
||||||
|
label(ADDRESS_SCTP4_LISTEN)dit(bf(tt(SCTP4-LISTEN:<port>)))
|
||||||
|
Like link(SCTP-LISTEN)(ADDRESS_SCTP_LISTEN), but only supports IPv4
|
||||||
|
protocol.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP4)(GROUP_IP4),link(SCTP)(GROUP_SCTP),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
label(ADDRESS_SCTP6_LISTEN)dit(bf(tt(SCTP6-LISTEN:<port>)))
|
||||||
|
Like link(SCTP-LISTEN)(ADDRESS_SCTP_LISTEN), but only supports IPv6
|
||||||
|
protocol.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
label(ADDRESS_SOCKET_CONNECT)dit(bf(tt(SOCKET-CONNECT:<domain>:<protocol>:<remote-address>)))
|
||||||
|
Creates a stream socket using the first and second given socket parameters
|
||||||
|
and tt(SOCK_STREAM) (see man socket(2)) and connects to the remote-address.
|
||||||
|
The two socket parameters have to be specified by link(int)(TYPE_INT)
|
||||||
|
numbers. Consult your OS documentation and include files to find the
|
||||||
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
representation of a sockaddr structure without sa_family and (BSD) sa_len
|
||||||
|
components.nl()
|
||||||
|
Please note that you can - beyond the options of the specified groups - also
|
||||||
|
use options of higher level protocols when you apply socat option
|
||||||
|
link(-g)(option_g).nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY)nl()
|
||||||
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(TCP)(ADDRESS_TCP_CONNECT),
|
||||||
|
link(UDP-CONNECT)(ADDRESS_UDP_CONNECT),
|
||||||
|
link(UNIX-CONNECT)(ADDRESS_UNIX_CONNECT),
|
||||||
|
link(SOCKET-LISTEN)(ADDRESS_SOCKET_LISTEN),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO)
|
||||||
|
label(ADDRESS_SOCKET_DATAGRAM)dit(bf(tt(SOCKET-DATAGRAM:<domain>:<type>:<protocol>:<remote-address>)))
|
||||||
|
Creates a datagram socket using the first three given socket parameters (see
|
||||||
|
man socket(2)) and sends outgoing data to the remote-address. The three
|
||||||
|
socket parameters have to be specified by link(int)(TYPE_INT)
|
||||||
|
numbers. Consult your OS documentation and include files to find the
|
||||||
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
representation of a sockaddr structure without sa_family and (BSD) sa_len
|
||||||
|
components.nl()
|
||||||
|
Please note that you can - beyond the options of the specified groups - also
|
||||||
|
use options of higher level protocols when you apply socat option
|
||||||
|
link(-g)(option_g).nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(RANGE)(GROUP_RANGE)nl()
|
||||||
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
|
link(range)(OPTION_RANGE),
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(UDP-DATAGRAM)(ADDRESS_UDP_DATAGRAM),
|
||||||
|
link(IP-DATAGRAM)(ADDRESS_IP_DATAGRAM),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
||||||
|
link(SOCKET-RECV)(ADDRESS_SOCKET_RECV),
|
||||||
|
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
||||||
|
label(ADDRESS_SOCKET_LISTEN)dit(bf(tt(SOCKET-LISTEN:<domain>:<protocol>:<local-address>)))
|
||||||
|
Creates a stream socket using the first and second given socket parameters
|
||||||
|
and tt(SOCK_STREAM) (see man socket(2)) and waits for incoming connections
|
||||||
|
on local-address. The two socket parameters have to be specified by
|
||||||
|
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
||||||
|
to find the appropriate values. The local-address must be the
|
||||||
|
link(data)(TYPE_DATA) representation of a sockaddr structure without
|
||||||
|
sa_family and (BSD) sa_len components.nl()
|
||||||
|
Please note that you can - beyond the options of the specified groups - also
|
||||||
|
use options of higher level protocols when you apply socat option
|
||||||
|
link(-g)(option_g).nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(RANGE)(GROUP_RANGE),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY)nl()
|
||||||
|
Useful options:
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(TCP)(ADDRESS_TCP_LISTEN),
|
||||||
|
link(UDP-CONNECT)(ADDRESS_UDP_LISTEN),
|
||||||
|
link(UNIX-CONNECT)(ADDRESS_UNIX_LISTEN),
|
||||||
|
link(SOCKET-LISTEN)(ADDRESS_SOCKET_CONNECT),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECVFROM),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECV)
|
||||||
|
label(ADDRESS_SOCKET_RECV)dit(bf(tt(SOCKET-RECV:<domain>:<type>:<protocol>:<local-address>)))
|
||||||
|
Creates a socket using the three given socket parameters (see man socket(2))
|
||||||
|
and binds it to <local-address>. Receives arriving data. The three
|
||||||
|
parameters have to be specified by link(int)(TYPE_INT) numbers. Consult your
|
||||||
|
OS documentation and include files to find the appropriate values. The
|
||||||
|
local-address must be the link(data)(TYPE_DATA) representation of a sockaddr
|
||||||
|
structure without sa_family and (BSD) sa_len components.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(RANGE)(GROUP_RANGE)nl()
|
||||||
|
Useful options:
|
||||||
|
link(range)(OPTION_RANGE),
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(UDP-RECV)(ADDRESS_UDP_RECV),
|
||||||
|
link(IP-RECV)(ADDRESS_IP_RECV),
|
||||||
|
link(UNIX-RECV)(ADDRESS_UNIX_RECV),
|
||||||
|
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
||||||
|
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
||||||
|
label(ADDRESS_SOCKET_RECVFROM)dit(bf(tt(SOCKET-RECVFROM:<domain>:<type>:<protocol>:<local-address>)))
|
||||||
|
Creates a socket using the three given socket parameters (see man socket(2))
|
||||||
|
and binds it to <local-address>. Receives arriving data and sends replies
|
||||||
|
back to the sender. The first three parameters have to be specified as
|
||||||
|
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
||||||
|
to find the appropriate values. The local-address must be the
|
||||||
|
link(data)(TYPE_DATA) representation of a sockaddr structure without
|
||||||
|
sa_family and (BSD) sa_len components.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE)nl()
|
||||||
|
Useful options:
|
||||||
|
link(fork)(OPTION_FORK),
|
||||||
|
link(range)(OPTION_RANGE),
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(UDP-RECVFROM)(ADDRESS_UDP_RECVFROM),
|
||||||
|
link(IP-RECVFROM)(ADDRESS_IP_RECVFROM),
|
||||||
|
link(UNIX-RECVFROM)(ADDRESS_UNIX_RECVFROM),
|
||||||
|
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
||||||
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
||||||
|
link(SOCKET-RECV)(ADDRESS_SOCKET_RECV)
|
||||||
|
label(ADDRESS_SOCKET_SENDTO)dit(bf(tt(SOCKET-SENDTO:<domain>:<type>:<protocol>:<remote-address>)))
|
||||||
|
Creates a socket using the three given socket parameters (see man
|
||||||
|
socket(2)). Sends outgoing data to the given address and receives replies.
|
||||||
|
The three parameters have to be specified as link(int)(TYPE_INT)
|
||||||
|
numbers. Consult your OS documentation and include files to find the
|
||||||
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
representation of a sockaddr structure without sa_family and (BSD) sa_len
|
||||||
|
components.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET)nl()
|
||||||
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
|
link(setsockopt-int)(OPTION_SETSOCKOPT_INT),
|
||||||
|
link(setsockopt-bin)(OPTION_SETSOCKOPT_BIN),
|
||||||
|
link(setsockopt-string)(OPTION_SETSOCKOPT_STRING)
|
||||||
|
nl()
|
||||||
|
See also:
|
||||||
|
link(UDP-SENDTO)(ADDRESS_UDP_SENDTO),
|
||||||
|
link(IP-SENDTO)(ADDRESS_IP_SENDTO),
|
||||||
|
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO),
|
||||||
|
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
||||||
|
link(SOCKET-RECV)(ADDRESS_SOCKET_RECV)
|
||||||
|
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
||||||
label(ADDRESS_SOCKS4)dit(bf(tt(SOCKS4:<socks-server>:<host>:<port>)))
|
label(ADDRESS_SOCKS4)dit(bf(tt(SOCKS4:<socks-server>:<host>:<port>)))
|
||||||
Connects via <socks-server> [link(IP address)(TYPE_IP_ADDRESS)]
|
Connects via <socks-server> [link(IP address)(TYPE_IP_ADDRESS)]
|
||||||
to <host> [link(IPv4 address)(TYPE_IPV4_ADDRESS)]
|
to <host> [link(IPv4 address)(TYPE_IPV4_ADDRESS)]
|
||||||
|
@ -689,6 +902,7 @@ label(ADDRESS_TCP_CONNECT)dit(bf(tt(TCP:<host>:<port>)))
|
||||||
link(TCP6)(ADDRESS_TCP6_CONNECT),
|
link(TCP6)(ADDRESS_TCP6_CONNECT),
|
||||||
link(TCP-LISTEN)(ADDRESS_TCP_LISTEN),
|
link(TCP-LISTEN)(ADDRESS_TCP_LISTEN),
|
||||||
link(UDP)(ADDRESS_UDP_CONNECT),
|
link(UDP)(ADDRESS_UDP_CONNECT),
|
||||||
|
link(SCTP-CONNECT)(ADDRESS_SCTP_CONNECT),
|
||||||
link(UNIX-CONNECT)(ADDRESS_UNIX_CONNECT)
|
link(UNIX-CONNECT)(ADDRESS_UNIX_CONNECT)
|
||||||
label(ADDRESS_TCP4_CONNECT)dit(bf(tt(TCP4:<host>:<port>)))
|
label(ADDRESS_TCP4_CONNECT)dit(bf(tt(TCP4:<host>:<port>)))
|
||||||
Like link(TCP)(ADDRESS_TCP_CONNECT), but only supports IPv4 protocol (link(example)(EXAMPLE_ADDRESS_TCP4_CONNECT)).nl()
|
Like link(TCP)(ADDRESS_TCP_CONNECT), but only supports IPv4 protocol (link(example)(EXAMPLE_ADDRESS_TCP4_CONNECT)).nl()
|
||||||
|
@ -699,7 +913,8 @@ label(ADDRESS_TCP6_CONNECT)dit(bf(tt(TCP6:<host>:<port>)))
|
||||||
label(ADDRESS_TCP_LISTEN)dit(bf(tt(TCP-LISTEN:<port>)))
|
label(ADDRESS_TCP_LISTEN)dit(bf(tt(TCP-LISTEN:<port>)))
|
||||||
Listens on <port> [link(TCP service)(TYPE_TCP_SERVICE)] and accepts a
|
Listens on <port> [link(TCP service)(TYPE_TCP_SERVICE)] and accepts a
|
||||||
TCP/IP connection. The IP version is 4 or the one specified with
|
TCP/IP connection. The IP version is 4 or the one specified with
|
||||||
link(pf)(OPTION_PROTOCOL_FAMILY).
|
address option link(pf)(OPTION_PROTOCOL_FAMILY), socat option
|
||||||
|
(link(-4)(option_4), link(-6)(option_6)), or environment variable link(SOCAT_DEFAULT_LISTEN_IP)(ENV_SOCAT_DEFAULT_LISTEN_IP).
|
||||||
Note that opening
|
Note that opening
|
||||||
this address usually blocks until a client connects.nl()
|
this address usually blocks until a client connects.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(TCP)(GROUP_TCP),link(RETRY)(GROUP_RETRY) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(TCP)(GROUP_TCP),link(RETRY)(GROUP_RETRY) nl()
|
||||||
|
@ -715,13 +930,15 @@ label(ADDRESS_TCP_LISTEN)dit(bf(tt(TCP-LISTEN:<port>)))
|
||||||
link(su)(OPTION_SUBSTUSER),
|
link(su)(OPTION_SUBSTUSER),
|
||||||
link(reuseaddr)(OPTION_REUSEADDR),
|
link(reuseaddr)(OPTION_REUSEADDR),
|
||||||
link(retry)(OPTION_RETRY),
|
link(retry)(OPTION_RETRY),
|
||||||
link(retry)(OPTION_COOL_WRITE)nl()
|
link(cool-write)(OPTION_COOL_WRITE)nl()
|
||||||
See also:
|
See also:
|
||||||
link(TCP4-LISTEN)(ADDRESS_TCP4_CONNECT),
|
link(TCP4-LISTEN)(ADDRESS_TCP4_LISTEN),
|
||||||
link(TCP6-LISTEN)(ADDRESS_TCP6_LISTEN),
|
link(TCP6-LISTEN)(ADDRESS_TCP6_LISTEN),
|
||||||
link(UDP-LISTEN)(ADDRESS_UDP_LISTEN),
|
link(UDP-LISTEN)(ADDRESS_UDP_LISTEN),
|
||||||
|
link(SCTP-LISTEN)(ADDRESS_SCTP_LISTEN),
|
||||||
link(UNIX-LISTEN)(ADDRESS_UNIX_LISTEN),
|
link(UNIX-LISTEN)(ADDRESS_UNIX_LISTEN),
|
||||||
link(OPENSSL-LISTEN)(ADDRESS_OPENSSL_LISTEN)
|
link(OPENSSL-LISTEN)(ADDRESS_OPENSSL_LISTEN),
|
||||||
|
link(TCP-CONNECT)(ADDRESS_TCP_CONNECT)
|
||||||
label(ADDRESS_TCP4_LISTEN)dit(bf(tt(TCP4-LISTEN:<port>)))
|
label(ADDRESS_TCP4_LISTEN)dit(bf(tt(TCP4-LISTEN:<port>)))
|
||||||
Like link(TCP-LISTEN)(ADDRESS_TCP_LISTEN), but only supports IPv4
|
Like link(TCP-LISTEN)(ADDRESS_TCP_LISTEN), but only supports IPv4
|
||||||
protocol (link(example)(EXAMPLE_ADDRESS_TCP4_LISTEN)).nl()
|
protocol (link(example)(EXAMPLE_ADDRESS_TCP4_LISTEN)).nl()
|
||||||
|
@ -783,7 +1000,8 @@ label(ADDRESS_UDP_DATAGRAM)dit(bf(tt(UDP-DATAGRAM:<address>:<port>)))
|
||||||
options. This address type can for example be used for implementing
|
options. This address type can for example be used for implementing
|
||||||
symmetric or asymmetric broadcast or multicast communications.nl()
|
symmetric or asymmetric broadcast or multicast communications.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE) nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
|
link(bind)(OPTION_BIND),
|
||||||
link(range)(OPTION_RANGE),
|
link(range)(OPTION_RANGE),
|
||||||
link(tcpwrap)(OPTION_TCPWRAPPERS),
|
link(tcpwrap)(OPTION_TCPWRAPPERS),
|
||||||
link(broadcast)(OPTION_SO_BROADCAST),
|
link(broadcast)(OPTION_SO_BROADCAST),
|
||||||
|
@ -793,7 +1011,6 @@ label(ADDRESS_UDP_DATAGRAM)dit(bf(tt(UDP-DATAGRAM:<address>:<port>)))
|
||||||
link(ip-add-membership)(OPTION_IP_ADD_MEMBERSHIP),
|
link(ip-add-membership)(OPTION_IP_ADD_MEMBERSHIP),
|
||||||
link(ttl)(OPTION_TTL),
|
link(ttl)(OPTION_TTL),
|
||||||
link(tos)(OPTION_TOS),
|
link(tos)(OPTION_TOS),
|
||||||
link(bind)(OPTION_BIND),
|
|
||||||
link(sourceport)(OPTION_SOURCEPORT),
|
link(sourceport)(OPTION_SOURCEPORT),
|
||||||
link(pf)(OPTION_PROTOCOL_FAMILY)nl()
|
link(pf)(OPTION_PROTOCOL_FAMILY)nl()
|
||||||
See also:
|
See also:
|
||||||
|
@ -1264,6 +1481,24 @@ label(OPTION_END_CLOSE)dit(bf(tt(end-close)))
|
||||||
Similarly, when an address of type EXEC or SYSTEM is ended, socat usually
|
Similarly, when an address of type EXEC or SYSTEM is ended, socat usually
|
||||||
will explicitely kill the sub process. With this option, it will just close
|
will explicitely kill the sub process. With this option, it will just close
|
||||||
the file descriptors.
|
the file descriptors.
|
||||||
|
label(OPTION_IOCTL_VOID)dit(bf(tt(ioctl-void=<request>)))
|
||||||
|
Calls tt(ioctl()) with the request value as second argument and NULL as
|
||||||
|
third argument. This option allows to utilize ioctls that are not
|
||||||
|
explicitely implemented in socat.
|
||||||
|
label(OPTION_IOCTL_INT)dit(bf(tt(ioctl-int=<reqeust>:<value>)))
|
||||||
|
Calls tt(ioctl()) with the request value as second argument and the integer
|
||||||
|
value as third argument.
|
||||||
|
label(OPTION_IOCTL_INTP)dit(bf(tt(ioctl-intp=<reqeust>:<value>)))
|
||||||
|
Calls tt(ioctl()) with the request value as second argument and a pointer to
|
||||||
|
the integer value as third argument.
|
||||||
|
label(OPTION_IOCTL_BIN)dit(bf(tt(ioctl-bin=<reqeust>:<value>)))
|
||||||
|
Calls tt(ioctl()) with the request value as second argument and a pointer to
|
||||||
|
the given data value as third argument. This data must be specified in
|
||||||
|
link(<dalan>)(TYPE_DATA) form.
|
||||||
|
label(OPTION_IOCTL_STRING)dit(bf(tt(ioctl-string=<reqeust>:<value>)))
|
||||||
|
Calls tt(ioctl()) with the request value as second argument and a pointer to
|
||||||
|
the given string as third argument.
|
||||||
|
link(<dalan>)(TYPE_DATA) form.
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
@ -1516,6 +1751,10 @@ label(OPTION_LOCKFILE)dit(bf(tt(lockfile=<filename>)))
|
||||||
label(OPTION_WAITLOCK)dit(bf(tt(waitlock=<filename>)))
|
label(OPTION_WAITLOCK)dit(bf(tt(waitlock=<filename>)))
|
||||||
If lockfile exists, waits until it disappears. When lockfile does not exist,
|
If lockfile exists, waits until it disappears. When lockfile does not exist,
|
||||||
creates it and continues, unlinks lockfile on exit.
|
creates it and continues, unlinks lockfile on exit.
|
||||||
|
label(OPTION_ESCAPE)dit(bf(tt(escape=<int>)))
|
||||||
|
Specifies the numeric code of a character that triggers EOF on the input
|
||||||
|
stream. It is useful with a terminal in raw mode
|
||||||
|
(link(example)(EXAMPLE_OPTION_ESCAPE)).
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
@ -1539,8 +1778,8 @@ label(OPTION_INTERFACE)dit(bf(tt(interface=<interface>)))
|
||||||
label(OPTION_SO_BROADCAST)dit(bf(tt(broadcast)))
|
label(OPTION_SO_BROADCAST)dit(bf(tt(broadcast)))
|
||||||
For datagram sockets, allows sending to broadcast addresses and receiving
|
For datagram sockets, allows sending to broadcast addresses and receiving
|
||||||
packets addressed to broadcast addresses.
|
packets addressed to broadcast addresses.
|
||||||
label(OPTION_BSDCOMPAT)dit(bf(tt(bsdcompat)))
|
COMMENT(label(OPTION_BSDCOMPAT)dit(bf(tt(bsdcompat)))
|
||||||
Emulates some (old?) bugs of the BSD socket implementation.
|
Emulates some (old?) bugs of the BSD socket implementation.)
|
||||||
label(OPTION_DEBUG)dit(bf(tt(debug)))
|
label(OPTION_DEBUG)dit(bf(tt(debug)))
|
||||||
Enables socket debugging.
|
Enables socket debugging.
|
||||||
label(OPTION_DONTROUTE)dit(bf(tt(dontroute)))
|
label(OPTION_DONTROUTE)dit(bf(tt(dontroute)))
|
||||||
|
@ -1585,11 +1824,23 @@ label(OPTION_SNDLOWAT)dit(bf(tt(sndlowat=<bytes>)))
|
||||||
layer will send the data to <bytes> [link(int)(TYPE_INT)].
|
layer will send the data to <bytes> [link(int)(TYPE_INT)].
|
||||||
label(OPTION_SNDTIMEO)dit(bf(tt(sndtimeo=<seconds>)))
|
label(OPTION_SNDTIMEO)dit(bf(tt(sndtimeo=<seconds>)))
|
||||||
Sets the send timeout to seconds [link(timeval)(TYPE_TIMEVAL)].
|
Sets the send timeout to seconds [link(timeval)(TYPE_TIMEVAL)].
|
||||||
label(OPTION_TYPE)dit(bf(tt(type=<type>)))
|
label(OPTION_PROTOCOL_FAMILY)dit(bf(tt(pf=<string>)))
|
||||||
Sets the type of the socket, usually as argument to the code(socket()) or
|
Forces the use of the specified IP version or protocol. <string> can be
|
||||||
code(socketpair()) call, to <type> [link(int)(TYPE_INT)].
|
something like "ip4" or "ip6". The resulting value is
|
||||||
|
used as first argument to the code(socket()) or code(socketpair()) calls.
|
||||||
|
This option affects address resolution and the required syntax of bind and
|
||||||
|
range options.
|
||||||
|
label(OPTION_SO_TYPE)dit(bf(tt(type=<type>)))
|
||||||
|
Sets the type of the socket, specified as second argument to the
|
||||||
|
code(socket()) or code(socketpair()) calls, to <type>
|
||||||
|
[link(int)(TYPE_INT)]. Address resolution is not affected by this option.
|
||||||
Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3
|
Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3
|
||||||
means raw socket.
|
means raw socket.
|
||||||
|
label(OPTION_SO_PROTOTYPE)dit(bf(tt(prototype)))
|
||||||
|
Sets the protocol of the socket, specified as third argument to the
|
||||||
|
code(socket()) or code(socketpair()) calls, to <prototype>
|
||||||
|
[link(int)(TYPE_INT)]. Address resolution is not affected by this option.
|
||||||
|
6 means TCP, 17 means UDP.
|
||||||
COMMENT(label(OPTION_USELOOPBACK)dit(bf(tt(useloopback)))
|
COMMENT(label(OPTION_USELOOPBACK)dit(bf(tt(useloopback)))
|
||||||
Sets the code(SO_USELOOPBACK) socket option.)
|
Sets the code(SO_USELOOPBACK) socket option.)
|
||||||
COMMENT(label(OPTION_ACCEPTCONN)dit(bf(tt(acceptconn)))
|
COMMENT(label(OPTION_ACCEPTCONN)dit(bf(tt(acceptconn)))
|
||||||
|
@ -1618,8 +1869,6 @@ COMMENT(label(OPTION_PASSCRED)dit(bf(tt(passcred)))
|
||||||
Set the code(SO_PASSCRED) socket option.)
|
Set the code(SO_PASSCRED) socket option.)
|
||||||
COMMENT(label(OPTION_PEERCRED)dit(bf(tt(peercred)))
|
COMMENT(label(OPTION_PEERCRED)dit(bf(tt(peercred)))
|
||||||
This is a read-only socket option.)
|
This is a read-only socket option.)
|
||||||
COMMENT(label(OPTION_PROTOTYPE)dit(bf(tt(prototype)))
|
|
||||||
Tries to set the code(SO_PROTOTYPE) socket option.)
|
|
||||||
COMMENT(label(OPTION_REUSEPORT)dit(bf(tt(reuseport)))
|
COMMENT(label(OPTION_REUSEPORT)dit(bf(tt(reuseport)))
|
||||||
Set the code(SO_REUSEPORT) socket option.)
|
Set the code(SO_REUSEPORT) socket option.)
|
||||||
COMMENT(label(OPTION_SECUTIYAUTHENTICATION)dit(bf(tt(securityauthentication)))
|
COMMENT(label(OPTION_SECUTIYAUTHENTICATION)dit(bf(tt(securityauthentication)))
|
||||||
|
@ -1632,9 +1881,27 @@ COMMENT(label(OPTION_SIOCSPGRP)dit(bf(tt(siocspgrp=<pid_t>)))
|
||||||
Set the SIOCSPGRP with code(ioclt()) to enable SIGIO.)
|
Set the SIOCSPGRP with code(ioclt()) to enable SIGIO.)
|
||||||
COMMENT(label(OPTION_USEIFBUFS)dit(bf(tt(useifbufs)))
|
COMMENT(label(OPTION_USEIFBUFS)dit(bf(tt(useifbufs)))
|
||||||
Set the code(SO_USE_IFBUFS) socket option.)
|
Set the code(SO_USE_IFBUFS) socket option.)
|
||||||
label(OPTION_PROTOCOL_FAMILY)dit(bf(tt(pf=<string>)))
|
label(OPTION_SO_TIMESTAMP)dit(bf(tt(so-timestamp)))
|
||||||
Forces the use of the specified IP version. <string> can be
|
Sets the SO_TIMESTAMP socket option. This enables receiving and logging of
|
||||||
something like "ip4" or "ip6".
|
timestamp ancillary messages.
|
||||||
|
label(OPTION_SETSOCKOPT_INT)dit(bf(tt(setsockopt-int=<level>:<optname>:<optval>)))
|
||||||
|
Invokes tt(setsockopt()) for the socket with the given parameters. tt(level)
|
||||||
|
[link(int)(TYPE_INT)] is used as second argument to tt(setsockopt()) and
|
||||||
|
specifies the layer, e.g. SOL_TCP for TCP (6 on Linux), or SOL_SOCKET for
|
||||||
|
the socket layer (1 on Linux). tt(optname) [link(int)(TYPE_INT)] is the
|
||||||
|
third argument to tt(setsockopt()) and tells which socket option is to be
|
||||||
|
set. For the actual numbers you might have to look up the appropriate include
|
||||||
|
files of your system. The 4th tt(setsockopt()) parameter, tt(value)
|
||||||
|
[link(int)(TYPE_INT)], is passed to the function per pointer, and for the
|
||||||
|
length parameter sizeof(int) is taken implicitely.
|
||||||
|
label(OPTION_SETSOCKOPT_BIN)dit(bf(tt(setsockopt-bin=<level>:<optname>:<optval>)))
|
||||||
|
Like tt(setsockopt-int), but <optval> must be provided in
|
||||||
|
link(dalan)(TYPE_DATA) format and specifies an arbitrary sequence of bytes;
|
||||||
|
the length parameter is automatically derived from the data.
|
||||||
|
label(OPTION_SETSOCKOPT_STRING)dit(bf(tt(setsockopt-string=<level>:<optname>:<optval>)))
|
||||||
|
Like tt(setsockopt-int), but <optval> must be a link(string)(TYPE_STRING).
|
||||||
|
This string is passed to the function with trailing null character, and the
|
||||||
|
length parameter is automatically derived from the data.
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
@ -1661,13 +1928,13 @@ label(OPTION_TOS)dit(bf(tt(tos=<tos>)))
|
||||||
label(OPTION_TTL)dit(bf(tt(ttl=<ttl>)))
|
label(OPTION_TTL)dit(bf(tt(ttl=<ttl>)))
|
||||||
Sets the TTL (time to live) field of outgoing packets to <ttl>
|
Sets the TTL (time to live) field of outgoing packets to <ttl>
|
||||||
[link(byte)(TYPE_BYTE)].
|
[link(byte)(TYPE_BYTE)].
|
||||||
label(OPTION_IPOPTIONS)dit(bf(tt(ipoptions=<data>)))
|
label(OPTION_IPOPTIONS)dit(bf(tt(ip-options=<data>)))
|
||||||
Sets IP options like source routing. Must be given in binary form,
|
Sets IP options like source routing. Must be given in binary form,
|
||||||
recommended format is a leading "x" followed by an even number of hex
|
recommended format is a leading "x" followed by an even number of hex
|
||||||
digits. This option may be used multiple times, data are appended.
|
digits. This option may be used multiple times, data are appended.
|
||||||
E.g., to connect to host 10.0.0.1 via some gateway using a loose source
|
E.g., to connect to host 10.0.0.1 via some gateway using a loose source
|
||||||
route, use the gateway as address parameter and set a loose source route
|
route, use the gateway as address parameter and set a loose source route
|
||||||
using the option code(ipoptions=x8307040a000001).nl()
|
using the option code(ip-options=x8307040a000001).nl()
|
||||||
IP options are defined in RFC 791. COMMENT(, RFC 2113)nl()
|
IP options are defined in RFC 791. COMMENT(, RFC 2113)nl()
|
||||||
COMMENT( x00 end of option list
|
COMMENT( x00 end of option list
|
||||||
x01 no operation (nop)
|
x01 no operation (nop)
|
||||||
|
@ -1680,26 +1947,39 @@ COMMENT( x00 end of option list
|
||||||
label(OPTION_MTUDISCOVER)dit(bf(tt(mtudiscover=<0|1|2>)))
|
label(OPTION_MTUDISCOVER)dit(bf(tt(mtudiscover=<0|1|2>)))
|
||||||
Takes 0, 1, 2 to never, want, or always use path MTU discover on this
|
Takes 0, 1, 2 to never, want, or always use path MTU discover on this
|
||||||
socket.
|
socket.
|
||||||
COMMENT(label(OPTION_HRDINCL)dit(bf(tt(hdrincl)))
|
COMMENT(label(OPTION_HRDINCL)dit(bf(tt(ip-hdrincl)))
|
||||||
Tell the raw socket that the application data includes the IP header.)
|
Tell the raw socket that the application data includes the IP header.)
|
||||||
COMMENT(label(OPTION_IP_MULTICAST_LOOP)dit(bf(tt(multicastloop)))
|
COMMENT(label(OPTION_IP_MULTICAST_LOOP)dit(bf(tt(ip-multicastloop)))
|
||||||
Allow looping back outgoing multicast to the local interface.)
|
Allow looping back outgoing multicast to the local interface.)
|
||||||
COMMENT(label(OPTION_IP_MULTICAST_TTL)dit(bf(tt(multicastttl)))
|
COMMENT(label(OPTION_IP_MULTICAST_TTL)dit(bf(tt(ip-multicastttl)))
|
||||||
Set the TTL for outgoing multicast packets.)
|
Set the TTL for outgoing multicast packets.)
|
||||||
COMMENT(label(OPTION_PKTINFO)dit(bf(tt(pktinfo)))
|
label(OPTION_IP_PKTINFO)dit(bf(tt(ip-pktinfo)))
|
||||||
Set the IP_PKTINFO socket option.)
|
Sets the IP_PKTINFO socket option. This enables receiving and logging of
|
||||||
COMMENT(label(OPTION_PKTOPTS)dit(bf(tt(pktopts)))
|
ancillary messages containing destination address and interface (Linux)
|
||||||
|
(link(example)(EXAMPLE_ANCILLARY)).
|
||||||
|
COMMENT(label(OPTION_PKTOPTS)dit(bf(tt(ip-pktopts)))
|
||||||
Set the IP_PKTOPTIONS socket option.)
|
Set the IP_PKTOPTIONS socket option.)
|
||||||
COMMENT(label(OPTION_RECVERR)dit(bf(tt(recverr)))
|
label(OPTION_IP_RECVERR)dit(bf(tt(ip-recverr)))
|
||||||
Set the IP_RECVERR socket option.)
|
Sets the IP_RECVERR socket option. This enables receiving and logging of
|
||||||
COMMENT(label(OPTION_RECVOPTS)dit(bf(tt(recvopts)))
|
ancillary messages containing detailled error information.
|
||||||
Set the IP_RECVOPTS socket option.)
|
label(OPTION_IP_RECVOPTS)dit(bf(tt(ip-recvopts)))
|
||||||
COMMENT(label(OPTION_RECVTOS)dit(bf(tt(recvtos)))
|
Sets the IP_RECVOPTS socket option. This enables receiving and logging of IP
|
||||||
Set the IP_RECVTOS socket option.)
|
options ancillary messages (Linux, *BSD).
|
||||||
COMMENT(label(OPTION_RECVTTL)dit(bf(tt(recvttl)))
|
label(OPTION_IP_RECVTOS)dit(bf(tt(ip-recvtos)))
|
||||||
Set the IP_RECVTTL socket option.)
|
Sets the IP_RECVTOS socket option. This enables receiving and logging of TOS
|
||||||
COMMENT(label(OPTION_RETOPTS)dit(bf(tt(retopts)))
|
(type of service) ancillary messages (Linux).
|
||||||
|
label(OPTION_IP_RECVTTL)dit(bf(tt(ip-recvttl)))
|
||||||
|
Sets the IP_RECVTTL socket option. This enables receiving and logging of TTL
|
||||||
|
(time to live) ancillary messages (Linux, *BSD).
|
||||||
|
COMMENT(label(OPTION_RETOPTS)dit(bf(tt(ip-retopts)))
|
||||||
Set the IP_RETOPTS socket option.)
|
Set the IP_RETOPTS socket option.)
|
||||||
|
label(OPTION_IP_RECVDSTADDR)dit(bf(tt(ip-recvdstaddr)))
|
||||||
|
Sets the IP_RECVDSTADDR socket option. This enables receiving and logging of
|
||||||
|
ancillary messages containing destination address (*BSD)
|
||||||
|
(link(example)(EXAMPLE_ANCILLARY)).
|
||||||
|
label(OPTION_IP_RECVIF)dit(bf(tt(ip-recvif)))
|
||||||
|
Sets the IP_RECVIF socket option. This enables receiving and logging of
|
||||||
|
interface ancillary messages (*BSD) (link(example)(EXAMPLE_ANCILLARY)).
|
||||||
COMMENT(label(OPTION_ROUTERALERT)dit(bf(tt(routeralert)))
|
COMMENT(label(OPTION_ROUTERALERT)dit(bf(tt(routeralert)))
|
||||||
Set the IP_ROUTER_ALERT socket option.)
|
Set the IP_ROUTER_ALERT socket option.)
|
||||||
label(OPTION_IP_ADD_MEMBERSHIP)
|
label(OPTION_IP_ADD_MEMBERSHIP)
|
||||||
|
@ -1754,6 +2034,30 @@ label(OPTION_IPV6_V6ONLY)dit(bf(tt(ipv6only=<bool>)))
|
||||||
Sets the IPV6_V6ONLY socket option. If 0, the TCP stack will also accept
|
Sets the IPV6_V6ONLY socket option. If 0, the TCP stack will also accept
|
||||||
connections using IPv4 protocol on the same port. The default is system
|
connections using IPv4 protocol on the same port. The default is system
|
||||||
dependent.
|
dependent.
|
||||||
|
label(OPTION_IPV6_RECVDSTOPTS)dit(bf(tt(ipv6-recvdstopts)))
|
||||||
|
Sets the IPV6_RECVDSTOPTS socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing the destination options.
|
||||||
|
label(OPTION_IPV6_RECVHOPLIMIT)dit(bf(tt(ipv6-recvhoplimit)))
|
||||||
|
Sets the IPV6_RECVHOPLIMIT socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing the hoplimit.
|
||||||
|
label(OPTION_IPV6_RECVHOPOPTS)dit(bf(tt(ipv6-recvhopopts)))
|
||||||
|
Sets the IPV6_RECVHOPOPTS socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing the hop options.
|
||||||
|
label(OPTION_IPV6_RECVPKTINFO)dit(bf(tt(ipv6-recvpktinfo)))
|
||||||
|
Sets the IPV6_RECVPKTINFO socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing destination address and interface.
|
||||||
|
label(OPTION_IPV6_UNICAST_HOPS)dit(bf(tt(ipv6-unicast-hops=link(TYPE_INT)(<int>))))
|
||||||
|
Sets the IPV6_UNICAST_HOPS socket option. This sets the hop count limit
|
||||||
|
(TTL) for outgoing unicast packets.
|
||||||
|
label(OPTION_IPV6_RECVRTHDR)dit(bf(tt(ipv6-recvrthdr)))
|
||||||
|
Sets the IPV6_RECVRTHDR socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing routing information.
|
||||||
|
label(OPTION_IPV6_TCLASS)dit(bf(tt(ipv6-tclass)))
|
||||||
|
Sets the IPV6_TCLASS socket option. This sets the transfer class of outgoing
|
||||||
|
packets.
|
||||||
|
label(OPTION_IPV6_RECVTCLASS)dit(bf(tt(ipv6-recvtclass)))
|
||||||
|
Sets the IPV6_RECVTCLASS socket option. This enables receiving and logging
|
||||||
|
of ancillary messages containing the transfer class.
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
@ -1832,10 +2136,24 @@ enddit()
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
|
||||||
|
|
||||||
em(bf(UDP and TCP option groups))
|
label(GROUP_SCTP)em(bf(SCTP option group))
|
||||||
|
|
||||||
Here we find options that are related to the network port mechanism and that
|
These options may be applied to SCTP stream sockets.
|
||||||
thus can be used with UDP and TCP, client and server addresses.
|
startdit()
|
||||||
|
label(OPTION_SCTP_NODELAY)dit(bf(tt(sctp-nodelay)))
|
||||||
|
Sets the SCTP_NODELAY socket option that disables the Nagle algorithm.
|
||||||
|
label(OPTION_SCTP_MAXSEG)dit(bf(tt(sctp-maxseg=<bytes>)))
|
||||||
|
Sets the SCTP_MAXSEG socket option to <bytes> [link(int)(TYPE_INT)]. This
|
||||||
|
value is then proposed to the peer with the SYN or SYN/ACK packet.
|
||||||
|
enddit()
|
||||||
|
|
||||||
|
startdit()enddit()nl()
|
||||||
|
|
||||||
|
|
||||||
|
em(bf(UDP, TCP, and SCTP option groups))
|
||||||
|
|
||||||
|
Here we find options that are related to the network port mechanism and thus
|
||||||
|
can be used with UDP, TCP, and SCTP client and server addresses.
|
||||||
startdit()
|
startdit()
|
||||||
label(OPTION_SOURCEPORT)dit(bf(tt(sourceport=<port>)))
|
label(OPTION_SOURCEPORT)dit(bf(tt(sourceport=<port>)))
|
||||||
For outgoing (client) TCP and UDP connections, it sets the source
|
For outgoing (client) TCP and UDP connections, it sets the source
|
||||||
|
@ -2196,6 +2514,13 @@ label(OPTION_VTDLY)dit(bf(tt(vtdly=<bool>)))
|
||||||
label(OPTION_WERASE)dit(bf(tt(werase=<byte>)))
|
label(OPTION_WERASE)dit(bf(tt(werase=<byte>)))
|
||||||
label(OPTION_XCASE)dit(bf(tt(xcase=<bool>)))
|
label(OPTION_XCASE)dit(bf(tt(xcase=<bool>)))
|
||||||
label(OPTION_XTABS)dit(bf(tt(xtabs)))
|
label(OPTION_XTABS)dit(bf(tt(xtabs)))
|
||||||
|
label(OPTION_I_POP_ALL)dit(bf(tt(i-pop-all)))
|
||||||
|
With UNIX System V STREAMS, removes all drivers from the stack.
|
||||||
|
label(OPTION_I_PUSH)dit(bf(tt(i-push=<string>)))
|
||||||
|
With UNIX System V STREAMS, pushes the driver (module) with the given name
|
||||||
|
(link(string)(TYPE_STRING)) onto the stack. For example, to make sure that a
|
||||||
|
character device on Solaris supports termios etc, use the following options:
|
||||||
|
tt(i-pop-all,i-push=ptem,i-push=ldterm,i-push=ttcompat)
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
startdit()enddit()nl()
|
startdit()enddit()nl()
|
||||||
|
@ -2413,8 +2738,9 @@ label(TYPE_COMMAND_LINE)dit(command-line)
|
||||||
A string specifying a program name and its arguments, separated by single
|
A string specifying a program name and its arguments, separated by single
|
||||||
spaces.
|
spaces.
|
||||||
label(TYPE_DATA)dit(data)
|
label(TYPE_DATA)dit(data)
|
||||||
A raw data specification following em(dalan) syntax. The only documented
|
A raw data specification following em(dalan) syntax. Currently the only
|
||||||
form is a string starting with 'x' followed by an even number of hex digits.
|
valid form is a string starting with 'x' followed by an even number of hex
|
||||||
|
digits, specifying a sequence of bytes.
|
||||||
label(TYPE_DIRECTORY)dit(directory)
|
label(TYPE_DIRECTORY)dit(directory)
|
||||||
A string with usual unix() directory name semantics.
|
A string with usual unix() directory name semantics.
|
||||||
label(TYPE_FACILITY)dit(facility)
|
label(TYPE_FACILITY)dit(facility)
|
||||||
|
@ -2433,7 +2759,8 @@ label(TYPE_INT)dit(int)
|
||||||
"0", i.e. decimal number, octal number with leading "0", or hexadecimal
|
"0", i.e. decimal number, octal number with leading "0", or hexadecimal
|
||||||
number with leading "0x". The value must fit into a C int.
|
number with leading "0x". The value must fit into a C int.
|
||||||
label(TYPE_INTERFACE)dit(interface)
|
label(TYPE_INTERFACE)dit(interface)
|
||||||
A string specifying the device name of a network interface, e.g. "eth0".
|
A string specifying the device name of a network interface
|
||||||
|
as shown by ifconfig or procan, e.g. "eth0".
|
||||||
label(TYPE_IP_ADDRESS)dit(IP address)
|
label(TYPE_IP_ADDRESS)dit(IP address)
|
||||||
An IPv4 address in numbers-and-dots notation, an IPv6 address in hex
|
An IPv4 address in numbers-and-dots notation, an IPv6 address in hex
|
||||||
notation enclosed in brackets, or a hostname that resolves to an IPv4 or an
|
notation enclosed in brackets, or a hostname that resolves to an IPv4 or an
|
||||||
|
@ -2509,7 +2836,7 @@ startdit()
|
||||||
label(EXAMPLE_ADDRESS_TCP4_CONNECT)
|
label(EXAMPLE_ADDRESS_TCP4_CONNECT)
|
||||||
dit(bf(tt(socat - TCP4:www.domain.org:80)))
|
dit(bf(tt(socat - TCP4:www.domain.org:80)))
|
||||||
|
|
||||||
Transfers data between link(STDIO)(ADDRESS_STDIO) (-) and a
|
transfers data between link(STDIO)(ADDRESS_STDIO) (-) and a
|
||||||
link(TCP4)(ADDRESS_TCP4_CONNECT) connection to port 80 of host
|
link(TCP4)(ADDRESS_TCP4_CONNECT) connection to port 80 of host
|
||||||
www.domain.org. This example results in an interactive connection similar to
|
www.domain.org. This example results in an interactive connection similar to
|
||||||
telnet or netcat. The stdin terminal parameters are not changed, so you may
|
telnet or netcat. The stdin terminal parameters are not changed, so you may
|
||||||
|
@ -2526,22 +2853,22 @@ mancommand(\.fi)
|
||||||
htmlcommand(<dt><code><strong>socat -d -d READLINE,history=$HOME/.http_history \</strong><br>
|
htmlcommand(<dt><code><strong>socat -d -d READLINE,history=$HOME/.http_history \</strong><br>
|
||||||
<strong>TCP4:www.domain.org:www,crnl</strong></code><dd>)
|
<strong>TCP4:www.domain.org:www,crnl</strong></code><dd>)
|
||||||
|
|
||||||
This is similar to the previous example, but you can edit the current line in a
|
this is similar to the previous example, but you can edit the current line in a
|
||||||
bash like manner (link(READLINE)(ADDRESS_READLINE)) and use the
|
bash like manner (link(READLINE)(ADDRESS_READLINE)) and use the
|
||||||
link(history)(OPTION_HISTORY) file .http_history; socat()
|
link(history)(OPTION_HISTORY) file .http_history; socat() prints messages about
|
||||||
prints messages about progress (link(-d -d)(option_d_d)). The port is specified by service name
|
progress (link(-d -d)(option_d_d)). The port is specified by service name
|
||||||
(www), and correct network line termination characters (link(crnl)(OPTION_CRNL)) instead of NL
|
(www), and correct network line termination characters
|
||||||
are used.
|
(link(crnl)(OPTION_CRNL)) instead of NL are used.
|
||||||
|
|
||||||
|
|
||||||
label(EXAMPLE_ADDRESS_TCP4_LISTEN)
|
label(EXAMPLE_ADDRESS_TCP4_LISTEN)
|
||||||
dit(bf(tt(socat TCP4-LISTEN:www TCP4:www.domain.org:www)))
|
dit(bf(tt(socat TCP4-LISTEN:www TCP4:www.domain.org:www)))
|
||||||
|
|
||||||
Installs a simple TCP port forwarder. With
|
installs a simple TCP port forwarder. With
|
||||||
link(TCP4-LISTEN)(ADDRESS_TCP4_LISTEN) it listens on local port "www" until a
|
link(TCP4-LISTEN)(ADDRESS_TCP4_LISTEN) it listens on local port "www" until a
|
||||||
connection comes in, accepts it, then connects to the remote host
|
connection comes in, accepts it, then connects to the remote host
|
||||||
(link(TCP4)(ADDRESS_TCP4_CONNECT)) and starts data transfer. It will not accept a
|
(link(TCP4)(ADDRESS_TCP4_CONNECT)) and starts data transfer. It will not accept
|
||||||
second connection.
|
a econd connection.
|
||||||
|
|
||||||
label(EXAMPLE_OPTION_BIND_TCP4)
|
label(EXAMPLE_OPTION_BIND_TCP4)
|
||||||
label(EXAMPLE_OPTION_REUSEADDR)
|
label(EXAMPLE_OPTION_REUSEADDR)
|
||||||
|
@ -2565,9 +2892,10 @@ arbitrary number of parallel or consecutive connections by
|
||||||
link(fork)(OPTION_FORK)'ing a new
|
link(fork)(OPTION_FORK)'ing a new
|
||||||
process after each code(accept()). It provides a little security by
|
process after each code(accept()). It provides a little security by
|
||||||
link(su)(OPTION_SUBSTUSER)'ing to user
|
link(su)(OPTION_SUBSTUSER)'ing to user
|
||||||
nobody after forking; it only permits connections from the private 10 network (link(range)(OPTION_RANGE));
|
nobody after forking; it only permits connections from the private 10 network
|
||||||
due to link(reuseaddr)(OPTION_REUSEADDR), it allows immediate restart after master process's
|
(link(range)(OPTION_RANGE)); due to link(reuseaddr)(OPTION_REUSEADDR), it
|
||||||
termination, even if some child sockets are not completely shut down.
|
allows immediate restart after master process's termination, even if some child
|
||||||
|
sockets are not completely shut down.
|
||||||
With link(-lmlocal2)(option_lm), socat logs to stderr until successfully
|
With link(-lmlocal2)(option_lm), socat logs to stderr until successfully
|
||||||
reaching the accept loop. Further logging is directed to syslog with facility
|
reaching the accept loop. Further logging is directed to syslog with facility
|
||||||
local2.
|
local2.
|
||||||
|
@ -2587,7 +2915,7 @@ mancommand(\.fi)
|
||||||
htmlcommand(<dt><code><strong>socat TCP4-LISTEN:5555,fork,tcpwrap=script \</strong><br>
|
htmlcommand(<dt><code><strong>socat TCP4-LISTEN:5555,fork,tcpwrap=script \</strong><br>
|
||||||
<strong>EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr</strong></code><dd>)
|
<strong>EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr</strong></code><dd>)
|
||||||
|
|
||||||
A simple server that accepts connections
|
a simple server that accepts connections
|
||||||
(link(TCP4-LISTEN)(ADDRESS_TCP4_LISTEN)) and link(fork)(OPTION_FORK)'s a new
|
(link(TCP4-LISTEN)(ADDRESS_TCP4_LISTEN)) and link(fork)(OPTION_FORK)'s a new
|
||||||
child process for each connection; every child acts as single relay.
|
child process for each connection; every child acts as single relay.
|
||||||
The client must match the rules for daemon process name "script" in
|
The client must match the rules for daemon process name "script" in
|
||||||
|
@ -2630,13 +2958,15 @@ at most 512 data bytes per packet (link(mss)(OPTION_MSS)).
|
||||||
label(EXAMPLE_ADDRESS_GOPEN)
|
label(EXAMPLE_ADDRESS_GOPEN)
|
||||||
label(EXAMPLE_OPTION_RAW)
|
label(EXAMPLE_OPTION_RAW)
|
||||||
label(EXAMPLE_OPTION_ECHO)
|
label(EXAMPLE_OPTION_ECHO)
|
||||||
dit(bf(tt(socat - /dev/ttyS0,raw,echo=0,crnl)))
|
label(EXAMPLE_OPTION_ESCAPE)
|
||||||
|
dit(bf(tt(socat -,raw,echo=0,escape=0x0f /dev/ttyS0,raw,echo=0,crnl)))
|
||||||
|
|
||||||
Opens an interactive connection via the serial line, e.g. for talking with a
|
opens an interactive connection via the serial line, e.g. for talking with a
|
||||||
modem. link(raw)(OPTION_RAW) and link(echo)(OPTION_ECHO) set ttyS0's terminal
|
modem. link(raw)(OPTION_RAW) and link(echo)(OPTION_ECHO) set the console's and
|
||||||
parameters to practicable values, link(crnl)(OPTION_CRNL)
|
ttyS0's terminal parameters to practicable values, link(crnl)(OPTION_CRNL)
|
||||||
converts to correct newline characters. Consider using
|
converts to correct newline characters. link(escape)(OPTION_ESCAPE) allows to
|
||||||
link(READLINE)(ADDRESS_READLINE) instead of `-'.
|
terminate the socat process with character control-O.
|
||||||
|
Consider using link(READLINE)(ADDRESS_READLINE) instead of the first address.
|
||||||
|
|
||||||
|
|
||||||
label(EXAMPLE_ADDRESS_UNIX_LISTEN)
|
label(EXAMPLE_ADDRESS_UNIX_LISTEN)
|
||||||
|
@ -2652,7 +2982,7 @@ mancommand(\.fi)
|
||||||
htmlcommand(<dt><code><strong>socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork \</strong><br>
|
htmlcommand(<dt><code><strong>socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork \</strong><br>
|
||||||
<strong>SOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20</strong></code><dd>)
|
<strong>SOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20</strong></code><dd>)
|
||||||
|
|
||||||
With link(UNIX-LISTEN)(ADDRESS_UNIX_LISTEN), socat() opens a listening
|
with link(UNIX-LISTEN)(ADDRESS_UNIX_LISTEN), socat() opens a listening
|
||||||
unixdomain() socket file(/tmp/.X11-unix/X1). This path corresponds
|
unixdomain() socket file(/tmp/.X11-unix/X1). This path corresponds
|
||||||
to local XWindow display :1 on your machine, so XWindow client connections to
|
to local XWindow display :1 on your machine, so XWindow client connections to
|
||||||
DISPLAY=:1 are accepted. Socat() then speaks with
|
DISPLAY=:1 are accepted. Socat() then speaks with
|
||||||
|
@ -2672,7 +3002,7 @@ label(EXAMPLE_option_u)
|
||||||
label(EXAMPLE_OPTION_IGNOREEOF)
|
label(EXAMPLE_OPTION_IGNOREEOF)
|
||||||
dit(bf(tt(socat -u /tmp/readdata,seek-end=0,ignoreeof -)))
|
dit(bf(tt(socat -u /tmp/readdata,seek-end=0,ignoreeof -)))
|
||||||
|
|
||||||
This is an example for unidirectional data transfer
|
this is an example for unidirectional data transfer
|
||||||
(link(-u)(option_u)). Socat() transfers data
|
(link(-u)(option_u)). Socat() transfers data
|
||||||
from file /tmp/readdata (implicit address link(GOPEN)(ADDRESS_GOPEN)), starting
|
from file /tmp/readdata (implicit address link(GOPEN)(ADDRESS_GOPEN)), starting
|
||||||
at its current end (link(seek-end)(OPTION_SEEK_END)=0 lets socat() start
|
at its current end (link(seek-end)(OPTION_SEEK_END)=0 lets socat() start
|
||||||
|
@ -2711,7 +3041,7 @@ mancommand(\.fi)
|
||||||
htmlcommand(<dt><code><strong>socat -u TCP4-LISTEN:3334,reuseaddr,fork \</strong><br>
|
htmlcommand(<dt><code><strong>socat -u TCP4-LISTEN:3334,reuseaddr,fork \</strong><br>
|
||||||
<strong>OPEN:/tmp/in.log,creat,append</strong></code><dd>)
|
<strong>OPEN:/tmp/in.log,creat,append</strong></code><dd>)
|
||||||
|
|
||||||
Implements a simple network based message collector.
|
implements a simple network based message collector.
|
||||||
For each client connecting to port 3334, a new child process is generated (option link(fork)(OPTION_FORK)).
|
For each client connecting to port 3334, a new child process is generated (option link(fork)(OPTION_FORK)).
|
||||||
All data sent by the clients are link(append)(OPTION_APPEND)'ed to the file /tmp/in.log.
|
All data sent by the clients are link(append)(OPTION_APPEND)'ed to the file /tmp/in.log.
|
||||||
If the file does not exist, socat link(creat)(OPTION_CREAT)'s it.
|
If the file does not exist, socat link(creat)(OPTION_CREAT)'s it.
|
||||||
|
@ -2721,7 +3051,7 @@ process.
|
||||||
COMMENT(
|
COMMENT(
|
||||||
dit(bf(tt(socat TCP4-LISTEN:3335,reuseaddr,fork OPEN:/tmp/motd,rdonly)))
|
dit(bf(tt(socat TCP4-LISTEN:3335,reuseaddr,fork OPEN:/tmp/motd,rdonly)))
|
||||||
|
|
||||||
Implements a simple network based motd server.
|
implements a simple network based motd server.
|
||||||
For each client connecting to port 3335, a new child process is generated
|
For each client connecting to port 3335, a new child process is generated
|
||||||
(option link(fork)(OPTION_FORK)).
|
(option link(fork)(OPTION_FORK)).
|
||||||
The contents of the file /tmp/motd is sent to each client.
|
The contents of the file /tmp/motd is sent to each client.
|
||||||
|
@ -2732,7 +3062,7 @@ process.
|
||||||
COMMENT(
|
COMMENT(
|
||||||
dit(bf(tt(socat - TCP4-LISTEN:8080,mtudiscover=0,rcvbuf=2048)))
|
dit(bf(tt(socat - TCP4-LISTEN:8080,mtudiscover=0,rcvbuf=2048)))
|
||||||
|
|
||||||
Changes some socket parameters to confuse active OS fingerprinting methods.
|
changes some socket parameters to confuse active OS fingerprinting methods.
|
||||||
link(mtudiscover)(OPTION_MTUDISCOVER)=0 sets the DF (don'ft fragment flag) in
|
link(mtudiscover)(OPTION_MTUDISCOVER)=0 sets the DF (don'ft fragment flag) in
|
||||||
the IP packets to 0 and link(rcvbuf)(OPTION_RCVBUF) changes the initial TCP
|
the IP packets to 0 and link(rcvbuf)(OPTION_RCVBUF) changes the initial TCP
|
||||||
window size.
|
window size.
|
||||||
|
@ -2741,7 +3071,7 @@ window size.
|
||||||
label(EXAMPLE_OPTION_NOECHO)
|
label(EXAMPLE_OPTION_NOECHO)
|
||||||
dit(bf(tt(socat READLINE,noecho='[Pp]assword:' EXEC:'ftp ftp.server.com',pty,setsid,ctty)))
|
dit(bf(tt(socat READLINE,noecho='[Pp]assword:' EXEC:'ftp ftp.server.com',pty,setsid,ctty)))
|
||||||
|
|
||||||
Wraps a command line history (link(READLINE)(ADDRESS_READLINE)) around the link(EXEC)(ADDRESS_EXEC)'uted ftp client utility.
|
wraps a command line history (link(READLINE)(ADDRESS_READLINE)) around the link(EXEC)(ADDRESS_EXEC)'uted ftp client utility.
|
||||||
This allows editing and reuse of FTP commands for relatively comfortable
|
This allows editing and reuse of FTP commands for relatively comfortable
|
||||||
browsing through the ftp directory hierarchy. The password is echoed!
|
browsing through the ftp directory hierarchy. The password is echoed!
|
||||||
link(pty)(OPTION_PTY) is required to have ftp issue a prompt.
|
link(pty)(OPTION_PTY) is required to have ftp issue a prompt.
|
||||||
|
@ -2755,7 +3085,7 @@ label(EXAMPLE_OPTION_WAITSLAVE)
|
||||||
label(EXAMPLE_OPTION_NONBLOCK)
|
label(EXAMPLE_OPTION_NONBLOCK)
|
||||||
(bf(tt(socat PTY,link=$HOME/dev/vmodem0,raw,echo=0,waitslave EXEC:'"ssh modemserver.us.org socat - /dev/ttyS0,nonblock,raw,echo=0"')))
|
(bf(tt(socat PTY,link=$HOME/dev/vmodem0,raw,echo=0,waitslave EXEC:'"ssh modemserver.us.org socat - /dev/ttyS0,nonblock,raw,echo=0"')))
|
||||||
|
|
||||||
Generates a pseudo terminal
|
generates a pseudo terminal
|
||||||
device (link(PTY)(ADDRESS_PTY)) on the client that can be reached under the
|
device (link(PTY)(ADDRESS_PTY)) on the client that can be reached under the
|
||||||
symbolic link(link)(OPTION_SYMBOLIC_LINK) file($HOME/dev/vmodem0).
|
symbolic link(link)(OPTION_SYMBOLIC_LINK) file($HOME/dev/vmodem0).
|
||||||
An application that expects a serial line or modem
|
An application that expects a serial line or modem
|
||||||
|
@ -2853,6 +3183,15 @@ sends a broadcast to the network 192.168.1.0/24 and receives the replies of the
|
||||||
timeservers there. Ignores NTP packets from hosts outside this network.
|
timeservers there. Ignores NTP packets from hosts outside this network.
|
||||||
|
|
||||||
|
|
||||||
|
label(EXAMPLE_ADDRESS_GENERIC_CLIENT)
|
||||||
|
dit(bf(tt(socat - SOCKET-DATAGRAM:2:2:17:x007bxc0a80100x0000000000000000,bind=x007bx00000000x0000000000000000,setsockopt-int=1:6:1,range=x0000xc0a80100x0000000000000000:x0000xffffff00x0000000000000000)))
|
||||||
|
|
||||||
|
is semantically equivalent to the link(previous
|
||||||
|
example)(EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT), but all parameters are
|
||||||
|
specified in generic form. the value 6 of setsockopt-int is the Linux value for
|
||||||
|
tt(SO_BROADCAST).
|
||||||
|
|
||||||
|
|
||||||
label(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT)
|
label(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT)
|
||||||
dit(bf(tt(socat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8)))
|
dit(bf(tt(socat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8)))
|
||||||
|
|
||||||
|
@ -2883,6 +3222,48 @@ client and server authentication (see OpenSSL
|
||||||
link(client)(EXAMPLE_ADDRESS_OPENSSL_CONNECT) and
|
link(client)(EXAMPLE_ADDRESS_OPENSSL_CONNECT) and
|
||||||
link(server)(EXAMPLE_ADDRESS_OPENSSL_LISTEN)).
|
link(server)(EXAMPLE_ADDRESS_OPENSSL_LISTEN)).
|
||||||
|
|
||||||
|
|
||||||
|
label(EXAMPLE_INTERFACE)
|
||||||
|
dit(bf(tt(socat PTY,link=/var/run/ppp,raw,echo=0 INTERFACE:hdlc0)))
|
||||||
|
|
||||||
|
circumvents the problem that pppd requires a serial device and thus might not
|
||||||
|
be able to work on a synchronous line that is represented by a network device.
|
||||||
|
socat creates a PTY to make pppd happy, binds to the network
|
||||||
|
link(interface)(ADDRESS_INTERFACE) tt(hdlc0), and can transfer data between
|
||||||
|
both devices. Use pppd on device tt(/var/run/ppp) then.
|
||||||
|
|
||||||
|
|
||||||
|
label(EXAMPLE_HTTPECHO)
|
||||||
|
dit(bf(tt(socat -T 1 -d -d TCP-L:10081,reuseaddr,fork,crlf SYSTEM:"echo -e \"\\\"HTTP/1.0 200 OK\\\nDocumentType: text/plain\\\n\\\ndate: \$\(date\)\\\nserver:\$SOCAT_SOCKADDR:\$SOCAT_SOCKPORT\\\nclient: \$SOCAT_PEERADDR:\$SOCAT_PEERPORT\\\n\\\"\"; cat; echo -e \"\\\"\\\n\\\"\"")))
|
||||||
|
|
||||||
|
creates a simple HTTP echo server: each HTTP client that connects gets a valid
|
||||||
|
HTTP reply that contains information about the client address and port as it is
|
||||||
|
seen by the server host, the host address (which might vary on multihomed
|
||||||
|
servers), and the original client request.
|
||||||
|
|
||||||
|
|
||||||
|
label(EXAMPLE_ANCILLARY)
|
||||||
|
dit(bf(tt(socat -d -d UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- SYSTEM:'export; sleep 1' |grep SOCAT)))
|
||||||
|
|
||||||
|
waits for incoming UDP packets on port 9999 and prints the environment
|
||||||
|
variables provided by socat. On BSD based systems you have to replace
|
||||||
|
link(tt(ip-pktinfo))(OPTION_IP_PKTINFO) with link(tt(ip-recvdstaddr))(OPTION_IP_RECVDSTADDR),link(tt(ip-recvif))(OPTION_IP_RECVIF). Especially interesting is
|
||||||
|
SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a
|
||||||
|
unicast, multicast, or broadcast address.
|
||||||
|
|
||||||
|
|
||||||
|
label(EXAMPLE_SCTP_OPENSSL_IP6)
|
||||||
|
dit(bf(tt(socat 'SCTP6-L:8888,reuseaddr,fork' '^SSL-L,fork,cert=testsrv.pem,verify=0|SYSTEM:export')))
|
||||||
|
|
||||||
|
dit(bf(tt(socat - 'SSL,verify=0|SCTP6:ip6hostname:8888')))
|
||||||
|
|
||||||
|
here two processes on different hosts communicate using openssl over SCTP on
|
||||||
|
IPv6.
|
||||||
|
|
||||||
|
dit(bf(tt()))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
|
|
||||||
|
@ -2926,45 +3307,128 @@ manpagefiles()
|
||||||
label(ENVIRONMENT_VARIABLES)
|
label(ENVIRONMENT_VARIABLES)
|
||||||
manpagesection(ENVIRONMENT VARIABLES)
|
manpagesection(ENVIRONMENT VARIABLES)
|
||||||
|
|
||||||
startdit()
|
Input variables carry information from the environment to socat, output
|
||||||
dit(bf(SOCAT_DEFAULT_LISTEN_IP)) (Values 4 or 6) Sets the IP version to be used
|
variables are set by socat for use in executed scripts and programs.
|
||||||
for listen, recv, and recvfrom addresses if no link(pf)(OPTION_PROTOCOL_FAMILY)
|
|
||||||
(protocol-family) option is given. Is overridden by socat options
|
|
||||||
link(-4)(option_4) or link(-6)(option_6).
|
|
||||||
|
|
||||||
dit(bf(SOCAT_PREFERRED_RESOLVE_IP)) (Values 0, 4, or 6) Sets the IP version to
|
In the output variables beginning with "SOCAT" this prefix is actually replaced
|
||||||
|
by the upper case name of the executable or the value of option
|
||||||
|
link(-lp)(option_lp).
|
||||||
|
|
||||||
|
startdit()
|
||||||
|
label(ENV_SOCAT_DEFAULT_LISTEN_IP)
|
||||||
|
dit(bf(SOCAT_DEFAULT_LISTEN_IP) (input)) (Values 4 or 6) Sets the IP version to
|
||||||
|
be used for listen, recv, and recvfrom addresses if no
|
||||||
|
link(pf)(OPTION_PROTOCOL_FAMILY) (protocol-family) option is given. Is
|
||||||
|
overridden by socat options link(-4)(option_4) or link(-6)(option_6).
|
||||||
|
|
||||||
|
dit(bf(SOCAT_PREFERRED_RESOLVE_IP) (input)) (Values 0, 4, or 6) Sets the IP
|
||||||
|
version to
|
||||||
be used when resolving target host names when version is not specified by
|
be used when resolving target host names when version is not specified by
|
||||||
address type, option link(pf)(OPTION_PROTOCOL_FAMILY) (protocol-family), or
|
address type, option link(pf)(OPTION_PROTOCOL_FAMILY) (protocol-family), or
|
||||||
address format. If name resolution does not return a matching entry, the first
|
address format. If name resolution does not return a matching entry, the first
|
||||||
result (with differing IP version) is taken. With value 0, socat always selects
|
result (with differing IP version) is taken. With value 0, socat always selects
|
||||||
the first record and its IP version.
|
the first record and its IP version.
|
||||||
|
|
||||||
dit(bf(SOCAT_FORK_WAIT)) Specifies the time (seconds) to sleep the parent and
|
dit(bf(SOCAT_FORK_WAIT) (input)) Specifies the time (seconds) to sleep the
|
||||||
child processes after successful fork(). Useful for debugging.
|
parent and child processes after successful fork(). Useful for debugging.
|
||||||
|
|
||||||
dit(bf(HOSTNAME)) Is used to determine the hostname for logging (see
|
dit(bf(SOCAT_VERSION) (output)) Socat sets this variable to its version string,
|
||||||
|
e.g. tt("1.7.0.0") for released versions or e.g. tt("1.6.0.1+envvar") for
|
||||||
|
temporary versions; can be used in scripts invoked by socat.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_PID) (output)) Socat sets this variable to its process id. In case
|
||||||
|
of link(fork)(OPTION_FORK) address option, SOCAT_PID gets the child processes
|
||||||
|
id. Forking for link(exec)(ADDRESS_EXEC) and link(system)(ADDRESS_SYSTEM) does
|
||||||
|
not change SOCAT_PID.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_PPID) (output)) Socat sets this variable to its process id. In
|
||||||
|
case of link(fork)(OPTION_FORK), SOCAT_PPID keeps the pid of the master process.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_PEERADDR) (output)) With passive socket addresses (all LISTEN and
|
||||||
|
RECVFROM addresses), this variable is set to a string describing the peers
|
||||||
|
socket address. Port information is not included.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_PEERPORT) (output)) With appropriate passive socket addresses
|
||||||
|
(TCP, UDP, and SCTP - LISTEN and RECVFROM), this variable is set to a string containing the
|
||||||
|
number of the peer port.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_SOCKADDR) (output)) With all LISTEN addresses, this variable is
|
||||||
|
set to a string describing the local socket address. Port information is not
|
||||||
|
included link(example)(EXAMPLE_HTTPECHO)
|
||||||
|
|
||||||
|
dit(bf(SOCAT_SOCKPORT) (output)) With link(TCP-LISTEN)(ADDRESS_TCP_LISTEN),
|
||||||
|
link(UDP-LISTEN)(ADDRESS_UDP_LISTEN), and
|
||||||
|
link(SCTP-LISTEN)(ADDRESS_SCTP_LISTEN) addresses, this variable is set to the
|
||||||
|
local port.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_TIMESTAMP) (output)) With all RECVFROM addresses where address
|
||||||
|
option link(so-timestamp)(OPTION_SO_TIMESTAMP) is applied, socat sets this
|
||||||
|
variable to the resulting timestamp.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_OPTIONS) (output)) With all IPv4 based RECVFROM addresses where
|
||||||
|
address option link(ip-recvopts)(OPTION_IP_RECVOPTS) is applied, socat fills
|
||||||
|
this variable with the IP options of the received packet.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_DSTADDR) (output)) With all IPv4 based RECVFROM addresses where
|
||||||
|
address option link(ip-recvdstaddr)(OPTION_IP_RECVDSTADDR) (BSD) or
|
||||||
|
link(ip-pktinfo)(OPTION_IP_PKTINFO) (other platforms) is applied, socat sets
|
||||||
|
this variable to the destination address of the received packet. This is
|
||||||
|
particularly useful to identify broadcast and multicast addressed packets.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_IF) (output)) With all IPv4 based RECVFROM addresses where
|
||||||
|
address option link(ip-recvif)(OPTION_IP_RECVIF) (BSD) or
|
||||||
|
link(ip-pktinfo)(OPTION_IP_PKTINFO) (other platforms) is applied, socat sets
|
||||||
|
this variable to the name of the interface where the packet was received.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_LOCADDR) (output)) With all IPv4 based RECVFROM
|
||||||
|
addresses where address option link(ip-pktinfo)(OPTION_IP_PKTINFO) is applied,
|
||||||
|
socat sets this variable to the address of the interface where the packet was
|
||||||
|
received.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_TOS) (output)) With all IPv4 based RECVFROM addresses where
|
||||||
|
address option link(ip-recvtos)(OPTION_IP_RECVTOS) is applied, socat sets this
|
||||||
|
variable to the TOS (type of service) of the received packet.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IP_TTL) (output)) With all IPv4 based RECVFROM addresses where
|
||||||
|
address option link(ip-recvttl)(OPTION_IP_RECVTTL) is applied, socat sets this
|
||||||
|
variable to the TTL (time to live) of the received packet.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IPV6_HOPLIMIT) (output)) With all IPv6 based RECVFROM addresses
|
||||||
|
where address option link(ipv6-recvhoplimit)(OPTION_IPV6_RECVHOPLIMIT) is
|
||||||
|
applied, socat sets this variable to the hoplimit value of the received packet.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IPV6_DSTADDR) (output)) With all IPv6 based RECVFROM
|
||||||
|
addresses where address option link(ipv6-recvpktinfo)(OPTION_IPV6_RECVPKTINFO)
|
||||||
|
is applied, socat sets this variable to the destination address of the received
|
||||||
|
packet.
|
||||||
|
|
||||||
|
dit(bf(SOCAT_IPV6_TCLASS) (output)) With all IPv6 based RECVFROM addresses
|
||||||
|
where address option link(ipv6-recvtclass)(OPTION_IPV6_RECVTCLASS) is applied,
|
||||||
|
socat sets this variable to the transfer class of the received packet.
|
||||||
|
|
||||||
|
dit(bf(HOSTNAME) (input)) Is used to determine the hostname for logging (see
|
||||||
link(-lh)(option_lh)).
|
link(-lh)(option_lh)).
|
||||||
|
|
||||||
dit(bf(LOGNAME)) Is used as name for the socks client user name if no
|
dit(bf(LOGNAME) (input)) Is used as name for the socks client user name if no
|
||||||
link(socksuser)(OPTION_SOCKSUSER) is given.nl()
|
link(socksuser)(OPTION_SOCKSUSER) is given.nl()
|
||||||
With options link(su)(OPTION_SUBSTUSER) and
|
With options link(su)(OPTION_SUBSTUSER) and
|
||||||
link(su-d)(OPTION_SUBSTUSER_DELAYED), LOGNAME is set to the given user name.
|
link(su-d)(OPTION_SUBSTUSER_DELAYED), LOGNAME is set to the given user name.
|
||||||
|
|
||||||
dit(bf(USER)) Is used as name for the socks client user name if no
|
dit(bf(USER) (input)) Is used as name for the socks client user name if no
|
||||||
link(socksuser)(OPTION_SOCKSUSER) is given and LOGNAME is empty.nl()
|
link(socksuser)(OPTION_SOCKSUSER) is given and LOGNAME is empty.nl()
|
||||||
With options link(su)(OPTION_SUBSTUSER) and
|
With options link(su)(OPTION_SUBSTUSER) and
|
||||||
link(su-d)(OPTION_SUBSTUSER_DELAYED), USER is set to the given user name.
|
link(su-d)(OPTION_SUBSTUSER_DELAYED), USER is set to the given user name.
|
||||||
|
|
||||||
dit(bf(SHELL))
|
dit(bf(SHELL) (output))
|
||||||
With options link(su)(OPTION_SUBSTUSER) and
|
With options link(su)(OPTION_SUBSTUSER) and
|
||||||
link(su-d)(OPTION_SUBSTUSER_DELAYED), SHELL is set to the login shell of the
|
link(su-d)(OPTION_SUBSTUSER_DELAYED), SHELL is set to the login shell of the
|
||||||
given user.
|
given user.
|
||||||
|
|
||||||
dit(bf(PATH))
|
dit(bf(PATH) (output))
|
||||||
Can be set with option link(path)(OPTION_PATH) for link(exec)(ADDRESS_EXEC) and
|
Can be set with option link(path)(OPTION_PATH) for link(exec)(ADDRESS_EXEC) and
|
||||||
link(system)(ADDRESS_SYSTEM) addresses.
|
link(system)(ADDRESS_SYSTEM) addresses.
|
||||||
|
|
||||||
dit(bf(HOME))
|
dit(bf(HOME) (output))
|
||||||
With options link(su)(OPTION_SUBSTUSER) and
|
With options link(su)(OPTION_SUBSTUSER) and
|
||||||
link(su-d)(OPTION_SUBSTUSER_DELAYED), HOME is set to the home directory of the
|
link(su-d)(OPTION_SUBSTUSER_DELAYED), HOME is set to the home directory of the
|
||||||
given user.
|
given user.
|
||||||
|
@ -2991,7 +3455,7 @@ standard specifications available on the Internet for free.
|
||||||
label(VERSION)
|
label(VERSION)
|
||||||
manpagesection(VERSION)
|
manpagesection(VERSION)
|
||||||
|
|
||||||
This man page describes version 1.6.0 of socat().
|
This man page describes version 2.0.0-b2 of socat().
|
||||||
|
|
||||||
|
|
||||||
label(BUGS)
|
label(BUGS)
|
||||||
|
|
75
error.c
75
error.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: error.c */
|
/* source: error.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* the logging subsystem */
|
/* the logging subsystem */
|
||||||
|
@ -39,7 +39,6 @@ struct diag_opts {
|
||||||
const char *progname;
|
const char *progname;
|
||||||
int msglevel;
|
int msglevel;
|
||||||
int exitlevel;
|
int exitlevel;
|
||||||
int logstderr;
|
|
||||||
int syslog;
|
int syslog;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
int logfacility;
|
int logfacility;
|
||||||
|
@ -51,7 +50,7 @@ struct diag_opts {
|
||||||
|
|
||||||
|
|
||||||
struct diag_opts diagopts =
|
struct diag_opts diagopts =
|
||||||
{ NULL, E_ERROR, E_ERROR, 1, 0, NULL, LOG_DAEMON, false, 0 } ;
|
{ NULL, E_ERROR, E_ERROR, 0, NULL, LOG_DAEMON, false, 0 } ;
|
||||||
|
|
||||||
static void _msg(int level, const char *buff, const char *syslp);
|
static void _msg(int level, const char *buff, const char *syslp);
|
||||||
|
|
||||||
|
@ -89,7 +88,21 @@ static struct wordent facilitynames[] = {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
static int diaginitialized;
|
||||||
|
static int diag_init(void) {
|
||||||
|
if (diaginitialized) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
diaginitialized = 1;
|
||||||
|
/* gcc with GNU libc refuses to set this in the initializer */
|
||||||
|
diagopts.logfile = stderr;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#define DIAG_INIT ((void)(diaginitialized || diag_init()))
|
||||||
|
|
||||||
|
|
||||||
void diag_set(char what, const char *arg) {
|
void diag_set(char what, const char *arg) {
|
||||||
|
DIAG_INIT;
|
||||||
switch (what) {
|
switch (what) {
|
||||||
const struct wordent *keywd;
|
const struct wordent *keywd;
|
||||||
|
|
||||||
|
@ -100,18 +113,28 @@ void diag_set(char what, const char *arg) {
|
||||||
sizeof(facilitynames)/sizeof(struct wordent))) == NULL) {
|
sizeof(facilitynames)/sizeof(struct wordent))) == NULL) {
|
||||||
Error1("unknown syslog facility \"%s\"", arg);
|
Error1("unknown syslog facility \"%s\"", arg);
|
||||||
} else {
|
} else {
|
||||||
diagopts.logfacility = (int)keywd->desc;
|
diagopts.logfacility = (int)(size_t)keywd->desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
||||||
diagopts.logstderr = false; break;
|
if (diagopts.logfile != NULL && diagopts.logfile != stderr) {
|
||||||
case 'f': if ((diagopts.logfile = fopen(arg, "a")) == NULL) {
|
fclose(diagopts.logfile);
|
||||||
Error2("cannot open log file \"%s\": %s", arg, strerror(errno));
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
diagopts.logstderr = false; break;
|
|
||||||
}
|
}
|
||||||
case 's': diagopts.logstderr = true; break; /* logging to stderr is default */
|
diagopts.logfile = NULL;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
if (diagopts.logfile != NULL && diagopts.logfile != stderr) {
|
||||||
|
fclose(diagopts.logfile);
|
||||||
|
}
|
||||||
|
if ((diagopts.logfile = fopen(arg, "a")) == NULL) {
|
||||||
|
Error2("cannot open log file \"%s\": %s", arg, strerror(errno));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
if (diagopts.logfile != NULL && diagopts.logfile != stderr) {
|
||||||
|
fclose(diagopts.logfile);
|
||||||
|
}
|
||||||
|
diagopts.logfile = stderr; break; /* logging to stderr is default */
|
||||||
case 'p': diagopts.progname = arg;
|
case 'p': diagopts.progname = arg;
|
||||||
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
||||||
break;
|
break;
|
||||||
|
@ -122,6 +145,7 @@ void diag_set(char what, const char *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void diag_set_int(char what, int arg) {
|
void diag_set_int(char what, int arg) {
|
||||||
|
DIAG_INIT;
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 'D': diagopts.msglevel = arg; break;
|
case 'D': diagopts.msglevel = arg; break;
|
||||||
case 'e': diagopts.exitlevel = arg; break;
|
case 'e': diagopts.exitlevel = arg; break;
|
||||||
|
@ -138,9 +162,10 @@ void diag_set_int(char what, int arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int diag_get_int(char what) {
|
int diag_get_int(char what) {
|
||||||
|
DIAG_INIT;
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 'y': return diagopts.syslog;
|
case 'y': return diagopts.syslog;
|
||||||
case 's': return diagopts.logstderr;
|
case 's': return diagopts.logfile == stderr;
|
||||||
case 'd': case 'D': return diagopts.msglevel;
|
case 'd': case 'D': return diagopts.msglevel;
|
||||||
case 'e': return diagopts.exitlevel;
|
case 'e': return diagopts.exitlevel;
|
||||||
}
|
}
|
||||||
|
@ -148,6 +173,7 @@ int diag_get_int(char what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *diag_get_string(char what) {
|
const char *diag_get_string(char what) {
|
||||||
|
DIAG_INIT;
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 'p': return diagopts.progname;
|
case 'p': return diagopts.progname;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +196,7 @@ void msg(int level, const char *format, ...) {
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
DIAG_INIT;
|
||||||
if (level < diagopts.msglevel) return;
|
if (level < diagopts.msglevel) return;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
#if HAVE_GETTIMEOFDAY || 1
|
#if HAVE_GETTIMEOFDAY || 1
|
||||||
|
@ -237,9 +264,6 @@ void msg(int level, const char *format, ...) {
|
||||||
|
|
||||||
|
|
||||||
static void _msg(int level, const char *buff, const char *syslp) {
|
static void _msg(int level, const char *buff, const char *syslp) {
|
||||||
if (diagopts.logstderr) {
|
|
||||||
fputs(buff, stderr); fflush(stderr);
|
|
||||||
}
|
|
||||||
if (diagopts.syslog) {
|
if (diagopts.syslog) {
|
||||||
/* prevent format string attacks (thanks to CoKi) */
|
/* prevent format string attacks (thanks to CoKi) */
|
||||||
syslog(syslevel[level], "%s", syslp);
|
syslog(syslevel[level], "%s", syslp);
|
||||||
|
@ -248,3 +272,24 @@ static void _msg(int level, const char *buff, const char *syslp) {
|
||||||
fputs(buff, diagopts.logfile); fflush(diagopts.logfile);
|
fputs(buff, diagopts.logfile); fflush(diagopts.logfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* use a new log output file descriptor that is dup'ed from the current one.
|
||||||
|
this is useful when socat logs to stderr but fd 2 should be redirected to
|
||||||
|
serve other purposes */
|
||||||
|
int diag_dup(void) {
|
||||||
|
int newfd;
|
||||||
|
|
||||||
|
DIAG_INIT;
|
||||||
|
if (diagopts.logfile == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
newfd = dup(fileno(diagopts.logfile));
|
||||||
|
if (diagopts.logfile != stderr) {
|
||||||
|
fclose(diagopts.logfile);
|
||||||
|
}
|
||||||
|
if (newfd >= 0) {
|
||||||
|
diagopts.logfile = fdopen(newfd, "w");
|
||||||
|
}
|
||||||
|
return newfd;
|
||||||
|
}
|
||||||
|
|
11
error.h
11
error.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: error.h */
|
/* source: error.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __error_h_included
|
#ifndef __error_h_included
|
||||||
|
@ -50,6 +50,9 @@
|
||||||
#define Error6(m,a1,a2,a3,a4,a5,a6) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6)
|
#define Error6(m,a1,a2,a3,a4,a5,a6) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6)
|
||||||
#define Error7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7)
|
#define Error7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Error9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Error10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Error11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
#else /* !(WITH_MSGLEVEL >= E_ERROR) */
|
#else /* !(WITH_MSGLEVEL >= E_ERROR) */
|
||||||
#define Error(m)
|
#define Error(m)
|
||||||
#define Error1(m,a1)
|
#define Error1(m,a1)
|
||||||
|
@ -60,6 +63,9 @@
|
||||||
#define Error6(m,a1,a2,a3,a4,a5,a6)
|
#define Error6(m,a1,a2,a3,a4,a5,a6)
|
||||||
#define Error7(m,a1,a2,a3,a4,a5,a6,a7)
|
#define Error7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Error9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Error10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Error11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
#endif /* !(WITH_MSGLEVEL <= E_ERROR) */
|
#endif /* !(WITH_MSGLEVEL <= E_ERROR) */
|
||||||
|
|
||||||
#if WITH_MSGLEVEL <= E_WARN
|
#if WITH_MSGLEVEL <= E_WARN
|
||||||
|
@ -202,7 +208,8 @@ extern void diag_set(char what, const char *arg);
|
||||||
extern void diag_set_int(char what, int arg);
|
extern void diag_set_int(char what, int arg);
|
||||||
extern int diag_get_int(char what);
|
extern int diag_get_int(char what);
|
||||||
extern const char *diag_get_string(char what);
|
extern const char *diag_get_string(char what);
|
||||||
|
extern int diag_dup(void);
|
||||||
|
extern int diag_dup2(int newfd);
|
||||||
extern void msg(int level, const char *format, ...);
|
extern void msg(int level, const char *format, ...);
|
||||||
|
|
||||||
#endif /* !defined(__error_h_included) */
|
#endif /* !defined(__error_h_included) */
|
||||||
|
|
15
fdname.c
15
fdname.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: fdname.c */
|
/* source: fdname.c */
|
||||||
/* Copyright Gerhard Rieger 2003-2007 */
|
/* Copyright Gerhard Rieger 2003-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* the subroutine sockname prints the basic info about the address of a socket
|
/* the subroutine sockname prints the basic info about the address of a socket
|
||||||
|
@ -32,7 +32,7 @@ int unixame(int fd, FILE *outfile);
|
||||||
int tcpname(int fd, FILE *outfile);
|
int tcpname(int fd, FILE *outfile);
|
||||||
|
|
||||||
|
|
||||||
int fdname(const char *file, int fd, FILE *outfile) {
|
int fdname(const char *file, int fd, FILE *outfile, const char *numform) {
|
||||||
struct stat buf = {0};
|
struct stat buf = {0};
|
||||||
int filetype;
|
int filetype;
|
||||||
Debug1("checking file descriptor %u", fd);
|
Debug1("checking file descriptor %u", fd);
|
||||||
|
@ -46,6 +46,9 @@ int fdname(const char *file, int fd, FILE *outfile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filetype = (buf.st_mode&S_IFMT)>>12;
|
filetype = (buf.st_mode&S_IFMT)>>12;
|
||||||
|
if (numform != NULL) {
|
||||||
|
fprintf(outfile, numform, fd);
|
||||||
|
}
|
||||||
return statname(file, fd, filetype, outfile);
|
return statname(file, fd, filetype, outfile);
|
||||||
} else {
|
} else {
|
||||||
if (Stat(file, &buf) < 0) {
|
if (Stat(file, &buf) < 0) {
|
||||||
|
@ -139,7 +142,7 @@ int statname(const char *file, int fd, int filetype, FILE *outfile) {
|
||||||
if (file) fprintf(outfile, " %s", file);
|
if (file) fprintf(outfile, " %s", file);
|
||||||
break;
|
break;
|
||||||
case (S_IFSOCK>>12): /* 12, socket */
|
case (S_IFSOCK>>12): /* 12, socket */
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
result = sockname(fd, outfile);
|
result = sockname(fd, outfile);
|
||||||
} else if (file) {
|
} else if (file) {
|
||||||
|
@ -150,7 +153,7 @@ int statname(const char *file, int fd, int filetype, FILE *outfile) {
|
||||||
#else
|
#else
|
||||||
Error("SOCKET support not compiled in");
|
Error("SOCKET support not compiled in");
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* !WITH_SOCKET */
|
#endif /* !_WITH_SOCKET */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* ioctl() */
|
/* ioctl() */
|
||||||
|
@ -185,7 +188,7 @@ int cdevname(int fd, FILE *outfile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
int sockname(int fd, FILE *outfile) {
|
int sockname(int fd, FILE *outfile) {
|
||||||
#define FDNAME_OPTLEN 256
|
#define FDNAME_OPTLEN 256
|
||||||
#define FDNAME_NAMELEN 256
|
#define FDNAME_NAMELEN 256
|
||||||
|
@ -320,7 +323,7 @@ int sockname(int fd, FILE *outfile) {
|
||||||
#undef FDNAME_OPTLEN
|
#undef FDNAME_OPTLEN
|
||||||
#undef FDNAME_NAMELEN
|
#undef FDNAME_NAMELEN
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
88
filan.c
88
filan.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: filan.c */
|
/* source: filan.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* the subroutine filan makes a "FILe descriptor ANalysis". It checks the
|
/* the subroutine filan makes a "FILe descriptor ANalysis". It checks the
|
||||||
|
@ -26,7 +26,9 @@ struct sockopt {
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* dirty workaround so we dont get an error on AIX when getting linked with
|
static int filan_streams_analyze(int fd, FILE *outfile);
|
||||||
|
|
||||||
|
/* dirty workaround so we dont get an error on AIX when being linked with
|
||||||
libwrap */
|
libwrap */
|
||||||
int allow_severity, deny_severity;
|
int allow_severity, deny_severity;
|
||||||
|
|
||||||
|
@ -127,7 +129,17 @@ int filan_fd(int fd, FILE *outfile) {
|
||||||
{ /* see if data is available */
|
{ /* see if data is available */
|
||||||
struct pollfd ufds;
|
struct pollfd ufds;
|
||||||
ufds.fd = fd;
|
ufds.fd = fd;
|
||||||
ufds.events = POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|POLLWRNORM|POLLWRBAND
|
ufds.events = POLLIN|POLLPRI|POLLOUT
|
||||||
|
#ifdef POLLRDNORM
|
||||||
|
|POLLRDNORM
|
||||||
|
#endif
|
||||||
|
#ifdef POLLRDBAND
|
||||||
|
|POLLRDBAND
|
||||||
|
#endif
|
||||||
|
|POLLWRNORM
|
||||||
|
#ifdef POLLWRBAND
|
||||||
|
|POLLWRBAND
|
||||||
|
#endif
|
||||||
#ifdef POLLMSG
|
#ifdef POLLMSG
|
||||||
|POLLMSG
|
|POLLMSG
|
||||||
#endif
|
#endif
|
||||||
|
@ -150,7 +162,7 @@ int filan_fd(int fd, FILE *outfile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* defined(FIONREAD) */
|
#endif /* defined(FIONREAD) */
|
||||||
#if WITH_SOCKET && defined(MSG_DONTWAIT)
|
#if _WITH_SOCKET && defined(MSG_DONTWAIT)
|
||||||
if ((ufds.revents & POLLIN) && isasocket(fd)) {
|
if ((ufds.revents & POLLIN) && isasocket(fd)) {
|
||||||
char _peername[SOCKADDR_MAX];
|
char _peername[SOCKADDR_MAX];
|
||||||
struct sockaddr *pa = (struct sockaddr *)_peername;
|
struct sockaddr *pa = (struct sockaddr *)_peername;
|
||||||
|
@ -186,7 +198,7 @@ int filan_fd(int fd, FILE *outfile) {
|
||||||
fprintf(outfile, "recvmsg="F_Zd", ", bytes);
|
fprintf(outfile, "recvmsg="F_Zd", ", bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET && defined(MSG_DONTWAIT) */
|
#endif /* _WITH_SOCKET && defined(MSG_DONTWAIT) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,6 +365,9 @@ int filan_stat(
|
||||||
, outfile);
|
, outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ever heard of POSIX streams? here we handle these */
|
||||||
|
filan_streams_analyze(statfd, outfile);
|
||||||
|
|
||||||
/* now see for type specific infos */
|
/* now see for type specific infos */
|
||||||
if (statfd >= 0) { /*!indent */
|
if (statfd >= 0) { /*!indent */
|
||||||
switch (buf->st_mode&S_IFMT) {
|
switch (buf->st_mode&S_IFMT) {
|
||||||
|
@ -371,12 +386,12 @@ int filan_stat(
|
||||||
break;
|
break;
|
||||||
#ifdef S_IFSOCK
|
#ifdef S_IFSOCK
|
||||||
case (S_IFSOCK): /* 12, socket */
|
case (S_IFSOCK): /* 12, socket */
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
result = sockan(statfd, outfile);
|
result = sockan(statfd, outfile);
|
||||||
#else
|
#else
|
||||||
Warn("SOCKET support not compiled in");
|
Warn("SOCKET support not compiled in");
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* !WITH_SOCKET */
|
#endif /* !_WITH_SOCKET */
|
||||||
break;
|
break;
|
||||||
#endif /* S_IFSOCK */
|
#endif /* S_IFSOCK */
|
||||||
}
|
}
|
||||||
|
@ -408,10 +423,53 @@ int devinfo(int fd) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* returns 0 on success (not a stream descriptor, or no module)
|
||||||
|
returns <0 on failure */
|
||||||
|
static int filan_streams_analyze(int fd, FILE *outfile) {
|
||||||
|
#ifdef I_LIST
|
||||||
|
# define SL_NMODS 8 /* max number of module names we can store */
|
||||||
|
struct str_list modnames;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!isastream(fd)) {
|
||||||
|
fprintf(outfile, "\t(no STREAMS modules)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#if 0 /* uncomment for debugging */
|
||||||
|
fprintf(outfile, "\tfind=%d", ioctl(fd, I_FIND, "ldterm"));
|
||||||
|
#endif
|
||||||
|
modnames.sl_nmods = ioctl(fd, I_LIST, 0);
|
||||||
|
if (modnames.sl_nmods < 0) {
|
||||||
|
fprintf(stderr, "ioctl(%d, I_LIST, 0): %s\n", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
modnames.sl_modlist = Malloc(modnames.sl_nmods*(sizeof(struct str_mlist)));
|
||||||
|
if (modnames.sl_modlist == NULL) {
|
||||||
|
fprintf(stderr, "out of memory\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ioctl(fd, I_LIST, &modnames) < 0) {
|
||||||
|
fprintf(stderr, "ioctl(%d, I_LIST, %p): %s\n",
|
||||||
|
fd, &modnames, strerror(errno));
|
||||||
|
free(modnames.sl_modlist);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fprintf(outfile, "\tSTREAMS: ");
|
||||||
|
for (i = 0; i < modnames.sl_nmods; ++i) {
|
||||||
|
fprintf(outfile, "\"%s\"", modnames.sl_modlist[i].l_name);
|
||||||
|
if (i+1 < modnames.sl_nmods) fputc(',', outfile);
|
||||||
|
}
|
||||||
|
free(modnames.sl_modlist);
|
||||||
|
#endif /* defined(I_LIST) */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* character device analysis */
|
/* character device analysis */
|
||||||
int cdevan(int fd, FILE *outfile) {
|
int cdevan(int fd, FILE *outfile) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#if _WITH_TERMIOS
|
||||||
if ((ret = Isatty(fd)) < 0) {
|
if ((ret = Isatty(fd)) < 0) {
|
||||||
Warn2("isatty(%d): %s", fd, strerror(errno));
|
Warn2("isatty(%d): %s", fd, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -458,11 +516,12 @@ int cdevan(int fd, FILE *outfile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
int sockan(int fd, FILE *outfile) {
|
int sockan(int fd, FILE *outfile) {
|
||||||
#define FILAN_OPTLEN 256
|
#define FILAN_OPTLEN 256
|
||||||
#define FILAN_NAMELEN 256
|
#define FILAN_NAMELEN 256
|
||||||
|
@ -479,6 +538,9 @@ int sockan(int fd, FILE *outfile) {
|
||||||
{SO_REUSEADDR, "REUSEADDR"},
|
{SO_REUSEADDR, "REUSEADDR"},
|
||||||
{SO_TYPE, "TYPE"},
|
{SO_TYPE, "TYPE"},
|
||||||
{SO_ERROR, "ERROR"},
|
{SO_ERROR, "ERROR"},
|
||||||
|
#ifdef SO_PROTOTYPE
|
||||||
|
{SO_PROTOTYPE, "PROTOTYPE"},
|
||||||
|
#endif
|
||||||
{SO_DONTROUTE, "DONTROUTE"},
|
{SO_DONTROUTE, "DONTROUTE"},
|
||||||
{SO_BROADCAST, "BROADCAST"},
|
{SO_BROADCAST, "BROADCAST"},
|
||||||
{SO_SNDBUF, "SNDBUF"},
|
{SO_SNDBUF, "SNDBUF"},
|
||||||
|
@ -634,7 +696,7 @@ int sockan(int fd, FILE *outfile) {
|
||||||
#undef FILAN_OPTLEN
|
#undef FILAN_OPTLEN
|
||||||
#undef FILAN_NAMELEN
|
#undef FILAN_NAMELEN
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
#if WITH_IP4 || WITH_IP6
|
#if WITH_IP4 || WITH_IP6
|
||||||
|
@ -823,7 +885,7 @@ int tcpan(int fd, FILE *outfile) {
|
||||||
#endif /* WITH_TCP */
|
#endif /* WITH_TCP */
|
||||||
|
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
int sockoptan(int fd, const struct sockopt *optname, int socklay, FILE *outfile) {
|
int sockoptan(int fd, const struct sockopt *optname, int socklay, FILE *outfile) {
|
||||||
#define FILAN_OPTLEN 256
|
#define FILAN_OPTLEN 256
|
||||||
char optval[FILAN_OPTLEN];
|
char optval[FILAN_OPTLEN];
|
||||||
|
@ -859,10 +921,10 @@ int sockoptan(int fd, const struct sockopt *optname, int socklay, FILE *outfile)
|
||||||
return 0;
|
return 0;
|
||||||
#undef FILAN_OPTLEN
|
#undef FILAN_OPTLEN
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
int isasocket(int fd) {
|
int isasocket(int fd) {
|
||||||
int retval;
|
int retval;
|
||||||
#if HAVE_STAT64
|
#if HAVE_STAT64
|
||||||
|
@ -883,7 +945,7 @@ int isasocket(int fd) {
|
||||||
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
||||||
return S_ISSOCK(props.st_mode);
|
return S_ISSOCK(props.st_mode);
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
const char *getfiletypestring(int st_mode) {
|
const char *getfiletypestring(int st_mode) {
|
||||||
|
|
9
filan.h
9
filan.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: filan.h */
|
/* source: filan.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
|
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
@ -26,13 +26,14 @@ extern int filan_stat(
|
||||||
|
|
||||||
extern int cdevan(int fd, FILE *outfile);
|
extern int cdevan(int fd, FILE *outfile);
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
extern int isasocket(int fd);
|
extern int isasocket(int fd);
|
||||||
extern int sockan(int fd, FILE *outfile);
|
extern int sockan(int fd, FILE *outfile);
|
||||||
extern int ipan(int fd, FILE *outfile);
|
extern int ipan(int fd, FILE *outfile);
|
||||||
extern int ip6an(int fd, FILE *outfile);
|
extern int ip6an(int fd, FILE *outfile);
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
extern int fdname(const char *file, int fd, FILE *outfile);
|
extern
|
||||||
|
int fdname(const char *file, int fd, FILE *outfile, const char *numform);
|
||||||
|
|
||||||
#endif /* !defined(__filan_h_included) */
|
#endif /* !defined(__filan_h_included) */
|
||||||
|
|
30
filan_main.c
30
filan_main.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: filan_main.c */
|
/* source: filan_main.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2006 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
const char copyright[] = "filan by Gerhard Rieger - see http://www.dest-unreach.org/socat/";
|
const char copyright[] = "filan by Gerhard Rieger - see http://www.dest-unreach.org/socat/";
|
||||||
|
@ -23,7 +23,8 @@ static void filan_usage(FILE *fd);
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
const char **arg1, *a;
|
const char **arg1, *a;
|
||||||
const char *filename = NULL, *waittimetxt;
|
const char *filename = NULL, *waittimetxt;
|
||||||
unsigned int m = 0, n = 1024; /* this is default on my Linux */
|
unsigned int m = 0; /* first FD (default) */
|
||||||
|
unsigned int n = FD_SETSIZE; /* last excl. */
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int style = 0;
|
int style = 0;
|
||||||
struct timespec waittime = { 0, 0 };
|
struct timespec waittime = { 0, 0 };
|
||||||
|
@ -57,7 +58,7 @@ int main(int argc, const char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m = strtoul(a, (char **)&a, 0);
|
m = strtoul(a, (char **)&a, 0);
|
||||||
n = m+1;
|
n = m;
|
||||||
break;
|
break;
|
||||||
case 'n': if (arg1[0][2]) {
|
case 'n': if (arg1[0][2]) {
|
||||||
a = *arg1+2;
|
a = *arg1+2;
|
||||||
|
@ -127,11 +128,11 @@ int main(int argc, const char *argv[]) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (outfname) {
|
if (outfname) {
|
||||||
// special cases
|
/* special cases */
|
||||||
if (!strcmp(outfname,"stdin")) { fdout=stdin; }
|
if (!strcmp(outfname,"stdin")) { fdout=stdin; }
|
||||||
else if (!strcmp(outfname,"stdout")) { fdout=stdout; }
|
else if (!strcmp(outfname,"stdout")) { fdout=stdout; }
|
||||||
else if (!strcmp(outfname,"stderr")) { fdout=stderr; }
|
else if (!strcmp(outfname,"stderr")) { fdout=stderr; }
|
||||||
// file descriptor
|
/* file descriptor */
|
||||||
else if (*outfname == '+') {
|
else if (*outfname == '+') {
|
||||||
a = outfname+1;
|
a = outfname+1;
|
||||||
fildes = strtoul(a, (char **)&a, 0);
|
fildes = strtoul(a, (char **)&a, 0);
|
||||||
|
@ -140,7 +141,7 @@ int main(int argc, const char *argv[]) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// file name
|
/* file name */
|
||||||
if ((fdout = fopen(outfname, "w")) == NULL) {
|
if ((fdout = fopen(outfname, "w")) == NULL) {
|
||||||
Error2("can't fopen '%s': %s\n",
|
Error2("can't fopen '%s': %s\n",
|
||||||
outfname, strerror(errno));
|
outfname, strerror(errno));
|
||||||
|
@ -168,6 +169,9 @@ int main(int argc, const char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
filan_file(filename, fdout);
|
filan_file(filename, fdout);
|
||||||
} else {
|
} else {
|
||||||
|
if (m == n) {
|
||||||
|
++n;
|
||||||
|
}
|
||||||
for (i = m; i < n; ++i) {
|
for (i = m; i < n; ++i) {
|
||||||
filan_fd(i, fdout);
|
filan_fd(i, fdout);
|
||||||
}
|
}
|
||||||
|
@ -189,12 +193,16 @@ int main(int argc, const char *argv[]) {
|
||||||
Debug2("open(\"%s\", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0700): %s",
|
Debug2("open(\"%s\", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0700): %s",
|
||||||
filename, strerror(errno));
|
filename, strerror(errno));
|
||||||
}
|
}
|
||||||
fdname(filename, fd, fdout);
|
fdname(filename, fd, fdout, NULL);
|
||||||
#endif
|
#endif
|
||||||
fdname(filename, -1, fdout);
|
fdname(filename, -1, fdout, NULL);
|
||||||
} else {
|
} else {
|
||||||
for (i = m; i < n; ++i) {
|
if (m == n) {
|
||||||
fdname("", i, fdout);
|
fdname("", m, fdout, NULL);
|
||||||
|
} else {
|
||||||
|
for (i = m; i < n; ++i) {
|
||||||
|
fdname("", i, fdout, "%5u ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +233,7 @@ static void filan_usage(FILE *fd) {
|
||||||
fputs(" -ls log to stderr (default if no other log)\n", fd);
|
fputs(" -ls log to stderr (default if no other log)\n", fd);
|
||||||
#endif
|
#endif
|
||||||
fputs(" -i<fdnum> only analyze this fd\n", fd);
|
fputs(" -i<fdnum> only analyze this fd\n", fd);
|
||||||
fputs(" -n<fdnum> analyze all fds from 0 up to fdnum-1 (default: 1024)\n", fd);
|
fprintf(fd, " -n<fdnum> analyze all fds from 0 up to fdnum-1 (default: %u)\n", FD_SETSIZE);
|
||||||
fputs(" -s simple output with just type and socket address or path\n", fd);
|
fputs(" -s simple output with just type and socket address or path\n", fd);
|
||||||
/* fputs(" -c alternate device visualization\n", fd);*/
|
/* fputs(" -c alternate device visualization\n", fd);*/
|
||||||
fputs(" -f<filename> analyze file system entry\n", fd);
|
fputs(" -f<filename> analyze file system entry\n", fd);
|
||||||
|
|
15
hostan.c
15
hostan.c
|
@ -20,22 +20,21 @@
|
||||||
static int iffan(FILE *outfile);
|
static int iffan(FILE *outfile);
|
||||||
|
|
||||||
int hostan(FILE *outfile) {
|
int hostan(FILE *outfile) {
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
fprintf(outfile, "\nIP INTERFACES\n");
|
fprintf(outfile, "\nIP INTERFACES\n");
|
||||||
iffan(outfile);
|
iffan(outfile);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
static int iffan(FILE *outfile) {
|
static int iffan(FILE *outfile) {
|
||||||
/* Linux: man 7 netdevice */
|
/* Linux: man 7 netdevice */
|
||||||
/* FreeBSD: man 4 networking */
|
/* FreeBSD, NetBSD: man 4 networking */
|
||||||
/* Solaris: man 7 if_tcp */
|
/* Solaris: man 7 if_tcp */
|
||||||
|
|
||||||
/* currently we support Linux and a little FreeBSD */
|
/* currently we support Linux and a little FreeBSD */
|
||||||
#ifdef SIOCGIFCONF /* not Solaris */
|
#ifdef SIOCGIFCONF /* not Solaris */
|
||||||
#ifdef SIOCGIFINDEX /* not OpenBSD */
|
|
||||||
|
|
||||||
#define IFBUFSIZ 32*sizeof(struct ifreq) /*1024*/
|
#define IFBUFSIZ 32*sizeof(struct ifreq) /*1024*/
|
||||||
int s;
|
int s;
|
||||||
|
@ -62,22 +61,24 @@ static int iffan(FILE *outfile) {
|
||||||
struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
|
struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
#if 0 || defined(SIOCGIFINDEX) /* not NetBSD, OpenBSD */
|
||||||
strcpy(ifr.ifr_name, ifp->ifr_name);
|
strcpy(ifr.ifr_name, ifp->ifr_name);
|
||||||
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
Error3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}): %s",
|
Error3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}): %s",
|
||||||
s, &ifr.ifr_name, strerror(errno));
|
s, &ifr.ifr_name, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_ifrn.ifrn_name);*/
|
|
||||||
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
fprintf(outfile, "%2d: %s\n", ifr.ifr_index, ifp->ifr_name);
|
fprintf(outfile, "%2d: %s\n", ifr.ifr_index, ifp->ifr_name);
|
||||||
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_name);
|
fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_name);
|
||||||
#endif /* HAVE_STRUCT_IFREQ_IFR_INDEX */
|
#endif /* HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
#else /* !defined(SIOCGIFINDEX) */
|
||||||
|
fprintf(outfile, "%2d: %s\n", i/sizeof(struct ifreq), ifp->ifr_name);
|
||||||
|
#endif /* defined(SIOCGIFINDEX) */
|
||||||
}
|
}
|
||||||
Close(s);
|
Close(s);
|
||||||
#endif /* defined(SIOCGIFCONF) */
|
#endif /* defined(SIOCGIFCONF) */
|
||||||
#endif /* defined(SIOCGIFINDEX) */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
|
@ -20,7 +20,7 @@ int procan_cdefs(FILE *outfile) {
|
||||||
fprintf(outfile, "#define FD_SETSIZE %u\n", FD_SETSIZE);
|
fprintf(outfile, "#define FD_SETSIZE %u\n", FD_SETSIZE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef NFDBITS
|
#ifdef NFDBITS
|
||||||
fprintf(outfile, "#define NFDBITS %u\n", NFDBITS);
|
fprintf(outfile, "#define NFDBITS "F_Zu"\n", NFDBITS);
|
||||||
#endif
|
#endif
|
||||||
#ifdef O_RDONLY
|
#ifdef O_RDONLY
|
||||||
fprintf(outfile, "#define O_RDONLY %u\n", O_RDONLY);
|
fprintf(outfile, "#define O_RDONLY %u\n", O_RDONLY);
|
||||||
|
@ -75,10 +75,90 @@ int procan_cdefs(FILE *outfile) {
|
||||||
#ifdef CSIZE
|
#ifdef CSIZE
|
||||||
fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE);
|
fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef TIOCEXCL
|
||||||
|
fprintf(outfile, "#define TIOCEXCL 0x%lx\n", (unsigned long)TIOCEXCL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* stdio constants */
|
/* stdio constants */
|
||||||
#ifdef FOPEN_MAX
|
#ifdef FOPEN_MAX
|
||||||
fprintf(outfile, "#define FOPEN_MAX %u\n", FOPEN_MAX);
|
fprintf(outfile, "#define FOPEN_MAX %u\n", FOPEN_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* socket constants */
|
||||||
|
#ifdef PF_UNIX
|
||||||
|
fprintf(outfile, "#define PF_UNIX %d\n", PF_UNIX);
|
||||||
|
#elif defined(PF_LOCAL)
|
||||||
|
fprintf(outfile, "#define PF_LOCAL %d\n", PF_LOCAL);
|
||||||
|
#endif
|
||||||
|
#ifdef PF_INET
|
||||||
|
fprintf(outfile, "#define PF_INET %d\n", PF_INET);
|
||||||
|
#endif
|
||||||
|
#ifdef PF_INET6
|
||||||
|
fprintf(outfile, "#define PF_INET6 %d\n", PF_INET6);
|
||||||
|
#endif
|
||||||
|
#ifdef PF_APPLETALK
|
||||||
|
fprintf(outfile, "#define PF_APPLETALK %d\n", PF_APPLETALK);
|
||||||
|
#endif
|
||||||
|
#ifdef PF_PACKET
|
||||||
|
fprintf(outfile, "#define PF_PACKET %d\n", PF_PACKET);
|
||||||
|
#endif
|
||||||
|
#ifdef SOCK_STREAM
|
||||||
|
fprintf(outfile, "#define SOCK_STREAM %d\n", SOCK_STREAM);
|
||||||
|
#endif
|
||||||
|
#ifdef SOCK_DGRAM
|
||||||
|
fprintf(outfile, "#define SOCK_DGRAM %d\n", SOCK_DGRAM);
|
||||||
|
#endif
|
||||||
|
#ifdef SOCK_RAW
|
||||||
|
fprintf(outfile, "#define SOCK_RAW %d\n", SOCK_RAW);
|
||||||
|
#endif
|
||||||
|
#ifdef SOCK_SEQPACKET
|
||||||
|
fprintf(outfile, "#define SOCK_SEQPACKET %d\n", SOCK_SEQPACKET);
|
||||||
|
#endif
|
||||||
|
#ifdef SOCK_PACKET
|
||||||
|
fprintf(outfile, "#define SOCK_PACKET %d\n", SOCK_PACKET);
|
||||||
|
#endif
|
||||||
|
#ifdef IPPROTO_IP
|
||||||
|
fprintf(outfile, "#define IPPROTO_IP %d\n", IPPROTO_IP);
|
||||||
|
#endif
|
||||||
|
#ifdef IPPROTO_TCP
|
||||||
|
fprintf(outfile, "#define IPPROTO_TCP %d\n", IPPROTO_TCP);
|
||||||
|
#endif
|
||||||
|
#ifdef IPPROTO_UDP
|
||||||
|
fprintf(outfile, "#define IPPROTO_UDP %d\n", IPPROTO_UDP);
|
||||||
|
#endif
|
||||||
|
#ifdef IPPROTO_SCTP
|
||||||
|
fprintf(outfile, "#define IPPROTO_SCTP %d\n", IPPROTO_SCTP);
|
||||||
|
#endif
|
||||||
|
#ifdef IPPROTO_DCCP
|
||||||
|
fprintf(outfile, "#define IPPROTO_DCCP %d\n", IPPROTO_DCCP);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_SOCKET
|
||||||
|
fprintf(outfile, "#define SOL_SOCKET 0x%x\n", SOL_SOCKET);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_PACKET
|
||||||
|
fprintf(outfile, "#define SOL_PACKET 0x%x\n", SOL_PACKET);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_IP
|
||||||
|
fprintf(outfile, "#define SOL_IP 0x%x\n", SOL_IP);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_IPV6
|
||||||
|
fprintf(outfile, "#define SOL_IPV6 0x%x\n", SOL_IPV6);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_TCP
|
||||||
|
fprintf(outfile, "#define SOL_TCP 0x%x\n", SOL_TCP);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_UDP
|
||||||
|
fprintf(outfile, "#define SOL_UDP 0x%x\n", SOL_UDP);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_SCTP
|
||||||
|
fprintf(outfile, "#define SOL_SCTP 0x%x\n", SOL_SCTP);
|
||||||
|
#endif
|
||||||
|
#ifdef SOL_DCCP
|
||||||
|
fprintf(outfile, "#define SOL_DCCP 0x%x\n", SOL_DCCP);
|
||||||
|
#endif
|
||||||
|
#ifdef SO_REUSEADDR
|
||||||
|
fprintf(outfile, "#define SO_REUSEADDR %d\n", SO_REUSEADDR);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# source: readline-test.sh
|
# source: readline-test.sh
|
||||||
# Copyright Gerhard Rieger 2003
|
# Copyright Gerhard Rieger 2003-2008
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
# script that simulates a simple program with authentication.
|
# script that simulates a simple program with authentication.
|
||||||
|
@ -29,8 +29,9 @@ trap "$ECHO $0 got SIGQUIT" QUIT
|
||||||
# print banner
|
# print banner
|
||||||
$ECHO "$BANNER"
|
$ECHO "$BANNER"
|
||||||
|
|
||||||
read -r -p "$($ECHO "$USERPROMPT")" USERNAME
|
# on (some) ksh read -p does not mean prompt
|
||||||
read -rs -p "$PWDPROMPT" PASSWORD
|
$ECHO "$USERPROMPT\c"; read -r USERNAME
|
||||||
|
$ECHO "$PWDPROMPT\c"; read -rs PASSWORD
|
||||||
$ECHO
|
$ECHO
|
||||||
|
|
||||||
if [ "$USERNAME" != "$CREDUSER" -o "$PASSWORD" != "$CREDPASS" ]; then
|
if [ "$USERNAME" != "$CREDUSER" -o "$PASSWORD" != "$CREDPASS" ]; then
|
||||||
|
@ -38,7 +39,7 @@ if [ "$USERNAME" != "$CREDUSER" -o "$PASSWORD" != "$CREDPASS" ]; then
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read -r -p "$PROMPT" COMMAND; do
|
while $ECHO "$PROMPT\c"; read -r COMMAND; do
|
||||||
if [ "$COMMAND" = "exit" ]; then
|
if [ "$COMMAND" = "exit" ]; then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
|
|
687
socat.c
687
socat.c
|
@ -63,12 +63,16 @@ bool havelock;
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
const char **arg1, *a;
|
const char **arg1, *a;
|
||||||
|
char *mainwaitstring;
|
||||||
char buff[10];
|
char buff[10];
|
||||||
double rto;
|
double rto;
|
||||||
int i, argc0, result;
|
int i, argc0, result;
|
||||||
struct utsname ubuf;
|
struct utsname ubuf;
|
||||||
int lockrc;
|
int lockrc;
|
||||||
|
|
||||||
|
if (mainwaitstring = getenv("SOCAT_MAIN_WAIT")) {
|
||||||
|
sleep(atoi(mainwaitstring));
|
||||||
|
}
|
||||||
diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
|
diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
|
||||||
|
|
||||||
/* we must init before applying options because env settings have lower
|
/* we must init before applying options because env settings have lower
|
||||||
|
@ -249,12 +253,14 @@ int main(int argc, const char *argv[]) {
|
||||||
Error("-U and -u must not be combined");
|
Error("-U and -u must not be combined");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xioinitialize2();
|
||||||
Info(copyright_socat);
|
Info(copyright_socat);
|
||||||
#if WITH_OPENSSL
|
#if WITH_OPENSSL
|
||||||
Info(copyright_openssl);
|
Info(copyright_openssl);
|
||||||
Info(copyright_ssleay);
|
Info(copyright_ssleay);
|
||||||
#endif
|
#endif
|
||||||
Debug2("socat version %s on %s", socatversion, timestamp);
|
Debug2("socat version %s on %s", socatversion, timestamp);
|
||||||
|
xiosetenv("VERSION", socatversion, 1); /* SOCAT_VERSION */
|
||||||
uname(&ubuf); /* ! here we circumvent internal tracing (Uname) */
|
uname(&ubuf); /* ! here we circumvent internal tracing (Uname) */
|
||||||
Debug4("running on %s version %s, release %s, machine %s\n",
|
Debug4("running on %s version %s, release %s, machine %s\n",
|
||||||
ubuf.sysname, ubuf.version, ubuf.release, ubuf.machine);
|
ubuf.sysname, ubuf.version, ubuf.release, ubuf.machine);
|
||||||
|
@ -428,6 +434,16 @@ void socat_version(FILE *fd) {
|
||||||
#else
|
#else
|
||||||
fputs(" #undef WITH_RAWIP\n", fd);
|
fputs(" #undef WITH_RAWIP\n", fd);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WITH_GENERICSOCKET
|
||||||
|
fprintf(fd, " #define WITH_GENERICSOCKET %d\n", WITH_GENERICSOCKET);
|
||||||
|
#else
|
||||||
|
fputs(" #undef WITH_GENERICSOCKET\n", fd);
|
||||||
|
#endif
|
||||||
|
#ifdef WITH_INTERFACE
|
||||||
|
fprintf(fd, " #define WITH_INTERFACE %d\n", WITH_INTERFACE);
|
||||||
|
#else
|
||||||
|
fputs(" #undef WITH_INTERFACE\n", fd);
|
||||||
|
#endif
|
||||||
#ifdef WITH_TCP
|
#ifdef WITH_TCP
|
||||||
fprintf(fd, " #define WITH_TCP %d\n", WITH_TCP);
|
fprintf(fd, " #define WITH_TCP %d\n", WITH_TCP);
|
||||||
#else
|
#else
|
||||||
|
@ -438,6 +454,11 @@ void socat_version(FILE *fd) {
|
||||||
#else
|
#else
|
||||||
fputs(" #undef WITH_UDP\n", fd);
|
fputs(" #undef WITH_UDP\n", fd);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WITH_SCTP
|
||||||
|
fprintf(fd, " #define WITH_SCTP %d\n", WITH_SCTP);
|
||||||
|
#else
|
||||||
|
fputs(" #undef WITH_SCTP\n", fd);
|
||||||
|
#endif
|
||||||
#ifdef WITH_LISTEN
|
#ifdef WITH_LISTEN
|
||||||
fprintf(fd, " #define WITH_LISTEN %d\n", WITH_LISTEN);
|
fprintf(fd, " #define WITH_LISTEN %d\n", WITH_LISTEN);
|
||||||
#else
|
#else
|
||||||
|
@ -590,677 +611,23 @@ int socat(int argc, const char *address1, const char *address2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
/* childleftdata() has been moved to xioengine.c */
|
||||||
/* checks if this is a connection to a child process, and if so, sees if the
|
|
||||||
child already died, leaving some data for us.
|
|
||||||
returns <0 if an error occurred;
|
|
||||||
returns 0 if no child or not yet died or died without data (sets eof);
|
|
||||||
returns >0 if child died and left data
|
|
||||||
*/
|
|
||||||
int childleftdata(xiofile_t *xfd) {
|
|
||||||
fd_set in, out, expt;
|
|
||||||
int retval;
|
|
||||||
/* have to check if a child process died before, but left read data */
|
|
||||||
if (XIO_READABLE(xfd) &&
|
|
||||||
(/*0 XIO_RDSTREAM(xfd)->howtoclose == END_KILL ||*/
|
|
||||||
XIO_RDSTREAM(xfd)->howtoclose == END_CLOSE_KILL ||
|
|
||||||
XIO_RDSTREAM(xfd)->howtoclose == END_SHUTDOWN_KILL) &&
|
|
||||||
XIO_RDSTREAM(xfd)->child.pid == 0) {
|
|
||||||
struct timeval time0 = { 0,0 };
|
|
||||||
|
|
||||||
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&expt);
|
|
||||||
if (XIO_READABLE(xfd) && !(XIO_RDSTREAM(xfd)->eof >= 2 && !XIO_RDSTREAM(xfd)->ignoreeof)) {
|
|
||||||
FD_SET(XIO_GETRDFD(xfd), &in);
|
|
||||||
/*0 FD_SET(XIO_GETRDFD(xfd), &expt);*/
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
retval = Select(FD_SETSIZE, &in, &out, &expt, &time0);
|
|
||||||
} while (retval < 0 && errno == EINTR);
|
|
||||||
|
|
||||||
if (retval < 0) {
|
/* _socat() has been moved to xioengine.c */
|
||||||
#if HAVE_FDS_BITS
|
|
||||||
Error5("select(%d, &0x%lx, &0x%lx, &0x%lx, {0}): %s",
|
|
||||||
FD_SETSIZE, in.fds_bits[0], out.fds_bits[0],
|
|
||||||
expt.fds_bits[0], strerror(errno));
|
|
||||||
#else
|
|
||||||
Error5("select(%d, &0x%lx, &0x%lx, &0x%lx, {0}): %s",
|
|
||||||
FD_SETSIZE, in.__fds_bits[0], out.__fds_bits[0],
|
|
||||||
expt.__fds_bits[0], strerror(errno));
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
} else if (retval == 0) {
|
|
||||||
Info("terminated child did not leave data for us");
|
|
||||||
XIO_RDSTREAM(xfd)->eof = 2;
|
|
||||||
xfd->stream.eof = 2;
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
bool mayrd1; /* sock1 has read data or eof, according to select() */
|
/* gettimestamp() has been moved to xiotransfer.c */
|
||||||
bool mayrd2; /* sock2 has read data or eof, according to select() */
|
|
||||||
bool maywr1; /* sock1 can be written to, according to select() */
|
|
||||||
bool maywr2; /* sock2 can be written to, according to select() */
|
|
||||||
|
|
||||||
/* here we come when the sockets are opened (in the meaning of C language),
|
|
||||||
and their options are set/applied
|
|
||||||
returns -1 on error or 0 on success */
|
|
||||||
int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
|
||||||
fd_set in, out, expt;
|
|
||||||
int retval;
|
|
||||||
unsigned char *buff;
|
|
||||||
ssize_t bytes1, bytes2;
|
|
||||||
int polling = 0; /* handling ignoreeof */
|
|
||||||
int wasaction = 1; /* last select was active, do NOT sleep before next */
|
|
||||||
struct timeval total_timeout; /* the actual total timeout timer */
|
|
||||||
|
|
||||||
sock1 = xfd1;
|
/* xioprintblockheader has been moved to xiotransfer.c */
|
||||||
sock2 = xfd2;
|
|
||||||
|
|
||||||
#if WITH_FILAN
|
|
||||||
if (socat_opts.debug) {
|
|
||||||
int fdi, fdo;
|
|
||||||
int msglevel, exitlevel;
|
|
||||||
|
|
||||||
msglevel = diag_get_int('D'); /* save current message level */
|
/* xiotransfer has been moved to xiotransfer.c */
|
||||||
diag_set_int('D', E_ERROR); /* only print errors and fatals in filan */
|
|
||||||
exitlevel = diag_get_int('e'); /* save current exit level */
|
|
||||||
diag_set_int('e', E_FATAL); /* only exit on fatals */
|
|
||||||
|
|
||||||
fdi = XIO_GETRDFD(sock1);
|
|
||||||
fdo = XIO_GETWRFD(sock1);
|
|
||||||
filan_fd(fdi, stderr);
|
|
||||||
if (fdo != fdi) {
|
|
||||||
filan_fd(fdo, stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
fdi = XIO_GETRDFD(sock2);
|
/* cv_newline has been moved to xiotransfer.c */
|
||||||
fdo = XIO_GETWRFD(sock2);
|
|
||||||
filan_fd(fdi, stderr);
|
|
||||||
if (fdo != fdi) {
|
|
||||||
filan_fd(fdo, stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
diag_set_int('e', exitlevel); /* restore old exit level */
|
|
||||||
diag_set_int('D', msglevel); /* restore old message level */
|
|
||||||
}
|
|
||||||
#endif /* WITH_FILAN */
|
|
||||||
|
|
||||||
/* when converting nl to crnl, size might double */
|
|
||||||
buff = Malloc(2*xioparams->bufsiz+1);
|
|
||||||
if (buff == NULL) return -1;
|
|
||||||
|
|
||||||
if (socat_opts.logopt == 'm' && xioinqopt('l', NULL, 0) == 'm') {
|
|
||||||
Info("switching to syslog");
|
|
||||||
diag_set('y', xioopts.syslogfac);
|
|
||||||
xiosetopt('l', "\0");
|
|
||||||
}
|
|
||||||
total_timeout = socat_opts.total_timeout;
|
|
||||||
|
|
||||||
Notice4("starting data transfer loop with FDs [%d,%d] and [%d,%d]",
|
|
||||||
XIO_GETRDFD(sock1), XIO_GETWRFD(sock1),
|
|
||||||
XIO_GETRDFD(sock2), XIO_GETWRFD(sock2));
|
|
||||||
while (XIO_RDSTREAM(sock1)->eof <= 1 ||
|
|
||||||
XIO_RDSTREAM(sock2)->eof <= 1) {
|
|
||||||
struct timeval timeout, *to = NULL;
|
|
||||||
|
|
||||||
Debug6("data loop: sock1->eof=%d, sock2->eof=%d, closing=%d, wasaction=%d, total_to={"F_tv_sec"."F_tv_usec"}",
|
|
||||||
XIO_RDSTREAM(sock1)->eof, XIO_RDSTREAM(sock2)->eof,
|
|
||||||
closing, wasaction,
|
|
||||||
total_timeout.tv_sec, total_timeout.tv_usec);
|
|
||||||
|
|
||||||
/* for ignoreeof */
|
|
||||||
if (polling) {
|
|
||||||
if (!wasaction) {
|
|
||||||
/* yes we could do it with select but I like readable trace output */
|
|
||||||
if (socat_opts.pollintv.tv_sec) Sleep(socat_opts.pollintv.tv_sec);
|
|
||||||
if (socat_opts.pollintv.tv_usec) Usleep(socat_opts.pollintv.tv_usec);
|
|
||||||
|
|
||||||
if (socat_opts.total_timeout.tv_sec != 0 ||
|
|
||||||
socat_opts.total_timeout.tv_usec != 0) {
|
|
||||||
if (total_timeout.tv_usec < socat_opts.pollintv.tv_usec) {
|
|
||||||
total_timeout.tv_usec += 1000000;
|
|
||||||
total_timeout.tv_sec -= 1;
|
|
||||||
}
|
|
||||||
total_timeout.tv_sec -= socat_opts.pollintv.tv_sec;
|
|
||||||
total_timeout.tv_usec -= socat_opts.pollintv.tv_usec;
|
|
||||||
if (total_timeout.tv_sec < 0 ||
|
|
||||||
total_timeout.tv_sec == 0 && total_timeout.tv_usec < 0) {
|
|
||||||
Notice("inactivity timeout triggered");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
wasaction = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (polling) {
|
|
||||||
/* there is a ignoreeof poll timeout, use it */
|
|
||||||
timeout = socat_opts.pollintv;
|
|
||||||
to = &timeout;
|
|
||||||
} else if (socat_opts.total_timeout.tv_sec != 0 ||
|
|
||||||
socat_opts.total_timeout.tv_usec != 0) {
|
|
||||||
/* there might occur a total inactivity timeout */
|
|
||||||
timeout = socat_opts.total_timeout;
|
|
||||||
to = &timeout;
|
|
||||||
} else {
|
|
||||||
to = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (closing>=1) {
|
|
||||||
/* first eof already occurred, start end timer */
|
|
||||||
timeout = socat_opts.closwait;
|
|
||||||
to = &timeout;
|
|
||||||
closing = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
int _errno;
|
|
||||||
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&expt);
|
|
||||||
|
|
||||||
childleftdata(sock1);
|
|
||||||
childleftdata(sock2);
|
|
||||||
|
|
||||||
if (closing>=1) {
|
|
||||||
/* first eof already occurred, start end timer */
|
|
||||||
timeout = socat_opts.closwait;
|
|
||||||
to = &timeout;
|
|
||||||
closing = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XIO_READABLE(sock1) &&
|
|
||||||
!(XIO_RDSTREAM(sock1)->eof > 1 && !XIO_RDSTREAM(sock1)->ignoreeof) &&
|
|
||||||
!socat_opts.righttoleft) {
|
|
||||||
Debug3("*** sock1: %p [%d,%d]", sock1, XIO_GETRDFD(sock1), XIO_GETWRFD(sock1));
|
|
||||||
if (!mayrd1) {
|
|
||||||
FD_SET(XIO_GETRDFD(sock1), &in);
|
|
||||||
}
|
|
||||||
if (!maywr2) {
|
|
||||||
FD_SET(XIO_GETWRFD(sock2), &out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (XIO_READABLE(sock2) &&
|
|
||||||
!(XIO_RDSTREAM(sock2)->eof > 1 && !XIO_RDSTREAM(sock2)->ignoreeof) &&
|
|
||||||
!socat_opts.lefttoright) {
|
|
||||||
Debug3("*** sock2: %p [%d,%d]", sock2, XIO_GETRDFD(sock2), XIO_GETWRFD(sock2));
|
|
||||||
if (!mayrd2) {
|
|
||||||
FD_SET(XIO_GETRDFD(sock2), &in);
|
|
||||||
}
|
|
||||||
if (!maywr1) {
|
|
||||||
FD_SET(XIO_GETWRFD(sock1), &out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
retval = Select(FD_SETSIZE, &in, &out, &expt, to);
|
|
||||||
_errno = errno;
|
|
||||||
if (retval < 0 && errno == EINTR) {
|
|
||||||
Info1("select(): %s", strerror(errno));
|
|
||||||
}
|
|
||||||
errno = _errno;
|
|
||||||
} while (retval < 0 && errno == EINTR);
|
|
||||||
|
|
||||||
/* attention:
|
|
||||||
when an exec'd process sends data and terminates, it is unpredictable
|
|
||||||
whether the data or the sigchild arrives first.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (retval < 0) {
|
|
||||||
#if HAVE_FDS_BITS
|
|
||||||
Error7("select(%d, &0x%lx, &0x%lx, &0x%lx, %s%lu): %s",
|
|
||||||
FD_SETSIZE, in.fds_bits[0], out.fds_bits[0],
|
|
||||||
expt.fds_bits[0], to?"&":"NULL/", to?to->tv_sec:0,
|
|
||||||
strerror(errno));
|
|
||||||
#else
|
|
||||||
Error7("select(%d, &0x%lx, &0x%lx, &0x%lx, %s%lu): %s",
|
|
||||||
FD_SETSIZE, in.__fds_bits[0], out.__fds_bits[0],
|
|
||||||
expt.__fds_bits[0], to?"&":"NULL/", to?to->tv_sec:0,
|
|
||||||
strerror(errno));
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
} else if (retval == 0) {
|
|
||||||
Info2("select timed out (no data within %ld.%06ld seconds)",
|
|
||||||
closing>=1?socat_opts.closwait.tv_sec:socat_opts.total_timeout.tv_sec,
|
|
||||||
closing>=1?socat_opts.closwait.tv_usec:socat_opts.total_timeout.tv_usec);
|
|
||||||
if (polling && !wasaction) {
|
|
||||||
/* there was a ignoreeof poll timeout, use it */
|
|
||||||
;
|
|
||||||
} else if (socat_opts.total_timeout.tv_sec != 0 ||
|
|
||||||
socat_opts.total_timeout.tv_usec != 0) {
|
|
||||||
/* there was a total inactivity timeout */
|
|
||||||
Notice("inactivity timeout triggered");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (closing) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* one possibility to come here is ignoreeof on some fd, but no EOF
|
|
||||||
and no data on any descriptor - this is no indication for end! */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XIO_READABLE(sock1) && XIO_GETRDFD(sock1) >= 0 &&
|
|
||||||
FD_ISSET(XIO_GETRDFD(sock1), &in)) {
|
|
||||||
mayrd1 = true;
|
|
||||||
}
|
|
||||||
if (XIO_READABLE(sock2) && XIO_GETRDFD(sock2) >= 0 &&
|
|
||||||
FD_ISSET(XIO_GETRDFD(sock2), &in)) {
|
|
||||||
mayrd2 = true;
|
|
||||||
}
|
|
||||||
if (XIO_GETWRFD(sock1) >= 0 && FD_ISSET(XIO_GETWRFD(sock1), &out)) {
|
|
||||||
maywr1 = true;
|
|
||||||
}
|
|
||||||
if (XIO_GETWRFD(sock2) >= 0 && FD_ISSET(XIO_GETWRFD(sock2), &out)) {
|
|
||||||
maywr2 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mayrd1 && maywr2) {
|
|
||||||
mayrd1 = false;
|
|
||||||
if ((bytes1 = xiotransfer(sock1, sock2, &buff, xioparams->bufsiz, false))
|
|
||||||
< 0) {
|
|
||||||
if (errno != EAGAIN) {
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
Notice("socket 1 to socket 2 is in error");
|
|
||||||
if (socat_opts.lefttoright) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (bytes1 > 0) {
|
|
||||||
maywr2 = false;
|
|
||||||
total_timeout = socat_opts.total_timeout;
|
|
||||||
wasaction = 1;
|
|
||||||
/* is more data available that has already passed select()? */
|
|
||||||
mayrd1 = (xiopending(sock1) > 0);
|
|
||||||
if (XIO_RDSTREAM(sock1)->readbytes != 0 &&
|
|
||||||
XIO_RDSTREAM(sock1)->actbytes == 0) {
|
|
||||||
/* avoid idle when all readbytes already there */
|
|
||||||
mayrd1 = true;
|
|
||||||
}
|
|
||||||
} else { /* bytes2 == 0 */
|
|
||||||
if (XIO_RDSTREAM(sock1)->ignoreeof && !closing) {
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
XIO_RDSTREAM(sock1)->eof = 2;
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
}
|
|
||||||
/* (bytes1 == 0) handled later */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bytes1 = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mayrd2 && maywr1) {
|
|
||||||
mayrd2 = false;
|
|
||||||
if ((bytes2 = xiotransfer(sock2, sock1, &buff, xioparams->bufsiz, true))
|
|
||||||
< 0) {
|
|
||||||
if (errno != EAGAIN) {
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
Notice("socket 2 to socket 1 is in error");
|
|
||||||
if (socat_opts.righttoleft) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (bytes2 > 0) {
|
|
||||||
maywr1 = false;
|
|
||||||
total_timeout = socat_opts.total_timeout;
|
|
||||||
wasaction = 1;
|
|
||||||
/* is more data available that has already passed select()? */
|
|
||||||
mayrd2 = (xiopending(sock2) > 0);
|
|
||||||
if (XIO_RDSTREAM(sock2)->readbytes != 0 &&
|
|
||||||
XIO_RDSTREAM(sock2)->actbytes == 0) {
|
|
||||||
/* avoid idle when all readbytes already there */
|
|
||||||
mayrd2 = true;
|
|
||||||
}
|
|
||||||
} else { /* bytes == 0 */
|
|
||||||
if (XIO_RDSTREAM(sock2)->ignoreeof && !closing) {
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
XIO_RDSTREAM(sock2)->eof = 2;
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
}
|
|
||||||
/* (bytes2 == 0) handled later */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bytes2 = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOW handle EOFs */
|
|
||||||
|
|
||||||
if (bytes1 == 0 || XIO_RDSTREAM(sock1)->eof >= 2) {
|
|
||||||
if (XIO_RDSTREAM(sock1)->ignoreeof && !closing) {
|
|
||||||
Debug1("socket 1 (fd %d) is at EOF, ignoring",
|
|
||||||
XIO_RDSTREAM(sock1)->fd1); /*! */
|
|
||||||
polling = 1;
|
|
||||||
} else {
|
|
||||||
Notice1("socket 1 (fd %d) is at EOF", XIO_GETRDFD(sock1));
|
|
||||||
xioshutdown(sock2, SHUT_WR);
|
|
||||||
if (socat_opts.lefttoright) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytes2 == 0 || XIO_RDSTREAM(sock2)->eof >= 2) {
|
|
||||||
if (XIO_RDSTREAM(sock2)->ignoreeof && !closing) {
|
|
||||||
Debug1("socket 2 (fd %d) is at EOF, ignoring",
|
|
||||||
XIO_RDSTREAM(sock2)->fd1);
|
|
||||||
polling = 1;
|
|
||||||
} else {
|
|
||||||
Notice1("socket 2 (fd %d) is at EOF", XIO_GETRDFD(sock2));
|
|
||||||
xioshutdown(sock1, SHUT_WR);
|
|
||||||
if (socat_opts.righttoleft) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close everything that's still open */
|
|
||||||
xioclose(sock1);
|
|
||||||
xioclose(sock2);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define MAXTIMESTAMPLEN 128
|
|
||||||
/* prints the timestamp to the buffer and terminates it with '\0'. This buffer
|
|
||||||
should be at least MAXTIMESTAMPLEN bytes long.
|
|
||||||
returns 0 on success or -1 if an error occurred */
|
|
||||||
int gettimestamp(char *timestamp) {
|
|
||||||
size_t bytes;
|
|
||||||
#if HAVE_GETTIMEOFDAY || 1
|
|
||||||
struct timeval now;
|
|
||||||
int result;
|
|
||||||
time_t nowt;
|
|
||||||
#else /* !HAVE_GETTIMEOFDAY */
|
|
||||||
time_t now;
|
|
||||||
#endif /* !HAVE_GETTIMEOFDAY */
|
|
||||||
|
|
||||||
#if HAVE_GETTIMEOFDAY || 1
|
|
||||||
result = gettimeofday(&now, NULL);
|
|
||||||
if (result < 0) {
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
nowt = now.tv_sec;
|
|
||||||
#if HAVE_STRFTIME
|
|
||||||
bytes = strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
|
||||||
bytes += sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec);
|
|
||||||
#else
|
|
||||||
strcpy(timestamp, ctime(&nowt));
|
|
||||||
bytes = strlen(timestamp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else /* !HAVE_GETTIMEOFDAY */
|
|
||||||
now = time(NULL); if (now == (time_t)-1) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
#if HAVE_STRFTIME
|
|
||||||
bytes = strftime(timestamp, 21, "%Y/%m/%d %H:%M:%S ", localtime(&now));
|
|
||||||
#else
|
|
||||||
strcpy(timestamp, ctime(&now));
|
|
||||||
bytes = strlen(timestamp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif /* !HAVE_GETTIMEOFDAY */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static const char *prefixltor = "> ";
|
|
||||||
static const char *prefixrtol = "< ";
|
|
||||||
static unsigned long numltor;
|
|
||||||
static unsigned long numrtol;
|
|
||||||
/* print block header (during verbose or hex dump)
|
|
||||||
returns 0 on success or -1 if an error occurred */
|
|
||||||
static int
|
|
||||||
xioprintblockheader(FILE *file, size_t bytes, bool righttoleft) {
|
|
||||||
char timestamp[MAXTIMESTAMPLEN];
|
|
||||||
char buff[128+MAXTIMESTAMPLEN];
|
|
||||||
if (gettimestamp(timestamp) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (righttoleft) {
|
|
||||||
sprintf(buff, "%s%s length="F_Zu" from=%lu to=%lu\n",
|
|
||||||
prefixrtol, timestamp, bytes, numrtol, numrtol+bytes-1);
|
|
||||||
numrtol+=bytes;
|
|
||||||
} else {
|
|
||||||
sprintf(buff, "%s%s length="F_Zu" from=%lu to=%lu\n",
|
|
||||||
prefixltor, timestamp, bytes, numltor, numltor+bytes-1);
|
|
||||||
numltor+=bytes;
|
|
||||||
}
|
|
||||||
fputs(buff, file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* inpipe is suspected to have read data available; read at most bufsiz bytes
|
|
||||||
and transfer them to outpipe. Perform required data conversions.
|
|
||||||
buff should be at least twice as large as bufsiz, to allow all standard
|
|
||||||
conversions. Returns the number of bytes written, or 0 on EOF or <0 if an
|
|
||||||
error occurred or when data was read but none written due to conversions
|
|
||||||
(with EAGAIN). EAGAIN also occurs when reading from a nonblocking FD where
|
|
||||||
the file has a mandatory lock.
|
|
||||||
If 0 bytes were read (EOF), it does NOT shutdown or close a channel, and it
|
|
||||||
does NOT write a zero bytes block.
|
|
||||||
*/
|
|
||||||
/* inpipe, outpipe must be single descriptors (not dual!) */
|
|
||||||
int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
|
|
||||||
unsigned char **buff, size_t bufsiz, bool righttoleft) {
|
|
||||||
ssize_t bytes, writt;
|
|
||||||
|
|
||||||
bytes = xioread(inpipe, *buff, xioparams->bufsiz);
|
|
||||||
if (bytes < 0) {
|
|
||||||
if (errno != EAGAIN)
|
|
||||||
XIO_RDSTREAM(inpipe)->eof = 2;
|
|
||||||
/*xioshutdown(inpipe, SHUT_RD);*/
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (bytes == 0 && XIO_RDSTREAM(inpipe)->ignoreeof && !closing) {
|
|
||||||
writt = 0;
|
|
||||||
} else if (bytes == 0) {
|
|
||||||
XIO_RDSTREAM(inpipe)->eof = 2;
|
|
||||||
closing = MAX(closing, 1);
|
|
||||||
writt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
else /* if (bytes > 0)*/ {
|
|
||||||
|
|
||||||
if (XIO_RDSTREAM(inpipe)->lineterm !=
|
|
||||||
XIO_WRSTREAM(outpipe)->lineterm) {
|
|
||||||
cv_newline(buff, &bytes,
|
|
||||||
XIO_RDSTREAM(inpipe)->lineterm,
|
|
||||||
XIO_WRSTREAM(outpipe)->lineterm);
|
|
||||||
}
|
|
||||||
if (bytes == 0) {
|
|
||||||
errno = EAGAIN; return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xioparams->verbose && xioparams->verbhex) {
|
|
||||||
/* Hack-o-rama */
|
|
||||||
size_t i = 0;
|
|
||||||
size_t j;
|
|
||||||
size_t N = 16;
|
|
||||||
const unsigned char *end, *s, *t;
|
|
||||||
s = *buff;
|
|
||||||
end = (*buff)+bytes;
|
|
||||||
xioprintblockheader(stderr, bytes, righttoleft);
|
|
||||||
while (s < end) {
|
|
||||||
/*! prefix? */
|
|
||||||
j = Min(N, (size_t)(end-s));
|
|
||||||
|
|
||||||
/* print hex */
|
|
||||||
t = s;
|
|
||||||
i = 0;
|
|
||||||
while (i < j) {
|
|
||||||
int c = *t++;
|
|
||||||
fprintf(stderr, " %02x", c);
|
|
||||||
++i;
|
|
||||||
if (c == '\n') break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fill hex column */
|
|
||||||
while (i < N) {
|
|
||||||
fputs(" ", stderr);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
fputs(" ", stderr);
|
|
||||||
|
|
||||||
/* print acsii */
|
|
||||||
t = s;
|
|
||||||
i = 0;
|
|
||||||
while (i < j) {
|
|
||||||
int c = *t++;
|
|
||||||
if (c == '\n') {
|
|
||||||
fputc('.', stderr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!isprint(c))
|
|
||||||
c = '.';
|
|
||||||
fputc(c, stderr);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc('\n', stderr);
|
|
||||||
s = t;
|
|
||||||
}
|
|
||||||
fputs("--\n", stderr);
|
|
||||||
} else if (socat_opts.verbose) {
|
|
||||||
size_t i = 0;
|
|
||||||
xioprintblockheader(stderr, bytes, righttoleft);
|
|
||||||
while (i < (size_t)bytes) {
|
|
||||||
int c = (*buff)[i];
|
|
||||||
if (i > 0 && (*buff)[i-1] == '\n')
|
|
||||||
/*! prefix? */;
|
|
||||||
switch (c) {
|
|
||||||
case '\a' : fputs("\\a", stderr); break;
|
|
||||||
case '\b' : fputs("\\b", stderr); break;
|
|
||||||
case '\t' : fputs("\t", stderr); break;
|
|
||||||
case '\n' : fputs("\n", stderr); break;
|
|
||||||
case '\v' : fputs("\\v", stderr); break;
|
|
||||||
case '\f' : fputs("\\f", stderr); break;
|
|
||||||
case '\r' : fputs("\\r", stderr); break;
|
|
||||||
case '\\' : fputs("\\\\", stderr); break;
|
|
||||||
default:
|
|
||||||
if (!isprint(c))
|
|
||||||
c = '.';
|
|
||||||
fputc(c, stderr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
} else if (xioparams->verbhex) {
|
|
||||||
int i;
|
|
||||||
/*! prefix? */
|
|
||||||
for (i = 0; i < bytes; ++i) {
|
|
||||||
fprintf(stderr, " %02x", (*buff)[i]);
|
|
||||||
}
|
|
||||||
fputc('\n', stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
writt = xiowrite(outpipe, *buff, bytes);
|
|
||||||
if (writt < 0) {
|
|
||||||
/* EAGAIN when nonblocking but a mandatory lock is on file.
|
|
||||||
the problem with EAGAIN is that the read cannot be repeated,
|
|
||||||
so we need to buffer the data and try to write it later
|
|
||||||
again. not yet implemented, sorry. */
|
|
||||||
#if 0
|
|
||||||
if (errno == EPIPE) {
|
|
||||||
return 0; /* can no longer write; handle like EOF */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
Info3("transferred "F_Zu" bytes from %d to %d",
|
|
||||||
writt, XIO_GETRDFD(inpipe), XIO_GETWRFD(outpipe));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return writt;
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
#define CR '\r'
|
|
||||||
#define LF '\n'
|
|
||||||
|
|
||||||
int cv_newline(unsigned char **buff, ssize_t *bytes,
|
|
||||||
int lineterm1, int lineterm2) {
|
|
||||||
/* must perform newline changes */
|
|
||||||
if (lineterm1 <= LINETERM_CR && lineterm2 <= LINETERM_CR) {
|
|
||||||
/* no change in data length */
|
|
||||||
unsigned char from, to, *p, *z;
|
|
||||||
if (lineterm1 == LINETERM_RAW) {
|
|
||||||
from = '\n'; to = '\r';
|
|
||||||
} else {
|
|
||||||
from = '\r'; to = '\n';
|
|
||||||
}
|
|
||||||
z = *buff + *bytes;
|
|
||||||
p = *buff;
|
|
||||||
while (p < z) {
|
|
||||||
if (*p == from) *p = to;
|
|
||||||
++p;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (lineterm1 == LINETERM_CRNL) {
|
|
||||||
/* buffer becomes shorter */
|
|
||||||
unsigned char to, *s, *t, *z;
|
|
||||||
if (lineterm2 == LINETERM_RAW) {
|
|
||||||
to = '\n';
|
|
||||||
} else {
|
|
||||||
to = '\r';
|
|
||||||
}
|
|
||||||
z = *buff + *bytes;
|
|
||||||
s = t = *buff;
|
|
||||||
while (s < z) {
|
|
||||||
if (*s == '\r') {
|
|
||||||
++s;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (*s == '\n') {
|
|
||||||
*t++ = to; ++s;
|
|
||||||
} else {
|
|
||||||
*t++ = *s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*bytes = t - *buff;
|
|
||||||
} else {
|
|
||||||
/* buffer becomes longer, must alloc another space */
|
|
||||||
unsigned char *buf2;
|
|
||||||
unsigned char from; unsigned char *s, *t, *z;
|
|
||||||
if (lineterm1 == LINETERM_RAW) {
|
|
||||||
from = '\n';
|
|
||||||
} else {
|
|
||||||
from = '\r';
|
|
||||||
}
|
|
||||||
if ((buf2 = Malloc(2*xioparams->bufsiz+1)) == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
s = *buff; t = buf2; z = *buff + *bytes;
|
|
||||||
while (s < z) {
|
|
||||||
if (*s == from) {
|
|
||||||
*t++ = '\r'; *t++ = '\n';
|
|
||||||
++s;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
*t++ = *s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(*buff);
|
|
||||||
*buff = buf2;
|
|
||||||
*bytes = t - buf2;;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
void socat_signal(int signum) {
|
void socat_signal(int signum) {
|
||||||
switch (signum) {
|
switch (signum) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
%define majorver 1.6
|
%define majorver 1.7
|
||||||
%define minorver 0.1
|
%define minorver 0.0
|
||||||
|
|
||||||
Summary: socat - multipurpose relay
|
Summary: socat - multipurpose relay
|
||||||
Name: socat
|
Name: socat
|
||||||
|
|
76
sycls.c
76
sycls.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: sycls.c */
|
/* source: sycls.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* explicit system call and C library trace function, for those who miss strace
|
/* explicit system call and C library trace function, for those who miss strace
|
||||||
|
@ -593,6 +593,16 @@ int Ioctl(int d, int request, void *argp) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Ioctl_int(int d, int request, int arg) {
|
||||||
|
int retval, _errno;
|
||||||
|
Debug3("ioctl(%d, 0x%x, %d)", d, request, arg);
|
||||||
|
retval = ioctl(d, request, arg);
|
||||||
|
_errno = errno;
|
||||||
|
Debug1("ioctl() -> %d", retval);
|
||||||
|
errno = _errno;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int Close(int fd) {
|
int Close(int fd) {
|
||||||
int retval, _errno;
|
int retval, _errno;
|
||||||
Info1("close(%d)", fd);
|
Info1("close(%d)", fd);
|
||||||
|
@ -677,9 +687,21 @@ int Chmod(const char *path, mode_t mode) {
|
||||||
/* we only show the first struct pollfd; hope this is enough for most cases. */
|
/* we only show the first struct pollfd; hope this is enough for most cases. */
|
||||||
int Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
|
int Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
|
||||||
int result;
|
int result;
|
||||||
Debug4("poll({%d, 0x%02hx, }, %u, %d)", ufds[0].fd, ufds[0].events, nfds, timeout);
|
if (nfds == 4) {
|
||||||
|
Debug10("poll({%d,0x%02hx,}{%d,0x%02hx,}{%d,0x%02hx,}{%d,0x%02hx,}, %u, %d)",
|
||||||
|
ufds[0].fd, ufds[0].events, ufds[1].fd, ufds[1].events,
|
||||||
|
ufds[2].fd, ufds[2].events, ufds[3].fd, ufds[3].events,
|
||||||
|
nfds, timeout);
|
||||||
|
} else {
|
||||||
|
Debug4("poll({%d,0x%02hx,}, , %u, %d)", ufds[0].fd, ufds[0].events, nfds, timeout);
|
||||||
|
}
|
||||||
result = poll(ufds, nfds, timeout);
|
result = poll(ufds, nfds, timeout);
|
||||||
Debug2("poll(, {,, 0x%02hx}) -> %d", ufds[0].revents, result);
|
if (nfds == 4) {
|
||||||
|
Debug5("poll(, {,,0x%02hx}{,,0x%02hx}{,,0x%02hx}{,,0x%02hx}) -> %d",
|
||||||
|
ufds[0].revents, ufds[1].revents, ufds[2].revents, ufds[3].revents, result);
|
||||||
|
} else {
|
||||||
|
Debug2("poll(, {,,0x%02hx}) -> %d", ufds[0].revents, result);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_POLL */
|
#endif /* HAVE_POLL */
|
||||||
|
@ -1081,12 +1103,28 @@ int Recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from,
|
||||||
int Recvmsg(int s, struct msghdr *msgh, int flags) {
|
int Recvmsg(int s, struct msghdr *msgh, int flags) {
|
||||||
int retval, _errno;
|
int retval, _errno;
|
||||||
char infobuff[256];
|
char infobuff[256];
|
||||||
Debug3("recvmsg(%d, %p, %d)", s, msgh, flags);
|
#if defined(HAVE_STRUCT_MSGHDR_MSGCONTROL) && defined(HAVE_STRUCT_MSGHDR_MSGCONTROLLEN) && defined(HAVE_STRUCT_MSGHDR_MSGFLAGS)
|
||||||
|
Debug10("recvmsg(%d, %p{%p,%u,%p,%u,%p,%u,%d}, %d)", s, msgh,
|
||||||
|
msgh->msg_name, msgh->msg_namelen, msgh->msg_iov, msgh->msg_iovlen,
|
||||||
|
msgh->msg_control, msgh->msg_controllen, msgh->msg_flags, flags);
|
||||||
|
#else
|
||||||
|
Debug7("recvmsg(%d, %p{%p,%u,%p,%u}, %d)", s, msgh,
|
||||||
|
msgh->msg_name, msgh->msg_namelen, msgh->msg_iov, msgh->msg_iovlen,
|
||||||
|
flags);
|
||||||
|
#endif
|
||||||
retval = recvmsg(s, msgh, flags);
|
retval = recvmsg(s, msgh, flags);
|
||||||
_errno = errno;
|
_errno = errno;
|
||||||
Debug2("recvmsg(, {%s}, ) -> %d",
|
#if defined(HAVE_STRUCT_MSGHDR_MSGCONTROLLEN)
|
||||||
|
Debug5("recvmsg(, {%s,%u,,%u,,%u,}, ) -> %d",
|
||||||
msgh->msg_name?sockaddr_info(msgh->msg_name, msgh->msg_namelen, infobuff, sizeof(infobuff)):"NULL",
|
msgh->msg_name?sockaddr_info(msgh->msg_name, msgh->msg_namelen, infobuff, sizeof(infobuff)):"NULL",
|
||||||
|
msgh->msg_namelen, msgh->msg_iovlen, msgh->msg_controllen,
|
||||||
retval);
|
retval);
|
||||||
|
#else
|
||||||
|
Debug4("recvmsg(, {%s,%u,,%u,,}, ) -> %d",
|
||||||
|
msgh->msg_name?sockaddr_info(msgh->msg_name, msgh->msg_namelen, infobuff, sizeof(infobuff)):"NULL",
|
||||||
|
msgh->msg_namelen, msgh->msg_iovlen,
|
||||||
|
retval);
|
||||||
|
#endif
|
||||||
errno = _errno;
|
errno = _errno;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1271,6 +1309,7 @@ void *Realloc(void *ptr, size_t size) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _WITH_TERMIOS
|
||||||
int Tcgetattr(int fd, struct termios *termios_p) {
|
int Tcgetattr(int fd, struct termios *termios_p) {
|
||||||
int i, result, _errno;
|
int i, result, _errno;
|
||||||
char chars[5*NCCS], *cp = chars;
|
char chars[5*NCCS], *cp = chars;
|
||||||
|
@ -1290,7 +1329,9 @@ int Tcgetattr(int fd, struct termios *termios_p) {
|
||||||
errno = _errno;
|
errno = _errno;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
|
|
||||||
|
#if _WITH_TERMIOS
|
||||||
int Tcsetattr(int fd, int optional_actions, struct termios *termios_p) {
|
int Tcsetattr(int fd, int optional_actions, struct termios *termios_p) {
|
||||||
int i, result, _errno;
|
int i, result, _errno;
|
||||||
char chars[5*NCCS], *cp = chars;
|
char chars[5*NCCS], *cp = chars;
|
||||||
|
@ -1308,6 +1349,7 @@ int Tcsetattr(int fd, int optional_actions, struct termios *termios_p) {
|
||||||
errno = _errno;
|
errno = _errno;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
|
|
||||||
char *Ttyname(int fd) {
|
char *Ttyname(int fd) {
|
||||||
char *result;
|
char *result;
|
||||||
|
@ -1466,6 +1508,30 @@ int Mkstemp(char *template) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Setenv(const char *name, const char *value, int overwrite) {
|
||||||
|
int result, _errno;
|
||||||
|
Debug3("setenv(\"%s\", \"%s\", %d)", name, value, overwrite);
|
||||||
|
result = setenv(name, value, overwrite);
|
||||||
|
_errno = errno;
|
||||||
|
Debug1("setenv() -> %d", result);
|
||||||
|
errno = _errno;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if HAVE_UNSETENV
|
||||||
|
/* on Linux it returns int but on FreeBSD void.
|
||||||
|
we do not expect many errors, so we take void which works on all systems. */
|
||||||
|
void Unsetenv(const char *name) {
|
||||||
|
int _errno;
|
||||||
|
Debug1("unsetenv(\"%s\")", name);
|
||||||
|
unsetenv(name);
|
||||||
|
_errno = errno;
|
||||||
|
Debug("unsetenv() ->");
|
||||||
|
errno = _errno;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if WITH_READLINE
|
#if WITH_READLINE
|
||||||
|
|
||||||
char *Readline(const char *prompt) {
|
char *Readline(const char *prompt) {
|
||||||
|
|
8
sycls.h
8
sycls.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: sycls.h */
|
/* source: sycls.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __sycls_h_included
|
#ifndef __sycls_h_included
|
||||||
|
@ -64,6 +64,7 @@ int Ftruncate64(int fd, off64_t length);
|
||||||
#endif /* HAVE_FTRUNCATE64 */
|
#endif /* HAVE_FTRUNCATE64 */
|
||||||
int Flock(int fd, int operation);
|
int Flock(int fd, int operation);
|
||||||
int Ioctl(int d, int request, void *argp);
|
int Ioctl(int d, int request, void *argp);
|
||||||
|
int Ioctl_int(int d, int request, int arg);
|
||||||
int Close(int fd);
|
int Close(int fd);
|
||||||
int Fchown(int fd, uid_t owner, gid_t group);
|
int Fchown(int fd, uid_t owner, gid_t group);
|
||||||
int Fchmod(int fd, mode_t mode);
|
int Fchmod(int fd, mode_t mode);
|
||||||
|
@ -143,6 +144,8 @@ int Pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||||
void *(*start_routine)(void *), void *arg);
|
void *(*start_routine)(void *), void *arg);
|
||||||
int Pthread_join(pthread_t thread, void **value_ptr);
|
int Pthread_join(pthread_t thread, void **value_ptr);
|
||||||
int Mkstemp(char *template);
|
int Mkstemp(char *template);
|
||||||
|
int Setenv(const char *name, const char *value, int overwrite);
|
||||||
|
void Unsetenv(const char *name);
|
||||||
|
|
||||||
char *Readline(const char *prompt);
|
char *Readline(const char *prompt);
|
||||||
void Using_history(void);
|
void Using_history(void);
|
||||||
|
@ -207,6 +210,7 @@ int Gzclose(gzFile file) {
|
||||||
#define Ftruncate64(f,l) ftruncate64(f,l)
|
#define Ftruncate64(f,l) ftruncate64(f,l)
|
||||||
#define Flock(f,o) flock(f,o)
|
#define Flock(f,o) flock(f,o)
|
||||||
#define Ioctl(d,r,a) ioctl(d,r,a)
|
#define Ioctl(d,r,a) ioctl(d,r,a)
|
||||||
|
#define Ioctl_int(d,r,a) ioctl(d,r,a)
|
||||||
#define Close(f) close(f)
|
#define Close(f) close(f)
|
||||||
#define Fchown(f,o,g) fchown(f,o,g)
|
#define Fchown(f,o,g) fchown(f,o,g)
|
||||||
#define Fchmod(f,m) fchmod(f,m)
|
#define Fchmod(f,m) fchmod(f,m)
|
||||||
|
@ -272,6 +276,8 @@ int Gzclose(gzFile file) {
|
||||||
#define Pthread_create(t,attr,s,arg) pthread_create(t,attr,s,arg)
|
#define Pthread_create(t,attr,s,arg) pthread_create(t,attr,s,arg)
|
||||||
#define Pthread_join(t,ptr) pthread_join(t,ptr)
|
#define Pthread_join(t,ptr) pthread_join(t,ptr)
|
||||||
#define Mkstemp(t) mkstemp(t)
|
#define Mkstemp(t) mkstemp(t)
|
||||||
|
#define Setenv(n,v,o) setenv(n,v,o)
|
||||||
|
#define Unsetenv(n) unsetenv(n)
|
||||||
|
|
||||||
#define Readline(p) readline(p)
|
#define Readline(p) readline(p)
|
||||||
#define Using_history() using_history()
|
#define Using_history() using_history()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: sysincludes.h */
|
/* source: sysincludes.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __sysincludes_h_included
|
#ifndef __sysincludes_h_included
|
||||||
|
@ -24,7 +24,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include <signal.h> /* signal(), SIGPIPE, SIG_IGN */
|
#include <signal.h> /* signal(), SIGPIPE, SIG_IGN */
|
||||||
#include <time.h> /* struct timeval, strftime() */
|
#include <time.h> /* struct timeval, strftime() */
|
||||||
|
#if 0
|
||||||
#include <sys/timeb.h> /* struct timeb */
|
#include <sys/timeb.h> /* struct timeb */
|
||||||
|
#endif
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H
|
||||||
#include <unistd.h> /* select(), read(), write(), stat(), fork() */
|
#include <unistd.h> /* select(), read(), write(), stat(), fork() */
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,7 +36,7 @@
|
||||||
#if HAVE_GRP_H
|
#if HAVE_GRP_H
|
||||||
#include <grp.h> /* getgrnam() */
|
#include <grp.h> /* getgrnam() */
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_PTY_H
|
#if HAVE_PTY_H && _WITH_TERMIOS
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
|
@ -109,6 +111,9 @@
|
||||||
#include <arpa/nameser.h> /* req for resolv.h (esp. on MacOSX) */
|
#include <arpa/nameser.h> /* req for resolv.h (esp. on MacOSX) */
|
||||||
#endif
|
#endif
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#if HAVE_NET_IF_DL_H
|
||||||
|
#include <net/if_dl.h> /* FreeBSD: struct sockaddr_dl */
|
||||||
|
#endif
|
||||||
#if HAVE_RESOLV_H
|
#if HAVE_RESOLV_H
|
||||||
#include <resolv.h> /* _res */
|
#include <resolv.h> /* _res */
|
||||||
#endif
|
#endif
|
||||||
|
@ -117,11 +122,23 @@
|
||||||
#if HAVE_NET_IF_H
|
#if HAVE_NET_IF_H
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#endif /* HAVE_NET_IF_H */
|
#endif /* HAVE_NET_IF_H */
|
||||||
|
#if HAVE_LINUX_TYPES_H
|
||||||
|
#include <linux/types.h> /* __u32 for linux/errqueue.h */
|
||||||
|
#endif
|
||||||
|
#if HAVE_LINUX_ERRQUEUE_H
|
||||||
|
#include <linux/errqueue.h> /* struct sock_extended_err */
|
||||||
|
#endif
|
||||||
|
#if HAVE_NETPACKET_PACKET_H
|
||||||
|
#include <netpacket/packet.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_NETINET_IF_ETHER_H
|
||||||
|
#include <netinet/if_ether.h>
|
||||||
|
#endif
|
||||||
#if HAVE_LINUX_IF_TUN_H
|
#if HAVE_LINUX_IF_TUN_H
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_TERMIOS_H && WITH_TERMIOS
|
#if HAVE_TERMIOS_H && _WITH_TERMIOS
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_SYS_UTSNAME_H
|
#if HAVE_SYS_UTSNAME_H
|
||||||
|
|
283
sysutils.c
283
sysutils.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: sysutils.c */
|
/* source: sysutils.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* translate socket addresses into human readable form */
|
/* translate socket addresses into human readable form */
|
||||||
|
@ -106,6 +106,7 @@ void socket_in6_init(struct sockaddr_in6 *sa) {
|
||||||
length of the specific socket address, or 0 on error. */
|
length of the specific socket address, or 0 on error. */
|
||||||
socklen_t socket_init(int af, union sockaddr_union *sa) {
|
socklen_t socket_init(int af, union sockaddr_union *sa) {
|
||||||
switch (af) {
|
switch (af) {
|
||||||
|
case AF_UNSPEC: memset(sa, 0, sizeof(*sa)); return sizeof(*sa);
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
case AF_UNIX: socket_un_init(&sa->un); return sizeof(sa->un);
|
case AF_UNIX: socket_un_init(&sa->un); return sizeof(sa->un);
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,7 +116,7 @@ socklen_t socket_init(int af, union sockaddr_union *sa) {
|
||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
case AF_INET6: socket_in6_init(&sa->ip6); return sizeof(sa->ip6);
|
case AF_INET6: socket_in6_init(&sa->ip6); return sizeof(sa->ip6);
|
||||||
#endif
|
#endif
|
||||||
default: Error1("socket_init(): unknown address family %d", af);
|
default: Info1("socket_init(): unknown address family %d", af);
|
||||||
memset(sa, 0, sizeof(union sockaddr_union));
|
memset(sa, 0, sizeof(union sockaddr_union));
|
||||||
sa->soa.sa_family = af;
|
sa->soa.sa_family = af;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -129,64 +130,65 @@ socklen_t socket_init(int af, union sockaddr_union *sa) {
|
||||||
|
|
||||||
#if _WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size_t blen) {
|
char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size_t blen) {
|
||||||
char ubuff[5*UNIX_PATH_MAX+3];
|
union sockaddr_union *sau = (union sockaddr_union *)sa;
|
||||||
char *lbuff = buff;
|
char *lbuff = buff;
|
||||||
char *cp = lbuff;
|
char *cp = lbuff;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if ((n = snprintf(cp, blen, "AF=%d ", sa->sa_family)) < 0) {
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
if ((n = snprintf(cp, blen, "LEN=%d ", sau->soa.sa_len)) < 0) {
|
||||||
|
Warn1("sockaddr_info(): buffer too short ("F_Zu")", blen);
|
||||||
|
*buff = '\0';
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
cp += n, blen -= n;
|
||||||
|
#endif
|
||||||
|
if ((n = snprintf(cp, blen, "AF=%d ", sau->soa.sa_family)) < 0) {
|
||||||
Warn1("sockaddr_info(): buffer too short ("F_Zu")", blen);
|
Warn1("sockaddr_info(): buffer too short ("F_Zu")", blen);
|
||||||
*buff = '\0';
|
*buff = '\0';
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
cp += n, blen -= n;
|
cp += n, blen -= n;
|
||||||
|
|
||||||
switch (sa->sa_family) {
|
switch (sau->soa.sa_family) {
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
case 0:
|
case 0:
|
||||||
case AF_UNIX:
|
case AF_UNIX: sockaddr_unix_info(&sau->un, salen, cp+1, blen-1);
|
||||||
#if WITH_ABSTRACT_UNIXSOCKET
|
cp[0] = '"';
|
||||||
if (salen > XIOUNIXSOCKOVERHEAD &&
|
*strchr(cp+1, '\0') = '"';
|
||||||
sa->sa_data[0] == '\0') {
|
|
||||||
char *nextc;
|
|
||||||
// nextc =
|
|
||||||
// sanitize_string((char *)&sa->sa_data+1, salen-XIOUNIXSOCKOVERHEAD-1,
|
|
||||||
// ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
|
||||||
nextc =
|
|
||||||
sanitize_string((char *)&sa->sa_data, salen-XIOUNIXSOCKOVERHEAD,
|
|
||||||
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
|
||||||
*nextc = '\0';
|
|
||||||
// snprintf(cp, blen, "\"\\0%s\"", ubuff);
|
|
||||||
snprintf(cp, blen, "\"%s\"", ubuff);
|
|
||||||
} else
|
|
||||||
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
|
||||||
{
|
|
||||||
char *nextc;
|
|
||||||
nextc =
|
|
||||||
sanitize_string((char *)&sa->sa_data,
|
|
||||||
MIN(UNIX_PATH_MAX, strlen((char *)&sa->sa_data)),
|
|
||||||
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
|
||||||
*nextc = '\0';
|
|
||||||
snprintf(cp, blen, "\"%s\"", ubuff);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
case AF_INET: sockaddr_inet4_info((struct sockaddr_in *)sa, cp, blen);
|
case AF_INET: sockaddr_inet4_info(&sau->ip4, cp, blen);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
case AF_INET6: sockaddr_inet6_info((struct sockaddr_in6 *)sa, cp, blen);
|
case AF_INET6: sockaddr_inet6_info(&sau->ip6, cp, blen);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
if ((n = snprintf(cp, blen, "AF=%d ", sa->sa_family)) < 0) {
|
||||||
|
Warn1("sockaddr_info(): buffer too short ("F_Zu")", blen);
|
||||||
|
*buff = '\0';
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
cp += n, blen -= n;
|
||||||
if ((snprintf(cp, blen,
|
if ((snprintf(cp, blen,
|
||||||
"0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
"0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||||
sa->sa_data[0], sa->sa_data[1], sa->sa_data[2],
|
((unsigned char *)sau->soa.sa_data)[0],
|
||||||
sa->sa_data[3], sa->sa_data[4], sa->sa_data[5],
|
((unsigned char *)sau->soa.sa_data)[1],
|
||||||
sa->sa_data[6], sa->sa_data[7], sa->sa_data[8],
|
((unsigned char *)sau->soa.sa_data)[2],
|
||||||
sa->sa_data[9], sa->sa_data[10], sa->sa_data[11],
|
((unsigned char *)sau->soa.sa_data)[3],
|
||||||
sa->sa_data[12], sa->sa_data[13])) < 0) {
|
((unsigned char *)sau->soa.sa_data)[4],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[5],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[6],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[7],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[8],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[9],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[10],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[11],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[12],
|
||||||
|
((unsigned char *)sau->soa.sa_data)[13])) < 0) {
|
||||||
Warn("sockaddr_info(): buffer too short");
|
Warn("sockaddr_info(): buffer too short");
|
||||||
*buff = '\0';
|
*buff = '\0';
|
||||||
return buff;
|
return buff;
|
||||||
|
@ -199,10 +201,26 @@ char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size
|
||||||
|
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *buff, size_t blen) {
|
char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *buff, size_t blen) {
|
||||||
blen = Min(blen, sizeof(sa->sun_path));
|
char ubuff[5*UNIX_PATH_MAX+3];
|
||||||
strncpy(buff, sa->sun_path, blen);
|
char *nextc;
|
||||||
if (strlen(buff) >= blen) {
|
|
||||||
buff[blen-1] = '\0';
|
#if WITH_ABSTRACT_UNIXSOCKET
|
||||||
|
if (salen > XIOUNIXSOCKOVERHEAD &&
|
||||||
|
sa->sun_path[0] == '\0') {
|
||||||
|
nextc =
|
||||||
|
sanitize_string(sa->sun_path, salen-XIOUNIXSOCKOVERHEAD,
|
||||||
|
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||||
|
*nextc = '\0';
|
||||||
|
strncpy(buff, ubuff, blen);
|
||||||
|
} else
|
||||||
|
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
{
|
||||||
|
nextc =
|
||||||
|
sanitize_string(sa->sun_path,
|
||||||
|
MIN(UNIX_PATH_MAX, strlen(sa->sun_path)),
|
||||||
|
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||||
|
*nextc = '\0';
|
||||||
|
strncpy(buff, ubuff, blen);
|
||||||
}
|
}
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
@ -253,6 +271,7 @@ const char *inet_ntop(int pf, const void *binaddr,
|
||||||
return NULL; /* errno is valid */
|
return NULL; /* errno is valid */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if WITH_IP6
|
||||||
case PF_INET6:
|
case PF_INET6:
|
||||||
if ((retlen =
|
if ((retlen =
|
||||||
snprintf(addrtext, textlen, "%x:%x:%x:%x:%x:%x:%x:%x",
|
snprintf(addrtext, textlen, "%x:%x:%x:%x:%x:%x:%x:%x",
|
||||||
|
@ -269,6 +288,7 @@ const char *inet_ntop(int pf, const void *binaddr,
|
||||||
return NULL; /* errno is valid */
|
return NULL; /* errno is valid */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
default:
|
default:
|
||||||
errno = EAFNOSUPPORT;
|
errno = EAFNOSUPPORT;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -280,7 +300,7 @@ const char *inet_ntop(int pf, const void *binaddr,
|
||||||
|
|
||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
/* convert the IP6 socket address to human readable form. buff should be at
|
/* convert the IP6 socket address to human readable form. buff should be at
|
||||||
least 50 chars long */
|
least 50 chars long. output includes the port number */
|
||||||
char *sockaddr_inet6_info(const struct sockaddr_in6 *sa, char *buff, size_t blen) {
|
char *sockaddr_inet6_info(const struct sockaddr_in6 *sa, char *buff, size_t blen) {
|
||||||
if (snprintf(buff, blen, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%hu",
|
if (snprintf(buff, blen, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%hu",
|
||||||
#if HAVE_IP6_SOCKADDR==0
|
#if HAVE_IP6_SOCKADDR==0
|
||||||
|
@ -402,8 +422,66 @@ const char *hstrerror(int err) {
|
||||||
#endif /* !HAVE_HSTRERROR */
|
#endif /* !HAVE_HSTRERROR */
|
||||||
|
|
||||||
|
|
||||||
|
/* this function behaves like poll(). It tries to do so even when the poll()
|
||||||
|
system call is not available. */
|
||||||
|
/* note: glibc 5.4 does not know nfds_t */
|
||||||
|
int xiopoll(struct pollfd fds[], unsigned long nfds, struct timeval *timeout) {
|
||||||
|
int i, n = 0;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
while (true) { /* should be if (), but we want to break */
|
||||||
|
fd_set readfds;
|
||||||
|
fd_set writefds;
|
||||||
|
fd_set exceptfds;
|
||||||
|
|
||||||
|
FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds);
|
||||||
|
for (i = 0; i < nfds; ++i) {
|
||||||
|
fds[i].revents = 0;
|
||||||
|
if (fds[i].fd < 0) { continue; }
|
||||||
|
if (fds[i].fd > FD_SETSIZE) { break; /* use poll */ }
|
||||||
|
if (fds[i].events & POLLIN) {
|
||||||
|
FD_SET(fds[i].fd, &readfds); n = MAX(n, fds[i].fd); }
|
||||||
|
if (fds[i].events & POLLOUT) {
|
||||||
|
FD_SET(fds[i].fd, &writefds); n = MAX(n, fds[i].fd); }
|
||||||
|
}
|
||||||
|
if (i < nfds) { break; /* use poll */ }
|
||||||
|
|
||||||
|
result = Select(n+1, &readfds, &writefds, &exceptfds, timeout);
|
||||||
|
if (result < 0) { return result; }
|
||||||
|
for (i = 0; i < nfds; ++i) {
|
||||||
|
if (fds[i].fd < 0) { continue; }
|
||||||
|
if ((fds[i].events & POLLIN) && FD_ISSET(fds[i].fd, &readfds)) {
|
||||||
|
fds[i].revents |= POLLIN; ++result;
|
||||||
|
}
|
||||||
|
if ((fds[i].events & POLLOUT) && FD_ISSET(fds[i].fd, &writefds)) {
|
||||||
|
fds[i].revents |= POLLOUT; ++result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#if HAVE_POLL
|
||||||
|
{
|
||||||
|
int ms = 0;
|
||||||
|
if (timeout == NULL) {
|
||||||
|
ms = -1;
|
||||||
|
} else {
|
||||||
|
ms = 1000*timeout->tv_sec + timeout->tv_usec/1000;
|
||||||
|
}
|
||||||
|
/*! timeout */
|
||||||
|
return Poll(fds, nfds, ms);
|
||||||
|
#else /* HAVE_POLL */
|
||||||
|
} else {
|
||||||
|
Error("poll() not available");
|
||||||
|
return -1;
|
||||||
|
#endif /* !HAVE_POLL */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if _WITH_TCP || _WITH_UDP
|
#if _WITH_TCP || _WITH_UDP
|
||||||
/* returns port in network byte order */
|
/* returns port in network byte order;
|
||||||
|
ipproto==IPPROTO_UDP resolves as UDP service, every other value resolves as
|
||||||
|
TCP */
|
||||||
int parseport(const char *portname, int ipproto) {
|
int parseport(const char *portname, int ipproto) {
|
||||||
struct servent *se;
|
struct servent *se;
|
||||||
char *extra;
|
char *extra;
|
||||||
|
@ -418,7 +496,7 @@ int parseport(const char *portname, int ipproto) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((se = getservbyname(portname, ipproto==IPPROTO_TCP?"tcp":"udp")) == NULL) {
|
if ((se = getservbyname(portname, ipproto==IPPROTO_UDP?"udp":"tcp")) == NULL) {
|
||||||
Error2("cannot resolve service \"%s/%d\"", portname, ipproto);
|
Error2("cannot resolve service \"%s/%d\"", portname, ipproto);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -427,10 +505,15 @@ int parseport(const char *portname, int ipproto) {
|
||||||
}
|
}
|
||||||
#endif /* _WITH_TCP || _WITH_UDP */
|
#endif /* _WITH_TCP || _WITH_UDP */
|
||||||
|
|
||||||
#if WITH_IP4 || WITH_IP6
|
|
||||||
|
#if WITH_IP4 || WITH_IP6 || WITH_INTERFACE
|
||||||
/* check the systems interfaces for ifname and return its index
|
/* check the systems interfaces for ifname and return its index
|
||||||
or -1 if no interface with this name was found */
|
or -1 if no interface with this name was found
|
||||||
int ifindexbyname(const char *ifname) {
|
The system calls require an arbitrary socket; the calling program may
|
||||||
|
provide one in anysock to avoid creation of a dummy socket. anysock must be
|
||||||
|
<0 if it does not specify a socket fd.
|
||||||
|
*/
|
||||||
|
int ifindexbyname(const char *ifname, int anysock) {
|
||||||
/* Linux: man 7 netdevice */
|
/* Linux: man 7 netdevice */
|
||||||
/* FreeBSD: man 4 networking */
|
/* FreeBSD: man 4 networking */
|
||||||
/* Solaris: man 7 if_tcp */
|
/* Solaris: man 7 if_tcp */
|
||||||
|
@ -438,29 +521,35 @@ int ifindexbyname(const char *ifname) {
|
||||||
#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX)
|
#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX)
|
||||||
/* currently we support Linux, FreeBSD; not Solaris */
|
/* currently we support Linux, FreeBSD; not Solaris */
|
||||||
|
|
||||||
#define IFBUFSIZ 1024
|
#define IFBUFSIZ 32*sizeof(struct ifreq) /*1024*/
|
||||||
int s;
|
int s;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
|
||||||
if (ifname[0] == '\0') {
|
if (ifname[0] == '\0') {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((s = Socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) {
|
if (anysock >= 0) {
|
||||||
|
s = anysock;
|
||||||
|
} else if ((s = Socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) {
|
||||||
Error1("socket(PF_INET, SOCK_DGRAM, IPPROTO_IP): %s", strerror(errno));
|
Error1("socket(PF_INET, SOCK_DGRAM, IPPROTO_IP): %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
||||||
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
Close(s);
|
Info3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}): %s",
|
||||||
Info3("ioctl(%d, SIOCGIFINDEX, {%s}): %s",
|
|
||||||
s, ifr.ifr_name, strerror(errno));
|
s, ifr.ifr_name, strerror(errno));
|
||||||
|
Close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Close(s);
|
Close(s);
|
||||||
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
|
Info3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}) -> { %d }",
|
||||||
|
s, ifname, ifr.ifr_index);
|
||||||
return ifr.ifr_index;
|
return ifr.ifr_index;
|
||||||
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
|
Info3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}) -> { %d }",
|
||||||
|
s, ifname, ifr.ifr_ifindex);
|
||||||
return ifr.ifr_ifindex;
|
return ifr.ifr_ifindex;
|
||||||
#endif /* HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
#endif /* HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
@ -468,12 +557,15 @@ int ifindexbyname(const char *ifname) {
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* !defined(HAVE_ STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX) */
|
#endif /* !defined(HAVE_ STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX) */
|
||||||
}
|
}
|
||||||
|
#endif /* WITH_IP4 || WITH_IP6 || WITH_INTERFACE */
|
||||||
|
|
||||||
|
|
||||||
/* like ifindexbyname(), but allows an index number as input.
|
#if WITH_IP4 || WITH_IP6 || WITH_INTERFACE
|
||||||
|
/* like ifindexbyname(), but also allows the index number as input - in this
|
||||||
|
case it does not lookup the index.
|
||||||
writes the resulting index to *ifindex and returns 0,
|
writes the resulting index to *ifindex and returns 0,
|
||||||
or returns -1 on error */
|
or returns -1 on error */
|
||||||
int ifindex(const char *ifname, unsigned int *ifindex) {
|
int ifindex(const char *ifname, unsigned int *ifindex, int anysock) {
|
||||||
char *endptr;
|
char *endptr;
|
||||||
long int val;
|
long int val;
|
||||||
|
|
||||||
|
@ -486,10 +578,91 @@ int ifindex(const char *ifname, unsigned int *ifindex) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((val = ifindexbyname(ifname)) < 0) {
|
if ((val = ifindexbyname(ifname, anysock)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*ifindex = val;
|
*ifindex = val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* WITH_IP4 || WITH_IP6 */
|
#endif /* WITH_IP4 || WITH_IP6 || WITH_INTERFACE */
|
||||||
|
|
||||||
|
|
||||||
|
/* constructs an environment variable whose name is built from socats uppercase
|
||||||
|
program name, and underscore and varname; if a variable of this name already
|
||||||
|
exists a non zero value of overwrite lets the old value be overwritten.
|
||||||
|
returns 0 on success or <0 if an error occurred. */
|
||||||
|
int xiosetenv(const char *varname, const char *value, int overwrite) {
|
||||||
|
# define XIO_ENVNAMELEN 256
|
||||||
|
const char *progname;
|
||||||
|
char envname[XIO_ENVNAMELEN];
|
||||||
|
size_t i, l;
|
||||||
|
|
||||||
|
progname = diag_get_string('p');
|
||||||
|
strncpy(envname, progname, XIO_ENVNAMELEN-1);
|
||||||
|
l = strlen(progname);
|
||||||
|
strncpy(envname+l, "_", XIO_ENVNAMELEN-1-l);
|
||||||
|
for (i = 0; i < l; ++i) envname[i] = toupper(envname[i]);
|
||||||
|
strncpy(envname+l+1, varname, XIO_ENVNAMELEN-1-l);
|
||||||
|
if (Setenv(envname, value, overwrite) < 0) {
|
||||||
|
Warn3("setenv(\"%s\", \"%s\", 1): %s",
|
||||||
|
envname, value, strerror(errno));
|
||||||
|
#if HAVE_UNSETENV
|
||||||
|
Unsetenv(envname); /* dont want to have a wrong value */
|
||||||
|
#endif
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
# undef XIO_ENVNAMELEN
|
||||||
|
}
|
||||||
|
|
||||||
|
int xiosetenv2(const char *varname, const char *varname2, const char *value,
|
||||||
|
int overwrite) {
|
||||||
|
# define XIO_ENVNAMELEN 256
|
||||||
|
const char *progname;
|
||||||
|
char envname[XIO_ENVNAMELEN];
|
||||||
|
size_t i, l;
|
||||||
|
|
||||||
|
progname = diag_get_string('p');
|
||||||
|
strncpy(envname, progname, XIO_ENVNAMELEN-1);
|
||||||
|
l = strlen(progname);
|
||||||
|
strncpy(envname+l, "_", XIO_ENVNAMELEN-1-l);
|
||||||
|
l += 1;
|
||||||
|
strncpy(envname+l, varname, XIO_ENVNAMELEN-1-l);
|
||||||
|
l += strlen(varname);
|
||||||
|
strncpy(envname+l, "_", XIO_ENVNAMELEN-1-l);
|
||||||
|
l += 1;
|
||||||
|
strncpy(envname+l, varname2, XIO_ENVNAMELEN-1-l);
|
||||||
|
l += strlen(varname2);
|
||||||
|
for (i = 0; i < l; ++i) envname[i] = toupper(envname[i]);
|
||||||
|
if (Setenv(envname, value, overwrite) < 0) {
|
||||||
|
Warn3("setenv(\"%s\", \"%s\", 1): %s",
|
||||||
|
envname, value, strerror(errno));
|
||||||
|
#if HAVE_UNSETENV
|
||||||
|
Unsetenv(envname); /* dont want to have a wrong value */
|
||||||
|
#endif
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
# undef XIO_ENVNAMELEN
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* like xiosetenv(), but uses an unsigned long value */
|
||||||
|
int xiosetenvulong(const char *varname, unsigned long value, int overwrite) {
|
||||||
|
# define XIO_LONGLEN 21 /* should suffice for 64bit longs with \0 */
|
||||||
|
char envbuff[XIO_LONGLEN];
|
||||||
|
|
||||||
|
snprintf(envbuff, XIO_LONGLEN, "%lu", value);
|
||||||
|
return xiosetenv(varname, envbuff, overwrite);
|
||||||
|
# undef XIO_LONGLEN
|
||||||
|
}
|
||||||
|
|
||||||
|
/* like xiosetenv(), but uses an unsigned short value */
|
||||||
|
int xiosetenvushort(const char *varname, unsigned short value, int overwrite) {
|
||||||
|
# define XIO_SHORTLEN 11 /* should suffice for 32bit shorts with \0 */
|
||||||
|
char envbuff[XIO_SHORTLEN];
|
||||||
|
|
||||||
|
snprintf(envbuff, XIO_SHORTLEN, "%hu", value);
|
||||||
|
return xiosetenv(varname, envbuff, overwrite);
|
||||||
|
# undef XIO_SHORTLEN
|
||||||
|
}
|
||||||
|
|
43
sysutils.h
43
sysutils.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: sysutils.h */
|
/* source: sysutils.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __sysutils_h_included
|
#ifndef __sysutils_h_included
|
||||||
|
@ -15,6 +15,7 @@ union xioin6_u {
|
||||||
} ;
|
} ;
|
||||||
#endif /* WITH_IP6 */
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
union sockaddr_union {
|
union sockaddr_union {
|
||||||
struct sockaddr soa;
|
struct sockaddr soa;
|
||||||
#if _WITH_UNIX
|
#if _WITH_UNIX
|
||||||
|
@ -27,29 +28,12 @@ union sockaddr_union {
|
||||||
struct sockaddr_in6 ip6;
|
struct sockaddr_in6 ip6;
|
||||||
#endif /* _WITH_IP6 */
|
#endif /* _WITH_IP6 */
|
||||||
} ;
|
} ;
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
#if _WITH_IP4
|
|
||||||
struct xiorange_ip4 {
|
|
||||||
struct in_addr netaddr; /* network byte order */
|
|
||||||
struct in_addr netmask; /* network byte order */
|
|
||||||
} ;
|
|
||||||
#endif /* _WITH_IP4 */
|
|
||||||
|
|
||||||
#if _WITH_IP6
|
|
||||||
struct xiorange_ip6 {
|
|
||||||
struct in6_addr addr;
|
|
||||||
struct in6_addr mask;
|
|
||||||
} ;
|
|
||||||
#endif /* _WITH_IP4 */
|
|
||||||
|
|
||||||
#if _WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
union xiorange_union {
|
struct xiorange {
|
||||||
#if _WITH_IP4
|
union sockaddr_union netaddr;
|
||||||
struct xiorange_ip4 ip4;
|
union sockaddr_union netmask;
|
||||||
#endif /* _WITH_IP4 */
|
|
||||||
#if _WITH_IP6
|
|
||||||
struct xiorange_ip6 ip6;
|
|
||||||
#endif /* _WITH_IP6 */
|
|
||||||
} ;
|
} ;
|
||||||
#endif /* _WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
@ -90,9 +74,20 @@ extern int getusergroups(const char *user, gid_t *list, size_t *ngroups);
|
||||||
extern const char *hstrerror(int err);
|
extern const char *hstrerror(int err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int xiopoll(struct pollfd fds[], unsigned long nfds, struct timeval *timeout);
|
||||||
|
|
||||||
extern int parseport(const char *portname, int proto);
|
extern int parseport(const char *portname, int proto);
|
||||||
|
|
||||||
extern int ifindexbyname(const char *ifname);
|
extern int ifindexbyname(const char *ifname, int anysock);
|
||||||
extern int ifindex(const char *ifname, unsigned int *ifindex);
|
extern int ifindex(const char *ifname, unsigned int *ifindex, int anysock);
|
||||||
|
|
||||||
|
extern int xiosetenv(const char *varname, const char *value, int overwrite);
|
||||||
|
extern int
|
||||||
|
xiosetenv2(const char *varname, const char *varname2, const char *value,
|
||||||
|
int overwrite);
|
||||||
|
extern int xiosetenvulong(const char *varname, unsigned long value,
|
||||||
|
int overwrite);
|
||||||
|
extern int xiosetenvushort(const char *varname, unsigned short value,
|
||||||
|
int overwrite);
|
||||||
|
|
||||||
#endif /* !defined(__sysutils_h_included) */
|
#endif /* !defined(__sysutils_h_included) */
|
||||||
|
|
16
utils.c
16
utils.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: utils.c */
|
/* source: utils.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* useful additions to C library */
|
/* useful additions to C library */
|
||||||
|
@ -145,3 +145,17 @@ char *sanitize_string(const char *data, /* input data */
|
||||||
}
|
}
|
||||||
return coded;
|
return coded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* copies a substring out of a given buff
|
||||||
|
returns scratch, \0 terminated; scratch must provide len+1 bytes
|
||||||
|
*/
|
||||||
|
char *xiosubstr(char *scratch, const char *str, size_t from, size_t len) {
|
||||||
|
char *scratch0 = scratch;
|
||||||
|
str += from;
|
||||||
|
while (len--) {
|
||||||
|
*scratch++ = *str++;
|
||||||
|
}
|
||||||
|
*scratch = '\0';
|
||||||
|
return scratch0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
5
utils.h
5
utils.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: utils.h */
|
/* source: utils.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __utils_h_included
|
#ifndef __utils_h_included
|
||||||
|
@ -63,6 +63,7 @@ char *sanitize_string(const char *data, /* input data */
|
||||||
size_t bytes, /* length of input data, >=0 */
|
size_t bytes, /* length of input data, >=0 */
|
||||||
char *coded, /* output buffer, must be long enough */
|
char *coded, /* output buffer, must be long enough */
|
||||||
int style);
|
int style);
|
||||||
|
extern
|
||||||
|
char *xiosubstr(char *scratch, const char *str, size_t from, size_t len);
|
||||||
|
|
||||||
#endif /* !defined(__utils_h_included) */
|
#endif /* !defined(__utils_h_included) */
|
||||||
|
|
||||||
|
|
51
xio-ascii.c
51
xio-ascii.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ascii.c */
|
/* source: xio-ascii.c */
|
||||||
/* Copyright Gerhard Rieger 2002-2006 */
|
/* Copyright Gerhard Rieger 2002-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains functions for text encoding, decoding, and conversions */
|
/* this file contains functions for text encoding, decoding, and conversions */
|
||||||
|
@ -105,3 +105,52 @@ char *
|
||||||
}
|
}
|
||||||
return coded;
|
return coded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* write the binary data to output buffer codbuff in human readable form.
|
||||||
|
bytes gives the length of the data, codlen the available space in codbuff.
|
||||||
|
coding specifies how the data is to be presented. Not much to select now.
|
||||||
|
returns a pointer to the first char in codbuff that has not been overwritten;
|
||||||
|
it might also point to the first char after the buffer!
|
||||||
|
*/
|
||||||
|
static char *
|
||||||
|
_xiodump(const unsigned char *data, size_t bytes, char *codbuff, size_t codlen,
|
||||||
|
int coding) {
|
||||||
|
int start = 1;
|
||||||
|
int space = coding & 0xff;
|
||||||
|
|
||||||
|
if (bytes <= 0) { codbuff[0] = '\0'; return codbuff; }
|
||||||
|
if (space == 0) space = -1;
|
||||||
|
if (0) {
|
||||||
|
; /* for canonical reasons */
|
||||||
|
} else if (1) {
|
||||||
|
/* simple hexadecimal output */
|
||||||
|
if (bytes > 2*codlen+1) {
|
||||||
|
bytes = (codlen-1)/2;
|
||||||
|
}
|
||||||
|
*codbuff++ = 'x'; --codlen;
|
||||||
|
while (bytes-- > 0) {
|
||||||
|
if (start == 0 && space == 0) {
|
||||||
|
*codbuff++ = ' ';
|
||||||
|
space = (coding & 0xff);
|
||||||
|
}
|
||||||
|
codbuff += sprintf(codbuff, "%02x", *data++);
|
||||||
|
start = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return codbuff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write the binary data to codbuff in human readable form.
|
||||||
|
bytes gives the length of the data, codlen the available space in codbuff.
|
||||||
|
coding specifies how the data is to be presented. Not much to select now.
|
||||||
|
null terminates the output. returns a pointer to the output string.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
xiodump(const unsigned char *data, size_t bytes, char *codbuff, size_t codlen,
|
||||||
|
int coding) {
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
result = _xiodump(data, bytes, codbuff, codlen-1, coding);
|
||||||
|
*result = '\0';
|
||||||
|
return codbuff;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ascii.h */
|
/* source: xio-ascii.h */
|
||||||
/* Copyright Gerhard Rieger 2002-2006 */
|
/* Copyright Gerhard Rieger 2002-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_ascii_h_included
|
#ifndef __xio_ascii_h_included
|
||||||
|
@ -17,4 +17,8 @@ extern char *xiosanitize(const char *data, /* input data */
|
||||||
extern char *
|
extern char *
|
||||||
xiohexdump(const unsigned char *data, size_t bytes, char *coded);
|
xiohexdump(const unsigned char *data, size_t bytes, char *coded);
|
||||||
|
|
||||||
|
extern char *
|
||||||
|
xiodump(const unsigned char *data, size_t bytes, char *coded, size_t codlen,
|
||||||
|
int coding);
|
||||||
|
|
||||||
#endif /* !defined(__xio_ascii_h_included) */
|
#endif /* !defined(__xio_ascii_h_included) */
|
||||||
|
|
12
xio-exec.c
12
xio-exec.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-exec.c */
|
/* source: xio-exec.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening addresses of exec type */
|
/* this file contains the source for opening addresses of exec type */
|
||||||
|
@ -42,6 +42,7 @@ static int xioopen_exec1end(int argc, const char *argv[], struct opt *opts,
|
||||||
) {
|
) {
|
||||||
int status;
|
int status;
|
||||||
bool dash = false;
|
bool dash = false;
|
||||||
|
int duptostderr;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
Error3("\"%s:%s\": wrong number of parameters (%d instead of 1)", argv[0], argv[1], argc-1);
|
Error3("\"%s:%s\": wrong number of parameters (%d instead of 1)", argv[0], argv[1], argc-1);
|
||||||
|
@ -49,7 +50,7 @@ static int xioopen_exec1end(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
retropt_bool(opts, OPT_DASH, &dash);
|
retropt_bool(opts, OPT_DASH, &dash);
|
||||||
|
|
||||||
status = _xioopen_foxec_end(xioflags, &fd->stream, groups, &opts);
|
status = _xioopen_foxec_end(xioflags, &fd->stream, groups, &opts, &duptostderr);
|
||||||
if (status < 0) return status;
|
if (status < 0) return status;
|
||||||
if (status == 0) { /* child */
|
if (status == 0) { /* child */
|
||||||
const char *ends[] = { " ", NULL };
|
const char *ends[] = { " ", NULL };
|
||||||
|
@ -92,11 +93,11 @@ static int xioopen_exec1end(int argc, const char *argv[], struct opt *opts,
|
||||||
if (pargv[0] == NULL) pargv[0] = token; else ++pargv[0];
|
if (pargv[0] == NULL) pargv[0] = token; else ++pargv[0];
|
||||||
pargc = 1;
|
pargc = 1;
|
||||||
while (*strp == ' ') {
|
while (*strp == ' ') {
|
||||||
|
while (*++strp == ' ') ;
|
||||||
if ((pargc & 0x07) == 0) {
|
if ((pargc & 0x07) == 0) {
|
||||||
pargv = Realloc(pargv, (pargc+8)*sizeof(char *));
|
pargv = Realloc(pargv, (pargc+8)*sizeof(char *));
|
||||||
if (pargv == NULL) return STAT_RETRYLATER;
|
if (pargv == NULL) return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
++strp;
|
|
||||||
pargv[pargc++] = tokp;
|
pargv[pargc++] = tokp;
|
||||||
if (nestlex(&strp, &tokp, &len, ends, hquotes, squotes, nests,
|
if (nestlex(&strp, &tokp, &len, ends, hquotes, squotes, nests,
|
||||||
false, true, true, false) < 0) {
|
false, true, true, false) < 0) {
|
||||||
|
@ -128,6 +129,11 @@ static int xioopen_exec1end(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only now redirect stderr */
|
||||||
|
if (duptostderr >= 0) {
|
||||||
|
diag_dup();
|
||||||
|
Dup2(duptostderr, 2);
|
||||||
|
}
|
||||||
Notice1("execvp'ing \"%s\"", token);
|
Notice1("execvp'ing \"%s\"", token);
|
||||||
result = Execvp(token, pargv);
|
result = Execvp(token, pargv);
|
||||||
/* here we come only if execvp() failed */
|
/* here we come only if execvp() failed */
|
||||||
|
|
16
xio-fd.c
16
xio-fd.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-fd.c */
|
/* source: xio-fd.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains common file descriptor related option definitions */
|
/* this file contains common file descriptor related option definitions */
|
||||||
|
@ -74,5 +74,17 @@ const struct optdesc opt_flock_ex_nb = { "flock-ex-nb", "flock-nb", OPT_FLOCK_E
|
||||||
const struct optdesc opt_cool_write = { "cool-write", "coolwrite", OPT_COOL_WRITE, GROUP_FD, PH_INIT, TYPE_BOOL, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.cool_write };
|
const struct optdesc opt_cool_write = { "cool-write", "coolwrite", OPT_COOL_WRITE, GROUP_FD, PH_INIT, TYPE_BOOL, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.cool_write };
|
||||||
|
|
||||||
/* control closing of connections */
|
/* control closing of connections */
|
||||||
const struct optdesc opt_end_close = { "end-close", NULL, OPT_END_CLOSE, GROUP_FD, PH_INIT, TYPE_CONST, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.howtoclose, XIOCLOSE_CLOSE };
|
const struct optdesc opt_end_close = { "end-close", "close", OPT_END_CLOSE, GROUP_FD, PH_INIT, TYPE_CONST, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.howtoclose, XIOCLOSE_CLOSE };
|
||||||
const struct optdesc opt_shut_none = { "shut-none", NULL, OPT_SHUT_NONE, GROUP_FD, PH_INIT, TYPE_CONST, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.howtoshut, XIOSHUT_NONE };
|
const struct optdesc opt_shut_none = { "shut-none", NULL, OPT_SHUT_NONE, GROUP_FD, PH_INIT, TYPE_CONST, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.howtoshut, XIOSHUT_NONE };
|
||||||
|
|
||||||
|
/****** generic ioctl() options ******/
|
||||||
|
const struct optdesc opt_ioctl_void = { "ioctl-void", "ioctl", OPT_IOCTL_VOID, GROUP_FD, PH_FD, TYPE_INT, OFUNC_IOCTL_GENERIC, 0, 0, 0 };
|
||||||
|
const struct optdesc opt_ioctl_int = { "ioctl-int", NULL, OPT_IOCTL_INT, GROUP_FD, PH_FD, TYPE_INT_INT, OFUNC_IOCTL_GENERIC, 0, 0, 0 };
|
||||||
|
const struct optdesc opt_ioctl_intp = { "ioctl-intp", NULL, OPT_IOCTL_INTP, GROUP_FD, PH_FD, TYPE_INT_INTP, OFUNC_IOCTL_GENERIC, 0, 0, 0 };
|
||||||
|
const struct optdesc opt_ioctl_bin = { "ioctl-bin", NULL, OPT_IOCTL_BIN, GROUP_FD, PH_FD, TYPE_INT_BIN, OFUNC_IOCTL_GENERIC, 0, 0, 0 };
|
||||||
|
const struct optdesc opt_ioctl_string = { "ioctl-string",NULL, OPT_IOCTL_STRING,GROUP_FD, PH_FD, TYPE_INT_STRING,OFUNC_IOCTL_GENERIC, 0, 0, 0 };
|
||||||
|
|
||||||
|
/* POSIX STREAMS */
|
||||||
|
#define ENABLE_OPTIONS
|
||||||
|
#include "xio-streams.c"
|
||||||
|
#undef ENABLE_OPTIONS
|
||||||
|
|
8
xio-fd.h
8
xio-fd.h
|
@ -1,10 +1,15 @@
|
||||||
/* source: xio-fd.h */
|
/* source: xio-fd.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_fd_h_included
|
#ifndef __xio_fd_h_included
|
||||||
#define __xio_fd_h_included 1
|
#define __xio_fd_h_included 1
|
||||||
|
|
||||||
|
extern const struct optdesc opt_ioctl_void;
|
||||||
|
extern const struct optdesc opt_ioctl_int;
|
||||||
|
extern const struct optdesc opt_ioctl_intp;
|
||||||
|
extern const struct optdesc opt_ioctl_bin;
|
||||||
|
extern const struct optdesc opt_ioctl_string;
|
||||||
extern const struct optdesc opt_append;
|
extern const struct optdesc opt_append;
|
||||||
extern const struct optdesc opt_nonblock;
|
extern const struct optdesc opt_nonblock;
|
||||||
extern const struct optdesc opt_o_ndelay;
|
extern const struct optdesc opt_o_ndelay;
|
||||||
|
@ -38,5 +43,6 @@ extern const struct optdesc opt_f_setlkw_wr;
|
||||||
extern const struct optdesc opt_cool_write;
|
extern const struct optdesc opt_cool_write;
|
||||||
extern const struct optdesc opt_end_close;
|
extern const struct optdesc opt_end_close;
|
||||||
extern const struct optdesc opt_shut_none;
|
extern const struct optdesc opt_shut_none;
|
||||||
|
extern const struct optdesc opt_streams_i_push;
|
||||||
|
|
||||||
#endif /* !defined(__xio_fd_h_included) */
|
#endif /* !defined(__xio_fd_h_included) */
|
||||||
|
|
134
xio-gopen.c
134
xio-gopen.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-gopen.c */
|
/* source: xio-gopen.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening addresses of generic open type */
|
/* this file contains the source for opening addresses of generic open type */
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
|
||||||
const struct xioaddr_endpoint_desc xioaddr_gopen1 = { XIOADDR_SYS, "gopen", 1, XIOBIT_ALL, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS|GROUP_SOCKET|GROUP_SOCK_UNIX, XIOSHUT_UNSPEC, XIOCLOSE_UNSPEC, xioopen_gopen1, 0, 0, 0 HELP(":<filename>") };
|
const struct xioaddr_endpoint_desc xioaddr_gopen1 = { XIOADDR_SYS, "gopen", 1, XIOBIT_ALL, GROUP_FD|GROUP_FIFO|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS|GROUP_SOCKET|GROUP_SOCK_UNIX, XIOSHUT_UNSPEC, XIOCLOSE_UNSPEC, xioopen_gopen1, 0, 0, 0 HELP(":<filename>") };
|
||||||
|
|
||||||
const union xioaddr_desc *xioaddrs_gopen[] = {
|
const union xioaddr_desc *xioaddrs_gopen[] = {
|
||||||
(union xioaddr_desc *)&xioaddr_gopen1,
|
(union xioaddr_desc *)&xioaddr_gopen1,
|
||||||
|
@ -50,120 +50,19 @@ static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xi
|
||||||
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
||||||
if (exists && S_ISSOCK(st_mode)) {
|
if (exists && S_ISSOCK(st_mode)) {
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
int socktype = SOCK_STREAM;
|
union sockaddr_union us;
|
||||||
int optsotype = -1;
|
socklen_t uslen;
|
||||||
struct sockaddr_un sa, us;
|
|
||||||
socklen_t salen, uslen = sizeof(us);
|
|
||||||
bool needbind = false;
|
|
||||||
char infobuff[256];
|
char infobuff[256];
|
||||||
struct opt *opts2;
|
|
||||||
|
|
||||||
socket_un_init(&sa);
|
|
||||||
socket_un_init(&us);
|
|
||||||
|
|
||||||
Info1("\"%s\" is a socket, connecting to it", filename);
|
Info1("\"%s\" is a socket, connecting to it", filename);
|
||||||
if (retropt_int(opts, OPT_SO_TYPE, &optsotype) == 0) {
|
|
||||||
socktype = optsotype;
|
fd->stream.howtoshut = XIOSHUT_DOWN;
|
||||||
|
fd->stream.howtoclose = XIOCLOSE_CLOSE;
|
||||||
|
result =
|
||||||
|
_xioopen_unix_client(&fd->stream, xioflags, groups, 0, opts, filename);
|
||||||
|
if (result < 0) {
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retropt_bind(opts, AF_UNIX, socktype, 0, (struct sockaddr *)&us, &uslen, 0, 0, 0) != STAT_NOACTION) {
|
|
||||||
needbind = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
|
||||||
if (opt_unlink_close) {
|
|
||||||
if ((fd->stream.unlink_close = strdup(filename)) == NULL) {
|
|
||||||
Error1("strdup(\"%s\"): out of memory", filename);
|
|
||||||
}
|
|
||||||
fd->stream.opt_unlink_close = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save options, because we might have to start again with Socket() */
|
|
||||||
opts2 = copyopts(opts, GROUP_ALL);
|
|
||||||
|
|
||||||
if ((fd->stream.fd1 = Socket(PF_UNIX, socktype, 0)) < 0) {
|
|
||||||
Error2("socket(PF_UNIX, %d, 0): %s", socktype, strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
|
||||||
fd->stream.fd2 = fd->stream.fd1;
|
|
||||||
fd->stream.fdtype = FDTYPE_SINGLE;
|
|
||||||
if (fd->stream.howtoshut == XIOSHUT_UNSPEC)
|
|
||||||
fd->stream.howtoshut = XIOSHUT_DOWN;
|
|
||||||
if (fd->stream.howtoclose == XIOCLOSE_UNSPEC)
|
|
||||||
fd->stream.howtoclose = XIOCLOSE_CLOSE;
|
|
||||||
/*0 Info2("socket(PF_UNIX, %d, 0) -> %d", socktype, fd->stream.fd1);*/
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_PASTSOCKET);
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_FD);
|
|
||||||
|
|
||||||
applyopts_cloexec(fd->stream.fd1, opts);
|
|
||||||
|
|
||||||
sa.sun_family = AF_UNIX;
|
|
||||||
salen = xiosetunix(&sa, filename, false, false);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_PREBIND);
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_BIND);
|
|
||||||
if (us) {
|
|
||||||
if (Bind(fd->stream.fd1, us, uslen) < 0) {
|
|
||||||
Error4("bind(%d, {%s}, "F_Zd"): %s",
|
|
||||||
fd->fd, sockaddr_info(us, infobuff, sizeof(infobuff)),
|
|
||||||
uslen, strerror(errno));
|
|
||||||
if (fd->forever || --fd->retry) {
|
|
||||||
Nanosleep(&fd->intervall, NULL);
|
|
||||||
continue;
|
|
||||||
} else
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_PASTBIND);
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_CONNECT);
|
|
||||||
if ((result = Connect(fd->stream.fd1, (struct sockaddr *)&sa, salen)) < 0) {
|
|
||||||
if (errno == EINPROGRESS) {
|
|
||||||
Warn4("connect(%d, %s, "F_Zd"): %s",
|
|
||||||
fd->stream.fd1, sockaddr_unix_info(&sa, salen, infobuff, sizeof(infobuff)),
|
|
||||||
sizeof(sa), strerror(errno));
|
|
||||||
} else if (errno == EPROTOTYPE && optsotype != SOCK_STREAM) {
|
|
||||||
Warn4("connect(%d, %s, "F_Zd"): %s",
|
|
||||||
fd->stream.fd1, sockaddr_unix_info(&sa, salen, infobuff, sizeof(infobuff)),
|
|
||||||
sizeof(sa), strerror(errno));
|
|
||||||
Info("assuming datagram socket");
|
|
||||||
Close(fd->stream.fd1);
|
|
||||||
|
|
||||||
opts = opts2;
|
|
||||||
if ((fd->stream.fd1 = Socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
|
|
||||||
Error1("socket(PF_UNIX, SOCK_DGRAM, 0): %s", strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
|
||||||
/*0 Info1("socket(PF_UNIX, SOCK_DGRAM, 0) -> %d", fd->stream.fd1);*/
|
|
||||||
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_PASTSOCKET);
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_FD);
|
|
||||||
|
|
||||||
applyopts_cloexec(fd->stream.fd1, opts);
|
|
||||||
|
|
||||||
sa.sun_family = AF_UNIX;
|
|
||||||
strncpy(sa.sun_path, filename, sizeof(sa.sun_path));
|
|
||||||
|
|
||||||
fd->stream.dtype = XIODATA_RECVFROM;
|
|
||||||
fd->stream.salen = sizeof(sa);
|
|
||||||
memcpy(&fd->stream.peersa.soa, &sa, fd->stream.salen);
|
|
||||||
} else {
|
|
||||||
Error4("connect(%d, %s, "F_Zd"): %s",
|
|
||||||
fd->stream.fd1, sockaddr_unix_info(&sa, fd->stream.salen, infobuff, sizeof(infobuff)),
|
|
||||||
sizeof(sa), strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fd->stream.howtoshut == XIOSHUT_UNSPEC)
|
|
||||||
fd->stream.howtoshut = XIOSHUT_CLOSE;
|
|
||||||
if (fd->stream.howtoclose == XIOCLOSE_UNSPEC)
|
|
||||||
fd->stream.howtoclose = XIOCLOSE_CLOSE;
|
|
||||||
|
|
||||||
applyopts_fchown(fd->stream.fd1, opts);
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_CONNECTED);
|
|
||||||
applyopts(fd->stream.fd1, opts, PH_LATE);
|
|
||||||
applyopts_named(filename, opts, PH_PASTOPEN); /* unlink-late */
|
applyopts_named(filename, opts, PH_PASTOPEN); /* unlink-late */
|
||||||
|
|
||||||
if (Getsockname(fd->stream.fd1, (struct sockaddr *)&us, &uslen) < 0) {
|
if (Getsockname(fd->stream.fd1, (struct sockaddr *)&us, &uslen) < 0) {
|
||||||
|
@ -171,7 +70,8 @@ static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xi
|
||||||
fd->stream.fd1, &us, uslen, strerror(errno));
|
fd->stream.fd1, &us, uslen, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
Notice1("successfully connected via %s",
|
Notice1("successfully connected via %s",
|
||||||
sockaddr_unix_info(&us, uslen, infobuff, sizeof(infobuff)));
|
sockaddr_unix_info(&us.un, uslen,
|
||||||
|
infobuff, sizeof(infobuff)));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Error("\"%s\" is a socket, but UNIX socket support is not compiled in");
|
Error("\"%s\" is a socket, but UNIX socket support is not compiled in");
|
||||||
|
@ -190,6 +90,10 @@ static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xi
|
||||||
}
|
}
|
||||||
fd->stream.opt_unlink_close = true;
|
fd->stream.opt_unlink_close = true;
|
||||||
}
|
}
|
||||||
|
if (fd->stream.howtoshut == XIOSHUT_UNSPEC)
|
||||||
|
fd->stream.howtoshut = XIOSHUT_NONE;
|
||||||
|
if (fd->stream.howtoclose == XIOCLOSE_UNSPEC)
|
||||||
|
fd->stream.howtoclose = XIOCLOSE_CLOSE;
|
||||||
|
|
||||||
Notice3("opening %s \"%s\" for %s",
|
Notice3("opening %s \"%s\" for %s",
|
||||||
filetypenames[(st_mode&S_IFMT)>>12], filename, ddirection[(xioflags&XIO_ACCMODE)]);
|
filetypenames[(st_mode&S_IFMT)>>12], filename, ddirection[(xioflags&XIO_ACCMODE)]);
|
||||||
|
@ -202,10 +106,6 @@ static int xioopen_gopen1(int argc, const char *argv[], struct opt *opts, int xi
|
||||||
Ioctl(result, I_PUSH, "ttcompat");
|
Ioctl(result, I_PUSH, "ttcompat");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (fd->stream.howtoshut == XIOSHUT_UNSPEC)
|
|
||||||
fd->stream.howtoshut = XIOSHUT_NONE;
|
|
||||||
if (fd->stream.howtoclose == XIOCLOSE_UNSPEC)
|
|
||||||
fd->stream.howtoclose = XIOCLOSE_CLOSE;
|
|
||||||
fd->stream.fd1 = result;
|
fd->stream.fd1 = result;
|
||||||
|
|
||||||
#if WITH_TERMIOS
|
#if WITH_TERMIOS
|
||||||
|
|
105
xio-interface.c
Normal file
105
xio-interface.c
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/* source: xio-interface.c */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of raw socket type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
|
||||||
|
#if WITH_INTERFACE
|
||||||
|
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "xio-socket.h"
|
||||||
|
|
||||||
|
#include "xio-interface.h"
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
int xioopen_interface(int argc, const char *argv[], struct opt *opts,
|
||||||
|
int xioflags, xiofile_t *xfd, unsigned groups, int dummy,
|
||||||
|
int dummy2, int dummy3);
|
||||||
|
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_interface1 = { XIOADDR_SYS, "interface", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_interface, 0, 0, 0 HELP(":<interface>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_interface[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_interface1,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static
|
||||||
|
int _xioopen_interface(const char *ifname,
|
||||||
|
struct opt *opts, int xioflags, xiofile_t *xxfd,
|
||||||
|
unsigned groups) {
|
||||||
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_PACKET;
|
||||||
|
union sockaddr_union us = {{0}};
|
||||||
|
socklen_t uslen;
|
||||||
|
int socktype = SOCK_RAW;
|
||||||
|
unsigned int ifidx;
|
||||||
|
bool needbind = false;
|
||||||
|
char *bindstring = NULL;
|
||||||
|
struct sockaddr_ll sall = { 0 };
|
||||||
|
|
||||||
|
if (ifindex(ifname, &ifidx, -1) < 0) {
|
||||||
|
Error1("unknown interface \"%s\"", ifname);
|
||||||
|
ifidx = 0; /* desparate attempt to continue */
|
||||||
|
}
|
||||||
|
|
||||||
|
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
||||||
|
|
||||||
|
retropt_socket_pf(opts, &pf);
|
||||||
|
|
||||||
|
/* ...res_opts[] */
|
||||||
|
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
||||||
|
applyopts(-1, opts, PH_INIT);
|
||||||
|
|
||||||
|
xfd->salen = sizeof(xfd->peersa);
|
||||||
|
if (pf == PF_UNSPEC) {
|
||||||
|
pf = xfd->peersa.soa.sa_family;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfd->dtype = XIODATA_RECVFROM_SKIPIP;
|
||||||
|
|
||||||
|
if (retropt_string(opts, OPT_BIND, &bindstring)) {
|
||||||
|
needbind = true;
|
||||||
|
}
|
||||||
|
/*!!! parse by ':' */
|
||||||
|
((struct sockaddr_ll *)&us)->sll_family = pf;
|
||||||
|
((struct sockaddr_ll *)&us)->sll_protocol = htons(ETH_P_ALL);
|
||||||
|
((struct sockaddr_ll *)&us)->sll_ifindex = ifidx;
|
||||||
|
uslen = sizeof(sall);
|
||||||
|
needbind = true;
|
||||||
|
xfd->peersa = (union sockaddr_union)us;
|
||||||
|
|
||||||
|
return
|
||||||
|
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
||||||
|
opts, xioflags, xfd, groups, pf, socktype, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int xioopen_interface(int argc, const char *argv[], struct opt *opts,
|
||||||
|
int xioflags, xiofile_t *xxfd, unsigned groups,
|
||||||
|
int summy, int dummy2, int dummy3) {
|
||||||
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
Error2("%s: wrong number of parameters (%d instead of 1)",
|
||||||
|
argv[0], argc-1);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result =
|
||||||
|
_xioopen_interface(argv[1], opts, xioflags, xxfd, groups))
|
||||||
|
!= STAT_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfd->dtype = XIOREAD_RECV|XIOWRITE_SENDTO;
|
||||||
|
|
||||||
|
xfd->para.socket.la.soa.sa_family = xfd->peersa.soa.sa_family;
|
||||||
|
|
||||||
|
_xio_openlate(xfd, opts);
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_INTERFACE */
|
10
xio-interface.h
Normal file
10
xio-interface.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* source: xio-interface.h */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_interface_h_included
|
||||||
|
#define __xio_interface_h_included 1
|
||||||
|
|
||||||
|
extern const union xioaddr_desc *xioaddrs_interface[];
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_interface_h_included) */
|
217
xio-ip.c
217
xio-ip.c
|
@ -9,6 +9,8 @@
|
||||||
#if _WITH_IP4 || _WITH_IP6
|
#if _WITH_IP4 || _WITH_IP6
|
||||||
|
|
||||||
#include "xioopen.h"
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-ascii.h"
|
||||||
#include "xio-socket.h"
|
#include "xio-socket.h"
|
||||||
#include "xio-ip.h"
|
#include "xio-ip.h"
|
||||||
#include "xio-ip6.h"
|
#include "xio-ip6.h"
|
||||||
|
@ -25,7 +27,7 @@ const struct optdesc opt_ip_pktinfo = { "ip-pktinfo", "pktinfo", OPT_IP_PKTINF
|
||||||
#ifdef IP_RECVTOS
|
#ifdef IP_RECVTOS
|
||||||
const struct optdesc opt_ip_recvtos = { "ip-recvtos", "recvtos", OPT_IP_RECVTOS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTOS };
|
const struct optdesc opt_ip_recvtos = { "ip-recvtos", "recvtos", OPT_IP_RECVTOS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTOS };
|
||||||
#endif
|
#endif
|
||||||
#ifdef IP_RECVTTL
|
#ifdef IP_RECVTTL /* -Cygwin */
|
||||||
const struct optdesc opt_ip_recvttl = { "ip-recvttl", "recvttl", OPT_IP_RECVTTL, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTTL };
|
const struct optdesc opt_ip_recvttl = { "ip-recvttl", "recvttl", OPT_IP_RECVTTL, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTTL };
|
||||||
#endif
|
#endif
|
||||||
#ifdef IP_RECVOPTS
|
#ifdef IP_RECVOPTS
|
||||||
|
@ -56,7 +58,8 @@ const struct optdesc opt_ip_router_alert={"ip-router-alert","routeralert",OPT_IP
|
||||||
#endif
|
#endif
|
||||||
/* following: Linux allows int but OpenBSD reqs char/byte */
|
/* following: Linux allows int but OpenBSD reqs char/byte */
|
||||||
const struct optdesc opt_ip_multicast_ttl={"ip-multicast-ttl","multicastttl",OPT_IP_MULTICAST_TTL,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_BYTE,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_TTL};
|
const struct optdesc opt_ip_multicast_ttl={"ip-multicast-ttl","multicastttl",OPT_IP_MULTICAST_TTL,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_BYTE,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_TTL};
|
||||||
const struct optdesc opt_ip_multicast_loop={"ip-multicast-loop","multicastloop",OPT_IP_MULTICAST_LOOP,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_INT,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_LOOP};
|
/* following: Linux allows int but OpenBSD reqs char/byte */
|
||||||
|
const struct optdesc opt_ip_multicast_loop={"ip-multicast-loop","multicastloop",OPT_IP_MULTICAST_LOOP,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_BYTE,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_LOOP};
|
||||||
const struct optdesc opt_ip_multicast_if ={"ip-multicast-if", "multicast-if", OPT_IP_MULTICAST_IF, GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_IP4NAME,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_IF};
|
const struct optdesc opt_ip_multicast_if ={"ip-multicast-if", "multicast-if", OPT_IP_MULTICAST_IF, GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_IP4NAME,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_IF};
|
||||||
#ifdef IP_PKTOPTIONS
|
#ifdef IP_PKTOPTIONS
|
||||||
const struct optdesc opt_ip_pktoptions = { "ip-pktoptions", "pktopts", OPT_IP_PKTOPTIONS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_PKTOPTIONS };
|
const struct optdesc opt_ip_pktoptions = { "ip-pktoptions", "pktopts", OPT_IP_PKTOPTIONS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_PKTOPTIONS };
|
||||||
|
@ -64,6 +67,12 @@ const struct optdesc opt_ip_pktoptions = { "ip-pktoptions", "pktopts", OPT_IP_PK
|
||||||
#ifdef IP_ADD_MEMBERSHIP
|
#ifdef IP_ADD_MEMBERSHIP
|
||||||
const struct optdesc opt_ip_add_membership = { "ip-add-membership", "membership",OPT_IP_ADD_MEMBERSHIP, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IP, IP_ADD_MEMBERSHIP };
|
const struct optdesc opt_ip_add_membership = { "ip-add-membership", "membership",OPT_IP_ADD_MEMBERSHIP, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IP, IP_ADD_MEMBERSHIP };
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IP_RECVDSTADDR
|
||||||
|
const struct optdesc opt_ip_recvdstaddr = { "ip-recvdstaddr", "recvdstaddr",OPT_IP_RECVDSTADDR, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVDSTADDR };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVIF
|
||||||
|
const struct optdesc opt_ip_recvif = { "ip-recvif", "recvdstaddrif",OPT_IP_RECVIF, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVIF };
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_RESOLV_H
|
#if HAVE_RESOLV_H
|
||||||
const struct optdesc opt_res_debug = { "res-debug", NULL, OPT_RES_DEBUG, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_DEBUG };
|
const struct optdesc opt_res_debug = { "res-debug", NULL, OPT_RES_DEBUG, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_DEBUG };
|
||||||
|
@ -204,6 +213,18 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
if (node != NULL || service != NULL) {
|
if (node != NULL || service != NULL) {
|
||||||
struct addrinfo *record;
|
struct addrinfo *record;
|
||||||
|
|
||||||
|
if (socktype != SOCK_STREAM && socktype != SOCK_DGRAM) {
|
||||||
|
/* actual socket type value is not supported - fallback to a good one */
|
||||||
|
socktype = SOCK_DGRAM;
|
||||||
|
}
|
||||||
|
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
|
||||||
|
/* actual protocol value is not supported - fallback to a good one */
|
||||||
|
if (socktype == SOCK_DGRAM) {
|
||||||
|
protocol = IPPROTO_UDP;
|
||||||
|
} else {
|
||||||
|
protocol = IPPROTO_TCP;
|
||||||
|
}
|
||||||
|
}
|
||||||
hints.ai_flags |= AI_PASSIVE;
|
hints.ai_flags |= AI_PASSIVE;
|
||||||
hints.ai_family = family;
|
hints.ai_family = family;
|
||||||
hints.ai_socktype = socktype;
|
hints.ai_socktype = socktype;
|
||||||
|
@ -423,89 +444,121 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int xioparsenetwork(const char *rangename, int pf, union xiorange_union *range) {
|
#if defined(HAVE_STRUCT_CMSGHDR) && defined(CMSG_DATA)
|
||||||
#if WITH_IP4
|
/* these are valid for IPv4 and IPv6 */
|
||||||
struct in_addr *netaddr_in = &range->ip4.netaddr;
|
int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num,
|
||||||
struct in_addr *netmask_in = &range->ip4.netmask;
|
char *typbuff, int typlen,
|
||||||
#endif /* WITH_IP4 */
|
char *nambuff, int namlen,
|
||||||
struct hostent *maskaddr;
|
char *envbuff, int envlen,
|
||||||
char *delimpos; /* absolute address of delimiter */
|
char *valbuff, int vallen) {
|
||||||
int bits;
|
const char *cmsgtype, *cmsgname = NULL, *cmsgenvn = NULL, *cmsgfmt = NULL;
|
||||||
|
size_t msglen;
|
||||||
|
char scratch1[16]; /* can hold an IPv4 address in ASCII */
|
||||||
|
char scratch2[16];
|
||||||
|
char scratch3[16];
|
||||||
|
|
||||||
switch (pf) {
|
msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg);
|
||||||
#if WITH_IP4
|
envbuff[0] = '\0';
|
||||||
char *rangename1; /* a copy of rangename with writing allowed */
|
switch (cmsg->cmsg_type) {
|
||||||
case PF_INET:
|
|
||||||
if ((rangename1 = strdup(rangename)) == NULL) {
|
|
||||||
Error1("strdup(\"%s\"): out of memory", rangename);
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delimpos = strchr(rangename1, '/')) {
|
|
||||||
bits = strtoul(delimpos+1, NULL, 10);
|
|
||||||
netmask_in->s_addr = htonl((0xffffffff << (32-bits)));
|
|
||||||
} else if (delimpos = strchr(rangename1, ':')) {
|
|
||||||
if ((maskaddr = Gethostbyname(delimpos+1)) == NULL) {
|
|
||||||
Error2("gethostbyname(\"%s\"): %s", delimpos+1,
|
|
||||||
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
|
||||||
hstrerror(h_errno));
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
netmask_in->s_addr = *(uint32_t *)maskaddr->h_addr_list[0];
|
|
||||||
} else {
|
|
||||||
Error1("xioparsenetwork(\"%s\",,): missing netmask delimiter", rangename);
|
|
||||||
free(rangename1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
struct hostent *nameaddr;
|
|
||||||
*delimpos = 0;
|
|
||||||
if ((nameaddr = Gethostbyname(rangename1)) == NULL) {
|
|
||||||
Error2("gethostbyname(\"%s\"): %s", rangename1,
|
|
||||||
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
|
||||||
hstrerror(h_errno));
|
|
||||||
free(rangename1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
netaddr_in->s_addr = *(unsigned long *)nameaddr->h_addr_list[0];
|
|
||||||
}
|
|
||||||
free(rangename1);
|
|
||||||
break;
|
|
||||||
#endif /* WITH_IP4 */
|
|
||||||
#if WITH_IP6
|
|
||||||
case PF_INET6:
|
|
||||||
return xioparsenetwork_ip6(rangename, &range->ip6);
|
|
||||||
break;
|
|
||||||
#endif /* WITH_IP6 */
|
|
||||||
default:
|
|
||||||
Error1("range option not supported with address family %d", pf);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
return STAT_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* parses a string of form address/bits or address:mask, and fills the fields
|
|
||||||
of the range union. The addr component is masked with mask. */
|
|
||||||
int parserange(const char *rangename, int pf, union xiorange_union *range) {
|
|
||||||
if (xioparsenetwork(rangename, pf, range) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
switch (pf) {
|
|
||||||
#if WITH_IP4
|
|
||||||
case PF_INET:
|
|
||||||
range->ip4.netaddr.s_addr &= range->ip4.netmask.s_addr;
|
|
||||||
break;
|
|
||||||
#endif /* WITH_IP4 */
|
|
||||||
#if WITH_IP6
|
|
||||||
case PF_INET6:
|
|
||||||
return xiorange_ip6andmask(&range->ip6);
|
|
||||||
break;
|
|
||||||
#endif /* WITH_IP6 */
|
|
||||||
default:
|
default:
|
||||||
Error1("range option not supported with address family %d", pf);
|
*num = 1;
|
||||||
return STAT_NORETRY;
|
strncpy(typbuff, "IP", typlen);
|
||||||
|
snprintf(nambuff, namlen, "type_%u", cmsg->cmsg_type);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#if WITH_IP4
|
||||||
|
#if defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO
|
||||||
|
case IP_PKTINFO: {
|
||||||
|
struct in_pktinfo *pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg);
|
||||||
|
*num = 3;
|
||||||
|
strncpy(typbuff, "IP_PKTINFO", typlen);
|
||||||
|
snprintf(nambuff, namlen, "%s%c%s%c%s", "if", '\0', "locaddr", '\0', "dstaddr");
|
||||||
|
snprintf(envbuff, envlen, "%s%c%s%c%s", "IP_IF", '\0',
|
||||||
|
"IP_LOCADDR", '\0', "IP_DSTADDR");
|
||||||
|
snprintf(valbuff, vallen, "%s%c%s%c%s",
|
||||||
|
xiogetifname(pktinfo->ipi_ifindex, scratch1, -1), '\0',
|
||||||
|
inet4addr_info(ntohl(pktinfo->ipi_spec_dst.s_addr), scratch2, sizeof(scratch2)), '\0',
|
||||||
|
inet4addr_info(ntohl(pktinfo->ipi_addr.s_addr), scratch3, sizeof(scratch3)));
|
||||||
}
|
}
|
||||||
return 0;
|
return STAT_OK;
|
||||||
|
#endif /* defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO */
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#ifdef IP_RECVERR
|
||||||
|
case IP_RECVERR: {
|
||||||
|
struct sock_extended_err *err =
|
||||||
|
(struct sock_extended_err *)CMSG_DATA(cmsg);
|
||||||
|
*num = 6;
|
||||||
|
strncpy(typbuff, "IP_RECVERR", typlen);
|
||||||
|
snprintf(nambuff, namlen, "%s%c%s%c%s%c%s%c%s%c%s",
|
||||||
|
"errno", '\0', "origin", '\0', "type", '\0',
|
||||||
|
"code", '\0', "info", '\0', "data");
|
||||||
|
snprintf(envbuff, envlen, "%s%c%s%c%s%c%s%c%s%c%s",
|
||||||
|
"IP_RECVERR_ERRNO", '\0', "IP_RECVERR_ORIGIN", '\0',
|
||||||
|
"IP_RECVERR_TYPE", '\0', "IP_RECVERR_CODE", '\0',
|
||||||
|
"IP_RECVERR_INFO", '\0', "IP_RECVERR_DATA");
|
||||||
|
snprintf(valbuff, vallen, "%u%c%u%c%u%c%u%c%u%c%u",
|
||||||
|
err->ee_errno, '\0', err->ee_origin, '\0', err->ee_type, '\0',
|
||||||
|
err->ee_code, '\0', err->ee_info, '\0', err->ee_data);
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
#endif /* IP_RECVERR */
|
||||||
|
#ifdef IP_RECVIF
|
||||||
|
case IP_RECVIF: {
|
||||||
|
/* spec in FreeBSD: /usr/include/net/if_dl.h */
|
||||||
|
struct sockaddr_dl *sadl = (struct sockaddr_dl *)CMSG_DATA(cmsg);
|
||||||
|
*num = 1;
|
||||||
|
strncpy(typbuff, "IP_RECVIF", typlen);
|
||||||
|
strncpy(nambuff, "if", namlen);
|
||||||
|
strncpy(envbuff, "IP_IF", envlen);
|
||||||
|
strncpy(valbuff,
|
||||||
|
xiosubstr(scratch1, sadl->sdl_data, 0, sadl->sdl_nlen), vallen);
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
#endif /* defined(IP_RECVIF) */
|
||||||
|
#if WITH_IP4
|
||||||
|
#ifdef IP_RECVDSTADDR
|
||||||
|
case IP_RECVDSTADDR:
|
||||||
|
*num = 1;
|
||||||
|
strncpy(typbuff, "IP_RECVDSTADDR", typlen);
|
||||||
|
strncpy(nambuff, "dstaddr", namlen);
|
||||||
|
strncpy(envbuff, "IP_DSTADDR", envlen);
|
||||||
|
inet4addr_info(ntohl(*(uint32_t *)CMSG_DATA(cmsg)), valbuff, vallen);
|
||||||
|
return STAT_OK;
|
||||||
|
#endif
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
case IP_OPTIONS:
|
||||||
|
#ifdef IP_RECVOPTS
|
||||||
|
case IP_RECVOPTS:
|
||||||
|
#endif
|
||||||
|
cmsgtype = "IP_OPTIONS"; cmsgname = "options"; cmsgfmt = NULL; break;
|
||||||
|
case IP_TOS:
|
||||||
|
cmsgtype = "IP_TOS"; cmsgname = "tos"; cmsgfmt = "%u"; break;
|
||||||
|
case IP_TTL: /* Linux */
|
||||||
|
#ifdef IP_RECVTTL
|
||||||
|
case IP_RECVTTL: /* FreeBSD */
|
||||||
|
#endif
|
||||||
|
cmsgtype = "IP_TTL"; cmsgname = "ttl"; cmsgfmt = "%u"; break;
|
||||||
|
}
|
||||||
|
/* when we come here we provide a single parameter
|
||||||
|
with type in cmsgtype, name in cmsgname, printf format in cmsgfmt */
|
||||||
|
*num = 1;
|
||||||
|
if (strlen(cmsgtype) >= typlen) Fatal("buff too short");
|
||||||
|
strncpy(typbuff, cmsgtype, typlen);
|
||||||
|
if (strlen(cmsgname) >= namlen) Fatal("buff too short");
|
||||||
|
strncpy(nambuff, cmsgname, namlen);
|
||||||
|
if (cmsgenvn) {
|
||||||
|
if (strlen(cmsgenvn) >= envlen) Fatal("buff too short");
|
||||||
|
strncpy(envbuff, cmsgenvn, envlen);
|
||||||
|
} else {
|
||||||
|
envbuff[0] = '\0';
|
||||||
|
}
|
||||||
|
if (cmsgfmt != NULL) {
|
||||||
|
snprintf(valbuff, vallen, cmsgfmt, *(unsigned char *)CMSG_DATA(cmsg));
|
||||||
|
} else {
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
}
|
||||||
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
|
#endif /* defined(HAVE_STRUCT_CMSGHDR) && defined(CMSG_DATA) */
|
||||||
|
|
||||||
#endif /* _WITH_IP4 || _WITH_IP6 */
|
#endif /* _WITH_IP4 || _WITH_IP6 */
|
||||||
|
|
13
xio-ip.h
13
xio-ip.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ip.h */
|
/* source: xio-ip.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_ip_h_included
|
#ifndef __xio_ip_h_included
|
||||||
|
@ -24,6 +24,8 @@ extern const struct optdesc opt_ip_multicast_loop;
|
||||||
extern const struct optdesc opt_ip_multicast_if;
|
extern const struct optdesc opt_ip_multicast_if;
|
||||||
extern const struct optdesc opt_ip_pktoptions;
|
extern const struct optdesc opt_ip_pktoptions;
|
||||||
extern const struct optdesc opt_ip_add_membership;
|
extern const struct optdesc opt_ip_add_membership;
|
||||||
|
extern const struct optdesc opt_ip_recvdstaddr;
|
||||||
|
extern const struct optdesc opt_ip_recvif;
|
||||||
|
|
||||||
extern const struct optdesc opt_res_debug;
|
extern const struct optdesc opt_res_debug;
|
||||||
extern const struct optdesc opt_res_aaonly;
|
extern const struct optdesc opt_res_aaonly;
|
||||||
|
@ -40,9 +42,10 @@ extern int xiogetaddrinfo(const char *node, const char *service,
|
||||||
union sockaddr_union *sa, socklen_t *socklen,
|
union sockaddr_union *sa, socklen_t *socklen,
|
||||||
unsigned long res_opts0, unsigned long res_opts1);
|
unsigned long res_opts0, unsigned long res_opts1);
|
||||||
extern
|
extern
|
||||||
int xioparsenetwork(const char *rangename, int pf,
|
int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num,
|
||||||
union xiorange_union *range);
|
char *typbuff, int typlen,
|
||||||
extern
|
char *nambuff, int namlen,
|
||||||
int parserange(const char *rangename, int pf, union xiorange_union *range);
|
char *envbuff, int envlen,
|
||||||
|
char *valbuff, int vallen);
|
||||||
|
|
||||||
#endif /* !defined(__xio_ip_h_included) */
|
#endif /* !defined(__xio_ip_h_included) */
|
||||||
|
|
93
xio-ip4.c
93
xio-ip4.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ip4.c */
|
/* source: xio-ip4.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for IP4 related functions */
|
/* this file contains the source for IP4 related functions */
|
||||||
|
@ -13,11 +13,59 @@
|
||||||
#include "xio-ip.h"
|
#include "xio-ip.h"
|
||||||
#include "xio-ip4.h"
|
#include "xio-ip4.h"
|
||||||
|
|
||||||
|
|
||||||
|
int xioparsenetwork_ip4(const char *rangename, struct xiorange *range) {
|
||||||
|
struct hostent *maskaddr;
|
||||||
|
struct in_addr *netaddr_in = &range->netaddr.ip4.sin_addr;
|
||||||
|
struct in_addr *netmask_in = &range->netmask.ip4.sin_addr;
|
||||||
|
char *rangename1; /* a copy of rangename with writing allowed */
|
||||||
|
char *delimpos; /* absolute address of delimiter */
|
||||||
|
int bits;
|
||||||
|
|
||||||
|
if ((rangename1 = strdup(rangename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", rangename);
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delimpos = strchr(rangename1, '/')) {
|
||||||
|
bits = strtoul(delimpos+1, NULL, 10);
|
||||||
|
netmask_in->s_addr = htonl((0xffffffff << (32-bits)));
|
||||||
|
} else if (delimpos = strchr(rangename1, ':')) {
|
||||||
|
if ((maskaddr = Gethostbyname(delimpos+1)) == NULL) {
|
||||||
|
/* note: cast is req on AIX: */
|
||||||
|
Error2("gethostbyname(\"%s\"): %s", delimpos+1,
|
||||||
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
|
(char *)hstrerror(h_errno));
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
netmask_in->s_addr = *(uint32_t *)maskaddr->h_addr_list[0];
|
||||||
|
} else {
|
||||||
|
Error1("xioparsenetwork_ip4(\"%s\",,): missing netmask delimiter", rangename);
|
||||||
|
free(rangename1);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
struct hostent *nameaddr;
|
||||||
|
*delimpos = 0;
|
||||||
|
if ((nameaddr = Gethostbyname(rangename1)) == NULL) {
|
||||||
|
/* note: cast is req on AIX: */
|
||||||
|
Error2("gethostbyname(\"%s\"): %s", rangename1,
|
||||||
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
|
(char *)hstrerror(h_errno));
|
||||||
|
free(rangename1);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
netaddr_in->s_addr = *(unsigned long *)nameaddr->h_addr_list[0];
|
||||||
|
}
|
||||||
|
free(rangename1);
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* check if peer address is within permitted range.
|
/* check if peer address is within permitted range.
|
||||||
return >= 0 if so. */
|
return >= 0 if so. */
|
||||||
int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange_ip4 *range) {
|
int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange *range) {
|
||||||
struct in_addr *netaddr_in = &range->netaddr;
|
struct in_addr *netaddr_in = &range->netaddr.ip4.sin_addr;
|
||||||
struct in_addr *netmask_in = &range->netmask;
|
struct in_addr *netmask_in = &range->netmask.ip4.sin_addr;
|
||||||
char addrbuf[256], maskbuf[256];
|
char addrbuf[256], maskbuf[256];
|
||||||
char peername[256];
|
char peername[256];
|
||||||
|
|
||||||
|
@ -43,4 +91,41 @@ int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange_ip4 *range) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns information that can be used for constructing an environment
|
||||||
|
variable describing the socket address.
|
||||||
|
if idx is 0, this function writes "ADDR" into namebuff and the IP address
|
||||||
|
into valuebuff, and returns 1 (which means that one more info is there).
|
||||||
|
if idx is 1, it writes "PORT" into namebuff and the port number into
|
||||||
|
valuebuff, and returns 0 (no more info)
|
||||||
|
namelen and valuelen contain the max. allowed length of output chars in the
|
||||||
|
respective buffer.
|
||||||
|
on error this function returns -1.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xiosetsockaddrenv_ip4(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
|
struct sockaddr_in *sa, int ipproto) {
|
||||||
|
switch (idx) {
|
||||||
|
case 0:
|
||||||
|
strcpy(namebuff, "ADDR");
|
||||||
|
strcpy(valuebuff,
|
||||||
|
inet4addr_info(ntohl(sa->sin_addr.s_addr), valuebuff, valuelen));
|
||||||
|
switch (ipproto) {
|
||||||
|
case IPPROTO_TCP:
|
||||||
|
case IPPROTO_UDP:
|
||||||
|
#ifdef IPPROTO_SCTP
|
||||||
|
case IPPROTO_SCTP:
|
||||||
|
#endif
|
||||||
|
return 1; /* there is port information to also be retrieved */
|
||||||
|
default:
|
||||||
|
return 0; /* no port info coming */
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
strcpy(namebuff, "PORT");
|
||||||
|
snprintf(valuebuff, valuelen, "%u", ntohs(sa->sin_port));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WITH_IP4 */
|
#endif /* WITH_IP4 */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ip4.h */
|
/* source: xio-ip4.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_ip4_h_included
|
#ifndef __xio_ip4_h_included
|
||||||
|
@ -7,7 +7,12 @@
|
||||||
|
|
||||||
extern const struct optdesc opt_ip4_add_membership;
|
extern const struct optdesc opt_ip4_add_membership;
|
||||||
|
|
||||||
|
int xioparsenetwork_ip4(const char *rangename, struct xiorange *range);
|
||||||
extern
|
extern
|
||||||
int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange_ip4 *range);
|
int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange *range);
|
||||||
|
extern int
|
||||||
|
xiosetsockaddrenv_ip4(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
|
struct sockaddr_in *sa, int ipproto);
|
||||||
|
|
||||||
#endif /* !defined(__xio_ip4_h_included) */
|
#endif /* !defined(__xio_ip4_h_included) */
|
||||||
|
|
261
xio-ip6.c
261
xio-ip6.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ip6.c */
|
/* source: xio-ip6.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for IP6 related functions */
|
/* this file contains the source for IP6 related functions */
|
||||||
|
@ -9,27 +9,71 @@
|
||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
|
|
||||||
#include "xioopen.h"
|
#include "xioopen.h"
|
||||||
|
#include "xio-ascii.h"
|
||||||
#include "xio-socket.h"
|
#include "xio-socket.h"
|
||||||
#include "xio-ip.h" /* xiogetaddrinfo() */
|
#include "xio-ip.h" /* xiogetaddrinfo() */
|
||||||
|
|
||||||
#include "xio-ip6.h"
|
#include "xio-ip6.h"
|
||||||
|
|
||||||
|
|
||||||
|
static char *inet6addr_info(const struct in6_addr *sa, char *buff, size_t blen);
|
||||||
|
|
||||||
|
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
const struct optdesc opt_ipv6_v6only = { "ipv6-v6only", "ipv6only", OPT_IPV6_V6ONLY, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_V6ONLY };
|
const struct optdesc opt_ipv6_v6only = { "ipv6-v6only", "ipv6only", OPT_IPV6_V6ONLY, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_V6ONLY };
|
||||||
#endif
|
#endif
|
||||||
#ifdef IPV6_JOIN_GROUP
|
#ifdef IPV6_JOIN_GROUP
|
||||||
const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTBIND, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP };
|
const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTBIND, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP };
|
||||||
#endif
|
#endif
|
||||||
|
const struct optdesc opt_ipv6_pktinfo = { "ipv6-pktinfo", "pktinfo", OPT_IPV6_PKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_PKTINFO };
|
||||||
|
#ifdef IPV6_RECVPKTINFO
|
||||||
|
const struct optdesc opt_ipv6_recvpktinfo = { "ipv6-recvpktinfo", "recvpktinfo", OPT_IPV6_RECVPKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVPKTINFO };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_ipv6_rthdr = { "ipv6-rthdr", "rthdr", OPT_IPV6_RTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RTHDR };
|
||||||
|
#ifdef IPV6_RECVRTHDR
|
||||||
|
const struct optdesc opt_ipv6_recvrthdr = { "ipv6-recvrthdr", "recvrthdr", OPT_IPV6_RECVRTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVRTHDR };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_AUTHHDR
|
||||||
|
const struct optdesc opt_ipv6_authhdr = { "ipv6-authhdr", "authhdr", OPT_IPV6_AUTHHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_AUTHHDR };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_ipv6_dstopts = { "ipv6-dstopts", "dstopts", OPT_IPV6_DSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_DSTOPTS };
|
||||||
|
#ifdef IPV6_RECVDSTOPTS
|
||||||
|
const struct optdesc opt_ipv6_recvdstopts = { "ipv6-recvdstopts", "recvdstopts", OPT_IPV6_RECVDSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVDSTOPTS };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_ipv6_hopopts = { "ipv6-hopopts", "hopopts", OPT_IPV6_HOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPOPTS };
|
||||||
|
#ifdef IPV6_RECVHOPOPTS
|
||||||
|
const struct optdesc opt_ipv6_recvhopopts = { "ipv6-recvhopopts", "recvhopopts", OPT_IPV6_RECVHOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPOPTS };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_FLOWINFO /* is in linux/in6.h */
|
||||||
|
const struct optdesc opt_ipv6_flowinfo= { "ipv6-flowinfo","flowinfo",OPT_IPV6_FLOWINFO,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_FLOWINFO };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_ipv6_hoplimit= { "ipv6-hoplimit","hoplimit",OPT_IPV6_HOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPLIMIT };
|
||||||
|
const struct optdesc opt_ipv6_unicast_hops= { "ipv6-unicast-hops","unicast-hops",OPT_IPV6_UNICAST_HOPS,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_UNICAST_HOPS };
|
||||||
|
#ifdef IPV6_RECVHOPLIMIT
|
||||||
|
const struct optdesc opt_ipv6_recvhoplimit= { "ipv6-recvhoplimit","recvhoplimit",OPT_IPV6_RECVHOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPLIMIT };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVERR
|
||||||
|
const struct optdesc opt_ipv6_recverr = { "ipv6-recverr", "recverr", OPT_IPV6_RECVERR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVERR };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_TCLASS
|
||||||
|
const struct optdesc opt_ipv6_tclass = { "ipv6-tclass", "tclass", OPT_IPV6_TCLASS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_TCLASS };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVTCLASS
|
||||||
|
const struct optdesc opt_ipv6_recvtclass = { "ipv6-recvtclass", "recvtclass", OPT_IPV6_RECVTCLASS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVTCLASS };
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVPATHMTU
|
||||||
|
const struct optdesc opt_ipv6_recvpathmtu = { "ipv6-recvpathmtu", "recvpathmtu", OPT_IPV6_RECVPATHMTU, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVPATHMTU };
|
||||||
|
#endif
|
||||||
|
|
||||||
int xioparsenetwork_ip6(const char *rangename, struct xiorange_ip6 *range) {
|
int xioparsenetwork_ip6(const char *rangename, struct xiorange *range) {
|
||||||
char *delimpos; /* absolute address of delimiter */
|
char *delimpos; /* absolute address of delimiter */
|
||||||
size_t delimind; /* index of delimiter in string */
|
size_t delimind; /* index of delimiter in string */
|
||||||
int bits;
|
int bits;
|
||||||
char *baseaddr;
|
char *baseaddr;
|
||||||
union sockaddr_union sockaddr;
|
union sockaddr_union sockaddr;
|
||||||
socklen_t sockaddrlen = sizeof(sockaddr);
|
socklen_t sockaddrlen = sizeof(sockaddr);
|
||||||
union xioin6_u *rangeaddr = (union xioin6_u *)&range->addr;
|
union xioin6_u *rangeaddr = (union xioin6_u *)&range->netaddr.ip6.sin6_addr;
|
||||||
union xioin6_u *rangemask = (union xioin6_u *)&range->mask;
|
union xioin6_u *rangemask = (union xioin6_u *)&range->netmask.ip6.sin6_addr;
|
||||||
union xioin6_u *nameaddr = (union xioin6_u *)&sockaddr.ip6.sin6_addr;
|
union xioin6_u *nameaddr = (union xioin6_u *)&sockaddr.ip6.sin6_addr;
|
||||||
|
|
||||||
if (rangename[0] != '[' || rangename[strlen(rangename)-1] != ']') {
|
if (rangename[0] != '[' || rangename[strlen(rangename)-1] != ']') {
|
||||||
|
@ -87,7 +131,7 @@ int xioparsenetwork_ip6(const char *rangename, struct xiorange_ip6 *range) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xiorange_ip6andmask(struct xiorange_ip6 *range) {
|
int xiorange_ip6andmask(struct xiorange *range) {
|
||||||
int i;
|
int i;
|
||||||
#if 0
|
#if 0
|
||||||
range->addr.s6_addr32[0] &= range->mask.s6_addr32[0];
|
range->addr.s6_addr32[0] &= range->mask.s6_addr32[0];
|
||||||
|
@ -96,7 +140,8 @@ int xiorange_ip6andmask(struct xiorange_ip6 *range) {
|
||||||
range->addr.s6_addr32[3] &= range->mask.s6_addr32[3];
|
range->addr.s6_addr32[3] &= range->mask.s6_addr32[3];
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < 16; ++i) {
|
for (i = 0; i < 16; ++i) {
|
||||||
range->addr.s6_addr[i] &= range->mask.s6_addr[i];
|
range->netaddr.ip6.sin6_addr.s6_addr[i] &=
|
||||||
|
range->netmask.ip6.sin6_addr.s6_addr[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -104,12 +149,12 @@ int xiorange_ip6andmask(struct xiorange_ip6 *range) {
|
||||||
|
|
||||||
/* check if peer address is within permitted range.
|
/* check if peer address is within permitted range.
|
||||||
return >= 0 if so. */
|
return >= 0 if so. */
|
||||||
int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange_ip6 *range) {
|
int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange *range) {
|
||||||
union xioin6_u masked;
|
union xioin6_u masked;
|
||||||
int i;
|
int i;
|
||||||
char peername[256];
|
char peername[256];
|
||||||
union xioin6_u *rangeaddr = (union xioin6_u *)&range->addr;
|
union xioin6_u *rangeaddr = (union xioin6_u *)&range->netaddr.ip6.sin6_addr;
|
||||||
union xioin6_u *rangemask = (union xioin6_u *)&range->mask;
|
union xioin6_u *rangemask = (union xioin6_u *)&range->netmask.ip6;
|
||||||
|
|
||||||
Debug16("permitted client subnet: [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
|
Debug16("permitted client subnet: [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
|
||||||
htons(rangeaddr->u6_addr16[0]), htons(rangeaddr->u6_addr16[1]),
|
htons(rangeaddr->u6_addr16[0]), htons(rangeaddr->u6_addr16[1]),
|
||||||
|
@ -142,4 +187,202 @@ int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange_ip6 *range) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(HAVE_STRUCT_CMSGHDR) && defined(CMSG_DATA)
|
||||||
|
/* provides info about the ancillary message */
|
||||||
|
int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
|
||||||
|
char *typbuff, int typlen,
|
||||||
|
char *nambuff, int namlen,
|
||||||
|
char *envbuff, int envlen,
|
||||||
|
char *valbuff, int vallen) {
|
||||||
|
char scratch1[42]; /* can hold an IPv6 address in ASCII */
|
||||||
|
char scratch2[32];
|
||||||
|
size_t msglen;
|
||||||
|
|
||||||
|
*num = 1; /* good for most message types */
|
||||||
|
msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg);
|
||||||
|
envbuff[0] = '\0';
|
||||||
|
switch (cmsg->cmsg_type) {
|
||||||
|
case IPV6_PKTINFO: {
|
||||||
|
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
|
||||||
|
*num = 2;
|
||||||
|
strncpy(typbuff, "IPV6_PKTINFO", typlen);
|
||||||
|
snprintf(nambuff, namlen, "%s%c%s", "dstaddr", '\0', "if");
|
||||||
|
snprintf(envbuff, envlen, "%s%c%s", "IPV6_DSTADDR", '\0', "IPV6_IF");
|
||||||
|
snprintf(valbuff, vallen, "%s%c%s",
|
||||||
|
inet6addr_info(&pktinfo->ipi6_addr, scratch1, sizeof(scratch1)),
|
||||||
|
'\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1));
|
||||||
|
}
|
||||||
|
return STAT_OK;
|
||||||
|
case IPV6_HOPLIMIT:
|
||||||
|
strncpy(typbuff, "IPV6_HOPLIMIT", typlen);
|
||||||
|
strncpy(nambuff, "hoplimit", namlen);
|
||||||
|
snprintf(valbuff, vallen, "%d", *(int *)CMSG_DATA(cmsg));
|
||||||
|
return STAT_OK;
|
||||||
|
case IPV6_RTHDR:
|
||||||
|
strncpy(typbuff, "IPV6_RTHDR", typlen);
|
||||||
|
strncpy(nambuff, "rthdr", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#ifdef IPV6_AUTHHDR
|
||||||
|
case IPV6_AUTHHDR:
|
||||||
|
strncpy(typbuff, "IPV6_AUTHHDR", typlen);
|
||||||
|
strncpy(nambuff, "authhdr", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#endif
|
||||||
|
case IPV6_DSTOPTS:
|
||||||
|
strncpy(typbuff, "IPV6_DSTOPTS", typlen);
|
||||||
|
strncpy(nambuff, "dstopts", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
case IPV6_HOPOPTS:
|
||||||
|
strncpy(typbuff, "IPV6_HOPOPTS", typlen);
|
||||||
|
strncpy(nambuff, "hopopts", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#ifdef IPV6_FLOWINFO
|
||||||
|
case IPV6_FLOWINFO:
|
||||||
|
strncpy(typbuff, "IPV6_FLOWINFO", typlen);
|
||||||
|
strncpy(nambuff, "flowinfo", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_TCLASS
|
||||||
|
case IPV6_TCLASS:
|
||||||
|
strncpy(typbuff, "IPV6_TCLASS", typlen);
|
||||||
|
strncpy(nambuff, "tclass", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
snprintf(typbuff, typlen, "IPV6.%u", cmsg->cmsg_type);
|
||||||
|
strncpy(nambuff, "data", namlen);
|
||||||
|
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
#endif /* defined(HAVE_STRUCT_CMSGHDR) && defined(CMSG_DATA) */
|
||||||
|
|
||||||
|
|
||||||
|
/* convert the IP6 socket address to human readable form. buff should be at
|
||||||
|
least 50 chars long. output includes the port number */
|
||||||
|
static char *inet6addr_info(const struct in6_addr *sa, char *buff, size_t blen) {
|
||||||
|
if (snprintf(buff, blen, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
|
||||||
|
#if HAVE_IP6_SOCKADDR==0
|
||||||
|
(sa->s6_addr[0]<<8)+sa->s6_addr[1],
|
||||||
|
(sa->s6_addr[2]<<8)+sa->s6_addr[3],
|
||||||
|
(sa->s6_addr[4]<<8)+sa->s6_addr[5],
|
||||||
|
(sa->s6_addr[6]<<8)+sa->s6_addr[7],
|
||||||
|
(sa->s6_addr[8]<<8)+sa->s6_addr[9],
|
||||||
|
(sa->s6_addr[10]<<8)+sa->s6_addr[11],
|
||||||
|
(sa->s6_addr[12]<<8)+sa->s6_addr[13],
|
||||||
|
(sa->s6_addr[14]<<8)+sa->s6_addr[15]
|
||||||
|
#elif HAVE_IP6_SOCKADDR==1
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr.u6_addr16)[7])
|
||||||
|
#elif HAVE_IP6_SOCKADDR==2
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->u6_addr16)[7])
|
||||||
|
#elif HAVE_IP6_SOCKADDR==3
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->in6_u.u6_addr16)[7])
|
||||||
|
#elif HAVE_IP6_SOCKADDR==4
|
||||||
|
(sa->_S6_un._S6_u8[0]<<8)|(sa->_S6_un._S6_u8[1]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[2]<<8)|(sa->_S6_un._S6_u8[3]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[4]<<8)|(sa->_S6_un._S6_u8[5]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[6]<<8)|(sa->_S6_un._S6_u8[7]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[8]<<8)|(sa->_S6_un._S6_u8[9]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[10]<<8)|(sa->_S6_un._S6_u8[11]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[12]<<8)|(sa->_S6_un._S6_u8[13]&0xff),
|
||||||
|
(sa->_S6_un._S6_u8[14]<<8)|(sa->_S6_un._S6_u8[15]&0xff)
|
||||||
|
#elif HAVE_IP6_SOCKADDR==5
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->__u6_addr.__u6_addr16)[7])
|
||||||
|
#endif
|
||||||
|
) < 0) {
|
||||||
|
Warn("sockaddr_inet6_info(): buffer too short");
|
||||||
|
buff[blen-1] = '\0';
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* returns information that can be used for constructing an environment
|
||||||
|
variable describing the socket address.
|
||||||
|
if idx is 0, this function writes "ADDR" into namebuff and the IP address
|
||||||
|
into valuebuff, and returns 1 (which means that one more info is there).
|
||||||
|
if idx is 1, it writes "PORT" into namebuff and the port number into
|
||||||
|
valuebuff, and returns 0 (no more info)
|
||||||
|
namelen and valuelen contain the max. allowed length of output chars in the
|
||||||
|
respective buffer.
|
||||||
|
on error this function returns -1.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xiosetsockaddrenv_ip6(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
|
struct sockaddr_in6 *sa, int ipproto) {
|
||||||
|
switch (idx) {
|
||||||
|
case 0:
|
||||||
|
strcpy(namebuff, "ADDR");
|
||||||
|
snprintf(valuebuff, valuelen, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
|
||||||
|
(sa->sin6_addr.s6_addr[0]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[1],
|
||||||
|
(sa->sin6_addr.s6_addr[2]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[3],
|
||||||
|
(sa->sin6_addr.s6_addr[4]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[5],
|
||||||
|
(sa->sin6_addr.s6_addr[6]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[7],
|
||||||
|
(sa->sin6_addr.s6_addr[8]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[9],
|
||||||
|
(sa->sin6_addr.s6_addr[10]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[11],
|
||||||
|
(sa->sin6_addr.s6_addr[12]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[13],
|
||||||
|
(sa->sin6_addr.s6_addr[14]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[15]);
|
||||||
|
switch (ipproto) {
|
||||||
|
case IPPROTO_TCP:
|
||||||
|
case IPPROTO_UDP:
|
||||||
|
#ifdef IPPROTO_SCTP
|
||||||
|
case IPPROTO_SCTP:
|
||||||
|
#endif
|
||||||
|
return 1; /* there is port information to also be retrieved */
|
||||||
|
default:
|
||||||
|
return 0; /* no port info coming */
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
strcpy(namebuff, "PORT");
|
||||||
|
snprintf(valuebuff, valuelen, "%u", ntohs(sa->sin6_port));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WITH_IP6 */
|
#endif /* WITH_IP6 */
|
||||||
|
|
35
xio-ip6.h
35
xio-ip6.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ip6.h */
|
/* source: xio-ip6.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_ip6_h_included
|
#ifndef __xio_ip6_h_included
|
||||||
|
@ -9,13 +9,40 @@
|
||||||
|
|
||||||
extern const struct optdesc opt_ipv6_v6only;
|
extern const struct optdesc opt_ipv6_v6only;
|
||||||
extern const struct optdesc opt_ipv6_join_group;
|
extern const struct optdesc opt_ipv6_join_group;
|
||||||
|
extern const struct optdesc opt_ipv6_pktinfo;
|
||||||
|
extern const struct optdesc opt_ipv6_recvpktinfo;
|
||||||
|
extern const struct optdesc opt_ipv6_rthdr;
|
||||||
|
extern const struct optdesc opt_ipv6_recvrthdr;
|
||||||
|
extern const struct optdesc opt_ipv6_authhdr;
|
||||||
|
extern const struct optdesc opt_ipv6_dstopts;
|
||||||
|
extern const struct optdesc opt_ipv6_recvdstopts;
|
||||||
|
extern const struct optdesc opt_ipv6_hopopts;
|
||||||
|
extern const struct optdesc opt_ipv6_unicast_hops;
|
||||||
|
extern const struct optdesc opt_ipv6_recvhopopts;
|
||||||
|
extern const struct optdesc opt_ipv6_flowinfo;
|
||||||
|
extern const struct optdesc opt_ipv6_hoplimit;
|
||||||
|
extern const struct optdesc opt_ipv6_recvhoplimit;
|
||||||
|
extern const struct optdesc opt_ipv6_recverr;
|
||||||
|
extern const struct optdesc opt_ipv6_tclass;
|
||||||
|
extern const struct optdesc opt_ipv6_recvtclass;
|
||||||
|
extern const struct optdesc opt_ipv6_recvpathmtu;
|
||||||
|
|
||||||
extern
|
extern
|
||||||
int xioparsenetwork_ip6(const char *rangename, struct xiorange_ip6 *range);
|
int xioparsenetwork_ip6(const char *rangename, struct xiorange *range);
|
||||||
extern int xiorange_ip6andmask(struct xiorange_ip6 *range);
|
extern int xiorange_ip6andmask(struct xiorange *range);
|
||||||
|
|
||||||
extern
|
extern
|
||||||
int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange_ip6 *range);
|
int xiocheckrange_ip6(struct sockaddr_in6 *pa, struct xiorange *range);
|
||||||
|
extern
|
||||||
|
int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
|
||||||
|
char *typbuff, int typlen,
|
||||||
|
char *nambuff, int namlen,
|
||||||
|
char *envbuff, int envlen,
|
||||||
|
char *valbuff, int vallen);
|
||||||
|
extern int
|
||||||
|
xiosetsockaddrenv_ip6(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
|
struct sockaddr_in6 *sa, int ipproto);
|
||||||
|
|
||||||
#endif /* WITH_IP6 */
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
|
54
xio-ipapp.c
54
xio-ipapp.c
|
@ -50,8 +50,8 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
if (_xioopen_ipapp_prepare(opts, &opts0, hostname, portname, &pf, ipproto,
|
if (_xioopen_ipapp_prepare(opts, &opts0, hostname, portname, &pf, ipproto,
|
||||||
xfd->para.socket.ip.res_opts[1],
|
xfd->para.socket.ip.res_opts[1],
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
them, &themlen, us, &uslen, &needbind, &lowport,
|
them, &themlen, us, &uslen, &needbind, &lowport,
|
||||||
&socktype) != STAT_OK) {
|
socktype) != STAT_OK) {
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,31 +102,27 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
while ((pid = Fork()) < 0) {
|
int level = E_ERROR;
|
||||||
int level = E_ERROR;
|
if (xfd->forever || xfd->retry) {
|
||||||
if (xfd->forever || --xfd->retry) {
|
level = E_WARN; /* most users won't expect a problem here,
|
||||||
level = E_WARN; /* most users won't expect a problem here,
|
|
||||||
so Notice is too weak */
|
so Notice is too weak */
|
||||||
}
|
}
|
||||||
Msg1(level, "fork(): %s", strerror(errno));
|
while ((pid = xio_fork(false, level)) < 0) {
|
||||||
if (xfd->forever || xfd->retry) {
|
if (xfd->forever || --xfd->retry) {
|
||||||
dropopts(opts, PH_ALL); opts = copyopts(opts0, GROUP_ALL);
|
|
||||||
Nanosleep(&xfd->intervall, NULL); continue;
|
Nanosleep(&xfd->intervall, NULL); continue;
|
||||||
}
|
}
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child process */
|
|
||||||
Info1("just born: TCP client process "F_pid, Getpid());
|
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
if (pid == 0) { /* child process */
|
||||||
if (xio_forked_inchild() != 0) {
|
xfd->forever = false; xfd->retry = 0;
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent process */
|
/* parent process */
|
||||||
Notice1("forked off child process "F_pid, pid);
|
Notice1("forked off child process "F_pid, pid);
|
||||||
Close(xfd->fd1);
|
Close(xfd->fd1);
|
||||||
|
|
||||||
/* with and without retry */
|
/* with and without retry */
|
||||||
Nanosleep(&xfd->intervall, NULL);
|
Nanosleep(&xfd->intervall, NULL);
|
||||||
dropopts(opts, PH_ALL); opts = copyopts(opts0, GROUP_ALL);
|
dropopts(opts, PH_ALL); opts = copyopts(opts0, GROUP_ALL);
|
||||||
|
@ -137,6 +133,7 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
|
/* only "active" process breaks (master without fork, or child) */
|
||||||
|
|
||||||
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -145,7 +142,11 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* returns STAT_OK on success or some other value on failure */
|
/* returns STAT_OK on success or some other value on failure
|
||||||
|
applies and consumes the following options:
|
||||||
|
PH_EARLY
|
||||||
|
OPT_PROTOCOL_FAMILY, OPT_BIND, OPT_SOURCEPORT, OPT_LOWPORT
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
_xioopen_ipapp_prepare(struct opt *opts, struct opt **opts0,
|
_xioopen_ipapp_prepare(struct opt *opts, struct opt **opts0,
|
||||||
const char *hostname,
|
const char *hostname,
|
||||||
|
@ -156,7 +157,7 @@ int
|
||||||
union sockaddr_union *them, socklen_t *themlen,
|
union sockaddr_union *them, socklen_t *themlen,
|
||||||
union sockaddr_union *us, socklen_t *uslen,
|
union sockaddr_union *us, socklen_t *uslen,
|
||||||
bool *needbind, bool *lowport,
|
bool *needbind, bool *lowport,
|
||||||
int *socktype) {
|
int socktype) {
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char infobuff[256];
|
char infobuff[256];
|
||||||
int result;
|
int result;
|
||||||
|
@ -165,7 +166,7 @@ int
|
||||||
|
|
||||||
if ((result =
|
if ((result =
|
||||||
xiogetaddrinfo(hostname, portname,
|
xiogetaddrinfo(hostname, portname,
|
||||||
*pf, *socktype, protocol,
|
*pf, socktype, protocol,
|
||||||
(union sockaddr_union *)them, themlen,
|
(union sockaddr_union *)them, themlen,
|
||||||
res_opts0, res_opts1
|
res_opts0, res_opts1
|
||||||
))
|
))
|
||||||
|
@ -179,7 +180,7 @@ int
|
||||||
applyopts(-1, opts, PH_EARLY);
|
applyopts(-1, opts, PH_EARLY);
|
||||||
|
|
||||||
/* 3 means: IP address AND port accepted */
|
/* 3 means: IP address AND port accepted */
|
||||||
if (retropt_bind(opts, *pf, *socktype, protocol, (struct sockaddr *)us, uslen, 3,
|
if (retropt_bind(opts, *pf, socktype, protocol, (struct sockaddr *)us, uslen, 3,
|
||||||
res_opts0, res_opts1)
|
res_opts0, res_opts1)
|
||||||
!= STAT_NOACTION) {
|
!= STAT_NOACTION) {
|
||||||
*needbind = true;
|
*needbind = true;
|
||||||
|
@ -208,7 +209,6 @@ int
|
||||||
}
|
}
|
||||||
|
|
||||||
retropt_bool(opts, OPT_LOWPORT, lowport);
|
retropt_bool(opts, OPT_LOWPORT, lowport);
|
||||||
retropt_int(opts, OPT_SO_TYPE, socktype);
|
|
||||||
|
|
||||||
*opts0 = copyopts(opts, GROUP_ALL);
|
*opts0 = copyopts(opts, GROUP_ALL);
|
||||||
|
|
||||||
|
@ -220,22 +220,24 @@ int
|
||||||
|
|
||||||
|
|
||||||
#if _WITH_TCP && WITH_LISTEN
|
#if _WITH_TCP && WITH_LISTEN
|
||||||
|
/*
|
||||||
|
applies and consumes the following options:
|
||||||
|
OPT_PROTOCOL_FAMILY, OPT_BIND
|
||||||
|
*/
|
||||||
int _xioopen_ipapp_listen_prepare(struct opt *opts, struct opt **opts0,
|
int _xioopen_ipapp_listen_prepare(struct opt *opts, struct opt **opts0,
|
||||||
const char *portname, int *pf, int ipproto,
|
const char *portname, int *pf, int ipproto,
|
||||||
unsigned long res_opts0,
|
unsigned long res_opts0,
|
||||||
unsigned long res_opts1,
|
unsigned long res_opts1,
|
||||||
union sockaddr_union *us, socklen_t *uslen,
|
union sockaddr_union *us, socklen_t *uslen,
|
||||||
int *socktype) {
|
int socktype) {
|
||||||
char *bindname = NULL;
|
char *bindname = NULL;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, socktype);
|
|
||||||
|
|
||||||
retropt_socket_pf(opts, pf);
|
retropt_socket_pf(opts, pf);
|
||||||
|
|
||||||
retropt_string(opts, OPT_BIND, &bindname);
|
retropt_string(opts, OPT_BIND, &bindname);
|
||||||
if ((result =
|
if ((result =
|
||||||
xiogetaddrinfo(bindname, portname, *pf, *socktype, ipproto,
|
xiogetaddrinfo(bindname, portname, *pf, socktype, ipproto,
|
||||||
(union sockaddr_union *)us, uslen,
|
(union sockaddr_union *)us, uslen,
|
||||||
res_opts0, res_opts1))
|
res_opts0, res_opts1))
|
||||||
!= STAT_OK) {
|
!= STAT_OK) {
|
||||||
|
@ -283,7 +285,7 @@ int xioopen_ipapp_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
if (_xioopen_ipapp_listen_prepare(opts, &opts0, argv[1], &pf, ipproto,
|
if (_xioopen_ipapp_listen_prepare(opts, &opts0, argv[1], &pf, ipproto,
|
||||||
fd->stream.para.socket.ip.res_opts[1],
|
fd->stream.para.socket.ip.res_opts[1],
|
||||||
fd->stream.para.socket.ip.res_opts[0],
|
fd->stream.para.socket.ip.res_opts[0],
|
||||||
us, &uslen, &socktype)
|
us, &uslen, socktype)
|
||||||
!= STAT_OK) {
|
!= STAT_OK) {
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-ipapp.h */
|
/* source: xio-ipapp.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2006 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_ipapp_h_included
|
#ifndef __xio_ipapp_h_included
|
||||||
|
@ -25,7 +25,7 @@ extern int
|
||||||
union sockaddr_union *them, socklen_t *themlen,
|
union sockaddr_union *them, socklen_t *themlen,
|
||||||
union sockaddr_union *us, socklen_t *uslen,
|
union sockaddr_union *us, socklen_t *uslen,
|
||||||
bool *needbind, bool *lowport,
|
bool *needbind, bool *lowport,
|
||||||
int *socktype);
|
int socktype);
|
||||||
extern int _xioopen_ip4app_connect(const char *hostname, const char *portname,
|
extern int _xioopen_ip4app_connect(const char *hostname, const char *portname,
|
||||||
struct single *xfd,
|
struct single *xfd,
|
||||||
int socktype, int ipproto, void *protname,
|
int socktype, int ipproto, void *protname,
|
||||||
|
@ -39,7 +39,7 @@ extern int _xioopen_ipapp_listen_prepare(struct opt *opts, struct opt **opts0,
|
||||||
unsigned long res_opts0,
|
unsigned long res_opts0,
|
||||||
unsigned long res_opts1,
|
unsigned long res_opts1,
|
||||||
union sockaddr_union *us, socklen_t *uslen,
|
union sockaddr_union *us, socklen_t *uslen,
|
||||||
int *socktype);
|
int socktype);
|
||||||
extern int xioopen_ip6app_connect(int argc, const char *argv[], struct opt *opts,
|
extern int xioopen_ip6app_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
int rw, xiofile_t *fd,
|
int rw, xiofile_t *fd,
|
||||||
unsigned groups, int socktype, int ipproto,
|
unsigned groups, int socktype, int ipproto,
|
||||||
|
|
85
xio-listen.c
85
xio-listen.c
|
@ -25,6 +25,13 @@ const struct optdesc opt_range = { "range", NULL, OPT_RANGE, GROUP_R
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
applies and consumes the following option:
|
||||||
|
PH_INIT, PH_PASTSOCKET, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_EARLY,
|
||||||
|
PH_PREOPEN, PH_FD, PH_CONNECTED, PH_LATE, PH_LATE2
|
||||||
|
OPT_FORK, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_BACKLOG, OPT_RANGE, tcpwrap,
|
||||||
|
OPT_SOURCEPORT, OPT_LOWPORT, cloexec
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
xioopen_listen(struct single *xfd, int xioflags,
|
xioopen_listen(struct single *xfd, int xioflags,
|
||||||
struct sockaddr *us, socklen_t uslen,
|
struct sockaddr *us, socklen_t uslen,
|
||||||
|
@ -81,15 +88,24 @@ int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* waits for incoming connection, checks its source address and port. Depending
|
/* creates the listening socket, bind, applies options; waits for incoming
|
||||||
on fork option, it may fork a subprocess.
|
connection, checks its source address and port. Depending on fork option, it
|
||||||
|
may fork a subprocess.
|
||||||
|
pf specifies the syntax expected for range option. In the case of generic
|
||||||
|
socket it is 0 (expecting raw binary data), and the real pf can be obtained
|
||||||
|
from us->af_family; for other socket types pf == us->af_family
|
||||||
Returns 0 if a connection was accepted; with fork option, this is always in
|
Returns 0 if a connection was accepted; with fork option, this is always in
|
||||||
a subprocess!
|
a subprocess!
|
||||||
Other return values indicate a problem; this can happen in the master
|
Other return values indicate a problem; this can happen in the master
|
||||||
process or in a subprocess.
|
process or in a subprocess.
|
||||||
This function does not retry. If you need retries, handle this is a
|
This function does not retry. If you need retries, handle this in a
|
||||||
loop in the calling function.
|
loop in the calling function (and always provide the options...)
|
||||||
after fork, we set the forever/retry of the child process to 0
|
After fork, we set the forever/retry of the child process to 0
|
||||||
|
applies and consumes the following option:
|
||||||
|
PH_INIT, PH_PASTSOCKET, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_EARLY,
|
||||||
|
PH_PREOPEN, PH_FD, PH_CONNECTED, PH_LATE, PH_LATE2
|
||||||
|
OPT_FORK, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_BACKLOG, OPT_RANGE, tcpwrap,
|
||||||
|
OPT_SOURCEPORT, OPT_LOWPORT, cloexec
|
||||||
*/
|
*/
|
||||||
int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, socklen_t uslen,
|
int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, socklen_t uslen,
|
||||||
struct opt *opts, int pf, int socktype, int proto, int level) {
|
struct opt *opts, int pf, int socktype, int proto, int level) {
|
||||||
|
@ -98,9 +114,14 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
int backlog = 5; /* why? 1 seems to cause problems under some load */
|
int backlog = 5; /* why? 1 seems to cause problems under some load */
|
||||||
char *rangename;
|
char *rangename;
|
||||||
bool dofork = false;
|
bool dofork = false;
|
||||||
pid_t pid; /* mostly int; only used with fork */
|
|
||||||
char infobuff[256];
|
char infobuff[256];
|
||||||
char lisname[256];
|
char lisname[256];
|
||||||
|
union sockaddr_union _peername;
|
||||||
|
union sockaddr_union _sockname;
|
||||||
|
union sockaddr_union *pa = &_peername; /* peer address */
|
||||||
|
union sockaddr_union *la = &_sockname; /* local address */
|
||||||
|
socklen_t pas = sizeof(_peername); /* peer address size */
|
||||||
|
socklen_t las = sizeof(_sockname); /* local address size */
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
retropt_bool(opts, OPT_FORK, &dofork);
|
retropt_bool(opts, OPT_FORK, &dofork);
|
||||||
|
@ -119,9 +140,7 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
xiosetchilddied(); /* set SIGCHLD handler */
|
xiosetchilddied(); /* set SIGCHLD handler */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xfd->fd1 = Socket(pf, socktype, proto)) < 0) {
|
if ((xfd->fd1 = xiosocket(opts, us->sa_family, socktype, proto, level)) < 0) {
|
||||||
Msg4(level,
|
|
||||||
"socket(%d, %d, %d): %s", pf, socktype, proto, strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
xfd->fdtype = FDTYPE_SINGLE;
|
xfd->fdtype = FDTYPE_SINGLE;
|
||||||
|
@ -170,7 +189,8 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
|
|
||||||
#if WITH_IP4 /*|| WITH_IP6*/
|
#if WITH_IP4 /*|| WITH_IP6*/
|
||||||
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
||||||
if (parserange(rangename, us->sa_family, &xfd->para.socket.range) < 0) {
|
if (xioparserange(rangename, pf, &xfd->para.socket.range)
|
||||||
|
< 0) {
|
||||||
free(rangename);
|
free(rangename);
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
@ -190,6 +210,12 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
retropt_bool(opts, OPT_LOWPORT, &xfd->para.socket.ip.lowport);
|
retropt_bool(opts, OPT_LOWPORT, &xfd->para.socket.ip.lowport);
|
||||||
#endif /* WITH_TCP || WITH_UDP */
|
#endif /* WITH_TCP || WITH_UDP */
|
||||||
|
|
||||||
|
retropt_int(opts, OPT_BACKLOG, &backlog);
|
||||||
|
if (Listen(xfd->fd1, backlog) < 0) {
|
||||||
|
Error3("listen(%d, %d): %s", xfd->fd1, backlog, strerror(errno));
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioopts.logopt == 'm') {
|
||||||
Info("starting accept loop, switching to syslog");
|
Info("starting accept loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
||||||
|
@ -200,12 +226,6 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
char peername[256];
|
char peername[256];
|
||||||
char sockname[256];
|
char sockname[256];
|
||||||
int ps; /* peer socket */
|
int ps; /* peer socket */
|
||||||
union sockaddr_union _peername;
|
|
||||||
union sockaddr_union _sockname;
|
|
||||||
union sockaddr_union *pa = &_peername; /* peer address */
|
|
||||||
union sockaddr_union *la = &_sockname; /* local address */
|
|
||||||
socklen_t pas = sizeof(_peername); /* peer address size */
|
|
||||||
socklen_t las = sizeof(_sockname); /* local address size */
|
|
||||||
salen = sizeof(struct sockaddr);
|
salen = sizeof(struct sockaddr);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -233,16 +253,18 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
if (Getpeername(ps, &pa->soa, &pas) < 0) {
|
if (Getpeername(ps, &pa->soa, &pas) < 0) {
|
||||||
Warn4("getpeername(%d, %p, {"F_socklen"}): %s",
|
Warn4("getpeername(%d, %p, {"F_socklen"}): %s",
|
||||||
ps, pa, pas, strerror(errno));
|
ps, pa, pas, strerror(errno));
|
||||||
|
pa = NULL;
|
||||||
}
|
}
|
||||||
if (Getsockname(ps, &la->soa, &las) < 0) {
|
if (Getsockname(ps, &la->soa, &las) < 0) {
|
||||||
Warn4("getsockname(%d, %p, {"F_socklen"}): %s",
|
Warn4("getsockname(%d, %p, {"F_socklen"}): %s",
|
||||||
ps, pa, pas, strerror(errno));
|
ps, la, las, strerror(errno));
|
||||||
|
la = NULL;
|
||||||
}
|
}
|
||||||
Notice2("accepting connection from %s on %s",
|
Notice2("accepting connection from %s on %s",
|
||||||
sockaddr_info(&pa->soa, pas, peername, sizeof(peername)),
|
sockaddr_info(pa?&pa->soa:NULL, pas, peername, sizeof(peername)),
|
||||||
sockaddr_info(&la->soa, las, sockname, sizeof(sockname)));
|
sockaddr_info(pa?&la->soa:NULL, las, sockname, sizeof(sockname)));
|
||||||
|
|
||||||
if (xiocheckpeer(xfd, pa, la) < 0) {
|
if (pa != NULL && la != NULL && xiocheckpeer(xfd, pa, la) < 0) {
|
||||||
if (Shutdown(ps, 2) < 0) {
|
if (Shutdown(ps, 2) < 0) {
|
||||||
Info2("shutdown(%d, 2): %s", ps, strerror(errno));
|
Info2("shutdown(%d, 2): %s", ps, strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -254,16 +276,20 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
infobuff, sizeof(infobuff)));
|
infobuff, sizeof(infobuff)));
|
||||||
|
|
||||||
applyopts(xfd->fd1, opts, PH_FD);
|
applyopts(xfd->fd1, opts, PH_FD);
|
||||||
|
|
||||||
applyopts(xfd->fd1, opts, PH_CONNECTED);
|
applyopts(xfd->fd1, opts, PH_CONNECTED);
|
||||||
|
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
if ((pid = Fork()) < 0) {
|
pid_t pid; /* mostly int; only used with fork */
|
||||||
Msg1(level, "fork(): %s", strerror(errno));
|
if ((pid = xio_fork(false, level==E_ERROR?level:E_WARN)) < 0) {
|
||||||
Close(xfd->fd1);
|
Close(xfd->fd1);
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child */
|
if (pid == 0) { /* child */
|
||||||
|
pid_t cpid = Getpid();
|
||||||
|
|
||||||
|
Info1("just born: client process "F_pid, cpid);
|
||||||
|
xiosetenvulong("PID", cpid, 1);
|
||||||
|
|
||||||
if (Close(xfd->fd1) < 0) {
|
if (Close(xfd->fd1) < 0) {
|
||||||
Info2("close(%d): %s", xfd->fd1, strerror(errno));
|
Info2("close(%d): %s", xfd->fd1, strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -271,16 +297,10 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
|
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
/* !? */
|
/* !? */
|
||||||
xfd->retry = 0;
|
xfd->forever = false; xfd->retry = 0;
|
||||||
xfd->forever = 0;
|
|
||||||
level = E_ERROR;
|
level = E_ERROR;
|
||||||
#endif /* WITH_RETRY */
|
#endif /* WITH_RETRY */
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
|
||||||
if (xio_forked_inchild() != 0) {
|
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
/* with UNIX sockets: only listening parent is allowed to remove
|
/* with UNIX sockets: only listening parent is allowed to remove
|
||||||
the socket file */
|
the socket file */
|
||||||
|
@ -296,7 +316,6 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
if (Close(ps) < 0) {
|
if (Close(ps) < 0) {
|
||||||
Info2("close(%d): %s", ps, strerror(errno));
|
Info2("close(%d): %s", ps, strerror(errno));
|
||||||
}
|
}
|
||||||
Notice1("forked off child process "F_pid, pid);
|
|
||||||
Info("still listening");
|
Info("still listening");
|
||||||
} else {
|
} else {
|
||||||
if (Close(xfd->fd1) < 0) {
|
if (Close(xfd->fd1) < 0) {
|
||||||
|
@ -309,6 +328,10 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
if ((result = _xio_openlate(xfd, opts)) < 0)
|
if ((result = _xio_openlate(xfd, opts)) < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* set the env vars describing the local and remote sockets */
|
||||||
|
xiosetsockaddrenv("SOCK", la, las, proto);
|
||||||
|
xiosetsockaddrenv("PEER", pa, pas, proto);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: xio-socks.c,v 1.25 2006/02/08 19:46:59 gerhard Exp $ */
|
/* source: xio-nop.c */
|
||||||
/* Copyright Gerhard Rieger 2006-2007 */
|
/* Copyright Gerhard Rieger 2006-2007 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ static int
|
||||||
xfd->para.socket.ip.res_opts[1],
|
xfd->para.socket.ip.res_opts[1],
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
them, &themlen, us, &uslen,
|
them, &themlen, us, &uslen,
|
||||||
&needbind, &lowport, &socktype);
|
&needbind, &lowport, socktype);
|
||||||
if (result != STAT_OK) return STAT_NORETRY;
|
if (result != STAT_OK) return STAT_NORETRY;
|
||||||
} else if (argc = 1) {
|
} else if (argc = 1) {
|
||||||
|
|
||||||
|
@ -291,7 +291,6 @@ static int
|
||||||
applyopts(-1, opts, PH_INIT);
|
applyopts(-1, opts, PH_INIT);
|
||||||
|
|
||||||
retropt_bool(opts, OPT_FORK, &dofork);
|
retropt_bool(opts, OPT_FORK, &dofork);
|
||||||
|
|
||||||
retropt_string(opts, OPT_OPENSSL_CERTIFICATE, &opt_cert);
|
retropt_string(opts, OPT_OPENSSL_CERTIFICATE, &opt_cert);
|
||||||
|
|
||||||
result =
|
result =
|
||||||
|
@ -384,30 +383,22 @@ static int
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
while ((pid = Fork()) < 0) {
|
int level = E_ERROR;
|
||||||
int level = E_ERROR;
|
if (xfd->forever || xfd->retry) {
|
||||||
if (xfd->forever || xfd->retry) {
|
level = E_WARN;
|
||||||
level = E_WARN;
|
}
|
||||||
}
|
while ((pid = xio_fork(false, level)) < 0) {
|
||||||
Msg1(level, "fork(): %s", strerror(errno));
|
if (xfd->forever || --xfd->retry) {
|
||||||
if (xfd->forever || xfd->retry) {
|
Nanosleep(&xfd->intervall, NULL); continue;
|
||||||
Nanosleep(&xfd->intervall, NULL);
|
|
||||||
--xfd->retry;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child process */
|
|
||||||
Info1("just born: OpenSSL client process "F_pid, Getpid());
|
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
if (pid == 0) { /* child process */
|
||||||
if (xio_forked_inchild() != 0) {
|
xfd->forever = false; xfd->retry = 0;
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
xfd->forever = false;
|
|
||||||
xfd->retry = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent process */
|
/* parent process */
|
||||||
Notice1("forked off child process "F_pid, pid);
|
Notice1("forked off child process "F_pid, pid);
|
||||||
Close(xfd->fd1);
|
Close(xfd->fd1);
|
||||||
|
@ -545,7 +536,7 @@ static int
|
||||||
if (_xioopen_ipapp_listen_prepare(opts, &opts0, portname, &pf, ipproto,
|
if (_xioopen_ipapp_listen_prepare(opts, &opts0, portname, &pf, ipproto,
|
||||||
xfd->para.socket.ip.res_opts[1],
|
xfd->para.socket.ip.res_opts[1],
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
us, &uslen, &socktype)
|
us, &uslen, socktype)
|
||||||
!= STAT_OK) {
|
!= STAT_OK) {
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
124
xio-progcall.c
124
xio-progcall.c
|
@ -11,6 +11,9 @@
|
||||||
#include "xio-process.h"
|
#include "xio-process.h"
|
||||||
#include "xio-progcall.h"
|
#include "xio-progcall.h"
|
||||||
|
|
||||||
|
#include "xio-socket.h"
|
||||||
|
|
||||||
|
|
||||||
/* these options are used by address pty too */
|
/* these options are used by address pty too */
|
||||||
#if HAVE_OPENPTY
|
#if HAVE_OPENPTY
|
||||||
const struct optdesc opt_openpty = { "openpty", NULL, OPT_OPENPTY, GROUP_PTY, PH_BIGEN, TYPE_BOOL, OFUNC_SPEC };
|
const struct optdesc opt_openpty = { "openpty", NULL, OPT_OPENPTY, GROUP_PTY, PH_BIGEN, TYPE_BOOL, OFUNC_SPEC };
|
||||||
|
@ -37,6 +40,8 @@ const struct optdesc opt_sigint = { "sigint", NULL, OPT_SIGINT, GROUP_P
|
||||||
const struct optdesc opt_sigquit = { "sigquit", NULL, OPT_SIGQUIT, GROUP_PARENT, PH_LATE, TYPE_CONST, OFUNC_SIGNAL, SIGQUIT };
|
const struct optdesc opt_sigquit = { "sigquit", NULL, OPT_SIGQUIT, GROUP_PARENT, PH_LATE, TYPE_CONST, OFUNC_SIGNAL, SIGQUIT };
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
/* fork for exec/system, but return before exec'ing.
|
/* fork for exec/system, but return before exec'ing.
|
||||||
return=0: is child process
|
return=0: is child process
|
||||||
return>0: is parent process
|
return>0: is parent process
|
||||||
|
@ -45,11 +50,12 @@ const struct optdesc opt_sigquit = { "sigquit", NULL, OPT_SIGQUIT, GROUP_P
|
||||||
int _xioopen_foxec_int(int xioflags, /* XIO_RDONLY etc. */
|
int _xioopen_foxec_int(int xioflags, /* XIO_RDONLY etc. */
|
||||||
struct single *fd,
|
struct single *fd,
|
||||||
unsigned groups,
|
unsigned groups,
|
||||||
struct opt **copts /* in: opts; out: opts for child */
|
struct opt **copts, /* in: opts; out: opts for child */
|
||||||
|
int *duptostderr /* out: redirect stderr to output fd */
|
||||||
) {
|
) {
|
||||||
struct opt *popts; /* parent process options */
|
struct opt *popts; /* parent process options */
|
||||||
int numleft;
|
int numleft;
|
||||||
int d, type, protocol, sv[2], rdpip[2], wrpip[2];
|
int d, sv[2], rdpip[2], wrpip[2];
|
||||||
int rw = (xioflags & XIO_ACCMODE);
|
int rw = (xioflags & XIO_ACCMODE);
|
||||||
bool usepipes = false;
|
bool usepipes = false;
|
||||||
#if HAVE_PTY
|
#if HAVE_PTY
|
||||||
|
@ -399,13 +405,14 @@ int _xioopen_foxec_int(int xioflags, /* XIO_RDONLY etc. */
|
||||||
applyopts(fd->fd1, popts, PH_LATE);
|
applyopts(fd->fd1, popts, PH_LATE);
|
||||||
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
||||||
} else {
|
} else {
|
||||||
d = AF_UNIX; type = SOCK_STREAM;
|
int socktype = SOCK_STREAM;
|
||||||
protocol = 0; /* PF_UNIX does not work on AIX */
|
int protocol = 0;
|
||||||
retropt_int(popts, OPT_SO_TYPE, &type);
|
d = AF_UNIX;
|
||||||
result = Socketpair(d, type, protocol, sv);
|
retropt_int(popts, OPT_SO_TYPE, &socktype);
|
||||||
|
result = Socketpair(d, socktype, protocol, sv);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
Error5("socketpair(%d, %d, %d, %p): %s",
|
Error5("socketpair(%d, %d, %d, %p): %s",
|
||||||
d, type, protocol, sv, strerror(errno));
|
d, socktype, protocol, sv, strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
/*0 Info5("socketpair(%d, %d, %d, {%d,%d})",
|
/*0 Info5("socketpair(%d, %d, %d, {%d,%d})",
|
||||||
|
@ -672,6 +679,8 @@ int _xioopen_foxec_int(int xioflags, /* XIO_RDONLY etc. */
|
||||||
return pid; /* indicate parent (main) process */
|
return pid; /* indicate parent (main) process */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
|
||||||
/* fork for exec/system, but return before exec'ing.
|
/* fork for exec/system, but return before exec'ing.
|
||||||
return=0: is child process
|
return=0: is child process
|
||||||
|
@ -681,11 +690,12 @@ int _xioopen_foxec_int(int xioflags, /* XIO_RDONLY etc. */
|
||||||
int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
struct single *fd,
|
struct single *fd,
|
||||||
unsigned groups,
|
unsigned groups,
|
||||||
struct opt **copts /* in: opts; out: opts for child */
|
struct opt **copts, /* in: opts; out: opts for child */
|
||||||
|
int *duptostderr
|
||||||
) {
|
) {
|
||||||
struct opt *popts; /* parent process options */
|
struct opt *popts; /* parent process options */
|
||||||
int numleft;
|
int numleft;
|
||||||
int d, type, protocol, sv[2], rdpip[2], wrpip[2];
|
int sv[2], rdpip[2], wrpip[2];
|
||||||
int rw = (xioflags & XIO_ACCMODE);
|
int rw = (xioflags & XIO_ACCMODE);
|
||||||
bool usepipes = false;
|
bool usepipes = false;
|
||||||
#if HAVE_PTY
|
#if HAVE_PTY
|
||||||
|
@ -919,7 +929,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
}
|
}
|
||||||
if (tn == NULL) {
|
if (tn == NULL) {
|
||||||
Error("could not open pty");
|
Error("could not open pty");
|
||||||
return STAT_NORETRY;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Info1("opened pseudo terminal %s", tn);
|
Info1("opened pseudo terminal %s", tn);
|
||||||
|
@ -938,7 +948,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
#endif /* HAVE_OPENPTY */
|
#endif /* HAVE_OPENPTY */
|
||||||
free(*copts);
|
free(*copts);
|
||||||
if ((*copts = moveopts(popts, GROUP_TERMIOS|GROUP_FORK|GROUP_EXEC|GROUP_PROCESS)) == NULL) {
|
if ((*copts = moveopts(popts, GROUP_TERMIOS|GROUP_FORK|GROUP_EXEC|GROUP_PROCESS)) == NULL) {
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
applyopts_cloexec(ptyfd, popts);/*!*/
|
applyopts_cloexec(ptyfd, popts);/*!*/
|
||||||
|
|
||||||
|
@ -978,7 +988,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_WRONLY) {
|
if (rw != XIO_WRONLY) {
|
||||||
if (Pipe(rdpip) < 0) {
|
if (Pipe(rdpip) < 0) {
|
||||||
Error2("pipe(%p): %s", rdpip, strerror(errno));
|
Error2("pipe(%p): %s", rdpip, strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*0 Info2("pipe({%d,%d})", rdpip[0], rdpip[1]);*/
|
/*0 Info2("pipe({%d,%d})", rdpip[0], rdpip[1]);*/
|
||||||
|
@ -986,7 +996,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
free(*copts);
|
free(*copts);
|
||||||
if ((*copts = moveopts(popts, GROUP_FORK|GROUP_EXEC|GROUP_PROCESS))
|
if ((*copts = moveopts(popts, GROUP_FORK|GROUP_EXEC|GROUP_PROCESS))
|
||||||
== NULL) {
|
== NULL) {
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
popts2 = copyopts(popts, GROUP_ALL);
|
popts2 = copyopts(popts, GROUP_ALL);
|
||||||
|
@ -1001,7 +1011,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_RDONLY) {
|
if (rw != XIO_RDONLY) {
|
||||||
if (Pipe(wrpip) < 0) {
|
if (Pipe(wrpip) < 0) {
|
||||||
Error2("pipe(%p): %s", wrpip, strerror(errno));
|
Error2("pipe(%p): %s", wrpip, strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*0 Info2("pipe({%d,%d})", wrpip[0], wrpip[1]);*/
|
/*0 Info2("pipe({%d,%d})", wrpip[0], wrpip[1]);*/
|
||||||
|
@ -1033,20 +1043,17 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
applyopts(fd->fd1, popts, PH_LATE);
|
applyopts(fd->fd1, popts, PH_LATE);
|
||||||
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
||||||
} else {
|
} else {
|
||||||
d = AF_UNIX; type = SOCK_STREAM;
|
int pf = AF_UNIX;
|
||||||
protocol = 0; /* PF_UNIX does not work on AIX */
|
retropt_int(popts, OPT_PROTOCOL_FAMILY, &pf);
|
||||||
retropt_int(popts, OPT_SO_TYPE, &type);
|
result = xiosocketpair(popts, pf, SOCK_STREAM, 0, sv);
|
||||||
result = Socketpair(d, type, protocol, sv);
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
Error5("socketpair(%d, %d, %d, %p): %s",
|
return -1;
|
||||||
d, type, protocol, sv, strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
|
||||||
}
|
}
|
||||||
/*0 Info5("socketpair(%d, %d, %d, {%d,%d})",
|
/*0 Info5("socketpair(%d, %d, %d, {%d,%d})",
|
||||||
d, type, protocol, sv[0], sv[1]);*/
|
d, type, protocol, sv[0], sv[1]);*/
|
||||||
free(*copts);
|
free(*copts);
|
||||||
if ((*copts = moveopts(popts, GROUP_FORK|GROUP_EXEC|GROUP_PROCESS)) == NULL) {
|
if ((*copts = moveopts(popts, GROUP_FORK|GROUP_EXEC|GROUP_PROCESS)) == NULL) {
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
applyopts(sv[0], *copts, PH_PASTSOCKET);
|
applyopts(sv[0], *copts, PH_PASTSOCKET);
|
||||||
applyopts(sv[1], popts, PH_PASTSOCKET);
|
applyopts(sv[1], popts, PH_PASTSOCKET);
|
||||||
|
@ -1077,37 +1084,30 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
if (applyopts_single(fd, popts, PH_LATE) < 0) return -1;
|
||||||
}
|
}
|
||||||
/*0 if ((optpr = copyopts(*copts, GROUP_PROCESS)) == NULL)
|
/*0 if ((optpr = copyopts(*copts, GROUP_PROCESS)) == NULL)
|
||||||
return STAT_RETRYLATER;*/
|
return -1;*/
|
||||||
retropt_bool(*copts, OPT_STDERR, &withstderr);
|
retropt_bool(*copts, OPT_STDERR, &withstderr);
|
||||||
|
|
||||||
xiosetchilddied(); /* set SIGCHLD handler */
|
xiosetchilddied(); /* set SIGCHLD handler */
|
||||||
|
|
||||||
|
xiosetchilddied(); /* set SIGCHLD handler */
|
||||||
|
|
||||||
if (withfork) {
|
if (withfork) {
|
||||||
const char *forkwaitstring;
|
|
||||||
int forkwaitsecs = 0;
|
|
||||||
sigset_t set, oldset;
|
sigset_t set, oldset;
|
||||||
|
|
||||||
sigemptyset(&set);
|
sigemptyset(&set);
|
||||||
sigaddset(&set, SIGCHLD);
|
sigaddset(&set, SIGCHLD);
|
||||||
|
|
||||||
Sigprocmask(SIG_BLOCK, &set, &oldset); /* disable SIGCHLD */
|
Sigprocmask(SIG_BLOCK, &set, &oldset); /* disable SIGCHLD */
|
||||||
|
pid = xio_fork(true, E_ERROR);
|
||||||
pid = Fork();
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
Sigprocmask(SIG_SETMASK, &oldset, NULL);
|
Sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
Error1("fork(): %s", strerror(errno));
|
Error1("fork(): %s", strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
|
||||||
/* gdb recommends to have env controlled sleep after fork */
|
|
||||||
if (forkwaitstring = getenv("SOCAT_FORK_WAIT")) {
|
|
||||||
forkwaitsecs = atoi(forkwaitstring);
|
|
||||||
Sleep(forkwaitsecs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
/* for parent (this is our socat process) */
|
/* for parent (this is our socat process) */
|
||||||
xiosigchld_register(pid, xiosigaction_child, fd);
|
xiosigchld_register(pid, xiosigaction_child, fd);
|
||||||
Sigprocmask(SIG_SETMASK, &oldset, NULL); /* disable SIGCHLD */
|
Sigprocmask(SIG_SETMASK, &oldset, NULL); /* enable SIGCHLD */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) { /* child */
|
if (pid == 0) { /* child */
|
||||||
|
@ -1115,7 +1115,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (xio_forked_inchild() != 0) {
|
if (xio_forked_inchild() != 0) {
|
||||||
Exit(1);
|
Exit(1);
|
||||||
}
|
}
|
||||||
Sigprocmask(SIG_SETMASK, &oldset, NULL); /* disable SIGCHLD */
|
Sigprocmask(SIG_SETMASK, &oldset, NULL); /* enable SIGCHLD */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!withfork || pid == 0) { /* child */
|
if (!withfork || pid == 0) { /* child */
|
||||||
|
@ -1132,13 +1132,13 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_RDONLY && fdi != ttyfd) {
|
if (rw != XIO_RDONLY && fdi != ttyfd) {
|
||||||
if (Dup2(ttyfd, fdi) < 0) {
|
if (Dup2(ttyfd, fdi) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", ttyfd, fdi, strerror(errno));
|
Error3("dup2(%d, %d): %s", ttyfd, fdi, strerror(errno));
|
||||||
return STAT_RETRYLATER; }
|
return -1; }
|
||||||
/*0 Info2("dup2(%d, %d)", ttyfd, fdi);*/
|
/*0 Info2("dup2(%d, %d)", ttyfd, fdi);*/
|
||||||
}
|
}
|
||||||
if (rw != XIO_WRONLY && fdo != ttyfd) {
|
if (rw != XIO_WRONLY && fdo != ttyfd) {
|
||||||
if (Dup2(ttyfd, fdo) < 0) {
|
if (Dup2(ttyfd, fdo) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", ttyfd, fdo, strerror(errno));
|
Error3("dup2(%d, %d): %s", ttyfd, fdo, strerror(errno));
|
||||||
return STAT_RETRYLATER; }
|
return -1; }
|
||||||
/*0 Info2("dup2(%d, %d)", ttyfd, fdo);*/
|
/*0 Info2("dup2(%d, %d)", ttyfd, fdo);*/
|
||||||
}
|
}
|
||||||
if ((rw == XIO_RDONLY || fdi != ttyfd) &&
|
if ((rw == XIO_RDONLY || fdi != ttyfd) &&
|
||||||
|
@ -1160,7 +1160,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (fdi == rdpip[1]) { /* a conflict here */
|
if (fdi == rdpip[1]) { /* a conflict here */
|
||||||
if ((tmpi = Dup(wrpip[0])) < 0) {
|
if ((tmpi = Dup(wrpip[0])) < 0) {
|
||||||
Error2("dup(%d): %s", wrpip[0], strerror(errno));
|
Error2("dup(%d): %s", wrpip[0], strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
/*0 Info2("dup(%d) -> %d", wrpip[0], tmpi);*/
|
/*0 Info2("dup(%d) -> %d", wrpip[0], tmpi);*/
|
||||||
rdpip[1] = tmpi;
|
rdpip[1] = tmpi;
|
||||||
|
@ -1168,7 +1168,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (fdo == wrpip[0]) { /* a conflict here */
|
if (fdo == wrpip[0]) { /* a conflict here */
|
||||||
if ((tmpo = Dup(rdpip[1])) < 0) {
|
if ((tmpo = Dup(rdpip[1])) < 0) {
|
||||||
Error2("dup(%d): %s", rdpip[1], strerror(errno));
|
Error2("dup(%d): %s", rdpip[1], strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
/*0 Info2("dup(%d) -> %d", rdpip[1], tmpo);*/
|
/*0 Info2("dup(%d) -> %d", rdpip[1], tmpo);*/
|
||||||
wrpip[0] = tmpo;
|
wrpip[0] = tmpo;
|
||||||
|
@ -1177,7 +1177,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_WRONLY && rdpip[1] != fdo) {
|
if (rw != XIO_WRONLY && rdpip[1] != fdo) {
|
||||||
if (Dup2(rdpip[1], fdo) < 0) {
|
if (Dup2(rdpip[1], fdo) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", rdpip[1], fdo, strerror(errno));
|
Error3("dup2(%d, %d): %s", rdpip[1], fdo, strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
Close(rdpip[1]);
|
Close(rdpip[1]);
|
||||||
/*0 Info2("dup2(%d, %d)", rdpip[1], fdo);*/
|
/*0 Info2("dup2(%d, %d)", rdpip[1], fdo);*/
|
||||||
|
@ -1186,7 +1186,7 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_RDONLY && wrpip[0] != fdi) {
|
if (rw != XIO_RDONLY && wrpip[0] != fdi) {
|
||||||
if (Dup2(wrpip[0], fdi) < 0) {
|
if (Dup2(wrpip[0], fdi) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", wrpip[0], fdi, strerror(errno));
|
Error3("dup2(%d, %d): %s", wrpip[0], fdi, strerror(errno));
|
||||||
return STAT_RETRYLATER;
|
return -1;
|
||||||
}
|
}
|
||||||
Close(wrpip[0]);
|
Close(wrpip[0]);
|
||||||
/*0 Info2("dup2(%d, %d)", wrpip[0], fdi);*/
|
/*0 Info2("dup2(%d, %d)", wrpip[0], fdi);*/
|
||||||
|
@ -1203,13 +1203,13 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (rw != XIO_RDONLY && fdi != sv[1]) {
|
if (rw != XIO_RDONLY && fdi != sv[1]) {
|
||||||
if (Dup2(sv[1], fdi) < 0) {
|
if (Dup2(sv[1], fdi) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", sv[1], fdi, strerror(errno));
|
Error3("dup2(%d, %d): %s", sv[1], fdi, strerror(errno));
|
||||||
return STAT_RETRYLATER; }
|
return -1; }
|
||||||
/*0 Info2("dup2(%d, %d)", sv[1], fdi);*/
|
/*0 Info2("dup2(%d, %d)", sv[1], fdi);*/
|
||||||
}
|
}
|
||||||
if (rw != XIO_WRONLY && fdo != sv[1]) {
|
if (rw != XIO_WRONLY && fdo != sv[1]) {
|
||||||
if (Dup2(sv[1], fdo) < 0) {
|
if (Dup2(sv[1], fdo) < 0) {
|
||||||
Error3("dup2(%d, %d): %s", sv[1], fdo, strerror(errno));
|
Error3("dup2(%d, %d): %s", sv[1], fdo, strerror(errno));
|
||||||
return STAT_RETRYLATER; }
|
return -1; }
|
||||||
/*0 Info2("dup2(%d, %d)", sv[1], fdo);*/
|
/*0 Info2("dup2(%d, %d)", sv[1], fdo);*/
|
||||||
}
|
}
|
||||||
if (fdi != sv[1] && fdo != sv[1]) {
|
if (fdi != sv[1] && fdo != sv[1]) {
|
||||||
|
@ -1224,36 +1224,6 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
applyopts(-1, *copts, PH_LATE);
|
applyopts(-1, *copts, PH_LATE);
|
||||||
applyopts(-1, *copts, PH_LATE2);
|
applyopts(-1, *copts, PH_LATE2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* what to do with stderr? */
|
|
||||||
if (withstderr) {
|
|
||||||
/* handle it just like ordinary process output, i.e. copy output fd */
|
|
||||||
if (!withfork) {
|
|
||||||
if (Dup2(fdo, 2) < 0) {
|
|
||||||
Error2("dup2(%d, 2): %s", fdo, strerror(errno));
|
|
||||||
}
|
|
||||||
/*0 Info1("dup2(%d, 2)", fdo);*/
|
|
||||||
} else
|
|
||||||
#if HAVE_PTY
|
|
||||||
if (usepty) {
|
|
||||||
if (Dup2(ttyfd, 2) < 0) {
|
|
||||||
Error2("dup2(%d, 2): %s", ttyfd, strerror(errno));
|
|
||||||
}
|
|
||||||
/*0 Info1("dup2(%d, 2)", ttyfd);*/
|
|
||||||
} else
|
|
||||||
#endif /* HAVE_PTY */
|
|
||||||
if (usepipes) {
|
|
||||||
if (Dup2(/*rdpip[1]*/ fdo, 2) < 0) {
|
|
||||||
Error2("dup2(%d, 2): %s", /*rdpip[1]*/ fdo, strerror(errno));
|
|
||||||
}
|
|
||||||
/*0 Info1("dup2(%d, 2)", rdpip[1]);*/
|
|
||||||
} else {
|
|
||||||
if (Dup2(sv[1], 2) < 0) {
|
|
||||||
Error2("dup2(%d, 2): %s", sv[1], strerror(errno));
|
|
||||||
}
|
|
||||||
/*0 Info1("dup2(%d, 2)", sv[1]);*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_xioopen_setdelayeduser();
|
_xioopen_setdelayeduser();
|
||||||
/* set group before user - maybe you are not permitted afterwards */
|
/* set group before user - maybe you are not permitted afterwards */
|
||||||
if (retropt_gidt(*copts, OPT_SETGID, &group) >= 0) {
|
if (retropt_gidt(*copts, OPT_SETGID, &group) >= 0) {
|
||||||
|
@ -1262,6 +1232,12 @@ int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
if (retropt_uidt(*copts, OPT_SETUID, &user) >= 0) {
|
if (retropt_uidt(*copts, OPT_SETUID, &user) >= 0) {
|
||||||
Setuid(user);
|
Setuid(user);
|
||||||
}
|
}
|
||||||
|
if (withstderr) {
|
||||||
|
*duptostderr = fdo;
|
||||||
|
} else {
|
||||||
|
*duptostderr = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0; /* indicate child process */
|
return 0; /* indicate child process */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-progcall.h */
|
/* source: xio-progcall.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_progcall_h_included
|
#ifndef __xio_progcall_h_included
|
||||||
|
@ -21,13 +21,18 @@ extern const struct optdesc opt_sigquit;
|
||||||
extern int _xioopen_foxec_int(int rw, /* O_RDONLY etc. */
|
extern int _xioopen_foxec_int(int rw, /* O_RDONLY etc. */
|
||||||
struct single *fd,
|
struct single *fd,
|
||||||
unsigned groups,
|
unsigned groups,
|
||||||
struct opt **opts
|
struct opt **opts,
|
||||||
|
int *duptostderr
|
||||||
);
|
);
|
||||||
extern int _xioopen_foxec_end(int rw, /* O_RDONLY etc. */
|
extern int _xioopen_foxec_end(int xioflags, /* XIO_RDONLY etc. */
|
||||||
struct single *fd,
|
struct single *fd,
|
||||||
unsigned groups,
|
unsigned groups,
|
||||||
struct opt **opts
|
struct opt **opts,
|
||||||
);
|
int *duptostderr
|
||||||
|
);
|
||||||
|
|
||||||
extern int setopt_path(struct opt *opts, char **path);
|
extern int setopt_path(struct opt *opts, char **path);
|
||||||
|
extern
|
||||||
|
int _xioopen_redir_stderr(int fdo);
|
||||||
|
|
||||||
#endif /* !defined(__xio_progcall_h_included) */
|
#endif /* !defined(__xio_progcall_h_included) */
|
||||||
|
|
32
xio-proxy.c
32
xio-proxy.c
|
@ -201,7 +201,7 @@ static int xioopen_proxy_connect3(int argc, const char *argv[], struct opt *opts
|
||||||
xfd->para.socket.ip.res_opts[1],
|
xfd->para.socket.ip.res_opts[1],
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
them, &themlen, us, &uslen,
|
them, &themlen, us, &uslen,
|
||||||
&needbind, &lowport, &socktype);
|
&needbind, &lowport, socktype);
|
||||||
if (result != STAT_OK) return result;
|
if (result != STAT_OK) return result;
|
||||||
Notice4("opening connection to %s:%u via proxy %s:%s",
|
Notice4("opening connection to %s:%u via proxy %s:%s",
|
||||||
proxyvars->targetaddr, proxyvars->targetport, proxyname, proxyport);
|
proxyvars->targetaddr, proxyvars->targetport, proxyname, proxyport);
|
||||||
|
@ -262,28 +262,22 @@ static int xioopen_proxy_connect3(int argc, const char *argv[], struct opt *opts
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
while ((pid = Fork()) < 0) {
|
int level = E_ERROR;
|
||||||
int level = E_ERROR;
|
if (xfd->forever || xfd->retry) {
|
||||||
if (xfd->forever || xfd->retry) {
|
level = E_WARN;
|
||||||
level = E_WARN;
|
}
|
||||||
}
|
while ((pid = xio_fork(false, level)) < 0) {
|
||||||
Msg1(level, "fork(): %s", strerror(errno));
|
if (xfd->forever || --xfd->retry) {
|
||||||
if (xfd->forever || xfd->retry--) {
|
Nanosleep(&xfd->intervall, NULL); continue;
|
||||||
Nanosleep(&xfd->intervall, NULL);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child process */
|
|
||||||
Info1("just born: proxy client process "F_pid, Getpid());
|
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
if (pid == 0) { /* child process */
|
||||||
if (xio_forked_inchild() != 0) {
|
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
xfd->forever = false; xfd->retry = 0;
|
xfd->forever = false; xfd->retry = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent process */
|
/* parent process */
|
||||||
Notice1("forked off child process "F_pid, pid);
|
Notice1("forked off child process "F_pid, pid);
|
||||||
Close(xfd->fd1);
|
Close(xfd->fd1);
|
||||||
|
@ -321,9 +315,11 @@ int _xioopen_proxy_prepare(struct proxyvars *proxyvars, struct opt *opts,
|
||||||
host = Gethostbyname(targetname);
|
host = Gethostbyname(targetname);
|
||||||
if (host == NULL) {
|
if (host == NULL) {
|
||||||
int level = E_WARN;
|
int level = E_WARN;
|
||||||
|
/* note: cast is req on AIX: */
|
||||||
Msg2(level, "gethostbyname(\"%s\"): %s", targetname,
|
Msg2(level, "gethostbyname(\"%s\"): %s", targetname,
|
||||||
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
hstrerror(h_errno)/*0 h_messages[h_errno-1]*/);
|
(char *)hstrerror(h_errno)/*0 h_messages[h_errno-1]*/);
|
||||||
|
|
||||||
proxyvars->targetaddr = strdup(targetname);
|
proxyvars->targetaddr = strdup(targetname);
|
||||||
} else {
|
} else {
|
||||||
#define LEN 16 /* www.xxx.yyy.zzz\0 */
|
#define LEN 16 /* www.xxx.yyy.zzz\0 */
|
||||||
|
|
49
xio-rawip.c
49
xio-rawip.c
|
@ -17,7 +17,6 @@
|
||||||
#include "xio-rawip.h"
|
#include "xio-rawip.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
|
int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
|
||||||
int xioflags, xiofile_t *fd, unsigned groups, int pf,
|
int xioflags, xiofile_t *fd, unsigned groups, int pf,
|
||||||
|
@ -37,7 +36,7 @@ int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
static
|
static
|
||||||
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
||||||
struct opt *opts, int xioflags,
|
struct opt *opts, int xioflags,
|
||||||
xiofile_t *xxfd, unsigned groups, int pf);
|
xiofile_t *xxfd, unsigned groups, int *pf);
|
||||||
|
|
||||||
static const struct xioaddr_endpoint_desc xioaddr_rawip_sendto2 = { XIOADDR_SYS, "ip-sendto", 2, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_rawip_sendto, PF_UNSPEC, 0, 0 HELP(":<host>:<protocol>") };
|
static const struct xioaddr_endpoint_desc xioaddr_rawip_sendto2 = { XIOADDR_SYS, "ip-sendto", 2, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_rawip_sendto, PF_UNSPEC, 0, 0 HELP(":<host>:<protocol>") };
|
||||||
const union xioaddr_desc *xioaddrs_rawip_sendto[] = { (union xioaddr_desc *)&xioaddr_rawip_sendto2, NULL };
|
const union xioaddr_desc *xioaddrs_rawip_sendto[] = { (union xioaddr_desc *)&xioaddr_rawip_sendto2, NULL };
|
||||||
|
@ -85,17 +84,24 @@ int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
if ((result = _xioopen_rawip_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
if ((result = _xioopen_rawip_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
||||||
groups, pf)) != STAT_OK) {
|
groups, &pf)) != STAT_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
_xio_openlate(&xxfd->stream, opts);
|
_xio_openlate(&xxfd->stream, opts);
|
||||||
return STAT_OK;
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
applies and consumes the following options:
|
||||||
|
PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECTED, PH_LATE
|
||||||
|
OFUNC_OFFSET
|
||||||
|
OPT_PROTOCOL_FAMILY, OPT_BIND, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_USER,
|
||||||
|
OPT_GROUP, OPT_CLOEXEC
|
||||||
|
*/
|
||||||
static
|
static
|
||||||
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
||||||
struct opt *opts, int xioflags, xiofile_t *xxfd,
|
struct opt *opts, int xioflags, xiofile_t *xxfd,
|
||||||
unsigned groups, int pf) {
|
unsigned groups, int *pf) {
|
||||||
char *garbage;
|
char *garbage;
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
union sockaddr_union us;
|
union sockaddr_union us;
|
||||||
|
@ -116,7 +122,7 @@ int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
||||||
/*return STAT_NORETRY;*/
|
/*return STAT_NORETRY;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
retropt_int(opts, OPT_PROTOCOL_FAMILY, pf);
|
||||||
|
|
||||||
/* ...res_opts[] */
|
/* ...res_opts[] */
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
||||||
|
@ -124,30 +130,30 @@ int _xioopen_rawip_sendto(const char *hostname, const char *protname,
|
||||||
|
|
||||||
xfd->salen = sizeof(xfd->peersa);
|
xfd->salen = sizeof(xfd->peersa);
|
||||||
if ((result =
|
if ((result =
|
||||||
xiogetaddrinfo(hostname, NULL, pf, socktype, ipproto,
|
xiogetaddrinfo(hostname, NULL, *pf, socktype, ipproto,
|
||||||
&xfd->peersa, &xfd->salen,
|
&xfd->peersa, &xfd->salen,
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
xfd->para.socket.ip.res_opts[1]))
|
xfd->para.socket.ip.res_opts[1]))
|
||||||
!= STAT_OK) {
|
!= STAT_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (pf == PF_UNSPEC) {
|
if (*pf == PF_UNSPEC) {
|
||||||
pf = xfd->peersa.soa.sa_family;
|
*pf = xfd->peersa.soa.sa_family;
|
||||||
}
|
}
|
||||||
|
|
||||||
uslen = socket_init(pf, &us);
|
uslen = socket_init(*pf, &us);
|
||||||
|
|
||||||
xfd->fdtype = FDTYPE_SINGLE;
|
xfd->fdtype = FDTYPE_SINGLE;
|
||||||
xfd->dtype = XIODATA_RECVFROM_SKIPIP;
|
xfd->dtype = XIODATA_RECVFROM_SKIPIP;
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, ipproto, &us.soa, &uslen, feats,
|
if (retropt_bind(opts, *pf, socktype, ipproto, &us.soa, &uslen, feats,
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
xfd->para.socket.ip.res_opts[1]) != STAT_NOACTION) {
|
xfd->para.socket.ip.res_opts[1]) != STAT_NOACTION) {
|
||||||
needbind = true;
|
needbind = true;
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
||||||
opts, xioflags, xfd, groups, pf, socktype, ipproto);
|
opts, xioflags, xfd, groups, *pf, socktype, ipproto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +173,7 @@ int xioopen_rawip_datagram(int argc, const char *argv[], struct opt *opts,
|
||||||
}
|
}
|
||||||
if ((result =
|
if ((result =
|
||||||
_xioopen_rawip_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
_xioopen_rawip_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
||||||
groups, pf)) != STAT_OK) {
|
groups, &pf)) != STAT_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +186,7 @@ int xioopen_rawip_datagram(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
/* which reply packets will be accepted - determine by range option */
|
/* which reply packets will be accepted - determine by range option */
|
||||||
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
||||||
if (parserange(rangename, pf, &xfd->para.socket.range) < 0) {
|
if (xioparserange(rangename, pf, &xfd->para.socket.range) < 0) {
|
||||||
free(rangename);
|
free(rangename);
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +233,6 @@ int xioopen_rawip_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
}
|
}
|
||||||
xfd->stream.howtoshut = XIOSHUT_NONE;
|
xfd->stream.howtoshut = XIOSHUT_NONE;
|
||||||
xfd->stream.howtoclose = XIOCLOSE_CLOSE;
|
xfd->stream.howtoclose = XIOCLOSE_CLOSE;
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
|
@ -265,6 +270,7 @@ int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
int pf, int socktype, int dummy3) {
|
int pf, int socktype, int dummy3) {
|
||||||
const char *protname = argv[1];
|
const char *protname = argv[1];
|
||||||
char *garbage;
|
char *garbage;
|
||||||
|
bool needbind = false;
|
||||||
union sockaddr_union us;
|
union sockaddr_union us;
|
||||||
socklen_t uslen = sizeof(us);
|
socklen_t uslen = sizeof(us);
|
||||||
int ipproto;
|
int ipproto;
|
||||||
|
@ -285,7 +291,6 @@ int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
protname);
|
protname);
|
||||||
/*return STAT_NORETRY;*/
|
/*return STAT_NORETRY;*/
|
||||||
}
|
}
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
|
@ -298,18 +303,24 @@ int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, ipproto, &us.soa, &uslen, 1,
|
if (retropt_bind(opts, pf, socktype, ipproto,
|
||||||
|
&/*us.soa*/xfd->stream.para.socket.la.soa, &uslen, 1,
|
||||||
xfd->stream.para.socket.ip.res_opts[0],
|
xfd->stream.para.socket.ip.res_opts[0],
|
||||||
xfd->stream.para.socket.ip.res_opts[1]) !=
|
xfd->stream.para.socket.ip.res_opts[1]) ==
|
||||||
STAT_OK) {
|
STAT_OK) {
|
||||||
|
needbind = true;
|
||||||
|
} else {
|
||||||
/* pf is required during xioread checks */
|
/* pf is required during xioread checks */
|
||||||
xfd->stream.para.socket.la.soa.sa_family = pf;
|
xfd->stream.para.socket.la.soa.sa_family = pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfd->stream.fdtype = FDTYPE_SINGLE;
|
xfd->stream.fdtype = FDTYPE_SINGLE;
|
||||||
xfd->stream.dtype = XIODATA_RECV_SKIPIP;
|
xfd->stream.dtype = XIODATA_RECV_SKIPIP;
|
||||||
result = _xioopen_dgram_recv(&xfd->stream, xioflags, NULL/*&us.soa*/, uslen,
|
result =
|
||||||
opts, pf, socktype, ipproto, E_ERROR);
|
_xioopen_dgram_recv(&xfd->stream, xioflags,
|
||||||
|
needbind?&/*us.soa*/xfd->stream.para.socket.la.soa:NULL,
|
||||||
|
uslen,
|
||||||
|
opts, pf, socktype, ipproto, E_ERROR);
|
||||||
_xio_openlate(&xfd->stream, opts);
|
_xio_openlate(&xfd->stream, opts);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-readline.c */
|
/* source: xio-readline.c */
|
||||||
/* Copyright Gerhard Rieger 2002-2007 */
|
/* Copyright Gerhard Rieger 2002-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening the readline address */
|
/* this file contains the source for opening the readline address */
|
||||||
|
@ -126,8 +126,10 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts,
|
||||||
if (xfd->stream.para.readline.history_file) {
|
if (xfd->stream.para.readline.history_file) {
|
||||||
Read_history(xfd->stream.para.readline.history_file);
|
Read_history(xfd->stream.para.readline.history_file);
|
||||||
}
|
}
|
||||||
|
#if _WITH_TERMIOS
|
||||||
xiotermios_clrflag(xfd->stream.fd1, 3, ICANON);
|
xiotermios_clrflag(xfd->stream.fd1, 3, ICANON);
|
||||||
xiotermios_clrflag(xfd->stream.fd1, 3, ECHO);
|
xiotermios_clrflag(xfd->stream.fd1, 3, ECHO);
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
return _xio_openlate(&xfd->stream, opts);
|
return _xio_openlate(&xfd->stream, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +145,7 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) {
|
||||||
pipe->para.readline.hasnoecho &&
|
pipe->para.readline.hasnoecho &&
|
||||||
!regexec(&pipe->para.readline.noecho,
|
!regexec(&pipe->para.readline.noecho,
|
||||||
pipe->para.readline.dynprompt, 0, NULL, 0)) {
|
pipe->para.readline.dynprompt, 0, NULL, 0)) {
|
||||||
|
#if _WITH_TERMIOS
|
||||||
/* under these conditions, we do not echo input, thus we circumvent
|
/* under these conditions, we do not echo input, thus we circumvent
|
||||||
readline */
|
readline */
|
||||||
struct termios saveterm, setterm;
|
struct termios saveterm, setterm;
|
||||||
|
@ -151,6 +154,7 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) {
|
||||||
setterm = saveterm;
|
setterm = saveterm;
|
||||||
setterm.c_lflag |= ICANON;
|
setterm.c_lflag |= ICANON;
|
||||||
Tcsetattr(pipe->fd1, TCSANOW, &setterm); /*!*/
|
Tcsetattr(pipe->fd1, TCSANOW, &setterm); /*!*/
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
do {
|
do {
|
||||||
bytes = Read(pipe->fd1, buff, bufsiz);
|
bytes = Read(pipe->fd1, buff, bufsiz);
|
||||||
} while (bytes < 0 && errno == EINTR);
|
} while (bytes < 0 && errno == EINTR);
|
||||||
|
@ -161,16 +165,20 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) {
|
||||||
errno = _errno;
|
errno = _errno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#if _WITH_TERMIOS
|
||||||
setterm.c_lflag &= ~ICANON;
|
setterm.c_lflag &= ~ICANON;
|
||||||
Tcgetattr(pipe->fd1, &setterm); /*! error */
|
Tcgetattr(pipe->fd1, &setterm); /*! error */
|
||||||
Tcsetattr(pipe->fd1, TCSANOW, &saveterm); /*!*/
|
Tcsetattr(pipe->fd1, TCSANOW, &saveterm); /*!*/
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
pipe->para.readline.dynend = pipe->para.readline.dynprompt;
|
pipe->para.readline.dynend = pipe->para.readline.dynprompt;
|
||||||
/*Write(pipe->fd1, "\n", 1);*/ /*!*/
|
/*Write(pipe->fd1, "\n", 1);*/ /*!*/
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_REGEX_H */
|
#endif /* HAVE_REGEX_H */
|
||||||
|
|
||||||
|
#if _WITH_TERMIOS
|
||||||
xiotermios_setflag(pipe->fd1, 3, ECHO);
|
xiotermios_setflag(pipe->fd1, 3, ECHO);
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
if (pipe->para.readline.prompt || pipe->para.readline.dynprompt) {
|
if (pipe->para.readline.prompt || pipe->para.readline.dynprompt) {
|
||||||
/* we must carriage return, because readline will first print the
|
/* we must carriage return, because readline will first print the
|
||||||
prompt */
|
prompt */
|
||||||
|
@ -197,7 +205,9 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) {
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
return 0; /* EOF */
|
return 0; /* EOF */
|
||||||
}
|
}
|
||||||
|
#if _WITH_TERMIOS
|
||||||
xiotermios_clrflag(pipe->fd1, 3, ECHO);
|
xiotermios_clrflag(pipe->fd1, 3, ECHO);
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
Add_history(line);
|
Add_history(line);
|
||||||
bytes = strlen(line);
|
bytes = strlen(line);
|
||||||
strncpy(buff, line, bufsiz);
|
strncpy(buff, line, bufsiz);
|
||||||
|
|
77
xio-sctp.c
Normal file
77
xio-sctp.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/* source: xio-sctp.c */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for SCTP related functions and options */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
|
||||||
|
#if WITH_SCTP
|
||||||
|
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "xio-listen.h"
|
||||||
|
#include "xio-ip4.h"
|
||||||
|
#include "xio-ipapp.h"
|
||||||
|
#include "xio-sctp.h"
|
||||||
|
|
||||||
|
/****** SCTP addresses ******/
|
||||||
|
|
||||||
|
#if WITH_IP4 || WITH_IP6
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp_connect2 = { XIOADDR_SYS, "sctp-connect", 2, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_connect, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":<host>:<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp_connect[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp_connect2,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#if WITH_LISTEN
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp_listen1 = { XIOADDR_SYS, "sctp-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_listen, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp_listen[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp_listen1,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
#endif /* WITH_LISTEN */
|
||||||
|
#endif /* WITH_IP4 || WITH_IP6 */
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp4_connect2 = { XIOADDR_SYS, "sctp4-connect", 2, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_connect, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":<host>:<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp4_connect[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp4_connect2,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#if WITH_LISTEN
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp4_listen1 = { XIOADDR_SYS, "sctp4-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_listen, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp4_listen[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp4_listen1,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
#endif /* WITH_LISTEN */
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp6_connect2 = { XIOADDR_SYS, "sctp6-connect", 2, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_connect, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP(":<host>:<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp6_connect[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp6_connect2,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#if WITH_LISTEN
|
||||||
|
const struct xioaddr_endpoint_desc xioaddr_sctp6_listen1 = { XIOADDR_SYS, "sctp6-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_listen, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP(":<port>") };
|
||||||
|
const union xioaddr_desc *xioaddrs_sctp6_listen[] = {
|
||||||
|
(union xioaddr_desc *)&xioaddr_sctp6_listen1,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
#endif /* WITH_LISTEN */
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
/****** SCTP address options ******/
|
||||||
|
|
||||||
|
#ifdef SCTP_NODELAY
|
||||||
|
const struct optdesc opt_sctp_nodelay = { "sctp-nodelay", "nodelay", OPT_SCTP_NODELAY, GROUP_IP_SCTP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_SCTP, SCTP_NODELAY };
|
||||||
|
#endif
|
||||||
|
#ifdef SCTP_MAXSEG
|
||||||
|
const struct optdesc opt_sctp_maxseg = { "sctp-maxseg", "mss", OPT_SCTP_MAXSEG, GROUP_IP_SCTP, PH_PASTSOCKET,TYPE_INT, OFUNC_SOCKOPT, SOL_SCTP, SCTP_MAXSEG };
|
||||||
|
const struct optdesc opt_sctp_maxseg_late={"sctp-maxseg-late","mss-late",OPT_SCTP_MAXSEG_LATE,GROUP_IP_SCTP,PH_CONNECTED,TYPE_INT,OFUNC_SOCKOPT, SOL_SCTP, SCTP_MAXSEG};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* WITH_SCTP */
|
19
xio-sctp.h
Normal file
19
xio-sctp.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/* source: xio-sctp.h */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_sctp_h_included
|
||||||
|
#define __xio_sctp_h_included 1
|
||||||
|
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp_connect[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp_listen[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp4_connect[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp4_listen[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp6_connect[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_sctp6_listen[];
|
||||||
|
|
||||||
|
extern const struct optdesc opt_sctp_nodelay;
|
||||||
|
extern const struct optdesc opt_sctp_maxseg;
|
||||||
|
extern const struct optdesc opt_sctp_maxseg_late;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_sctp_h_included) */
|
1339
xio-socket.c
1339
xio-socket.c
File diff suppressed because it is too large
Load diff
46
xio-socket.h
46
xio-socket.h
|
@ -1,10 +1,23 @@
|
||||||
/* source: xio-socket.h */
|
/* source: xio-socket.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_socket_h_included
|
#ifndef __xio_socket_h_included
|
||||||
#define __xio_socket_h_included 1
|
#define __xio_socket_h_included 1
|
||||||
|
|
||||||
|
/* SO_PROTOTYPE is OS defined on Solaris, HP-UX; we lend this for a more
|
||||||
|
general purpose */
|
||||||
|
#ifndef SO_PROTOTYPE
|
||||||
|
#define SO_PROTOTYPE 0x9999
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_connect[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_listen[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_sendto[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_datagram[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_recvfrom[];
|
||||||
|
extern const union xioaddr_desc *xioaddrs_socket_recv[];
|
||||||
|
|
||||||
extern const struct optdesc opt_connect_timeout;
|
extern const struct optdesc opt_connect_timeout;
|
||||||
extern const struct optdesc opt_so_debug;
|
extern const struct optdesc opt_so_debug;
|
||||||
extern const struct optdesc opt_so_acceptconn;
|
extern const struct optdesc opt_so_acceptconn;
|
||||||
|
@ -31,6 +44,7 @@ extern const struct optdesc opt_so_detach_filter;
|
||||||
extern const struct optdesc opt_so_bindtodevice;
|
extern const struct optdesc opt_so_bindtodevice;
|
||||||
extern const struct optdesc opt_so_bsdcompat;
|
extern const struct optdesc opt_so_bsdcompat;
|
||||||
extern const struct optdesc opt_so_cksumrecv;
|
extern const struct optdesc opt_so_cksumrecv;
|
||||||
|
extern const struct optdesc opt_so_timestamp;
|
||||||
extern const struct optdesc opt_so_kernaccept;
|
extern const struct optdesc opt_so_kernaccept;
|
||||||
extern const struct optdesc opt_so_no_check;
|
extern const struct optdesc opt_so_no_check;
|
||||||
extern const struct optdesc opt_so_noreuseaddr;
|
extern const struct optdesc opt_so_noreuseaddr;
|
||||||
|
@ -50,18 +64,27 @@ extern const struct optdesc opt_fiosetown;
|
||||||
extern const struct optdesc opt_siocspgrp;
|
extern const struct optdesc opt_siocspgrp;
|
||||||
extern const struct optdesc opt_bind;
|
extern const struct optdesc opt_bind;
|
||||||
extern const struct optdesc opt_protocol_family;
|
extern const struct optdesc opt_protocol_family;
|
||||||
|
extern const struct optdesc opt_setsockopt_int;
|
||||||
|
extern const struct optdesc opt_setsockopt_bin;
|
||||||
|
extern const struct optdesc opt_setsockopt_string;
|
||||||
|
|
||||||
|
|
||||||
|
extern
|
||||||
|
char *xiogetifname(int ind, char *val, int ins);
|
||||||
|
|
||||||
extern int retropt_socket_pf(struct opt *opts, int *pf);
|
extern int retropt_socket_pf(struct opt *opts, int *pf);
|
||||||
|
|
||||||
extern int xioopen_connect(struct single *fd,
|
extern int xioopen_connect(struct single *fd,
|
||||||
struct sockaddr *us, size_t uslen,
|
struct sockaddr *us, size_t uslen,
|
||||||
struct sockaddr *them, size_t themlen,
|
struct sockaddr *them, size_t themlen,
|
||||||
struct opt *opts, int pf, int stype, int proto,
|
struct opt *opts,
|
||||||
|
int pf, int socktype, int protocol,
|
||||||
bool alt);
|
bool alt);
|
||||||
extern int _xioopen_connect(struct single *fd,
|
extern int _xioopen_connect(struct single *fd,
|
||||||
struct sockaddr *us, size_t uslen,
|
struct sockaddr *us, size_t uslen,
|
||||||
struct sockaddr *them, size_t themlen,
|
struct sockaddr *them, size_t themlen,
|
||||||
struct opt *opts, int pf, int stype, int proto,
|
struct opt *opts,
|
||||||
|
int pf, int socktype, int protocol,
|
||||||
bool alt, int level);
|
bool alt, int level);
|
||||||
|
|
||||||
/* common to xioopen_udp_sendto, ..unix_sendto, ..rawip */
|
/* common to xioopen_udp_sendto, ..unix_sendto, ..rawip */
|
||||||
|
@ -82,9 +105,24 @@ int _xioopen_dgram_recv(struct single *xfd, int xioflags,
|
||||||
struct opt *opts, int pf, int socktype, int proto,
|
struct opt *opts, int pf, int socktype, int proto,
|
||||||
int level);
|
int level);
|
||||||
extern
|
extern
|
||||||
int xiogetpacketsrc(int fd, union sockaddr_union *pa, socklen_t *palen);
|
int xiodopacketinfo(struct msghdr *msgh, bool withlog, bool withenv);
|
||||||
|
extern
|
||||||
|
int xiogetpacketsrc(int fd, struct msghdr *msgh);
|
||||||
extern
|
extern
|
||||||
int xiocheckpeer(xiosingle_t *xfd,
|
int xiocheckpeer(xiosingle_t *xfd,
|
||||||
union sockaddr_union *pa, union sockaddr_union *la);
|
union sockaddr_union *pa, union sockaddr_union *la);
|
||||||
|
extern
|
||||||
|
int xiosetsockaddrenv(const char *lr, union sockaddr_union *sau, socklen_t salen, int proto);
|
||||||
|
|
||||||
|
extern
|
||||||
|
int xioparsenetwork(const char *rangename, int pf,
|
||||||
|
struct xiorange *range);
|
||||||
|
extern
|
||||||
|
int xioparserange(const char *rangename, int pf, struct xiorange *range);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
xiosocket(struct opt *opts, int pf, int socktype, int proto, int level);
|
||||||
|
extern int
|
||||||
|
xiosocketpair(struct opt *opts, int pf, int socktype, int proto, int sv[2]);
|
||||||
|
|
||||||
#endif /* !defined(__xio_socket_h_included) */
|
#endif /* !defined(__xio_socket_h_included) */
|
||||||
|
|
24
xio-socks.c
24
xio-socks.c
|
@ -119,7 +119,7 @@ static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts
|
||||||
xfd->para.socket.ip.res_opts[1],
|
xfd->para.socket.ip.res_opts[1],
|
||||||
xfd->para.socket.ip.res_opts[0],
|
xfd->para.socket.ip.res_opts[0],
|
||||||
them, &themlen, us, &uslen,
|
them, &themlen, us, &uslen,
|
||||||
&needbind, &lowport, &socktype);
|
&needbind, &lowport, socktype);
|
||||||
if (result != STAT_OK) return result;
|
if (result != STAT_OK) return result;
|
||||||
|
|
||||||
Notice5("opening connection to %s:%u via socks4 server %s:%s as user \"%s\"",
|
Notice5("opening connection to %s:%u via socks4 server %s:%s as user \"%s\"",
|
||||||
|
@ -213,28 +213,24 @@ static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
while ((pid = Fork()) < 0) {
|
int level = E_ERROR;
|
||||||
int level = E_ERROR;
|
if (xfd->forever || xfd->retry) {
|
||||||
if (xfd->forever || xfd->retry) {
|
level = E_WARN; /* most users won't expect a problem here,
|
||||||
level = E_WARN;
|
so Notice is too weak */
|
||||||
}
|
}
|
||||||
Msg1(level, "fork(): %s", strerror(errno));
|
while ((pid = xio_fork(false, level)) < 0) {
|
||||||
if (xfd->forever || xfd->retry--) {
|
if (xfd->forever || --xfd->retry) {
|
||||||
Nanosleep(&xfd->intervall, NULL);
|
Nanosleep(&xfd->intervall, NULL);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child process */
|
|
||||||
Info1("just born: socks client process "F_pid, Getpid());
|
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
if (pid == 0) { /* child process */
|
||||||
if (xio_forked_inchild() != 0) {
|
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
xfd->forever = false; xfd->retry = 0;
|
xfd->forever = false; xfd->retry = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent process */
|
/* parent process */
|
||||||
Notice1("forked off child process "F_pid, pid);
|
Notice1("forked off child process "F_pid, pid);
|
||||||
Close(xfd->fd1);
|
Close(xfd->fd1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id$ */
|
/* source: xio-socks5.c */
|
||||||
/* Copyright Gerhard Rieger 2004-2007 */
|
/* Copyright Gerhard Rieger 2004-2007 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
|
79
xio-streams.c
Normal file
79
xio-streams.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/* source: xio-streams.c */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains definitions and functions for handling POSIX STREAMS */
|
||||||
|
|
||||||
|
/* with this source file a new experimental approach is being introduced:
|
||||||
|
normally when adding a new option at least four existing files have to be
|
||||||
|
adapted; this is similar for new address types.
|
||||||
|
|
||||||
|
in the future i would like to have a more automatic assembling of socat from
|
||||||
|
topic oriented source files. this should make integration and control of
|
||||||
|
contributions more easy.
|
||||||
|
|
||||||
|
all code of a new topic - address and option definitions, open code, option
|
||||||
|
handing code, ev.parser code, etc. should go into one source file. the
|
||||||
|
selection of the desired code parts during the compilation is done by
|
||||||
|
setting cpp defines.
|
||||||
|
|
||||||
|
in the same was all public declarations should go in one header (.h) file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* do not compile this file directly but include it from other .c files. with
|
||||||
|
CPP defines you select one part you want to really get included:
|
||||||
|
|
||||||
|
ENABLE_OPTIONS: activate the definition of the address option records
|
||||||
|
ENABLE_APPLYOPTS: C code that applies the address option passed in opt
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPTIONS
|
||||||
|
|
||||||
|
#ifdef I_POP
|
||||||
|
const struct optdesc opt_streams_i_pop_all = { "streams-i-pop-all", "pop-all", OPT_STREAMS_I_POP_ALL, GROUP_FD, PH_FD, TYPE_BOOL, OFUNC_STREAMS_I_POP_ALL, 0, 0 };
|
||||||
|
#endif
|
||||||
|
#ifdef I_PUSH
|
||||||
|
const struct optdesc opt_streams_i_push = { "streams-i-push", "push", OPT_STREAMS_I_PUSH, GROUP_FD, PH_FD, TYPE_STRING, OFUNC_STREAMS_I_PUSH, 0, 0 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(ENABLE_APPLYOPT)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void dummy(void) {
|
||||||
|
if (0) { { ;
|
||||||
|
#endif
|
||||||
|
#ifdef I_POP
|
||||||
|
} else if (opt->desc->func == OFUNC_STREAMS_I_POP_ALL) {
|
||||||
|
while (Ioctl(fd, I_POP, 0) >= 0) {
|
||||||
|
Warn2("ioctl(%d, I_POP, 0): %s", fd, strerror(errno));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef I_PUSH
|
||||||
|
} else if (opt->desc->func == OFUNC_STREAMS_I_PUSH) {
|
||||||
|
if (Ioctl(fd, I_PUSH, opt->value.u_string) < 0) {
|
||||||
|
Warn3("ioctl(%d, I_PUSH, \"%s\"): %s",
|
||||||
|
fd, opt->value.u_string, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
} } }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* !defined(ENABLE_APPLYOPT) */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#if WITH_STREAMS /* make this address configure dependend */
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-fd.h"
|
||||||
|
#include "xio-socket.h" /* _xioopen_connect() */
|
||||||
|
#include "xio-listen.h"
|
||||||
|
#include "xio-ipapp.h"
|
||||||
|
#include "xio-openssl.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* WITH_STREAMS */
|
||||||
|
|
||||||
|
#endif /* !defined(ENABLE_OPTIONS) */
|
40
xio-streams.h
Normal file
40
xio-streams.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* source: xio-streams.h */
|
||||||
|
/* Copyright Gerhard Rieger 2008 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* when including this file select one part that you need by defining the
|
||||||
|
appropriate CPP define:
|
||||||
|
|
||||||
|
(none): standard define, variable, and function declarations
|
||||||
|
ENABLE_OPTCODE: option codes for use in enum e_optcode
|
||||||
|
ENABLE_OFUNC: option functions for use in enum e_func
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPTCODE
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
enum { /* make syntax feature of editors cooperative */
|
||||||
|
#endif
|
||||||
|
OPT_STREAMS_I_POP_ALL, /* with POSIX STREAMS */
|
||||||
|
OPT_STREAMS_I_PUSH, /* with POSIX STREAMS */
|
||||||
|
#if 0
|
||||||
|
} ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(ENABLE_OFUNC)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
enum { /* make syntax feature of editors cooperative */
|
||||||
|
#endif
|
||||||
|
OFUNC_STREAMS_I_POP_ALL,
|
||||||
|
OFUNC_STREAMS_I_PUSH,
|
||||||
|
#if 0
|
||||||
|
} ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* normal declarations */
|
||||||
|
|
||||||
|
extern const struct optdesc opt_streams_i_pop_all;
|
||||||
|
extern const struct optdesc opt_streams_i_push;
|
||||||
|
|
||||||
|
#endif
|
|
@ -35,10 +35,11 @@ static int xioopen_system(int argc, const char *argv[], struct opt *opts,
|
||||||
) {
|
) {
|
||||||
int status;
|
int status;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
int duptostderr;
|
||||||
int result;
|
int result;
|
||||||
const char *string = argv[1];
|
const char *string = argv[1];
|
||||||
|
|
||||||
status = _xioopen_foxec_end(xioflags, &fd->stream, groups, &opts);
|
status = _xioopen_foxec_end(xioflags, &fd->stream, groups, &opts, &duptostderr);
|
||||||
if (status < 0) return status;
|
if (status < 0) return status;
|
||||||
if (status == 0) { /* child */
|
if (status == 0) { /* child */
|
||||||
int numleft;
|
int numleft;
|
||||||
|
@ -54,6 +55,11 @@ static int xioopen_system(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only now redirect stderr */
|
||||||
|
if (duptostderr >= 0) {
|
||||||
|
diag_dup();
|
||||||
|
Dup2(duptostderr, 2);
|
||||||
|
}
|
||||||
Info1("executing shell command \"%s\"", string);
|
Info1("executing shell command \"%s\"", string);
|
||||||
result = System(string);
|
result = System(string);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-tcpwrap.c */
|
/* source: xio-tcpwrap.c */
|
||||||
/* Copyright Gerhard Rieger 2006-2007 */
|
/* Copyright Gerhard Rieger 2006-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for tcpwrapper handling stuff */
|
/* this file contains the source for tcpwrapper handling stuff */
|
||||||
|
@ -93,6 +93,7 @@ int xio_tcpwrap_check(xiosingle_t *xfd, union sockaddr_union *us,
|
||||||
if (!xfd->para.socket.ip.dolibwrap) {
|
if (!xfd->para.socket.ip.dolibwrap) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (us == NULL || them == NULL) { return -1; }
|
||||||
|
|
||||||
#if defined(HAVE_HOSTS_ALLOW_TABLE)
|
#if defined(HAVE_HOSTS_ALLOW_TABLE)
|
||||||
save_hosts_allow_table = hosts_allow_table;
|
save_hosts_allow_table = hosts_allow_table;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-termios.c */
|
/* source: xio-termios.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2006 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for terminal I/O options */
|
/* this file contains the source for terminal I/O options */
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
#include "xio-termios.h"
|
#include "xio-termios.h"
|
||||||
|
|
||||||
/****** TERMIOS addresses ******/
|
/****** TERMIOS addresses ******/
|
||||||
|
#if _WITH_TERMIOS
|
||||||
#if WITH_TERMIOS
|
#if WITH_TERMIOS
|
||||||
const struct optdesc opt_tiocsctty={ "tiocsctty", "ctty",OPT_TIOCSCTTY, GROUP_TERMIOS, PH_LATE2, TYPE_BOOL, OFUNC_SPEC };
|
const struct optdesc opt_tiocsctty={ "tiocsctty", "ctty",OPT_TIOCSCTTY, GROUP_TERMIOS, PH_LATE2, TYPE_BOOL, OFUNC_SPEC };
|
||||||
|
|
||||||
|
@ -42,8 +43,10 @@ const struct optdesc opt_cr2 = { "cr2", NULL, OPT_CR2, GROUP_TERMIOS
|
||||||
# endif
|
# endif
|
||||||
# ifdef CR3
|
# ifdef CR3
|
||||||
const struct optdesc opt_cr3 = { "cr3", NULL, OPT_CR3, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, CR3, CRDLY };
|
const struct optdesc opt_cr3 = { "cr3", NULL, OPT_CR3, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, CR3, CRDLY };
|
||||||
#endif
|
# endif
|
||||||
|
# if CRDLY_SHIFT >= 0
|
||||||
const struct optdesc opt_crdly = { "crdly", NULL, OPT_CRDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, CRDLY, CRDLY_SHIFT };
|
const struct optdesc opt_crdly = { "crdly", NULL, OPT_CRDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, CRDLY, CRDLY_SHIFT };
|
||||||
|
# endif
|
||||||
#endif /* defined(CRDLY) */
|
#endif /* defined(CRDLY) */
|
||||||
#ifdef NLDLY
|
#ifdef NLDLY
|
||||||
# ifdef NL0
|
# ifdef NL0
|
||||||
|
@ -90,8 +93,10 @@ const struct optdesc opt_tab3 = { "tab3", NULL, OPT_TAB3, GROUP_TERMIOS
|
||||||
# ifdef XTABS
|
# ifdef XTABS
|
||||||
const struct optdesc opt_xtabs = { "xtabs", NULL, OPT_XTABS, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_FLAG, 1, XTABS, TABDLY };
|
const struct optdesc opt_xtabs = { "xtabs", NULL, OPT_XTABS, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_FLAG, 1, XTABS, TABDLY };
|
||||||
# endif
|
# endif
|
||||||
|
# if TABDLY_SHIFT >= 0
|
||||||
const struct optdesc opt_tabdly = { "tabdly", NULL, OPT_TABDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, TABDLY, TABDLY_SHIFT };
|
const struct optdesc opt_tabdly = { "tabdly", NULL, OPT_TABDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, TABDLY, TABDLY_SHIFT };
|
||||||
#endif
|
# endif
|
||||||
|
#endif /* defined(TABDLY) */
|
||||||
#ifdef BSDLY
|
#ifdef BSDLY
|
||||||
# ifdef BS0
|
# ifdef BS0
|
||||||
const struct optdesc opt_bs0 = { "bs0", NULL, OPT_BS0, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, BS0, BSDLY };
|
const struct optdesc opt_bs0 = { "bs0", NULL, OPT_BS0, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, BS0, BSDLY };
|
||||||
|
@ -196,7 +201,9 @@ const struct optdesc opt_cs5 = { "cs5", NULL, OPT_CS5, GROUP_TERMIOS
|
||||||
const struct optdesc opt_cs6 = { "cs6", NULL, OPT_CS6, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS6, CSIZE };
|
const struct optdesc opt_cs6 = { "cs6", NULL, OPT_CS6, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS6, CSIZE };
|
||||||
const struct optdesc opt_cs7 = { "cs7", NULL, OPT_CS7, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS7, CSIZE };
|
const struct optdesc opt_cs7 = { "cs7", NULL, OPT_CS7, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS7, CSIZE };
|
||||||
const struct optdesc opt_cs8 = { "cs8", NULL, OPT_CS8, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS8, CSIZE };
|
const struct optdesc opt_cs8 = { "cs8", NULL, OPT_CS8, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS8, CSIZE };
|
||||||
|
#if CSIZE_SHIFT >= 0
|
||||||
const struct optdesc opt_csize = { "csize", NULL, OPT_CSIZE, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 2, CSIZE, CSIZE_SHIFT };
|
const struct optdesc opt_csize = { "csize", NULL, OPT_CSIZE, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 2, CSIZE, CSIZE_SHIFT };
|
||||||
|
#endif
|
||||||
const struct optdesc opt_cstopb = { "cstopb", NULL, OPT_CSTOPB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CSTOPB };
|
const struct optdesc opt_cstopb = { "cstopb", NULL, OPT_CSTOPB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CSTOPB };
|
||||||
const struct optdesc opt_cread = { "cread", NULL, OPT_CREAD, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CREAD };
|
const struct optdesc opt_cread = { "cread", NULL, OPT_CREAD, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CREAD };
|
||||||
const struct optdesc opt_parenb = { "parenb", NULL, OPT_PARENB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, PARENB };
|
const struct optdesc opt_parenb = { "parenb", NULL, OPT_PARENB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, PARENB };
|
||||||
|
@ -324,3 +331,5 @@ int xiotermios_clrflag(int fd, int word, tcflag_t mask) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _WITH_TERMIOS */
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-termios.h */
|
/* source: xio-termios.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2006 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_termios_h_included
|
#ifndef __xio_termios_h_included
|
||||||
|
@ -138,10 +138,10 @@ extern const struct optdesc opt_sane;
|
||||||
extern const struct optdesc opt_ispeed;
|
extern const struct optdesc opt_ispeed;
|
||||||
extern const struct optdesc opt_ospeed;
|
extern const struct optdesc opt_ospeed;
|
||||||
|
|
||||||
#if WITH_TERMIOS /* otherwise tcflag_t might be reported undefined */
|
#if _WITH_TERMIOS /* otherwise tcflag_t might be reported undefined */
|
||||||
extern int xiotermios_setflag(int fd, int word, tcflag_t mask);
|
extern int xiotermios_setflag(int fd, int word, tcflag_t mask);
|
||||||
extern int xiotermios_clrflag(int fd, int word, tcflag_t mask);
|
extern int xiotermios_clrflag(int fd, int word, tcflag_t mask);
|
||||||
extern int xiotermiosflag_applyopt(int fd, struct opt *opt);
|
extern int xiotermiosflag_applyopt(int fd, struct opt *opt);
|
||||||
#endif /* WITH_TERMIOS */
|
#endif /* _WITH_TERMIOS */
|
||||||
|
|
||||||
#endif /* !defined(__xio_termios_h_included) */
|
#endif /* !defined(__xio_termios_h_included) */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id$ */
|
/* source: xio-test.c */
|
||||||
/* Copyright Gerhard Rieger 2007 */
|
/* Copyright Gerhard Rieger 2007 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
|
18
xio-tun.c
18
xio-tun.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-tun.c */
|
/* source: xio-tun.c */
|
||||||
/* Copyright Gerhard Rieger 2007 */
|
/* Copyright Gerhard Rieger 2007-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening addresses of tun/tap type */
|
/* this file contains the source for opening addresses of tun/tap type */
|
||||||
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
#define XIO_OFFSETOF(x) ((size_t)&((xiosingle_t *)0)->x)
|
|
||||||
|
|
||||||
/****** TUN addresses ******/
|
/****** TUN addresses ******/
|
||||||
const struct optdesc opt_tun_device = { "tun-device", NULL, OPT_TUN_DEVICE, GROUP_TUN, PH_OPEN, TYPE_FILENAME, OFUNC_SPEC };
|
const struct optdesc opt_tun_device = { "tun-device", NULL, OPT_TUN_DEVICE, GROUP_TUN, PH_OPEN, TYPE_FILENAME, OFUNC_SPEC };
|
||||||
const struct optdesc opt_tun_name = { "tun-name", NULL, OPT_TUN_NAME, GROUP_INTERFACE, PH_FD, TYPE_STRING, OFUNC_SPEC };
|
const struct optdesc opt_tun_name = { "tun-name", NULL, OPT_TUN_NAME, GROUP_INTERFACE, PH_FD, TYPE_STRING, OFUNC_SPEC };
|
||||||
|
@ -46,20 +44,20 @@ const struct optdesc opt_iff_automedia = { "iff-automedia", "automedia", O
|
||||||
const struct optdesc opt_route = { "route", NULL, OPT_ROUTE, GROUP_INTERFACE, PH_INIT, TYPE_STRING, OFUNC_SPEC };
|
const struct optdesc opt_route = { "route", NULL, OPT_ROUTE, GROUP_INTERFACE, PH_INIT, TYPE_STRING, OFUNC_SPEC };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_tun1 = { XIOADDR_SYS, "tun", 1, XIOBIT_ALL, GROUP_FD|GROUP_CHR|GROUP_NAMED|GROUP_OPEN|GROUP_TUN, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_tun, 0, 0, 0 HELP(":<ip-addr>/<bits>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_tun1 = { XIOADDR_SYS, "tun", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_OPEN|GROUP_TUN, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_tun, 0, 0, 0 HELP(":<ip-addr>/<bits>") };
|
||||||
|
|
||||||
const union xioaddr_desc *xioaddrs_tun[] = {
|
const union xioaddr_desc *xioaddrs_tun[] = {
|
||||||
(union xioaddr_desc *)&xioendpoint_tun1,
|
(union xioaddr_desc *)&xioendpoint_tun1,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
/* "if-name"=tun3
|
||||||
// "if-name"=tun3
|
|
||||||
// "route"=address/netmask
|
// "route"=address/netmask
|
||||||
// "ip6-route"=address/netmask
|
// "ip6-route"=address/netmask
|
||||||
// "iff-broadcast"
|
// "iff-broadcast"
|
||||||
// "iff-debug"
|
// "iff-debug"
|
||||||
// "iff-promisc"
|
// "iff-promisc"
|
||||||
// see .../linux/if.h
|
// see .../linux/if.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if LATER
|
#if LATER
|
||||||
|
@ -75,7 +73,7 @@ static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xiofl
|
||||||
char *tundevice = NULL;
|
char *tundevice = NULL;
|
||||||
char *tunname = NULL, *tuntype = NULL;
|
char *tunname = NULL, *tuntype = NULL;
|
||||||
int pf = /*! PF_UNSPEC*/ PF_INET;
|
int pf = /*! PF_UNSPEC*/ PF_INET;
|
||||||
union xiorange_union network;
|
struct xiorange network;
|
||||||
bool no_pi = false;
|
bool no_pi = false;
|
||||||
const char *namedargv[] = { "tun", NULL, NULL };
|
const char *namedargv[] = { "tun", NULL, NULL };
|
||||||
int rw = (xioflags & XIO_ACCMODE);
|
int rw = (xioflags & XIO_ACCMODE);
|
||||||
|
@ -162,12 +160,14 @@ static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xiofl
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
socket_init(pf, (union sockaddr_union *)&ifr.ifr_addr);
|
socket_init(pf, (union sockaddr_union *)&ifr.ifr_addr);
|
||||||
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr = network.ip4.netaddr;
|
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr =
|
||||||
|
network.netaddr.ip4.sin_addr;
|
||||||
if (Ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) {
|
if (Ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) {
|
||||||
Error4("ioctl(%d, SIOCSIFADDR, {\"%s\", \"%s\"}: %s",
|
Error4("ioctl(%d, SIOCSIFADDR, {\"%s\", \"%s\"}: %s",
|
||||||
sockfd, ifr.ifr_name, ifaddr, strerror(errno));
|
sockfd, ifr.ifr_name, ifaddr, strerror(errno));
|
||||||
}
|
}
|
||||||
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr = network.ip4.netmask;
|
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr =
|
||||||
|
network.netmask.ip4.sin_addr;
|
||||||
if (Ioctl(sockfd, SIOCSIFNETMASK, &ifr) < 0) {
|
if (Ioctl(sockfd, SIOCSIFNETMASK, &ifr) < 0) {
|
||||||
Error4("ioctl(%d, SIOCSIFNETMASK, {\"0x%08u\", \"%s\"}, %s",
|
Error4("ioctl(%d, SIOCSIFNETMASK, {\"0x%08u\", \"%s\"}, %s",
|
||||||
sockfd, ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr,
|
sockfd, ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr,
|
||||||
|
|
51
xio-udp.c
51
xio-udp.c
|
@ -101,7 +101,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
union sockaddr_union themunion;
|
union sockaddr_union themunion;
|
||||||
union sockaddr_union *them = &themunion;
|
union sockaddr_union *them = &themunion;
|
||||||
int socktype = SOCK_DGRAM;
|
int socktype = SOCK_DGRAM;
|
||||||
fd_set in, out, expt;
|
struct pollfd readfd;
|
||||||
bool dofork = false;
|
bool dofork = false;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char *rangename;
|
char *rangename;
|
||||||
|
@ -133,7 +133,6 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
fd->stream.fdtype = FDTYPE_SINGLE;
|
fd->stream.fdtype = FDTYPE_SINGLE;
|
||||||
|
|
||||||
uslen = socket_init(pf, &us);
|
uslen = socket_init(pf, &us);
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
retropt_bind(opts, pf, socktype, IPPROTO_UDP,
|
retropt_bind(opts, pf, socktype, IPPROTO_UDP,
|
||||||
(struct sockaddr *)&us, &uslen, 1,
|
(struct sockaddr *)&us, &uslen, 1,
|
||||||
fd->stream.para.socket.ip.res_opts[1],
|
fd->stream.para.socket.ip.res_opts[1],
|
||||||
|
@ -164,7 +163,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
#if WITH_IP4 /*|| WITH_IP6*/
|
#if WITH_IP4 /*|| WITH_IP6*/
|
||||||
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
||||||
if (parserange(rangename, pf, &fd->stream.para.socket.range) < 0) {
|
if (xioparserange(rangename, pf, &fd->stream.para.socket.range) < 0) {
|
||||||
free(rangename);
|
free(rangename);
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +194,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
union sockaddr_union _sockname;
|
union sockaddr_union _sockname;
|
||||||
union sockaddr_union *la = &_sockname; /* local address */
|
union sockaddr_union *la = &_sockname; /* local address */
|
||||||
|
|
||||||
if ((fd->stream.fd1 = Socket(pf, socktype, ipproto)) < 0) {
|
if ((fd->stream.fd1 = xiosocket(opts, pf, socktype, ipproto, E_ERROR)) < 0) {
|
||||||
Error4("socket(%d, %d, %d): %s", pf, socktype, ipproto, strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
/*0 Info4("socket(%d, %d, %d) -> %d", pf, socktype, ipproto, fd->stream.fd);*/
|
/*0 Info4("socket(%d, %d, %d) -> %d", pf, socktype, ipproto, fd->stream.fd);*/
|
||||||
|
@ -225,9 +223,9 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
Notice1("listening on UDP %s",
|
Notice1("listening on UDP %s",
|
||||||
sockaddr_info(&us.soa, uslen, infobuff, sizeof(infobuff)));
|
sockaddr_info(&us.soa, uslen, infobuff, sizeof(infobuff)));
|
||||||
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&expt);
|
readfd.fd = fd->stream.fd1;
|
||||||
FD_SET(fd->stream.fd1, &in);
|
readfd.events = POLLIN|POLLERR;
|
||||||
while (Select(fd->stream.fd1+1, &in, &out, &expt, NULL) < 0) {
|
while (xiopoll(&readfd, 1, NULL) < 0) {
|
||||||
if (errno != EINTR) break;
|
if (errno != EINTR) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,33 +247,29 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
if (xiocheckpeer(&fd->stream, them, la) < 0) {
|
if (xiocheckpeer(&fd->stream, them, la) < 0) {
|
||||||
/* drop packet */
|
/* drop packet */
|
||||||
char buff[512];
|
char buff[512];
|
||||||
Recv(fd->stream.fd1, buff, sizeof(buff), 0);
|
Recv(fd->stream.fd1, buff, sizeof(buff), 0); /* drop packet */
|
||||||
|
Close(fd->stream.fd1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Info1("permitting UDP connection from %s",
|
Info1("permitting UDP connection from %s",
|
||||||
sockaddr_info(&them->soa, themlen, infobuff, sizeof(infobuff)));
|
sockaddr_info(&them->soa, themlen, infobuff, sizeof(infobuff)));
|
||||||
|
|
||||||
if (dofork) {
|
if (dofork) {
|
||||||
pid = Fork();
|
pid = xio_fork(false, E_ERROR);
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
Error1("fork(): %s", strerror(errno));
|
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
if (pid == 0) { /* child */
|
|
||||||
|
|
||||||
/* drop parents locks, reset FIPS... */
|
if (pid == 0) { /* child */
|
||||||
if (xio_forked_inchild() != 0) {
|
|
||||||
Exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* server: continue loop with select */
|
|
||||||
|
/* server: continue loop with socket()+recvfrom() */
|
||||||
/* when we dont close this we get awkward behaviour on Linux 2.4:
|
/* when we dont close this we get awkward behaviour on Linux 2.4:
|
||||||
recvfrom gives 0 bytes with invalid socket address */
|
recvfrom gives 0 bytes with invalid socket address */
|
||||||
if (Close(fd->stream.fd1) < 0) {
|
if (Close(fd->stream.fd1) < 0) {
|
||||||
Info2("close(%d): %s", fd->stream.fd1, strerror(errno));
|
Info2("close(%d): %s", fd->stream.fd1, strerror(errno));
|
||||||
}
|
}
|
||||||
Notice1("forked off child process "F_pid, pid);
|
|
||||||
Sleep(1); /*! give child a chance to consume the old packet */
|
Sleep(1); /*! give child a chance to consume the old packet */
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -292,6 +286,14 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the env vars describing the local and remote sockets */
|
||||||
|
if (Getsockname(fd->stream.fd1, &us.soa, &uslen) < 0) {
|
||||||
|
Warn4("getsockname(%d, %p, {%d}): %s",
|
||||||
|
fd->stream.fd1, &us.soa, uslen, strerror(errno));
|
||||||
|
}
|
||||||
|
xiosetsockaddrenv("SOCK", &us, uslen, IPPROTO_UDP);
|
||||||
|
xiosetsockaddrenv("PEER", them, themlen, IPPROTO_UDP);
|
||||||
|
|
||||||
applyopts_fchown(fd->stream.fd1, opts);
|
applyopts_fchown(fd->stream.fd1, opts);
|
||||||
applyopts(fd->stream.fd1, opts, PH_LATE);
|
applyopts(fd->stream.fd1, opts, PH_LATE);
|
||||||
|
|
||||||
|
@ -313,6 +315,8 @@ int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
|
||||||
argv[0], argc-1);
|
argv[0], argc-1);
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retropt_socket_pf(opts, &pf);
|
||||||
if ((result = _xioopen_udp_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
if ((result = _xioopen_udp_sendto(argv[1], argv[2], opts, xioflags, xxfd,
|
||||||
groups, pf, socktype, ipproto))
|
groups, pf, socktype, ipproto))
|
||||||
!= STAT_OK) {
|
!= STAT_OK) {
|
||||||
|
@ -322,6 +326,12 @@ int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_OK;
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
applies and consumes the following option:
|
||||||
|
PH_INIT, PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_CONNECTED, PH_LATE
|
||||||
|
OFUNC_OFFSET
|
||||||
|
OPT_BIND, OPT_SOURCEPORT, OPT_LOWPORT, OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_USER, OPT_GROUP, OPT_CLOEXEC
|
||||||
|
*/
|
||||||
static
|
static
|
||||||
int _xioopen_udp_sendto(const char *hostname, const char *servname,
|
int _xioopen_udp_sendto(const char *hostname, const char *servname,
|
||||||
struct opt *opts,
|
struct opt *opts,
|
||||||
|
@ -421,6 +431,7 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retropt_socket_pf(opts, &pf);
|
||||||
result =
|
result =
|
||||||
_xioopen_udp_sendto(hostname, argv[2], opts, xioflags, xxfd, groups,
|
_xioopen_udp_sendto(hostname, argv[2], opts, xioflags, xxfd, groups,
|
||||||
pf, socktype, ipproto);
|
pf, socktype, ipproto);
|
||||||
|
@ -440,7 +451,7 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
|
||||||
/* which reply packets will be accepted - determine by range option */
|
/* which reply packets will be accepted - determine by range option */
|
||||||
if (retropt_string(opts, OPT_RANGE, &rangename)
|
if (retropt_string(opts, OPT_RANGE, &rangename)
|
||||||
>= 0) {
|
>= 0) {
|
||||||
if (parserange(rangename, pf, &xfd->para.socket.range) < 0) {
|
if (xioparserange(rangename, pf, &xfd->para.socket.range) < 0) {
|
||||||
free(rangename);
|
free(rangename);
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +608,7 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
#if WITH_IP4 /*|| WITH_IP6*/
|
#if WITH_IP4 /*|| WITH_IP6*/
|
||||||
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
|
||||||
if (parserange(rangename, pf, &xfd->stream.para.socket.range) < 0) {
|
if (xioparserange(rangename, pf, &xfd->stream.para.socket.range) < 0) {
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
xfd->stream.para.socket.dorange = true;
|
xfd->stream.para.socket.dorange = true;
|
||||||
|
|
682
xio-unix.c
682
xio-unix.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-unix.c */
|
/* source: xio-unix.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening addresses of UNIX socket type */
|
/* this file contains the source for opening addresses of UNIX socket type */
|
||||||
|
@ -15,85 +15,85 @@
|
||||||
|
|
||||||
#if WITH_UNIX
|
#if WITH_UNIX
|
||||||
|
|
||||||
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
/* to avoid unneccessary "live" if () conditionals when no abstract support is
|
||||||
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
compiled in (or at least to give optimizing compilers a good chance) we need
|
||||||
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
a constant that can be used in C expressions */
|
||||||
static int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
#if WITH_ABSTRACT_UNIXSOCKET
|
||||||
|
# define ABSTRACT 1
|
||||||
|
#else
|
||||||
|
# define ABSTRACT 0
|
||||||
|
#endif
|
||||||
|
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
|
||||||
|
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
|
||||||
|
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
|
||||||
|
static int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
|
||||||
static
|
static
|
||||||
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
|
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
int xioflags, xiofile_t *xxfd, unsigned groups,
|
||||||
int pf, int socktype, int ipproto);
|
int abstract, int dummy2, int dummy3);
|
||||||
static
|
static
|
||||||
int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
|
||||||
#if WITH_ABSTRACT_UNIXSOCKET
|
|
||||||
static int xioopen_abstract_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
|
||||||
static int xioopen_abstract_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
|
||||||
static int xioopen_abstract_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
|
||||||
static int xioopen_abstract_recvfrom(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
|
||||||
static
|
|
||||||
int xioopen_abstract_recv(int argc, const char *argv[], struct opt *opts,
|
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
|
||||||
int pf, int socktype, int ipproto);
|
|
||||||
static
|
|
||||||
int xioopen_abstract_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
|
||||||
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
|
||||||
|
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_connect1 = { XIOADDR_SYS, "unix-connect", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_connect, 0, SOCK_STREAM, 0 HELP(":<filename>") };
|
/* the first free parameter is 0 for "normal" unix domain sockets, or 1 for
|
||||||
|
abstract unix sockets (Linux); the second and third parameters are unsused */
|
||||||
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_connect1 = { XIOADDR_SYS, "unix-connect", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_connect, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_connect[] = { (union xioaddr_desc *)&xioendpoint_unix_connect1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_connect[] = { (union xioaddr_desc *)&xioendpoint_unix_connect1, NULL };
|
||||||
|
|
||||||
#if WITH_LISTEN
|
#if WITH_LISTEN
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_listen1 = { XIOADDR_SYS, "unix-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_listen, 0, SOCK_STREAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_listen1 = { XIOADDR_SYS, "unix-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_listen, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_listen[] = { (union xioaddr_desc *)&xioendpoint_unix_listen1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_listen[] = { (union xioaddr_desc *)&xioendpoint_unix_listen1, NULL };
|
||||||
#endif /* WITH_LISTEN */
|
#endif /* WITH_LISTEN */
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_sendto1 = { XIOADDR_SYS, "unix-sendto", 1, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_sendto, 0, SOCK_DGRAM, 0 HELP(":<filename>") };
|
|
||||||
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_sendto1 = { XIOADDR_SYS, "unix-sendto", 1, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_sendto, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_sendto[] = { (union xioaddr_desc *)&xioendpoint_unix_sendto1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_sendto[] = { (union xioaddr_desc *)&xioendpoint_unix_sendto1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_recvfrom1= { XIOADDR_SYS, "unix-recvfrom",1, XIOBIT_RDONLY|XIOBIT_RDWR, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recvfrom, PF_UNIX, SOCK_DGRAM, 0 HELP(":<filename>") };
|
|
||||||
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_recvfrom1= { XIOADDR_SYS, "unix-recvfrom",1, XIOBIT_RDONLY|XIOBIT_RDWR, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recvfrom, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_recvfrom[]= { (union xioaddr_desc *)&xioendpoint_unix_recvfrom1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_recvfrom[]= { (union xioaddr_desc *)&xioendpoint_unix_recvfrom1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_recv1 = { XIOADDR_SYS, "unix-recv", 1, XIOBIT_RDONLY, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recv, PF_UNIX, SOCK_DGRAM, 0 HELP(":<filename>") };
|
|
||||||
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_recv1 = { XIOADDR_SYS, "unix-recv", 1, XIOBIT_RDONLY, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recv, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_recv[] = { (union xioaddr_desc *)&xioendpoint_unix_recv1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_recv[] = { (union xioaddr_desc *)&xioendpoint_unix_recv1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_unix_client1 = { XIOADDR_SYS, "unix-client", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_client, PF_UNIX, 0, 0 HELP(":<filename>") };
|
|
||||||
|
static const struct xioaddr_endpoint_desc xioendpoint_unix_client1 = { XIOADDR_SYS, "unix-client", 1, XIOBIT_ALL, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_client, 0, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_unix_client[] = { (union xioaddr_desc *)&xioendpoint_unix_client1, NULL };
|
const union xioaddr_desc *xioaddrs_unix_client[] = { (union xioaddr_desc *)&xioendpoint_unix_client1, NULL };
|
||||||
|
|
||||||
#if WITH_ABSTRACT_UNIXSOCKET
|
#if WITH_ABSTRACT_UNIXSOCKET
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_connect1 = { XIOADDR_SYS, "abstract-connect", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_abstract_connect, 0, SOCK_STREAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_connect1 = { XIOADDR_SYS, "abstract-connect", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_connect, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_connect[] = { (union xioaddr_desc *)&xioendpoint_abstract_connect1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_connect[] = { (union xioaddr_desc *)&xioendpoint_abstract_connect1, NULL };
|
||||||
#if WITH_LISTEN
|
#if WITH_LISTEN
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_listen1 = { XIOADDR_SYS, "abstract-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_abstract_listen, 0, SOCK_STREAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_listen1 = { XIOADDR_SYS, "abstract-listen", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_listen, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_listen[] = { (union xioaddr_desc *)&xioendpoint_abstract_listen1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_listen[] = { (union xioaddr_desc *)&xioendpoint_abstract_listen1, NULL };
|
||||||
#endif /* WITH_LISTEN */
|
#endif /* WITH_LISTEN */
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_sendto1 = { XIOADDR_SYS, "abstract-sendto", 1, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_abstract_sendto, 0, SOCK_DGRAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_sendto1 = { XIOADDR_SYS, "abstract-sendto", 1, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_sendto, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_sendto[] = { (union xioaddr_desc *)&xioendpoint_abstract_sendto1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_sendto[] = { (union xioaddr_desc *)&xioendpoint_abstract_sendto1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_recvfrom1= { XIOADDR_SYS, "abstract-recvfrom", 1, XIOBIT_RDONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_abstract_recvfrom, PF_UNIX, SOCK_DGRAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_recvfrom1= { XIOADDR_SYS, "abstract-recvfrom", 1, XIOBIT_RDONLY|XIOBIT_RDWR, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recvfrom, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_recvfrom[] = { (union xioaddr_desc *)&xioendpoint_abstract_recvfrom1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_recvfrom[] = { (union xioaddr_desc *)&xioendpoint_abstract_recvfrom1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_recv1 = { XIOADDR_SYS, "abstract-recv", 1, XIOBIT_RDONLY, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_abstract_recv, PF_UNIX, SOCK_DGRAM, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_recv1 = { XIOADDR_SYS, "abstract-recv", 1, XIOBIT_RDONLY, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_NONE, xioopen_unix_recv, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_recv[] = { (union xioaddr_desc *)&xioendpoint_abstract_recv1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_recv[] = { (union xioaddr_desc *)&xioendpoint_abstract_recv1, NULL };
|
||||||
static const struct xioaddr_endpoint_desc xioendpoint_abstract_client1 = { XIOADDR_SYS, "abstract-client", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_abstract_client, PF_UNIX, 0, 0 HELP(":<filename>") };
|
static const struct xioaddr_endpoint_desc xioendpoint_abstract_client1 = { XIOADDR_SYS, "abstract-client", 1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_unix_client, 1, 0, 0 HELP(":<filename>") };
|
||||||
const union xioaddr_desc *xioaddrs_abstract_client[] = { (union xioaddr_desc *)&xioendpoint_abstract_client1, NULL };
|
const union xioaddr_desc *xioaddrs_abstract_client[] = { (union xioaddr_desc *)&xioendpoint_abstract_client1, NULL };
|
||||||
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
|
||||||
const struct optdesc opt_unix_tightsocklen = { "unix-tightsocklen", "tightsocklen", OPT_UNIX_TIGHTSOCKLEN, GROUP_SOCK_UNIX, PH_INIT, TYPE_BOOL, OFUNC_SPEC, 0, 0 };
|
const struct optdesc xioopt_unix_tightsocklen = { "unix-tightsocklen", "tightsocklen", OPT_UNIX_TIGHTSOCKLEN, GROUP_SOCK_UNIX, PH_INIT, TYPE_BOOL, OFUNC_SPEC, 0, 0 };
|
||||||
|
|
||||||
|
|
||||||
|
/* fills the socket address struct and returns its effective length.
|
||||||
|
abstract is usually 0; != 0 generates an abstract socket address on Linux.
|
||||||
|
tight!=0 calculates the resulting length from the path length, not from the
|
||||||
|
structures length; this is more common.
|
||||||
|
the struct need not be initialized when calling this function.
|
||||||
|
*/
|
||||||
socklen_t
|
socklen_t
|
||||||
xiosetunix(struct sockaddr_un *saun,
|
xiosetunix(int pf,
|
||||||
|
struct sockaddr_un *saun,
|
||||||
const char *path,
|
const char *path,
|
||||||
bool abstract,
|
bool abstract,
|
||||||
bool tight) {
|
bool tight) {
|
||||||
size_t pathlen;
|
size_t pathlen;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
|
|
||||||
if (!abstract) {
|
socket_un_init(saun);
|
||||||
if ((pathlen = strlen(path)) > sizeof(saun->sun_path)) {
|
#ifdef WITH_ABSTRACT_UNIXSOCKET
|
||||||
Warn2("unix socket address "F_Zu" characters long, truncating to "F_Zu"",
|
if (abstract) {
|
||||||
pathlen, sizeof(saun->sun_path));
|
|
||||||
}
|
|
||||||
strncpy(saun->sun_path, path, sizeof(saun->sun_path));
|
|
||||||
if (tight) {
|
|
||||||
len = sizeof(struct sockaddr_un)-sizeof(saun->sun_path)+
|
|
||||||
MIN(pathlen, sizeof(saun->sun_path));
|
|
||||||
} else {
|
|
||||||
len = sizeof(struct sockaddr_un);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((pathlen = strlen(path)) >= sizeof(saun->sun_path)) {
|
if ((pathlen = strlen(path)) >= sizeof(saun->sun_path)) {
|
||||||
Warn2("socket address "F_Zu" characters long, truncating to "F_Zu"",
|
Warn2("socket address "F_Zu" characters long, truncating to "F_Zu"",
|
||||||
pathlen+1, sizeof(saun->sun_path));
|
pathlen+1, sizeof(saun->sun_path));
|
||||||
|
@ -103,18 +103,41 @@ xiosetunix(struct sockaddr_un *saun,
|
||||||
if (tight) {
|
if (tight) {
|
||||||
len = sizeof(struct sockaddr_un)-sizeof(saun->sun_path)+
|
len = sizeof(struct sockaddr_un)-sizeof(saun->sun_path)+
|
||||||
MIN(pathlen+1, sizeof(saun->sun_path));
|
MIN(pathlen+1, sizeof(saun->sun_path));
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
saun->sun_len = len;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
len = sizeof(struct sockaddr_un);
|
len = sizeof(struct sockaddr_un);
|
||||||
}
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
|
||||||
|
if ((pathlen = strlen(path)) > sizeof(saun->sun_path)) {
|
||||||
|
Warn2("unix socket address "F_Zu" characters long, truncating to "F_Zu"",
|
||||||
|
pathlen, sizeof(saun->sun_path));
|
||||||
|
}
|
||||||
|
strncpy(saun->sun_path, path, sizeof(saun->sun_path));
|
||||||
|
if (tight) {
|
||||||
|
len = sizeof(struct sockaddr_un)-sizeof(saun->sun_path)+
|
||||||
|
MIN(pathlen, sizeof(saun->sun_path));
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
saun->sun_len = len;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
len = sizeof(struct sockaddr_un);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_LISTEN
|
#if WITH_LISTEN
|
||||||
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
|
||||||
/* we expect the form: filename */
|
/* we expect the form: filename */
|
||||||
const char *name;
|
const char *name;
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = SOCK_STREAM;
|
||||||
|
int protocol = 0;
|
||||||
struct sockaddr_un us;
|
struct sockaddr_un us;
|
||||||
socklen_t uslen;
|
socklen_t uslen;
|
||||||
bool tight = true;
|
bool tight = true;
|
||||||
|
@ -129,48 +152,48 @@ static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, i
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_un_init(&us);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
uslen = xiosetunix(&us, name, false, tight);
|
retropt_socket_pf(opts, &pf);
|
||||||
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
|
uslen = xiosetunix(pf, &us, name, abstract, tight);
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
if (!(ABSTRACT && abstract)) {
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
/* only for non abstract because abstract do not work in file system */
|
||||||
|
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
||||||
if (opt_unlink_close) {
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
if ((xfd->unlink_close = strdup(name)) == NULL) {
|
if (opt_unlink_close) {
|
||||||
Error1("strdup(\"%s\"): out of memory", name);
|
if ((xfd->unlink_close = strdup(name)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", name);
|
||||||
|
}
|
||||||
|
xfd->opt_unlink_close = true;
|
||||||
}
|
}
|
||||||
xfd->opt_unlink_close = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
applyopts(-1, opts, PH_INIT);
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
applyopts(-1, opts, PH_EARLY);
|
applyopts(-1, opts, PH_EARLY);
|
||||||
|
|
||||||
if (opt_unlink_early) {
|
if (!(ABSTRACT && abstract)) {
|
||||||
if (Unlink(name) < 0) {
|
if (opt_unlink_early) {
|
||||||
if (errno == ENOENT) {
|
if (Unlink(name) < 0) {
|
||||||
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
if (errno == ENOENT) {
|
||||||
} else {
|
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
} else {
|
||||||
|
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* trying to set user-early, perm-early etc. here is useless because
|
||||||
|
file system entry is available only past bind() call. */
|
||||||
|
applyopts_named(name, opts, PH_EARLY); /* umask! */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trying to set user-early, perm-early etc. here is useless because
|
|
||||||
file system entry is available only past bind() call. */
|
|
||||||
applyopts_named(name, opts, PH_EARLY); /* umask! */
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
opts0 = copyopts(opts, GROUP_ALL);
|
opts0 = copyopts(opts, GROUP_ALL);
|
||||||
|
|
||||||
if ((result =
|
if ((result =
|
||||||
xioopen_listen(xfd, xioflags,
|
xioopen_listen(xfd, xioflags,
|
||||||
(struct sockaddr *)&us, uslen,
|
(struct sockaddr *)&us, uslen,
|
||||||
opts, opts0, PF_UNIX, socktype, 0))
|
opts, opts0, pf, socktype, protocol))
|
||||||
!= 0)
|
!= 0)
|
||||||
return result;
|
return result;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -178,10 +201,13 @@ static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, i
|
||||||
#endif /* WITH_LISTEN */
|
#endif /* WITH_LISTEN */
|
||||||
|
|
||||||
|
|
||||||
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
|
||||||
/* we expect the form: filename */
|
/* we expect the form: filename */
|
||||||
const char *name;
|
const char *name;
|
||||||
struct single *xfd = &xxfd->stream;
|
struct single *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = SOCK_STREAM;
|
||||||
|
int protocol = 0;
|
||||||
struct sockaddr_un them, us;
|
struct sockaddr_un them, us;
|
||||||
socklen_t themlen, uslen;
|
socklen_t themlen, uslen;
|
||||||
bool tight = true;
|
bool tight = true;
|
||||||
|
@ -195,15 +221,15 @@ static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_un_init(&us);
|
|
||||||
socket_un_init(&them);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
themlen = xiosetunix(&them, name, false, tight);
|
retropt_socket_pf(opts, &pf);
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
|
themlen = xiosetunix(pf, &them, name, abstract, tight);
|
||||||
if (retropt_bind(opts, AF_UNIX, socktype, 0, (struct sockaddr *)&us, &uslen, 0, 0, 0)
|
if (!(ABSTRACT && abstract)) {
|
||||||
|
/* only for non abstract because abstract do not work in file system */
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
}
|
||||||
|
if (retropt_bind(opts, pf, socktype, protocol, (struct sockaddr *)&us, &uslen, 0, 0, 0)
|
||||||
!= STAT_NOACTION) {
|
!= STAT_NOACTION) {
|
||||||
needbind = true;
|
needbind = true;
|
||||||
}
|
}
|
||||||
|
@ -223,23 +249,26 @@ static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
xioopen_connect(xfd,
|
xioopen_connect(xfd,
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
needbind?(struct sockaddr *)&us:NULL, uslen,
|
||||||
(struct sockaddr *)&them, themlen,
|
(struct sockaddr *)&them, themlen,
|
||||||
opts, PF_UNIX, socktype, 0, false)) != 0) {
|
opts, pf, socktype, protocol, false)) != 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return 0;
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy, int dummy3) {
|
||||||
|
/* we expect the form: filename */
|
||||||
const char *name;
|
const char *name;
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = SOCK_DGRAM;
|
||||||
|
int protocol = 0;
|
||||||
union sockaddr_union us;
|
union sockaddr_union us;
|
||||||
socklen_t uslen;
|
socklen_t uslen;
|
||||||
bool tight = true;
|
bool tight = true;
|
||||||
int pf = PF_UNIX;
|
|
||||||
bool needbind = false;
|
bool needbind = false;
|
||||||
bool opt_unlink_close = false;
|
bool opt_unlink_close = false;
|
||||||
|
|
||||||
|
@ -256,13 +285,17 @@ static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, i
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
xfd->salen = xiosetunix(&xfd->peersa.un, name, false, tight);
|
retropt_socket_pf(opts, &pf);
|
||||||
|
xfd->salen = xiosetunix(pf, &xfd->peersa.un, name, abstract, tight);
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
if (!(ABSTRACT && abstract)) {
|
||||||
|
/* only for non abstract because abstract do not work in file system */
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
}
|
||||||
|
|
||||||
xfd->dtype = XIODATA_RECVFROM;
|
xfd->dtype = XIODATA_RECVFROM;
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, 0, &us.soa, &uslen, 0, 0, 0)
|
if (retropt_bind(opts, pf, socktype, protocol, &us.soa, &uslen, 0, 0, 0)
|
||||||
!= STAT_NOACTION) {
|
!= STAT_NOACTION) {
|
||||||
needbind = true;
|
needbind = true;
|
||||||
}
|
}
|
||||||
|
@ -279,15 +312,21 @@ static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, i
|
||||||
|
|
||||||
return
|
return
|
||||||
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
||||||
opts, xioflags, xfd, groups, pf, socktype, 0);
|
opts, xioflags, xfd, groups,
|
||||||
|
pf, socktype, protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
|
int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
int xioflags, xiofile_t *xxfd, unsigned groups,
|
||||||
int pf, int socktype, int dummy3) {
|
int abstract, int dummy2, int dummy3) {
|
||||||
|
/* we expect the form: filename */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = SOCK_DGRAM;
|
||||||
|
int protocol = 0;
|
||||||
struct sockaddr_un us;
|
struct sockaddr_un us;
|
||||||
socklen_t uslen;
|
socklen_t uslen;
|
||||||
bool tight = true;
|
bool tight = true;
|
||||||
|
@ -301,48 +340,60 @@ int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_un_init(&us);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
uslen = xiosetunix(&us, name, false, tight);
|
retropt_socket_pf(opts, &pf);
|
||||||
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
|
uslen = xiosetunix(pf, &us, name, abstract, tight);
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
||||||
retropt_bind(opts, pf, socktype, 0, (struct sockaddr *)&us, &uslen, 1, 0, 0);
|
|
||||||
|
retropt_bind(opts, pf, socktype, protocol, (struct sockaddr *)&us, &uslen,
|
||||||
|
1, 0, 0);
|
||||||
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
|
||||||
if (opt_unlink_close) {
|
if (!(ABSTRACT && abstract)) {
|
||||||
if ((xfd->stream.unlink_close = strdup(name)) == NULL) {
|
/* only for non abstract because abstract do not work in file system */
|
||||||
Error1("strdup(\"%s\"): out of memory", name);
|
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
if (opt_unlink_close) {
|
||||||
|
if ((xfd->unlink_close = strdup(name)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", name);
|
||||||
|
}
|
||||||
|
xfd->opt_unlink_close = true;
|
||||||
}
|
}
|
||||||
xfd->stream.opt_unlink_close = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_unlink_early) {
|
if (opt_unlink_early) {
|
||||||
if (Unlink(name) < 0) {
|
if (Unlink(name) < 0) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xfd->stream.para.socket.la.soa.sa_family = pf;
|
xfd->para.socket.la.soa.sa_family = pf;
|
||||||
|
|
||||||
xfd->stream.dtype = XIODATA_RECVFROM_ONE;
|
xfd->dtype = XIODATA_RECVFROM_ONE;
|
||||||
return _xioopen_dgram_recvfrom(&xfd->stream, xioflags,
|
return
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
_xioopen_dgram_recvfrom(xfd, xioflags,
|
||||||
opts, pf, socktype, 0, E_ERROR);
|
needbind?(struct sockaddr *)&us:NULL, uslen,
|
||||||
|
opts, pf, socktype, protocol, E_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
|
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
int xioflags, xiofile_t *xxfd, unsigned groups,
|
||||||
int pf, int socktype, int ipproto) {
|
int abstract, int dummy2, int dummy3) {
|
||||||
|
/* we expect the form: filename */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
xiosingle_t *xfd = &xxfd->stream;
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = SOCK_DGRAM;
|
||||||
|
int protocol = 0;
|
||||||
union sockaddr_union us;
|
union sockaddr_union us;
|
||||||
socklen_t uslen;
|
socklen_t uslen;
|
||||||
bool tight = true;
|
bool tight = true;
|
||||||
|
@ -356,75 +407,96 @@ int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
socket_un_init(&us.un);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
uslen = xiosetunix(&us.un, name, false, tight);
|
retropt_socket_pf(opts, &pf);
|
||||||
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
|
uslen = xiosetunix(pf, &us.un, name, abstract, tight);
|
||||||
|
|
||||||
#if 1 /*!!! why bind option? */
|
#if 1 /*!!! why bind option? */
|
||||||
retropt_bind(opts, pf, socktype, ipproto, &us.soa, &uslen, 1, 0, 0);
|
retropt_bind(opts, pf, socktype, protocol, &us.soa, &uslen, 1, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
if (!(ABSTRACT && abstract)) {
|
||||||
if (opt_unlink_early) {
|
/* only for non abstract because abstract do not work in file system */
|
||||||
if (Unlink(name) < 0) {
|
retropt_bool(opts, OPT_UNLINK_EARLY, &opt_unlink_early);
|
||||||
if (errno == ENOENT) {
|
if (opt_unlink_early) {
|
||||||
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
if (Unlink(name) < 0) {
|
||||||
} else {
|
if (errno == ENOENT) {
|
||||||
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
Warn2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
|
} else {
|
||||||
|
Error2("unlink(\"%s\"): %s", name, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
|
||||||
if (opt_unlink_close) {
|
if (opt_unlink_close) {
|
||||||
if ((xfd->stream.unlink_close = strdup(name)) == NULL) {
|
if ((xfd->unlink_close = strdup(name)) == NULL) {
|
||||||
Error1("strdup(\"%s\"): out of memory", name);
|
Error1("strdup(\"%s\"): out of memory", name);
|
||||||
|
}
|
||||||
|
xfd->opt_unlink_close = true;
|
||||||
}
|
}
|
||||||
xfd->stream.opt_unlink_close = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xfd->stream.para.socket.la.soa.sa_family = pf;
|
xfd->para.socket.la.soa.sa_family = pf;
|
||||||
|
|
||||||
xfd->stream.dtype = XIODATA_RECV;
|
xfd->dtype = XIODATA_RECV;
|
||||||
result = _xioopen_dgram_recv(&xfd->stream, xioflags, &us.soa, uslen,
|
result = _xioopen_dgram_recv(xfd, xioflags, &us.soa, uslen,
|
||||||
opts, pf, socktype, ipproto, E_ERROR);
|
opts, pf, socktype, protocol, E_ERROR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
|
||||||
const char *name;
|
/* we expect the form: filename */
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
|
||||||
bool tight = true;
|
|
||||||
int pf = PF_UNIX;
|
|
||||||
union sockaddr_union them, us;
|
|
||||||
socklen_t themlen;
|
|
||||||
socklen_t uslen;
|
|
||||||
bool needbind = false;
|
|
||||||
bool opt_unlink_close = false;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)", argv[0], argc-1);
|
Error2("%s: wrong number of parameters (%d instead of 1)", argv[0], argc-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
return
|
||||||
|
_xioopen_unix_client(&xxfd->stream, xioflags, groups, abstract, opts,
|
||||||
|
argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
uslen = socket_init(pf, &us);
|
/* establishes communication with an existing UNIX type socket. supports stream
|
||||||
themlen = socket_init(pf, &them);
|
and datagram socket types: first tries to connect(), but when this fails it
|
||||||
|
falls back to sendto().
|
||||||
|
applies and consumes the following option:
|
||||||
|
PH_INIT, PH_PASTSOCKET, PH_FD, PH_PREBIND, PH_BIND, PH_PASTBIND,
|
||||||
|
PH_CONNECTED, PH_LATE, ?PH_CONNECT
|
||||||
|
OFUNC_OFFSET,
|
||||||
|
OPT_PROTOCOL_FAMILY, OPT_UNIX_TIGHTSOCKLEN, OPT_UNLINK_CLOSE, OPT_BIND,
|
||||||
|
OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK,
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
|
||||||
|
int abstract, struct opt *opts, const char *name) {
|
||||||
|
int pf = PF_UNIX;
|
||||||
|
int socktype = 0; /* to be determined by server socket type */
|
||||||
|
int protocol = 0;
|
||||||
|
union sockaddr_union them, us;
|
||||||
|
socklen_t themlen, uslen;
|
||||||
|
bool tight = true;
|
||||||
|
bool needbind = false;
|
||||||
|
bool opt_unlink_close = false;
|
||||||
|
struct opt *opts0;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
applyopts(-1, opts, PH_INIT);
|
||||||
|
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
||||||
|
|
||||||
|
retropt_socket_pf(opts, &pf);
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
||||||
name = argv[1];
|
themlen = xiosetunix(pf, &them.un, name, abstract, tight);
|
||||||
themlen = xiosetunix(&them.un, name, false, tight);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
if (!(ABSTRACT && abstract)) {
|
||||||
|
/* only for non abstract because abstract do not work in file system */
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
}
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, 0, &us.soa, &uslen, 0, 0, 0)
|
if (retropt_bind(opts, pf, socktype, protocol, &us.soa, &uslen, 0, 0, 0)
|
||||||
!= STAT_NOACTION) {
|
!= STAT_NOACTION) {
|
||||||
needbind = true;
|
needbind = true;
|
||||||
}
|
}
|
||||||
|
@ -436,26 +508,29 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i
|
||||||
xfd->opt_unlink_close = true;
|
xfd->opt_unlink_close = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save options, because we might have to start again */
|
||||||
|
opts0 = copyopts(opts, GROUP_ALL);
|
||||||
|
|
||||||
/* xfd->dtype = DATA_STREAM; // is default */
|
/* xfd->dtype = DATA_STREAM; // is default */
|
||||||
if ((result =
|
if ((result =
|
||||||
xioopen_connect(xfd,
|
xioopen_connect(xfd,
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
needbind?(struct sockaddr *)&us:NULL, uslen,
|
||||||
(struct sockaddr *)&them, themlen,
|
(struct sockaddr *)&them, themlen,
|
||||||
opts, PF_UNIX, socktype?socktype:SOCK_STREAM, 0, false)) != 0) {
|
opts, pf, socktype?socktype:SOCK_STREAM, protocol,
|
||||||
|
false)) != 0) {
|
||||||
if (errno == EPROTOTYPE) {
|
if (errno == EPROTOTYPE) {
|
||||||
if (needbind) {
|
if (needbind) {
|
||||||
Unlink(us.un.sun_path);
|
Unlink(us.un.sun_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
dropopts2(opts, PH_INIT, PH_SPEC); opts = opts0;
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
|
|
||||||
xfd->peersa = them;
|
xfd->peersa = them;
|
||||||
xfd->salen = sizeof(struct sockaddr_un);
|
xfd->salen = sizeof(struct sockaddr_un);
|
||||||
if ((result =
|
if ((result =
|
||||||
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
||||||
opts, xioflags, xfd, groups, pf,
|
opts, xioflags, xfd, groups,
|
||||||
socktype?socktype:SOCK_DGRAM, 0))
|
pf, socktype?socktype:SOCK_DGRAM, protocol))
|
||||||
!= 0) {
|
!= 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -469,270 +544,25 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if WITH_ABSTRACT_UNIXSOCKET
|
/* returns information that can be used for constructing an environment
|
||||||
#if WITH_LISTEN
|
variable describing the socket address.
|
||||||
static int xioopen_abstract_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
if idx is 0, this function writes "ADDR" into namebuff and the path into
|
||||||
/* we expect the form: filename */
|
valuebuff, and returns 0 (which means that no more info is there).
|
||||||
const char *name;
|
if idx is != 0, it returns -1
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
namelen and valuelen contain the max. allowed length of output chars in the
|
||||||
bool tight = true;
|
respective buffer.
|
||||||
struct sockaddr_un us;
|
on error this function returns -1.
|
||||||
socklen_t uslen;
|
*/
|
||||||
struct opt *opts0 = NULL;
|
int
|
||||||
int result;
|
xiosetsockaddrenv_unix(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
if (argc != 2) {
|
struct sockaddr_un *sa, socklen_t salen, int ipproto) {
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)",
|
if (idx != 0) {
|
||||||
argv[0], argc-1);
|
return -1;
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
}
|
||||||
|
strcpy(namebuff, "ADDR");
|
||||||
socket_un_init(&us);
|
sockaddr_unix_info(sa, salen, valuebuff, valuelen);
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
uslen = xiosetunix(&us, name, true, tight);
|
|
||||||
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
applyopts(-1, opts, PH_EARLY);
|
|
||||||
|
|
||||||
/* trying to set user-early, perm-early etc. here is useless because
|
|
||||||
file system entry is available only past bind() call. */
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
opts0 = copyopts(opts, GROUP_ALL);
|
|
||||||
|
|
||||||
if ((result =
|
|
||||||
xioopen_listen(xfd, xioflags,
|
|
||||||
(struct sockaddr *)&us, uslen,
|
|
||||||
opts, opts0, PF_UNIX, socktype, 0))
|
|
||||||
!= 0)
|
|
||||||
return result;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* WITH_LISTEN */
|
|
||||||
|
|
||||||
static int xioopen_abstract_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
|
||||||
/* we expect the form: filename */
|
|
||||||
const char *name;
|
|
||||||
struct single *xfd = &xxfd->stream;
|
|
||||||
bool tight = true;
|
|
||||||
struct sockaddr_un them, us;
|
|
||||||
socklen_t themlen, uslen;
|
|
||||||
bool needbind = false;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)",
|
|
||||||
argv[0], argc-1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
socket_un_init(&us);
|
|
||||||
socket_un_init(&them);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
themlen = xiosetunix(&them, name, true, tight);
|
|
||||||
|
|
||||||
if (retropt_bind(opts, AF_UNIX, socktype, 0, (struct sockaddr *)&us, &uslen, 0, 0, 0)
|
|
||||||
!= STAT_NOACTION) {
|
|
||||||
needbind = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
applyopts(-1, opts, PH_EARLY);
|
|
||||||
|
|
||||||
if ((result =
|
|
||||||
xioopen_connect(xfd,
|
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
|
||||||
(struct sockaddr *)&them, themlen,
|
|
||||||
opts, PF_UNIX, socktype, 0, false)) != 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int xioopen_abstract_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
|
||||||
const char *name;
|
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
|
||||||
union sockaddr_union us;
|
|
||||||
socklen_t uslen;
|
|
||||||
bool tight = true;
|
|
||||||
int pf = PF_UNIX;
|
|
||||||
bool needbind = false;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)",
|
|
||||||
argv[0], argc-1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
uslen = socket_init(pf, &us);
|
|
||||||
xfd->salen = socket_init(pf, &xfd->peersa);
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
xfd->salen = xiosetunix(&xfd->peersa.un, name, true, tight);
|
|
||||||
|
|
||||||
xfd->dtype = XIODATA_RECVFROM;
|
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, 0, &us.soa, &uslen, 0, 0, 0)
|
|
||||||
!= STAT_NOACTION) {
|
|
||||||
needbind = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
|
|
||||||
return
|
|
||||||
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
|
||||||
opts, xioflags, xfd, groups, pf, socktype, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
int xioopen_abstract_recvfrom(int argc, const char *argv[], struct opt *opts,
|
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
|
||||||
int pf, int socktype, int dummy3) {
|
|
||||||
const char *name;
|
|
||||||
struct sockaddr_un us;
|
|
||||||
socklen_t uslen;
|
|
||||||
bool tight = true;
|
|
||||||
bool needbind = true;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)",
|
|
||||||
argv[0], argc-1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
socket_un_init(&us);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
uslen = xiosetunix(&us, name, true, tight);
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
retropt_bind(opts, pf, socktype, 0, (struct sockaddr *)&us, &uslen, 1, 0, 0);
|
|
||||||
|
|
||||||
xfd->stream.para.socket.la.soa.sa_family = pf;
|
|
||||||
|
|
||||||
xfd->stream.dtype = XIODATA_RECVFROM_ONE;
|
|
||||||
return _xioopen_dgram_recvfrom(&xfd->stream, xioflags,
|
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
|
||||||
opts, pf, socktype, 0, E_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
int xioopen_abstract_recv(int argc, const char *argv[], struct opt *opts,
|
|
||||||
int xioflags, xiofile_t *xfd, unsigned groups,
|
|
||||||
int pf, int socktype, int ipproto) {
|
|
||||||
const char *name;
|
|
||||||
union sockaddr_union us;
|
|
||||||
socklen_t uslen;
|
|
||||||
bool tight = true;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)",
|
|
||||||
argv[0], argc-1);
|
|
||||||
return STAT_NORETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
socket_un_init(&us.un);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
uslen = xiosetunix(&us.un, name, true, tight);
|
|
||||||
|
|
||||||
#if 1 /*!!! why bind option? */
|
|
||||||
retropt_bind(opts, pf, socktype, ipproto, &us.soa, &uslen, 1, 0, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xfd->stream.para.socket.la.soa.sa_family = pf;
|
|
||||||
|
|
||||||
xfd->stream.dtype = XIODATA_RECV;
|
|
||||||
result = _xioopen_dgram_recv(&xfd->stream, xioflags, &us.soa, uslen,
|
|
||||||
opts, pf, socktype, ipproto, E_ERROR);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int xioopen_abstract_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int dummy1, int socktype, int dummy3) {
|
|
||||||
const char *name;
|
|
||||||
xiosingle_t *xfd = &xxfd->stream;
|
|
||||||
bool tight = true;
|
|
||||||
int pf = PF_UNIX;
|
|
||||||
union sockaddr_union them, us;
|
|
||||||
socklen_t themlen;
|
|
||||||
socklen_t uslen;
|
|
||||||
bool needbind = false;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
Error2("%s: wrong number of parameters (%d instead of 1)", argv[0], argc-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
retropt_int(opts, OPT_SO_TYPE, &socktype);
|
|
||||||
|
|
||||||
uslen = socket_init(pf, &us);
|
|
||||||
themlen = socket_init(pf, &them);
|
|
||||||
|
|
||||||
retropt_bool(opts, OPT_UNIX_TIGHTSOCKLEN, &tight);
|
|
||||||
name = argv[1];
|
|
||||||
themlen = xiosetunix(&them.un, name, true, tight);
|
|
||||||
|
|
||||||
if (retropt_bind(opts, pf, socktype, 0, &us.soa, &uslen, 0, 0, 0)
|
|
||||||
!= STAT_NOACTION) {
|
|
||||||
needbind = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* xfd->dtype = DATA_STREAM; // is default */
|
|
||||||
if ((result =
|
|
||||||
xioopen_connect(xfd,
|
|
||||||
needbind?(struct sockaddr *)&us:NULL, uslen,
|
|
||||||
(struct sockaddr *)&them, themlen,
|
|
||||||
opts, PF_UNIX, socktype?socktype:SOCK_STREAM, 0, false)) != 0) {
|
|
||||||
if (errno == EPROTOTYPE) {
|
|
||||||
if (needbind) {
|
|
||||||
Unlink(us.un.sun_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ...res_opts[] */
|
|
||||||
applyopts(-1, opts, PH_INIT);
|
|
||||||
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
|
||||||
|
|
||||||
xfd->peersa = them;
|
|
||||||
xfd->salen = themlen;
|
|
||||||
if ((result =
|
|
||||||
_xioopen_dgram_sendto(needbind?&us:NULL, uslen,
|
|
||||||
opts, xioflags, xfd, groups, pf,
|
|
||||||
socktype?socktype:SOCK_DGRAM, 0))
|
|
||||||
!= 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
xfd->dtype = XIODATA_RECVFROM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((result = _xio_openlate(xfd, opts)) < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
|
||||||
|
|
||||||
#endif /* WITH_UNIX */
|
#endif /* WITH_UNIX */
|
||||||
|
|
15
xio-unix.h
15
xio-unix.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-unix.h */
|
/* source: xio-unix.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xio_unix_h_included
|
#ifndef __xio_unix_h_included
|
||||||
|
@ -18,12 +18,21 @@ extern const union xioaddr_desc *xioaddrs_abstract_recvfrom[];
|
||||||
extern const union xioaddr_desc *xioaddrs_abstract_recv[];
|
extern const union xioaddr_desc *xioaddrs_abstract_recv[];
|
||||||
extern const union xioaddr_desc *xioaddrs_abstract_client[];
|
extern const union xioaddr_desc *xioaddrs_abstract_client[];
|
||||||
|
|
||||||
extern const struct optdesc opt_unix_tightsocklen;
|
extern const struct optdesc xioopt_unix_tightsocklen;
|
||||||
|
|
||||||
extern socklen_t
|
extern socklen_t
|
||||||
xiosetunix(struct sockaddr_un *saun,
|
xiosetunix(int pf,
|
||||||
|
struct sockaddr_un *saun,
|
||||||
const char *path,
|
const char *path,
|
||||||
bool abstract,
|
bool abstract,
|
||||||
bool tight);
|
bool tight);
|
||||||
|
extern int
|
||||||
|
xiosetsockaddrenv_unix(int idx, char *namebuff, size_t namelen,
|
||||||
|
char *valuebuff, size_t valuelen,
|
||||||
|
struct sockaddr_un *sa, socklen_t salen, int ipproto);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
|
||||||
|
int abstract, struct opt *opts, const char *name);
|
||||||
|
|
||||||
#endif /* !defined(__xio_unix_h_included) */
|
#endif /* !defined(__xio_unix_h_included) */
|
||||||
|
|
17
xio.h
17
xio.h
|
@ -180,10 +180,10 @@ struct xioaddr_inter_desc {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
struct xioaddr_endpoint_desc {
|
struct xioaddr_endpoint_desc {
|
||||||
int tag; /* 0: endpoint addr; 1: inter addr */
|
int tag; /* XIOADDR_ENDPOINT, XIOADDR_INTER */
|
||||||
const char *defname; /* main (canonical) name of address */
|
const char *defname; /* main (canonical) name of address */
|
||||||
int numparams; /* number of required parameters */
|
int numparams; /* number of required parameters */
|
||||||
int leftdirs;
|
int leftdirs; /* XIOBIT_* */
|
||||||
unsigned groups;
|
unsigned groups;
|
||||||
int howtoshut;
|
int howtoshut;
|
||||||
int howtoclose;
|
int howtoclose;
|
||||||
|
@ -337,6 +337,8 @@ typedef struct single {
|
||||||
int (*sigchild)(struct single *); /* callback after sigchild */
|
int (*sigchild)(struct single *); /* callback after sigchild */
|
||||||
} child;
|
} child;
|
||||||
pid_t ppid; /* parent pid, only if we send it signals */
|
pid_t ppid; /* parent pid, only if we send it signals */
|
||||||
|
int escape; /* escape character; -1 for no escape */
|
||||||
|
bool actescape; /* escape character found in input data */
|
||||||
pthread_t subthread; /* thread handling next inter-addr in chain */
|
pthread_t subthread; /* thread handling next inter-addr in chain */
|
||||||
union {
|
union {
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -350,7 +352,7 @@ typedef struct single {
|
||||||
union sockaddr_union la; /* local socket address */
|
union sockaddr_union la; /* local socket address */
|
||||||
bool emptyiseof; /* with dgram: empty packet means EOF */
|
bool emptyiseof; /* with dgram: empty packet means EOF */
|
||||||
bool dorange;
|
bool dorange;
|
||||||
union xiorange_union range; /* restrictions for peer address */
|
struct xiorange range; /* restrictions for peer address */
|
||||||
#if _WITH_IP4 || _WITH_IP6
|
#if _WITH_IP4 || _WITH_IP6
|
||||||
struct {
|
struct {
|
||||||
unsigned int res_opts[2]; /* bits to be set in _res.options are
|
unsigned int res_opts[2]; /* bits to be set in _res.options are
|
||||||
|
@ -532,7 +534,7 @@ union integral {
|
||||||
} u_ip_mreq;
|
} u_ip_mreq;
|
||||||
#endif
|
#endif
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
in_addr_t u_ip4addr;
|
struct in_addr u_ip4addr;
|
||||||
#endif
|
#endif
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -554,6 +556,8 @@ union integral {
|
||||||
struct opt {
|
struct opt {
|
||||||
const struct optdesc *desc;
|
const struct optdesc *desc;
|
||||||
union integral value;
|
union integral value;
|
||||||
|
union integral value2;
|
||||||
|
union integral value3;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
/* with threading, the arguments indirectly passed to xioengine() */
|
/* with threading, the arguments indirectly passed to xioengine() */
|
||||||
|
@ -578,11 +582,14 @@ extern xiofile_t *sock[XIO_MAXSOCK];
|
||||||
not even by external changes correctable */
|
not even by external changes correctable */
|
||||||
|
|
||||||
extern int xioinitialize(int xioflags);
|
extern int xioinitialize(int xioflags);
|
||||||
|
extern int xioinitialize2(void);
|
||||||
|
extern pid_t xio_fork(bool subchild, int level);
|
||||||
extern int xio_forked_inchild(void);
|
extern int xio_forked_inchild(void);
|
||||||
extern int xiosetopt(char what, const char *arg);
|
extern int xiosetopt(char what, const char *arg);
|
||||||
extern int xioinqopt(char what, char *arg, size_t n);
|
extern int xioinqopt(char what, char *arg, size_t n);
|
||||||
extern xiofile_t *xioopen(const char *args, int xioflags);
|
extern xiofile_t *xioopen(const char *args, int xioflags);
|
||||||
extern xiofile_t *xioopenx(const char *addr, int xioflags, int infd, int outfd);extern int xiosocketpair(xiofile_t **xfd1p, xiofile_t **xfd2p, int how, ...);
|
extern xiofile_t *xioopenx(const char *addr, int xioflags, int infd, int outfd);
|
||||||
|
extern int xiosocketpair2(xiofile_t **xfd1p, xiofile_t **xfd2p, int how, ...);
|
||||||
|
|
||||||
extern int xioopensingle(char *addr, xiosingle_t *fd, int xioflags);
|
extern int xioopensingle(char *addr, xiosingle_t *fd, int xioflags);
|
||||||
extern int xioopenhelp(FILE *of, int level);
|
extern int xioopenhelp(FILE *of, int level);
|
||||||
|
|
20
xioclose.c
20
xioclose.c
|
@ -47,15 +47,6 @@ int xioclose1(struct single *pipe) {
|
||||||
break;
|
break;
|
||||||
#endif /* WITH_OPENSSL */
|
#endif /* WITH_OPENSSL */
|
||||||
|
|
||||||
#if WITH_TERMIOS
|
|
||||||
if (pipe->ttyvalid) {
|
|
||||||
if (Tcsetattr(pipe->fd1, 0, &pipe->savetty) < 0) {
|
|
||||||
Warn2("cannot restore terminal settings on fd %d: %s",
|
|
||||||
pipe->fd1, strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* WITH_TERMIOS */
|
|
||||||
|
|
||||||
case XIOCLOSE_SIGTERM:
|
case XIOCLOSE_SIGTERM:
|
||||||
if (pipe->child.pid > 0) {
|
if (pipe->child.pid > 0) {
|
||||||
if (Kill(pipe->child.pid, SIGTERM) < 0) {
|
if (Kill(pipe->child.pid, SIGTERM) < 0) {
|
||||||
|
@ -94,10 +85,19 @@ int xioclose1(struct single *pipe) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Error2("xioclose(): bad end action 0x%x on 0x%x", pipe->howtoclose, pipe);
|
Error2("xioclose(): bad close action 0x%x on 0x%x", pipe->howtoclose, pipe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_TERMIOS
|
||||||
|
if (pipe->ttyvalid) {
|
||||||
|
if (Tcsetattr(pipe->fd1, 0, &pipe->savetty) < 0) {
|
||||||
|
Warn2("cannot restore terminal settings on fd %d: %s",
|
||||||
|
pipe->fd1, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_TERMIOS */
|
||||||
|
|
||||||
/* unlock */
|
/* unlock */
|
||||||
if (pipe->havelock) {
|
if (pipe->havelock) {
|
||||||
xiounlock(pipe->lock.lockfile);
|
xiounlock(pipe->lock.lockfile);
|
||||||
|
|
14
xioconfig.h
14
xioconfig.h
|
@ -1,5 +1,5 @@
|
||||||
/* source: xioconfig.h */
|
/* source: xioconfig.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xioconfig_h_included
|
#ifndef __xioconfig_h_included
|
||||||
|
@ -20,6 +20,10 @@
|
||||||
# define WITH_NAMED 1
|
# define WITH_NAMED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WITH_TERMIOS || WITH_PTY || WITH_READLINE
|
||||||
|
# define _WITH_TERMIOS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if WITH_SOCKS4A
|
#if WITH_SOCKS4A
|
||||||
# define _WITH_SOCKS4 1
|
# define _WITH_SOCKS4 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,7 +58,7 @@
|
||||||
# define _WITH_UNIX 1
|
# define _WITH_UNIX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WITH_IP4 || WITH_IP6 || WITH_SOCKS4 || WITH_RAWIP || _WITH_UNIX
|
#if _WITH_UNIX || WITH_IP4 || WITH_IP6 || WITH_SOCKS4 || WITH_RAWIP || WITH_GENERICSOCKET
|
||||||
# define WITH_SOCKET 1
|
# define WITH_SOCKET 1
|
||||||
#else
|
#else
|
||||||
# undef WITH_SOCKET
|
# undef WITH_SOCKET
|
||||||
|
@ -68,7 +72,7 @@
|
||||||
# undef WITH_LIBWRAP
|
# undef WITH_LIBWRAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WITH_SOCKET || WITH_TUN
|
#if WITH_GENERICSOCKET || WITH_TUN
|
||||||
# define _WITH_SOCKET 1
|
# define _WITH_SOCKET 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -131,4 +135,8 @@
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_TYPE_SA_FAMILY_T
|
||||||
|
typedef uint16_t sa_family_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !defined(__xioconfig_h_included) */
|
#endif /* !defined(__xioconfig_h_included) */
|
||||||
|
|
205
xioengine.c
205
xioengine.c
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* source: xioengine.c */
|
||||||
/* Copyright Gerhard Rieger 2007 */
|
/* Copyright Gerhard Rieger 2007-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this is the source file of the socat transfer loop/engine */
|
/* this is the source file of the socat transfer loop/engine */
|
||||||
|
@ -17,8 +17,9 @@
|
||||||
returns >0 if child died and left data
|
returns >0 if child died and left data
|
||||||
*/
|
*/
|
||||||
int childleftdata(xiofile_t *xfd) {
|
int childleftdata(xiofile_t *xfd) {
|
||||||
fd_set in, out, expt;
|
struct pollfd in;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* have to check if a child process died before, but left read data */
|
/* have to check if a child process died before, but left read data */
|
||||||
if (XIO_READABLE(xfd) &&
|
if (XIO_READABLE(xfd) &&
|
||||||
(XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_SIGTERM ||
|
(XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_SIGTERM ||
|
||||||
|
@ -26,35 +27,29 @@ int childleftdata(xiofile_t *xfd) {
|
||||||
XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_CLOSE_SIGTERM ||
|
XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_CLOSE_SIGTERM ||
|
||||||
XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_CLOSE_SIGKILL) &&
|
XIO_RDSTREAM(xfd)->howtoclose == XIOCLOSE_CLOSE_SIGKILL) &&
|
||||||
XIO_RDSTREAM(xfd)->child.pid == 0) {
|
XIO_RDSTREAM(xfd)->child.pid == 0) {
|
||||||
struct timeval time0 = { 0,0 };
|
struct timeval timeout = { 0,0 };
|
||||||
|
|
||||||
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&expt);
|
|
||||||
if (XIO_READABLE(xfd) && !(XIO_RDSTREAM(xfd)->eof >= 2 && !XIO_RDSTREAM(xfd)->ignoreeof)) {
|
if (XIO_READABLE(xfd) && !(XIO_RDSTREAM(xfd)->eof >= 2 && !XIO_RDSTREAM(xfd)->ignoreeof)) {
|
||||||
FD_SET(XIO_GETRDFD(xfd), &in);
|
in.fd = XIO_GETRDFD(xfd);
|
||||||
/*0 FD_SET(XIO_GETRDFD(xfd), &expt);*/
|
in.events = POLLIN/*|POLLRDBAND*/;
|
||||||
|
in.revents = 0;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
retval = Select(FD_SETSIZE, &in, &out, &expt, &time0);
|
retval = xiopoll(&in, 1, &timeout);
|
||||||
} while (retval < 0 && errno == EINTR);
|
} while (retval < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
#if HAVE_FDS_BITS
|
Error5("xiopoll({%d,%0o}, 1, {"F_tv_sec"."F_tv_usec"}): %s",
|
||||||
Error5("select(%d, &0x%lx, &0x%lx, &0x%lx, {0}): %s",
|
in.fd, in.events, timeout.tv_sec, timeout.tv_usec,
|
||||||
FD_SETSIZE, in.fds_bits[0], out.fds_bits[0],
|
strerror(errno));
|
||||||
expt.fds_bits[0], strerror(errno));
|
return -1;
|
||||||
#else
|
}
|
||||||
Error5("select(%d, &0x%lx, &0x%lx, &0x%lx, {0}): %s",
|
if (retval == 0) {
|
||||||
FD_SETSIZE, in.__fds_bits[0], out.__fds_bits[0],
|
Info("terminated child did not leave data for us");
|
||||||
expt.__fds_bits[0], strerror(errno));
|
XIO_RDSTREAM(xfd)->eof = 2;
|
||||||
#endif
|
xfd->stream.eof = 2;
|
||||||
return -1;
|
xfd->stream.closing = MAX(xfd->stream.closing, 1);
|
||||||
} else if (retval == 0) {
|
|
||||||
Info("terminated child did not leave data for us");
|
|
||||||
XIO_RDSTREAM(xfd)->eof = 2;
|
|
||||||
xfd->stream.eof = 2;
|
|
||||||
/*0 closing = MAX(closing, 1);*/
|
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +67,11 @@ void *xioengine(void *thread_arg) {
|
||||||
returns -1 on error or 0 on success */
|
returns -1 on error or 0 on success */
|
||||||
int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
xiofile_t *sock1, *sock2;
|
xiofile_t *sock1, *sock2;
|
||||||
fd_set in, out, expt;
|
struct pollfd fds[4],
|
||||||
|
*fd1in = &fds[0],
|
||||||
|
*fd1out = &fds[1],
|
||||||
|
*fd2in = &fds[2],
|
||||||
|
*fd2out = &fds[3];
|
||||||
int retval;
|
int retval;
|
||||||
unsigned char *buff;
|
unsigned char *buff;
|
||||||
ssize_t bytes1, bytes2;
|
ssize_t bytes1, bytes2;
|
||||||
|
@ -134,19 +133,17 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
XIO_RDSTREAM(sock2)->eof <= 1) {
|
XIO_RDSTREAM(sock2)->eof <= 1) {
|
||||||
struct timeval timeout, *to = NULL;
|
struct timeval timeout, *to = NULL;
|
||||||
|
|
||||||
Debug4("data loop: sock1->eof=%d, sock2->eof=%d, 1->closing=%d, 2->closing=%d",
|
Debug4("data loop: sock1->eof=%d, sock2->eof=%d, 1->closing=%d, 2->closing=%d, wasaction=%d, total_to={"F_tv_sec"."F_tv_usec"}",
|
||||||
XIO_RDSTREAM(sock1)->eof, XIO_RDSTREAM(sock2)->eof,
|
XIO_RDSTREAM(sock1)->eof, XIO_RDSTREAM(sock2)->eof,
|
||||||
sock1->stream.closing, sock2->stream.closing);
|
sock1->stream.closing, sock2->stream.closing);
|
||||||
Debug3("wasaction=%d, total_to={"F_tv_sec"."F_tv_usec"}",
|
Debug6("wasaction=%d, total_to={"F_tv_sec"."F_tv_usec"}",
|
||||||
wasaction, total_timeout.tv_sec, total_timeout.tv_usec);
|
wasaction, total_timeout.tv_sec, total_timeout.tv_usec, wasaction,
|
||||||
|
total_timeout.tv_sec, total_timeout.tv_usec);
|
||||||
|
|
||||||
/* for ignoreeof */
|
/* for ignoreeof */
|
||||||
if (polling) {
|
if (polling) {
|
||||||
if (!wasaction) {
|
if (!wasaction) {
|
||||||
/* yes we could do it with select but I like readable trace output */
|
/* yes we could do it with select but I like readable trace output */
|
||||||
if (xioparams->pollintv.tv_sec) Sleep(xioparams->pollintv.tv_sec);
|
|
||||||
if (xioparams->pollintv.tv_usec) Usleep(xioparams->pollintv.tv_usec);
|
|
||||||
|
|
||||||
if (xioparams->total_timeout.tv_sec != 0 ||
|
if (xioparams->total_timeout.tv_sec != 0 ||
|
||||||
xioparams->total_timeout.tv_usec != 0) {
|
xioparams->total_timeout.tv_usec != 0) {
|
||||||
if (total_timeout.tv_usec < xioparams->pollintv.tv_usec) {
|
if (total_timeout.tv_usec < xioparams->pollintv.tv_usec) {
|
||||||
|
@ -185,12 +182,13 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
/* first eof already occurred, start end timer */
|
/* first eof already occurred, start end timer */
|
||||||
timeout = xioparams->closwait;
|
timeout = xioparams->closwait;
|
||||||
to = &timeout;
|
to = &timeout;
|
||||||
|
/*0 closing = 2;*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* frame 1: set the poll parameters and loop over poll() EINTR) */
|
||||||
do {
|
do {
|
||||||
int _errno;
|
int _errno;
|
||||||
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&expt);
|
|
||||||
|
|
||||||
childleftdata(sock1);
|
childleftdata(sock1);
|
||||||
childleftdata(sock2);
|
childleftdata(sock2);
|
||||||
|
@ -216,35 +214,66 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* use the ignoreeof timeout if appropriate */
|
||||||
|
if (polling) {
|
||||||
|
if ((sock1->stream.closing == 0 && sock2->stream.closing == 0) ||
|
||||||
|
(xioparams->pollintv.tv_sec < timeout.tv_sec) ||
|
||||||
|
((xioparams->pollintv.tv_sec == timeout.tv_sec) &&
|
||||||
|
xioparams->pollintv.tv_usec < timeout.tv_usec)) {
|
||||||
|
timeout = xioparams->pollintv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now the fds will be assigned */
|
||||||
if (XIO_READABLE(sock1) &&
|
if (XIO_READABLE(sock1) &&
|
||||||
!(XIO_RDSTREAM(sock1)->eof > 1 && !XIO_RDSTREAM(sock1)->ignoreeof)
|
!(XIO_RDSTREAM(sock1)->eof > 1 && !XIO_RDSTREAM(sock1)->ignoreeof)
|
||||||
/*0 && !xioparams->righttoleft*/) {
|
/*0 && !xioparams->righttoleft*/) {
|
||||||
Debug3("*** sock1: %p [%d,%d]", sock1, XIO_GETRDFD(sock1), XIO_GETWRFD(sock1));
|
Debug3("*** sock1: %p [%d,%d]", sock1, XIO_GETRDFD(sock1), XIO_GETWRFD(sock1));
|
||||||
if (!mayrd1) {
|
if (!mayrd1 && !(XIO_RDSTREAM(sock1)->eof > 1)) {
|
||||||
FD_SET(XIO_GETRDFD(sock1), &in);
|
fd1in->fd = XIO_GETRDFD(sock1);
|
||||||
|
fd1in->events = POLLIN;
|
||||||
|
} else {
|
||||||
|
fd1in->fd = -1;
|
||||||
}
|
}
|
||||||
if (!maywr2) {
|
if (!maywr2) {
|
||||||
FD_SET(XIO_GETWRFD(sock2), &out);
|
fd2out->fd = XIO_GETWRFD(sock2);
|
||||||
|
fd2out->events = POLLOUT;
|
||||||
|
} else {
|
||||||
|
fd2out->fd = -1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
fd1in->fd = -1;
|
||||||
|
fd2out->fd = -1;
|
||||||
|
}
|
||||||
if (XIO_READABLE(sock2) &&
|
if (XIO_READABLE(sock2) &&
|
||||||
!(XIO_RDSTREAM(sock2)->eof > 1 && !XIO_RDSTREAM(sock2)->ignoreeof)
|
!(XIO_RDSTREAM(sock2)->eof > 1 && !XIO_RDSTREAM(sock2)->ignoreeof)
|
||||||
/*0 && !xioparams->lefttoright*/) {
|
/*0 && !xioparams->lefttoright*/) {
|
||||||
Debug3("*** sock2: %p [%d,%d]", sock2, XIO_GETRDFD(sock2), XIO_GETWRFD(sock2));
|
Debug3("*** sock2: %p [%d,%d]", sock2, XIO_GETRDFD(sock2), XIO_GETWRFD(sock2));
|
||||||
if (!mayrd2) {
|
if (!mayrd2 && !(XIO_RDSTREAM(sock2)->eof > 1)) {
|
||||||
FD_SET(XIO_GETRDFD(sock2), &in);
|
fd2in->fd = XIO_GETRDFD(sock2);
|
||||||
|
fd2in->events = POLLIN;
|
||||||
|
} else {
|
||||||
|
fd2in->fd = -1;
|
||||||
}
|
}
|
||||||
if (!maywr1) {
|
if (!maywr1) {
|
||||||
FD_SET(XIO_GETWRFD(sock1), &out);
|
fd1out->fd = XIO_GETWRFD(sock1);
|
||||||
|
fd1out->events = POLLOUT;
|
||||||
|
} else {
|
||||||
|
fd1out->fd = -1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fd1out->fd = -1;
|
||||||
|
fd2in->fd = -1;
|
||||||
|
}
|
||||||
|
/* frame 0: innermost part of the transfer loop: check FD status */
|
||||||
|
retval = xiopoll(fds, 4, to);
|
||||||
|
if (retval >= 0 || errno != EINTR) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
retval = Select(FD_SETSIZE, &in, &out, &expt, to);
|
|
||||||
_errno = errno;
|
_errno = errno;
|
||||||
if (retval < 0 && errno == EINTR) {
|
Info1("xiopoll(): %s", strerror(errno));
|
||||||
Info1("select(): %s", strerror(errno));
|
|
||||||
}
|
|
||||||
errno = _errno;
|
errno = _errno;
|
||||||
} while (retval < 0 && errno == EINTR);
|
} while (true);
|
||||||
|
|
||||||
/* attention:
|
/* attention:
|
||||||
when an exec'd process sends data and terminates, it is unpredictable
|
when an exec'd process sends data and terminates, it is unpredictable
|
||||||
|
@ -252,27 +281,26 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
#if HAVE_FDS_BITS
|
Error11("xiopoll({%d,%0o}{%d,%0o}{%d,%0o}{%d,%0o}, 4, {"F_tv_sec"."F_tv_usec"}): %s",
|
||||||
Error7("select(%d, &0x%lx, &0x%lx, &0x%lx, %s%lu): %s",
|
fds[0].fd, fds[0].events, fds[1].fd, fds[1].events,
|
||||||
FD_SETSIZE, in.fds_bits[0], out.fds_bits[0],
|
fds[2].fd, fds[2].events, fds[3].fd, fds[3].events,
|
||||||
expt.fds_bits[0], to?"&":"NULL/", to?to->tv_sec:0,
|
timeout.tv_sec, timeout.tv_usec, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
#else
|
|
||||||
Error7("select(%d, &0x%lx, &0x%lx, &0x%lx, %s%lu): %s",
|
|
||||||
FD_SETSIZE, in.__fds_bits[0], out.__fds_bits[0],
|
|
||||||
expt.__fds_bits[0], to?"&":"NULL/", to?to->tv_sec:0,
|
|
||||||
strerror(errno));
|
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
} else if (retval == 0) {
|
} else if (retval == 0) {
|
||||||
Info2("select timed out (no data within %ld.%06ld seconds)",
|
Info2("poll timed out (no data within %ld.%06ld seconds)",
|
||||||
(sock1->stream.closing>=1||sock2->stream.closing>=1)?
|
(sock1->stream.closing>=1||sock2->stream.closing>=1)?
|
||||||
xioparams->closwait.tv_sec:xioparams->total_timeout.tv_sec,
|
xioparams->closwait.tv_sec:xioparams->total_timeout.tv_sec,
|
||||||
(sock1->stream.closing>=1||sock2->stream.closing>=1)?
|
(sock1->stream.closing>=1||sock2->stream.closing>=1)?
|
||||||
xioparams->closwait.tv_usec:xioparams->total_timeout.tv_usec);
|
xioparams->closwait.tv_usec:xioparams->total_timeout.tv_usec);
|
||||||
if (polling && !wasaction) {
|
if (polling && !wasaction) {
|
||||||
/* there was a ignoreeof poll timeout, use it */
|
/* there was a ignoreeof poll timeout, use it */
|
||||||
;
|
polling = 0; /*%%%*/
|
||||||
|
if (XIO_RDSTREAM(sock1)->ignoreeof) {
|
||||||
|
mayrd1 = 0;
|
||||||
|
}
|
||||||
|
} else if (polling && wasaction) {
|
||||||
|
wasaction = 0;
|
||||||
|
|
||||||
} else if (xioparams->total_timeout.tv_sec != 0 ||
|
} else if (xioparams->total_timeout.tv_sec != 0 ||
|
||||||
xioparams->total_timeout.tv_usec != 0) {
|
xioparams->total_timeout.tv_usec != 0) {
|
||||||
/* there was a total inactivity timeout */
|
/* there was a total inactivity timeout */
|
||||||
|
@ -291,21 +319,40 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
/*0 Debug1("XIO_READABLE(sock1) = %d", XIO_READABLE(sock1));*/
|
/*0 Debug1("XIO_READABLE(sock1) = %d", XIO_READABLE(sock1));*/
|
||||||
/*0 Debug1("XIO_GETRDFD(sock1) = %d", XIO_GETRDFD(sock1));*/
|
/*0 Debug1("XIO_GETRDFD(sock1) = %d", XIO_GETRDFD(sock1));*/
|
||||||
if (XIO_READABLE(sock1) && XIO_GETRDFD(sock1) >= 0 &&
|
if (XIO_READABLE(sock1) && XIO_GETRDFD(sock1) >= 0 &&
|
||||||
FD_ISSET(XIO_GETRDFD(sock1), &in)) {
|
(fd1in->revents /*&(POLLIN|POLLHUP|POLLERR)*/)) {
|
||||||
mayrd1 = true;
|
if (fd1in->revents & POLLNVAL) {
|
||||||
|
/* this is what we find on Mac OS X when poll()'ing on a device or
|
||||||
|
named pipe. a read() might imm. return with 0 bytes, resulting
|
||||||
|
in a loop? */
|
||||||
|
Error1("poll(...[%d]: invalid request", fd1in->fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mayrd1 = true;
|
||||||
}
|
}
|
||||||
/*0 Debug1("XIO_READABLE(sock2) = %d", XIO_READABLE(sock2));*/
|
/*0 Debug1("XIO_READABLE(sock2) = %d", XIO_READABLE(sock2));*/
|
||||||
/*0 Debug1("XIO_GETRDFD(sock2) = %d", XIO_GETRDFD(sock2));*/
|
/*0 Debug1("XIO_GETRDFD(sock2) = %d", XIO_GETRDFD(sock2));*/
|
||||||
/*0 Debug1("FD_ISSET(XIO_GETRDFD(sock2), &in) = %d", FD_ISSET(XIO_GETRDFD(sock2), &in));*/
|
/*0 Debug1("FD_ISSET(XIO_GETRDFD(sock2), &in) = %d", FD_ISSET(XIO_GETRDFD(sock2), &in));*/
|
||||||
if (XIO_READABLE(sock2) && XIO_GETRDFD(sock2) >= 0 &&
|
if (XIO_READABLE(sock2) && XIO_GETRDFD(sock2) >= 0 &&
|
||||||
FD_ISSET(XIO_GETRDFD(sock2), &in)) {
|
(fd2in->revents)) {
|
||||||
|
if (fd2in->revents & POLLNVAL) {
|
||||||
|
Error1("poll(...[%d]: invalid request", fd2in->fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
mayrd2 = true;
|
mayrd2 = true;
|
||||||
}
|
}
|
||||||
/*0 Debug2("mayrd2 = %d, maywr1 = %d", mayrd2, maywr1);*/
|
/*0 Debug2("mayrd2 = %d, maywr1 = %d", mayrd2, maywr1);*/
|
||||||
if (XIO_GETWRFD(sock1) >= 0 && FD_ISSET(XIO_GETWRFD(sock1), &out)) {
|
if (XIO_GETWRFD(sock1) >= 0 && fd1out->fd >= 0 && fd1out->revents) {
|
||||||
|
if (fd1out->revents & POLLNVAL) {
|
||||||
|
Error1("poll(...[%d]: invalid request", fd1out->fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
maywr1 = true;
|
maywr1 = true;
|
||||||
}
|
}
|
||||||
if (XIO_GETWRFD(sock2) >= 0 && FD_ISSET(XIO_GETWRFD(sock2), &out)) {
|
if (XIO_GETWRFD(sock2) >= 0 && fd2out->fd >= 0 && fd2out->revents) {
|
||||||
|
if (fd2out->revents & POLLNVAL) {
|
||||||
|
Error1("poll(...[%d]: invalid request", fd2out->fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
maywr2 = true;
|
maywr2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +378,12 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
/* avoid idle when all readbytes already there */
|
/* avoid idle when all readbytes already there */
|
||||||
mayrd1 = true;
|
mayrd1 = true;
|
||||||
}
|
}
|
||||||
} else { /* bytes1 == 0 */
|
/* escape char occurred? */
|
||||||
|
if (XIO_RDSTREAM(sock1)->actescape) {
|
||||||
|
bytes1 = 0; /* indicate EOF */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bytes1 == 0) {
|
||||||
if (XIO_RDSTREAM(sock1)->ignoreeof && !sock1->stream.closing) {
|
if (XIO_RDSTREAM(sock1)->ignoreeof && !sock1->stream.closing) {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
|
@ -365,7 +417,12 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
/* avoid idle when all readbytes already there */
|
/* avoid idle when all readbytes already there */
|
||||||
mayrd2 = true;
|
mayrd2 = true;
|
||||||
}
|
}
|
||||||
} else { /* bytes == 0 */
|
/* escape char occurred? */
|
||||||
|
if (XIO_RDSTREAM(sock2)->actescape) {
|
||||||
|
bytes2 = 0; /* indicate EOF */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bytes2 == 0) {
|
||||||
if (XIO_RDSTREAM(sock2)->ignoreeof && !sock2->stream.closing) {
|
if (XIO_RDSTREAM(sock2)->ignoreeof && !sock2->stream.closing) {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
|
@ -380,33 +437,45 @@ int _socat(xiofile_t *xfd1, xiofile_t *xfd2) {
|
||||||
/* NOW handle EOFs */
|
/* NOW handle EOFs */
|
||||||
|
|
||||||
if (bytes1 == 0 || XIO_RDSTREAM(sock1)->eof >= 2) {
|
if (bytes1 == 0 || XIO_RDSTREAM(sock1)->eof >= 2) {
|
||||||
if (XIO_RDSTREAM(sock1)->ignoreeof && !sock1->stream.closing) {
|
if (XIO_RDSTREAM(sock1)->ignoreeof &&
|
||||||
|
!XIO_RDSTREAM(sock1)->actescape && !sock1->stream.closing) {
|
||||||
Debug1("socket 1 (fd %d) is at EOF, ignoring",
|
Debug1("socket 1 (fd %d) is at EOF, ignoring",
|
||||||
XIO_RDSTREAM(sock1)->fd1); /*! */
|
XIO_RDSTREAM(sock1)->fd1); /*! */
|
||||||
polling = 1;
|
mayrd1 = true;
|
||||||
|
polling = 1; /* do not hook this eof fd to poll for pollintv*/
|
||||||
} else {
|
} else {
|
||||||
Notice1("socket 1 (fd %d) is at EOF", XIO_GETRDFD(sock1));
|
Notice1("socket 1 (fd %d) is at EOF", XIO_GETRDFD(sock1));
|
||||||
xioshutdown(sock2, SHUT_WR);
|
xioshutdown(sock2, SHUT_WR);
|
||||||
|
XIO_RDSTREAM(sock1)->eof = 2;
|
||||||
|
XIO_RDSTREAM(sock1)->ignoreeof = false;
|
||||||
sock2->stream.closing = MAX(sock2->stream.closing, 1);
|
sock2->stream.closing = MAX(sock2->stream.closing, 1);
|
||||||
if (/*0 xioparams->lefttoright*/ !XIO_READABLE(sock2)) {
|
if (/*0 xioparams->lefttoright*/ !XIO_READABLE(sock2)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (polling && XIO_RDSTREAM(sock1)->ignoreeof) {
|
||||||
|
polling = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes2 == 0 || XIO_RDSTREAM(sock2)->eof >= 2) {
|
if (bytes2 == 0 || XIO_RDSTREAM(sock2)->eof >= 2) {
|
||||||
if (XIO_RDSTREAM(sock2)->ignoreeof && !sock2->stream.closing) {
|
if (XIO_RDSTREAM(sock2)->ignoreeof &&
|
||||||
|
!XIO_RDSTREAM(sock2)->actescape && !sock2->stream.closing) {
|
||||||
Debug1("socket 2 (fd %d) is at EOF, ignoring",
|
Debug1("socket 2 (fd %d) is at EOF, ignoring",
|
||||||
XIO_RDSTREAM(sock2)->fd1);
|
XIO_RDSTREAM(sock2)->fd1);
|
||||||
polling = 1;
|
mayrd2 = true;
|
||||||
|
polling = 1; /* do not hook this eof fd to poll for pollintv*/
|
||||||
} else {
|
} else {
|
||||||
Notice1("socket 2 (fd %d) is at EOF", XIO_GETRDFD(sock2));
|
Notice1("socket 2 (fd %d) is at EOF", XIO_GETRDFD(sock2));
|
||||||
xioshutdown(sock1, SHUT_WR);
|
xioshutdown(sock1, SHUT_WR);
|
||||||
|
XIO_RDSTREAM(sock2)->eof = 2;
|
||||||
|
XIO_RDSTREAM(sock2)->ignoreeof = false;
|
||||||
sock1->stream.closing = MAX(sock1->stream.closing, 1);
|
sock1->stream.closing = MAX(sock1->stream.closing, 1);
|
||||||
if (/*0 xioparams->righttoleft*/ !XIO_READABLE(sock1)) {
|
if (/*0 xioparams->righttoleft*/ !XIO_READABLE(sock1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (polling && XIO_RDSTREAM(sock2)->ignoreeof) {
|
||||||
|
polling = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,21 @@ static const char *optiontypenames[] = {
|
||||||
"STRUCT-IP_MREQ",
|
"STRUCT-IP_MREQ",
|
||||||
#endif
|
#endif
|
||||||
"IP4NAME",
|
"IP4NAME",
|
||||||
|
"INT:INT", "INT:INTP", "INT:BIN", "INT:STRING",
|
||||||
|
"INT:INT:INT", "INT:INT:BIN", "INT:INT:STRING",
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
/* keep consistent with xioopts.h:#define GROUP_* ! */
|
/* keep consistent with xioopts.h:#define GROUP_* ! */
|
||||||
static const char *addressgroupnames[] = {
|
static const char *addressgroupnames[] = {
|
||||||
"FD", "FIFO", "CHR", "BLK",
|
"FD", "FIFO", "SOCKS5", "BLK",
|
||||||
"REG", "SOCKET", "READLINE", "undef",
|
"REG", "SOCKET", "READLINE", "undef",
|
||||||
"NAMED", "OPEN", "EXEC", "FORK",
|
"NAMED", "OPEN", "EXEC", "FORK",
|
||||||
"LISTEN", "DEVICE", "CHILD", "RETRY",
|
"LISTEN", "DEVICE", "CHILD", "RETRY",
|
||||||
"TERMIOS", "RANGE", "PTY", "PARENT",
|
"TERMIOS", "RANGE", "PTY", "PARENT",
|
||||||
"UNIX", "IP4", "IP6", "INTERFACE",
|
"UNIX", "IP4", "IP6", "INTERFACE",
|
||||||
"UDP", "TCP", "SOCKS4", "OPENSSL",
|
"UDP", "TCP", "SOCKS4", "OPENSSL",
|
||||||
"PROCESS", "APPL", "HTTP", "SOCKS5"
|
"PROCESS", "APPL", "HTTP", "SCTP"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,15 @@ int xioinitialize(int xioflags) {
|
||||||
|
|
||||||
/* some assertions about termios */
|
/* some assertions about termios */
|
||||||
#if WITH_TERMIOS
|
#if WITH_TERMIOS
|
||||||
#ifdef CRDLY
|
#if defined(CRDLY) && CRDLY_SHIFT >= 0
|
||||||
assert(3 << opt_crdly.arg3 == CRDLY);
|
assert(3 << opt_crdly.arg3 == CRDLY);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TABDLY
|
#if defined(TABDLY) && TABDLY_SHIFT >= 0
|
||||||
assert(3 << opt_tabdly.arg3 == TABDLY);
|
assert(3 << opt_tabdly.arg3 == TABDLY);
|
||||||
#endif
|
#endif
|
||||||
|
#if CSIZE_SHIFT >= 0
|
||||||
assert(3 << opt_csize.arg3 == CSIZE);
|
assert(3 << opt_csize.arg3 == CSIZE);
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
struct termios termarg;
|
struct termios termarg;
|
||||||
|
@ -139,6 +141,14 @@ int xioinitialize(int xioflags) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* call this function when option -lp (reset program name) has been applied */
|
||||||
|
int xioinitialize2(void) {
|
||||||
|
pid_t pid = Getpid();
|
||||||
|
xiosetenvulong("PID", pid, 1);
|
||||||
|
xiosetenvulong("PPID", pid, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* well, this function is not for initialization, but I could not find a better
|
/* well, this function is not for initialization, but I could not find a better
|
||||||
source file for it
|
source file for it
|
||||||
|
@ -196,6 +206,7 @@ static int xio_nokill(xiofile_t *sock) {
|
||||||
returns 0 on success or != 0 if an error occurred */
|
returns 0 on success or != 0 if an error occurred */
|
||||||
int xio_forked_inchild(void) {
|
int xio_forked_inchild(void) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
xiodroplocks();
|
xiodroplocks();
|
||||||
#if WITH_FIPS
|
#if WITH_FIPS
|
||||||
if (xio_reset_fips_mode() != 0) {
|
if (xio_reset_fips_mode() != 0) {
|
||||||
|
@ -221,3 +232,45 @@ int xio_forked_inchild(void) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* subchild != 0 means that the current process is already a child process of
|
||||||
|
the master process and thus the new sub child process should not set the
|
||||||
|
SOCAT_PID variable */
|
||||||
|
pid_t xio_fork(bool subchild, int level) {
|
||||||
|
pid_t pid;
|
||||||
|
const char *forkwaitstring;
|
||||||
|
int forkwaitsecs = 0;
|
||||||
|
|
||||||
|
if ((pid = Fork()) < 0) {
|
||||||
|
Msg1(level, "fork(): %s", strerror(errno));
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pid == 0) { /* child process */
|
||||||
|
pid_t cpid = Getpid();
|
||||||
|
|
||||||
|
Info1("just born: client process "F_pid, cpid);
|
||||||
|
if (!subchild) {
|
||||||
|
/* set SOCAT_PID to new value */
|
||||||
|
xiosetenvulong("PID", pid, 1);
|
||||||
|
}
|
||||||
|
/* gdb recommends to have env controlled sleep after fork */
|
||||||
|
if (forkwaitstring = getenv("SOCAT_FORK_WAIT")) {
|
||||||
|
forkwaitsecs = atoi(forkwaitstring);
|
||||||
|
Sleep(forkwaitsecs);
|
||||||
|
}
|
||||||
|
if (xio_forked_inchild() != 0) {
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parent process */
|
||||||
|
Notice1("forked off child process "F_pid, pid);
|
||||||
|
/* gdb recommends to have env controlled sleep after fork */
|
||||||
|
if (forkwaitstring = getenv("SOCAT_FORK_WAIT")) {
|
||||||
|
forkwaitsecs = atoi(forkwaitstring);
|
||||||
|
Sleep(forkwaitsecs);
|
||||||
|
}
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ const struct optdesc opt_crnl = { "crnl", NULL, OPT_CRNL, GROUP_A
|
||||||
const struct optdesc opt_readbytes = { "readbytes", "bytes", OPT_READBYTES, GROUP_APPL, PH_LATE, TYPE_SIZE_T, OFUNC_EXT, (int)(&((struct single *)0)->readbytes), sizeof(((struct single *)0)->readbytes) };
|
const struct optdesc opt_readbytes = { "readbytes", "bytes", OPT_READBYTES, GROUP_APPL, PH_LATE, TYPE_SIZE_T, OFUNC_EXT, (int)(&((struct single *)0)->readbytes), sizeof(((struct single *)0)->readbytes) };
|
||||||
const struct optdesc opt_lockfile = { "lockfile", NULL, OPT_LOCKFILE, GROUP_APPL, PH_INIT, TYPE_FILENAME, OFUNC_EXT, 0, 0 };
|
const struct optdesc opt_lockfile = { "lockfile", NULL, OPT_LOCKFILE, GROUP_APPL, PH_INIT, TYPE_FILENAME, OFUNC_EXT, 0, 0 };
|
||||||
const struct optdesc opt_waitlock = { "waitlock", NULL, OPT_WAITLOCK, GROUP_APPL, PH_INIT, TYPE_FILENAME, OFUNC_EXT, 0, 0 };
|
const struct optdesc opt_waitlock = { "waitlock", NULL, OPT_WAITLOCK, GROUP_APPL, PH_INIT, TYPE_FILENAME, OFUNC_EXT, 0, 0 };
|
||||||
|
const struct optdesc opt_escape = { "escape", NULL, OPT_ESCAPE, GROUP_APPL, PH_INIT, TYPE_INT, OFUNC_OFFSET, XIO_OFFSETOF(escape), sizeof(((xiosingle_t *)0)->escape) };
|
||||||
/****** APPL addresses ******/
|
/****** APPL addresses ******/
|
||||||
#if WITH_RETRY
|
#if WITH_RETRY
|
||||||
const struct optdesc opt_forever = { "forever", NULL, OPT_FOREVER, GROUP_RETRY, PH_INIT, TYPE_BOOL, OFUNC_OFFSET, (int)(&((struct single *)0)->forever), sizeof(((struct single *)0)->forever) };
|
const struct optdesc opt_forever = { "forever", NULL, OPT_FOREVER, GROUP_RETRY, PH_INIT, TYPE_BOOL, OFUNC_OFFSET, (int)(&((struct single *)0)->forever), sizeof(((struct single *)0)->forever) };
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xiolayer.h */
|
/* source: xiolayer.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2005 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xiolayer_h_included
|
#ifndef __xiolayer_h_included
|
||||||
|
@ -11,6 +11,7 @@ extern const struct optdesc opt_crnl;
|
||||||
extern const struct optdesc opt_readbytes;
|
extern const struct optdesc opt_readbytes;
|
||||||
extern const struct optdesc opt_lockfile;
|
extern const struct optdesc opt_lockfile;
|
||||||
extern const struct optdesc opt_waitlock;
|
extern const struct optdesc opt_waitlock;
|
||||||
|
extern const struct optdesc opt_escape;
|
||||||
extern const struct optdesc opt_forever;
|
extern const struct optdesc opt_forever;
|
||||||
extern const struct optdesc opt_intervall;
|
extern const struct optdesc opt_intervall;
|
||||||
extern const struct optdesc opt_retry;
|
extern const struct optdesc opt_retry;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xiomodes.h */
|
/* source: xiomodes.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xiomodes_h_included
|
#ifndef __xiomodes_h_included
|
||||||
|
@ -15,11 +15,12 @@
|
||||||
#include "xio-creat.h"
|
#include "xio-creat.h"
|
||||||
#include "xio-gopen.h"
|
#include "xio-gopen.h"
|
||||||
#include "xio-pipe.h"
|
#include "xio-pipe.h"
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
#include "xio-socket.h"
|
#include "xio-socket.h"
|
||||||
#include "xio-listen.h"
|
#include "xio-listen.h"
|
||||||
#include "xio-unix.h"
|
#include "xio-unix.h"
|
||||||
#include "xio-rawip.h"
|
#include "xio-rawip.h"
|
||||||
|
#include "xio-interface.h"
|
||||||
#include "xio-ip.h"
|
#include "xio-ip.h"
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
#include "xio-ip4.h"
|
#include "xio-ip4.h"
|
||||||
|
@ -28,10 +29,11 @@
|
||||||
#include "xio-ipapp.h"
|
#include "xio-ipapp.h"
|
||||||
#include "xio-tcp.h"
|
#include "xio-tcp.h"
|
||||||
#include "xio-udp.h"
|
#include "xio-udp.h"
|
||||||
|
#include "xio-sctp.h"
|
||||||
#include "xio-socks.h"
|
#include "xio-socks.h"
|
||||||
#include "xio-socks5.h"
|
#include "xio-socks5.h"
|
||||||
#include "xio-proxy.h"
|
#include "xio-proxy.h"
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
#include "xio-progcall.h"
|
#include "xio-progcall.h"
|
||||||
#include "xio-exec.h"
|
#include "xio-exec.h"
|
||||||
#include "xio-system.h"
|
#include "xio-system.h"
|
||||||
|
@ -42,6 +44,7 @@
|
||||||
#include "xio-tcpwrap.h"
|
#include "xio-tcpwrap.h"
|
||||||
#include "xio-ext2.h"
|
#include "xio-ext2.h"
|
||||||
#include "xio-tun.h"
|
#include "xio-tun.h"
|
||||||
|
#include "xio-streams.h"
|
||||||
#include "xio-nop.h"
|
#include "xio-nop.h"
|
||||||
#include "xio-test.h"
|
#include "xio-test.h"
|
||||||
|
|
||||||
|
|
54
xioopen.c
54
xioopen.c
|
@ -1,5 +1,5 @@
|
||||||
/* source: xioopen.c */
|
/* source: xioopen.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this is the source file of the extended open function */
|
/* this is the source file of the extended open function */
|
||||||
|
@ -55,6 +55,10 @@ const struct xioaddrname address_names[] = {
|
||||||
{ "creat", xioaddrs_creat },
|
{ "creat", xioaddrs_creat },
|
||||||
{ "create", xioaddrs_creat },
|
{ "create", xioaddrs_creat },
|
||||||
#endif
|
#endif
|
||||||
|
#if WITH_GENERICSOCKET
|
||||||
|
{ "datagram", xioaddrs_socket_datagram },
|
||||||
|
{ "dgram", xioaddrs_socket_datagram },
|
||||||
|
#endif
|
||||||
#if WITH_PIPE
|
#if WITH_PIPE
|
||||||
{ "echo", xioaddrs_pipe },
|
{ "echo", xioaddrs_pipe },
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,6 +77,9 @@ const struct xioaddrname address_names[] = {
|
||||||
#if WITH_GOPEN
|
#if WITH_GOPEN
|
||||||
{ "gopen", xioaddrs_gopen },
|
{ "gopen", xioaddrs_gopen },
|
||||||
#endif
|
#endif
|
||||||
|
#if WITH_INTERFACE
|
||||||
|
{ "if", xioaddrs_interface },
|
||||||
|
#endif
|
||||||
#if (WITH_IP4 || WITH_IP6) && WITH_TCP
|
#if (WITH_IP4 || WITH_IP6) && WITH_TCP
|
||||||
{ "inet", xioaddrs_tcp_connect },
|
{ "inet", xioaddrs_tcp_connect },
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,6 +101,9 @@ const struct xioaddrname address_names[] = {
|
||||||
{ "inet6-l", xioaddrs_tcp6_listen },
|
{ "inet6-l", xioaddrs_tcp6_listen },
|
||||||
{ "inet6-listen", xioaddrs_tcp6_listen },
|
{ "inet6-listen", xioaddrs_tcp6_listen },
|
||||||
#endif
|
#endif
|
||||||
|
#if WITH_INTERFACE
|
||||||
|
{ "interface", xioaddrs_interface },
|
||||||
|
#endif
|
||||||
#if WITH_RAWIP
|
#if WITH_RAWIP
|
||||||
#if (WITH_IP4 || WITH_IP6)
|
#if (WITH_IP4 || WITH_IP6)
|
||||||
{ "ip", xioaddrs_rawip_sendto },
|
{ "ip", xioaddrs_rawip_sendto },
|
||||||
|
@ -154,6 +164,43 @@ const struct xioaddrname address_names[] = {
|
||||||
#if WITH_READLINE
|
#if WITH_READLINE
|
||||||
{ "readline", xioaddrs_readline },
|
{ "readline", xioaddrs_readline },
|
||||||
#endif
|
#endif
|
||||||
|
#if (WITH_IP4 || WITH_IP6) && WITH_SCTP
|
||||||
|
{ "sctp", xioaddrs_sctp_connect },
|
||||||
|
{ "sctp-connect", xioaddrs_sctp_connect },
|
||||||
|
#if WITH_LISTEN
|
||||||
|
{ "sctp-l", xioaddrs_sctp_listen },
|
||||||
|
{ "sctp-listen", xioaddrs_sctp_listen },
|
||||||
|
#endif
|
||||||
|
#if WITH_IP4
|
||||||
|
{ "sctp4", xioaddrs_sctp4_connect },
|
||||||
|
{ "sctp4-connect", xioaddrs_sctp4_connect },
|
||||||
|
#if WITH_LISTEN
|
||||||
|
{ "sctp4-l", xioaddrs_sctp4_listen },
|
||||||
|
{ "sctp4-listen", xioaddrs_sctp4_listen },
|
||||||
|
#endif
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
{ "sctp6", xioaddrs_sctp6_connect },
|
||||||
|
{ "sctp6-connect", xioaddrs_sctp6_connect },
|
||||||
|
#if WITH_LISTEN
|
||||||
|
{ "sctp6-l", xioaddrs_sctp6_listen },
|
||||||
|
{ "sctp6-listen", xioaddrs_sctp6_listen },
|
||||||
|
#endif
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
#endif /* (WITH_IP4 || WITH_IP6) && WITH_SCTP */
|
||||||
|
#if WITH_GENERICSOCKET
|
||||||
|
{ "sendto", xioaddrs_socket_sendto },
|
||||||
|
#endif
|
||||||
|
#if WITH_GENERICSOCKET
|
||||||
|
{ "socket-connect", xioaddrs_socket_connect },
|
||||||
|
{ "socket-datagram", xioaddrs_socket_datagram },
|
||||||
|
#if WITH_LISTEN
|
||||||
|
{ "socket-listen", xioaddrs_socket_listen },
|
||||||
|
#endif /* WITH_LISTEN */
|
||||||
|
{ "socket-recv", xioaddrs_socket_recv },
|
||||||
|
{ "socket-recvfrom", xioaddrs_socket_recvfrom },
|
||||||
|
{ "socket-sendto", xioaddrs_socket_sendto },
|
||||||
|
#endif
|
||||||
#if WITH_SOCKS4
|
#if WITH_SOCKS4
|
||||||
{ "socks", xioaddrs_socks4_connect },
|
{ "socks", xioaddrs_socks4_connect },
|
||||||
{ "socks-client", xioaddrs_socks4_connect },
|
{ "socks-client", xioaddrs_socks4_connect },
|
||||||
|
@ -333,12 +380,13 @@ xiofile_t *xioallocfd(void) {
|
||||||
fd->stream.fd2 = -1;
|
fd->stream.fd2 = -1;
|
||||||
fd->stream.fdtype = FDTYPE_SINGLE;
|
fd->stream.fdtype = FDTYPE_SINGLE;
|
||||||
fd->stream.dtype = XIODATA_STREAM;
|
fd->stream.dtype = XIODATA_STREAM;
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
/* fd->stream.salen = 0; */
|
/* fd->stream.salen = 0; */
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
/* fd->stream.howtoshut = XIOSHUT_UNSPEC;*/
|
/* fd->stream.howtoshut = XIOSHUT_UNSPEC;*/
|
||||||
/* fd->stream.howtoclose = XIOCLOSE_UNSPEC;*/
|
/* fd->stream.howtoclose = XIOCLOSE_UNSPEC;*/
|
||||||
/* fd->stream.name = NULL; */
|
/* fd->stream.name = NULL; */
|
||||||
|
fd->stream.escape = -1;
|
||||||
/* fd->stream.para.exec.pid = 0; */
|
/* fd->stream.para.exec.pid = 0; */
|
||||||
fd->stream.lineterm = LINETERM_RAW;
|
fd->stream.lineterm = LINETERM_RAW;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xioopen.h */
|
/* source: xioopen.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __xioopen_h_included
|
#ifndef __xioopen_h_included
|
||||||
|
|
543
xioopts.c
543
xioopts.c
|
@ -40,7 +40,7 @@ bool xioopts_ignoregroups;
|
||||||
# define IF_EXEC(a,b)
|
# define IF_EXEC(a,b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
# define IF_SOCKET(a,b) {a,b},
|
# define IF_SOCKET(a,b) {a,b},
|
||||||
#else
|
#else
|
||||||
# define IF_SOCKET(a,b)
|
# define IF_SOCKET(a,b)
|
||||||
|
@ -82,6 +82,12 @@ bool xioopts_ignoregroups;
|
||||||
# define IF_TCP(a,b)
|
# define IF_TCP(a,b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WITH_SCTP
|
||||||
|
# define IF_SCTP(a,b) {a,b},
|
||||||
|
#else
|
||||||
|
# define IF_SCTP(a,b)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if WITH_SOCKS4
|
#if WITH_SOCKS4
|
||||||
# define IF_SOCKS4(a,b) {a,b},
|
# define IF_SOCKS4(a,b) {a,b},
|
||||||
#else
|
#else
|
||||||
|
@ -171,6 +177,9 @@ const struct optname optionnames[] = {
|
||||||
#ifdef SO_AUDIT /* AIX 4.3.3 */
|
#ifdef SO_AUDIT /* AIX 4.3.3 */
|
||||||
IF_SOCKET ("audit", &opt_so_audit)
|
IF_SOCKET ("audit", &opt_so_audit)
|
||||||
#endif /* SO_AUDIT */
|
#endif /* SO_AUDIT */
|
||||||
|
#ifdef IPV6_AUTHHDR
|
||||||
|
IF_IP6 ("authhdr", &opt_ipv6_authhdr)
|
||||||
|
#endif
|
||||||
IF_TUN ("automedia", &opt_iff_automedia)
|
IF_TUN ("automedia", &opt_iff_automedia)
|
||||||
#ifdef CBAUD
|
#ifdef CBAUD
|
||||||
IF_TERMIOS("b0", &opt_b0)
|
IF_TERMIOS("b0", &opt_b0)
|
||||||
|
@ -313,7 +322,9 @@ const struct optname optionnames[] = {
|
||||||
# ifdef CR3
|
# ifdef CR3
|
||||||
IF_TERMIOS("cr3", &opt_cr3)
|
IF_TERMIOS("cr3", &opt_cr3)
|
||||||
# endif
|
# endif
|
||||||
|
# if CRDLY_SHIFT >= 0
|
||||||
IF_TERMIOS("crdly", &opt_crdly)
|
IF_TERMIOS("crdly", &opt_crdly)
|
||||||
|
# endif
|
||||||
#endif /* defined(CRDLY) */
|
#endif /* defined(CRDLY) */
|
||||||
IF_TERMIOS("cread", &opt_cread)
|
IF_TERMIOS("cread", &opt_cread)
|
||||||
IF_OPEN ("creat", &opt_o_create)
|
IF_OPEN ("creat", &opt_o_create)
|
||||||
|
@ -329,7 +340,9 @@ const struct optname optionnames[] = {
|
||||||
IF_TERMIOS("cs6", &opt_cs6)
|
IF_TERMIOS("cs6", &opt_cs6)
|
||||||
IF_TERMIOS("cs7", &opt_cs7)
|
IF_TERMIOS("cs7", &opt_cs7)
|
||||||
IF_TERMIOS("cs8", &opt_cs8)
|
IF_TERMIOS("cs8", &opt_cs8)
|
||||||
|
#if CSIZE_SHIFT >= 0
|
||||||
IF_TERMIOS("csize", &opt_csize)
|
IF_TERMIOS("csize", &opt_csize)
|
||||||
|
#endif
|
||||||
IF_TERMIOS("cstopb", &opt_cstopb)
|
IF_TERMIOS("cstopb", &opt_cstopb)
|
||||||
IF_TERMIOS("ctlecho", &opt_echoctl)
|
IF_TERMIOS("ctlecho", &opt_echoctl)
|
||||||
IF_TERMIOS("ctty", &opt_tiocsctty)
|
IF_TERMIOS("ctty", &opt_tiocsctty)
|
||||||
|
@ -381,6 +394,7 @@ const struct optname optionnames[] = {
|
||||||
IF_SOCKET ("dontlinger", &opt_so_dontlinger)
|
IF_SOCKET ("dontlinger", &opt_so_dontlinger)
|
||||||
#endif
|
#endif
|
||||||
IF_SOCKET ("dontroute", &opt_so_dontroute)
|
IF_SOCKET ("dontroute", &opt_so_dontroute)
|
||||||
|
IF_IP6 ("dstopts", &opt_ipv6_dstopts)
|
||||||
#ifdef VDSUSP /* HP-UX */
|
#ifdef VDSUSP /* HP-UX */
|
||||||
IF_TERMIOS("dsusp", &opt_vdsusp)
|
IF_TERMIOS("dsusp", &opt_vdsusp)
|
||||||
#endif
|
#endif
|
||||||
|
@ -403,6 +417,7 @@ const struct optname optionnames[] = {
|
||||||
IF_TERMIOS("eol2", &opt_veol2)
|
IF_TERMIOS("eol2", &opt_veol2)
|
||||||
IF_TERMIOS("erase", &opt_verase)
|
IF_TERMIOS("erase", &opt_verase)
|
||||||
IF_SOCKET ("error", &opt_so_error)
|
IF_SOCKET ("error", &opt_so_error)
|
||||||
|
IF_ANY ("escape", &opt_escape)
|
||||||
IF_OPEN ("excl", &opt_o_excl)
|
IF_OPEN ("excl", &opt_o_excl)
|
||||||
#if WITH_EXT2 && defined(EXT2_APPEND_FL)
|
#if WITH_EXT2 && defined(EXT2_APPEND_FL)
|
||||||
IF_ANY ("ext2-append", &opt_ext2_append)
|
IF_ANY ("ext2-append", &opt_ext2_append)
|
||||||
|
@ -506,6 +521,9 @@ const struct optname optionnames[] = {
|
||||||
IF_ANY ("flock-nb", &opt_flock_ex_nb)
|
IF_ANY ("flock-nb", &opt_flock_ex_nb)
|
||||||
IF_ANY ("flock-sh", &opt_flock_sh)
|
IF_ANY ("flock-sh", &opt_flock_sh)
|
||||||
IF_ANY ("flock-sh-nb", &opt_flock_sh_nb)
|
IF_ANY ("flock-sh-nb", &opt_flock_sh_nb)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV4_FLOWINFO
|
||||||
|
IF_IP6 ("flowinfo", &opt_ipv6_flowinfo)
|
||||||
#endif
|
#endif
|
||||||
IF_TERMIOS("flusho", &opt_flusho)
|
IF_TERMIOS("flusho", &opt_flusho)
|
||||||
IF_RETRY ("forever", &opt_forever)
|
IF_RETRY ("forever", &opt_forever)
|
||||||
|
@ -533,6 +551,8 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
IF_READLINE("history", &opt_history_file)
|
IF_READLINE("history", &opt_history_file)
|
||||||
IF_READLINE("history-file", &opt_history_file)
|
IF_READLINE("history-file", &opt_history_file)
|
||||||
|
IF_IP6 ("hoplimit", &opt_ipv6_hoplimit)
|
||||||
|
IF_IP6 ("hopopts", &opt_ipv6_hopopts)
|
||||||
#if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE)
|
#if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE)
|
||||||
IF_IPAPP ("hosts-allow", &opt_tcpwrap_hosts_allow_table)
|
IF_IPAPP ("hosts-allow", &opt_tcpwrap_hosts_allow_table)
|
||||||
#endif
|
#endif
|
||||||
|
@ -541,6 +561,12 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
IF_TERMIOS("hup", &opt_hupcl)
|
IF_TERMIOS("hup", &opt_hupcl)
|
||||||
IF_TERMIOS("hupcl", &opt_hupcl)
|
IF_TERMIOS("hupcl", &opt_hupcl)
|
||||||
|
#ifdef I_POP
|
||||||
|
IF_ANY ("i-pop-all", &opt_streams_i_pop_all)
|
||||||
|
#endif
|
||||||
|
#ifdef I_PUSH
|
||||||
|
IF_ANY ("i-push", &opt_streams_i_push)
|
||||||
|
#endif
|
||||||
IF_TERMIOS("icanon", &opt_icanon)
|
IF_TERMIOS("icanon", &opt_icanon)
|
||||||
IF_TERMIOS("icrnl", &opt_icrnl)
|
IF_TERMIOS("icrnl", &opt_icrnl)
|
||||||
IF_TERMIOS("iexten", &opt_iexten)
|
IF_TERMIOS("iexten", &opt_iexten)
|
||||||
|
@ -589,6 +615,12 @@ const struct optname optionnames[] = {
|
||||||
IF_RETRY ("interval", &opt_intervall)
|
IF_RETRY ("interval", &opt_intervall)
|
||||||
IF_RETRY ("intervall", &opt_intervall)
|
IF_RETRY ("intervall", &opt_intervall)
|
||||||
IF_TERMIOS("intr", &opt_vintr)
|
IF_TERMIOS("intr", &opt_vintr)
|
||||||
|
IF_ANY ("ioctl", &opt_ioctl_void)
|
||||||
|
IF_ANY ("ioctl-bin", &opt_ioctl_bin)
|
||||||
|
IF_ANY ("ioctl-int", &opt_ioctl_int)
|
||||||
|
IF_ANY ("ioctl-intp", &opt_ioctl_intp)
|
||||||
|
IF_ANY ("ioctl-string", &opt_ioctl_string)
|
||||||
|
IF_ANY ("ioctl-void", &opt_ioctl_void)
|
||||||
#ifdef IP_ADD_MEMBERSHIP
|
#ifdef IP_ADD_MEMBERSHIP
|
||||||
IF_IP ("ip-add-membership", &opt_ip_add_membership)
|
IF_IP ("ip-add-membership", &opt_ip_add_membership)
|
||||||
#endif
|
#endif
|
||||||
|
@ -619,9 +651,15 @@ const struct optname optionnames[] = {
|
||||||
#ifdef IP_PKTOPTIONS
|
#ifdef IP_PKTOPTIONS
|
||||||
IF_IP ("ip-pktoptions", &opt_ip_pktoptions)
|
IF_IP ("ip-pktoptions", &opt_ip_pktoptions)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IP_RECVDSTADDR
|
||||||
|
IF_IP ("ip-recvdstaddr", &opt_ip_recvdstaddr)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVERR
|
#ifdef IP_RECVERR
|
||||||
IF_IP ("ip-recverr", &opt_ip_recverr)
|
IF_IP ("ip-recverr", &opt_ip_recverr)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IP_RECVIF
|
||||||
|
IF_IP ("ip-recvif", &opt_ip_recvif)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVOPTS
|
#ifdef IP_RECVOPTS
|
||||||
IF_IP ("ip-recvopts", &opt_ip_recvopts)
|
IF_IP ("ip-recvopts", &opt_ip_recvopts)
|
||||||
#endif
|
#endif
|
||||||
|
@ -662,6 +700,9 @@ const struct optname optionnames[] = {
|
||||||
#ifdef IP_PKTOPTIONS
|
#ifdef IP_PKTOPTIONS
|
||||||
IF_IP ("ippktoptions", &opt_ip_pktoptions)
|
IF_IP ("ippktoptions", &opt_ip_pktoptions)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IP_RECVDSTADDR
|
||||||
|
IF_IP ("iprecvdstaddr", &opt_ip_recvdstaddr)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVERR
|
#ifdef IP_RECVERR
|
||||||
IF_IP ("iprecverr", &opt_ip_recverr)
|
IF_IP ("iprecverr", &opt_ip_recverr)
|
||||||
#endif
|
#endif
|
||||||
|
@ -683,7 +724,46 @@ const struct optname optionnames[] = {
|
||||||
IF_IP ("iptos", &opt_ip_tos)
|
IF_IP ("iptos", &opt_ip_tos)
|
||||||
IF_IP ("ipttl", &opt_ip_ttl)
|
IF_IP ("ipttl", &opt_ip_ttl)
|
||||||
IF_IP6 ("ipv6-add-membership", &opt_ipv6_join_group)
|
IF_IP6 ("ipv6-add-membership", &opt_ipv6_join_group)
|
||||||
|
#ifdef IPV6_AUTHHDR
|
||||||
|
IF_IP6 ("ipv6-authhdr", &opt_ipv6_authhdr)
|
||||||
|
#endif
|
||||||
|
IF_IP6 ("ipv6-dstopts", &opt_ipv6_dstopts)
|
||||||
|
#ifdef IPV4_FLOWINFO
|
||||||
|
IF_IP6 ("ipv6-flowinfo", &opt_ipv6_flowinfo)
|
||||||
|
#endif
|
||||||
|
IF_IP6 ("ipv6-hoplimit", &opt_ipv6_hoplimit)
|
||||||
|
IF_IP6 ("ipv6-hopopts", &opt_ipv6_hopopts)
|
||||||
IF_IP6 ("ipv6-join-group", &opt_ipv6_join_group)
|
IF_IP6 ("ipv6-join-group", &opt_ipv6_join_group)
|
||||||
|
IF_IP6 ("ipv6-pktinfo", &opt_ipv6_pktinfo)
|
||||||
|
#ifdef IPV6_RECVDSTOPTS
|
||||||
|
IF_IP6 ("ipv6-recvdstopts", &opt_ipv6_recvdstopts)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVERR
|
||||||
|
IF_IP6 ("ipv6-recverr", &opt_ipv6_recverr)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVHOPLIMIT
|
||||||
|
IF_IP6 ("ipv6-recvhoplimit", &opt_ipv6_recvhoplimit)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVHOPOPTS
|
||||||
|
IF_IP6 ("ipv6-recvhopopts", &opt_ipv6_recvhopopts)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_PATHMTU
|
||||||
|
IF_IP6 ("ipv6-recvpathmtu", &opt_ipv6_recvpathmtu)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVPKTINFO
|
||||||
|
IF_IP6 ("ipv6-recvpktinfo", &opt_ipv6_recvpktinfo)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVRTHDR
|
||||||
|
IF_IP6 ("ipv6-recvrthdr", &opt_ipv6_recvrthdr)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVTCLASS
|
||||||
|
IF_IP6 ("ipv6-recvtclass", &opt_ipv6_recvtclass)
|
||||||
|
#endif
|
||||||
|
IF_IP6 ("ipv6-rthdr", &opt_ipv6_rthdr)
|
||||||
|
#ifdef IPV6_TCLASS
|
||||||
|
IF_IP6 ("ipv6-tclass", &opt_ipv6_tclass)
|
||||||
|
#endif
|
||||||
|
IF_IP6 ("ipv6-unicast-hops", &opt_ipv6_unicast_hops)
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
IF_IP6 ("ipv6-v6only", &opt_ipv6_v6only)
|
IF_IP6 ("ipv6-v6only", &opt_ipv6_v6only)
|
||||||
IF_IP6 ("ipv6only", &opt_ipv6_v6only)
|
IF_IP6 ("ipv6only", &opt_ipv6_v6only)
|
||||||
|
@ -917,53 +997,6 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
IF_OPEN ("o-trunc", &opt_o_trunc)
|
IF_OPEN ("o-trunc", &opt_o_trunc)
|
||||||
IF_OPEN ("o-wronly", &opt_o_wronly)
|
IF_OPEN ("o-wronly", &opt_o_wronly)
|
||||||
IF_OPEN ("o_create", &opt_o_create)
|
|
||||||
#ifdef O_DEFER
|
|
||||||
IF_OPEN ("o_defer", &opt_o_defer)
|
|
||||||
#endif
|
|
||||||
#ifdef O_DELAY
|
|
||||||
IF_OPEN ("o_delay", &opt_o_delay)
|
|
||||||
#endif
|
|
||||||
#ifdef O_DIRECT
|
|
||||||
IF_OPEN ("o_direct", &opt_o_direct)
|
|
||||||
#endif
|
|
||||||
#ifdef O_DIRECTORY
|
|
||||||
IF_OPEN ("o_directory", &opt_o_directory)
|
|
||||||
#endif
|
|
||||||
#ifdef O_DSYNC
|
|
||||||
IF_OPEN ("o_dsync", &opt_o_dsync)
|
|
||||||
#endif
|
|
||||||
IF_OPEN ("o_excl", &opt_o_excl)
|
|
||||||
#ifdef O_LARGEFILE
|
|
||||||
IF_OPEN ("o_largefile", &opt_o_largefile)
|
|
||||||
#endif
|
|
||||||
#if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
|
|
||||||
IF_ANY ("o_ndelay", &opt_o_ndelay)
|
|
||||||
#else
|
|
||||||
IF_ANY ("o_ndelay", &opt_nonblock)
|
|
||||||
#endif
|
|
||||||
IF_OPEN ("o_noctty", &opt_o_noctty)
|
|
||||||
#ifdef O_NOFOLLOW
|
|
||||||
IF_OPEN ("o_nofollow", &opt_o_nofollow)
|
|
||||||
#endif
|
|
||||||
#ifdef O_NSHARE
|
|
||||||
IF_OPEN ("o_nshare", &opt_o_nshare)
|
|
||||||
#endif
|
|
||||||
#ifdef O_PRIV
|
|
||||||
IF_OPEN ("o_priv", &opt_o_priv)
|
|
||||||
#endif
|
|
||||||
IF_OPEN ("o_rdonly", &opt_o_rdonly)
|
|
||||||
IF_OPEN ("o_rdwr", &opt_o_rdwr)
|
|
||||||
#ifdef O_RSHARE
|
|
||||||
IF_OPEN ("o_rshare", &opt_o_rshare)
|
|
||||||
#endif
|
|
||||||
#ifdef O_RSYNC
|
|
||||||
IF_OPEN ("o_rsync", &opt_o_rsync)
|
|
||||||
#endif
|
|
||||||
#ifdef O_SYNC
|
|
||||||
IF_OPEN ("o_sync", &opt_o_sync)
|
|
||||||
#endif
|
|
||||||
IF_OPEN ("o_wronly", &opt_o_wronly)
|
|
||||||
#ifdef OCRNL
|
#ifdef OCRNL
|
||||||
IF_TERMIOS("ocrnl", &opt_ocrnl)
|
IF_TERMIOS("ocrnl", &opt_ocrnl)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1035,6 +1068,9 @@ const struct optname optionnames[] = {
|
||||||
IF_IP ("pktopts", &opt_ip_pktoptions)
|
IF_IP ("pktopts", &opt_ip_pktoptions)
|
||||||
#endif
|
#endif
|
||||||
IF_TUN ("pointopoint", &opt_iff_pointopoint)
|
IF_TUN ("pointopoint", &opt_iff_pointopoint)
|
||||||
|
#ifdef I_POP
|
||||||
|
IF_ANY ("pop-all", &opt_streams_i_pop_all)
|
||||||
|
#endif
|
||||||
/*IF_IPAPP("port", &opt_port)*/
|
/*IF_IPAPP("port", &opt_port)*/
|
||||||
IF_TUN ("portsel", &opt_iff_portsel)
|
IF_TUN ("portsel", &opt_iff_portsel)
|
||||||
#if HAVE_RESOLV_H
|
#if HAVE_RESOLV_H
|
||||||
|
@ -1048,12 +1084,15 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
IF_TUN ("promisc", &opt_iff_promisc)
|
IF_TUN ("promisc", &opt_iff_promisc)
|
||||||
IF_READLINE("prompt", &opt_prompt)
|
IF_READLINE("prompt", &opt_prompt)
|
||||||
|
#ifdef SO_PROTOTYPE
|
||||||
|
IF_SOCKET ("protocol", &opt_so_prototype)
|
||||||
|
#endif
|
||||||
IF_SOCKET ("protocol-family", &opt_protocol_family)
|
IF_SOCKET ("protocol-family", &opt_protocol_family)
|
||||||
#ifdef SO_PROTOTYPE
|
#ifdef SO_PROTOTYPE
|
||||||
IF_SOCKET ("prototype", &opt_so_prototype)
|
IF_SOCKET ("prototype", &opt_so_prototype)
|
||||||
#endif
|
#endif
|
||||||
IF_PROXY ("proxy-authorization", &opt_proxy_authorization)
|
|
||||||
IF_PROXY ("proxy-auth", &opt_proxy_authorization)
|
IF_PROXY ("proxy-auth", &opt_proxy_authorization)
|
||||||
|
IF_PROXY ("proxy-authorization", &opt_proxy_authorization)
|
||||||
IF_PROXY ("proxy-resolve", &opt_proxy_resolve)
|
IF_PROXY ("proxy-resolve", &opt_proxy_resolve)
|
||||||
IF_PROXY ("proxyauth", &opt_proxy_authorization)
|
IF_PROXY ("proxyauth", &opt_proxy_authorization)
|
||||||
IF_PROXY ("proxyport", &opt_proxyport)
|
IF_PROXY ("proxyport", &opt_proxyport)
|
||||||
|
@ -1072,6 +1111,9 @@ const struct optname optionnames[] = {
|
||||||
IF_PTY ("pty-intervall", &opt_pty_intervall)
|
IF_PTY ("pty-intervall", &opt_pty_intervall)
|
||||||
IF_PTY ("pty-wait-slave", &opt_pty_wait_slave)
|
IF_PTY ("pty-wait-slave", &opt_pty_wait_slave)
|
||||||
#endif /* HAVE_PTY && HAVE_POLL */
|
#endif /* HAVE_PTY && HAVE_POLL */
|
||||||
|
#ifdef I_PUSH
|
||||||
|
IF_ANY ("push", &opt_streams_i_push)
|
||||||
|
#endif
|
||||||
#ifdef TCP_QUICKACK
|
#ifdef TCP_QUICKACK
|
||||||
IF_TCP ("quickack", &opt_tcp_quickack)
|
IF_TCP ("quickack", &opt_tcp_quickack)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1092,12 +1134,33 @@ const struct optname optionnames[] = {
|
||||||
#if HAVE_RESOLV_H
|
#if HAVE_RESOLV_H
|
||||||
IF_IP ("recurse", &opt_res_recurse)
|
IF_IP ("recurse", &opt_res_recurse)
|
||||||
#endif /* HAVE_RESOLV_H */
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
#ifdef IP_RECVDSTADDR
|
||||||
|
IF_IP ("recvdstaddr", &opt_ip_recvdstaddr)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVDSTOPTS
|
||||||
|
IF_IP6 ("recvdstopts", &opt_ipv6_recvdstopts)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVERR
|
#ifdef IP_RECVERR
|
||||||
IF_IP ("recverr", &opt_ip_recverr)
|
IF_IP ("recverr", &opt_ip_recverr)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IPV6_RECVHOPLIMIT
|
||||||
|
IF_IP6 ("recvhoplimit", &opt_ipv6_recvhoplimit)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVHOPOPTS
|
||||||
|
IF_IP6 ("recvhopopts", &opt_ipv6_recvhopopts)
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVIF
|
||||||
|
IF_IP ("recvif", &opt_ip_recvif)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVOPTS
|
#ifdef IP_RECVOPTS
|
||||||
IF_IP ("recvopts", &opt_ip_recvopts)
|
IF_IP ("recvopts", &opt_ip_recvopts)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IPV6_RECVPKTINFO
|
||||||
|
IF_IP6 ("recvpktinfo", &opt_ipv6_recvpktinfo)
|
||||||
|
#endif
|
||||||
|
#ifdef IPV6_RECVRTHDR
|
||||||
|
IF_IP6 ("recvrthdr", &opt_ipv6_recvrthdr)
|
||||||
|
#endif
|
||||||
#ifdef IP_RECVTOS
|
#ifdef IP_RECVTOS
|
||||||
IF_IP ("recvtos", &opt_ip_recvtos)
|
IF_IP ("recvtos", &opt_ip_recvtos)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1144,6 +1207,7 @@ const struct optname optionnames[] = {
|
||||||
#ifdef O_RSYNC
|
#ifdef O_RSYNC
|
||||||
IF_OPEN ("rsync", &opt_o_rsync)
|
IF_OPEN ("rsync", &opt_o_rsync)
|
||||||
#endif
|
#endif
|
||||||
|
IF_IP6 ("rthdr", &opt_ipv6_rthdr)
|
||||||
IF_TUN ("running", &opt_iff_running)
|
IF_TUN ("running", &opt_iff_running)
|
||||||
#ifdef TCP_SACK_DISABLE
|
#ifdef TCP_SACK_DISABLE
|
||||||
IF_TCP ("sack-disable", &opt_tcp_sack_disable)
|
IF_TCP ("sack-disable", &opt_tcp_sack_disable)
|
||||||
|
@ -1152,6 +1216,13 @@ const struct optname optionnames[] = {
|
||||||
IF_TCP ("sackena", &opt_tcp_sackena)
|
IF_TCP ("sackena", &opt_tcp_sackena)
|
||||||
#endif
|
#endif
|
||||||
IF_TERMIOS("sane", &opt_sane)
|
IF_TERMIOS("sane", &opt_sane)
|
||||||
|
#ifdef SCTP_MAXSEG
|
||||||
|
IF_SCTP ("sctp-maxseg", &opt_sctp_maxseg)
|
||||||
|
IF_SCTP ("sctp-maxseg-late", &opt_sctp_maxseg_late)
|
||||||
|
#endif
|
||||||
|
#ifdef SCTP_NODELAY
|
||||||
|
IF_SCTP ("sctp-nodelay", &opt_sctp_nodelay)
|
||||||
|
#endif
|
||||||
#if WITH_EXT2 && defined(EXT2_SECRM_FL)
|
#if WITH_EXT2 && defined(EXT2_SECRM_FL)
|
||||||
IF_ANY ("secrm", &opt_ext2_secrm)
|
IF_ANY ("secrm", &opt_ext2_secrm)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1196,6 +1267,9 @@ const struct optname optionnames[] = {
|
||||||
#if WITH_EXEC || WITH_SYSTEM
|
#if WITH_EXEC || WITH_SYSTEM
|
||||||
IF_EXEC ("setsid", &opt_setsid)
|
IF_EXEC ("setsid", &opt_setsid)
|
||||||
#endif
|
#endif
|
||||||
|
IF_SOCKET ("setsockopt-bin", &opt_setsockopt_bin)
|
||||||
|
IF_SOCKET ("setsockopt-int", &opt_setsockopt_int)
|
||||||
|
IF_SOCKET ("setsockopt-string", &opt_setsockopt_string)
|
||||||
IF_ANY ("setuid", &opt_setuid)
|
IF_ANY ("setuid", &opt_setuid)
|
||||||
IF_ANY ("setuid-early", &opt_setuid_early)
|
IF_ANY ("setuid-early", &opt_setuid_early)
|
||||||
IF_ANY ("shut-none", &opt_shut_none)
|
IF_ANY ("shut-none", &opt_shut_none)
|
||||||
|
@ -1303,6 +1377,9 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
#ifdef SO_SNDTIMEO
|
#ifdef SO_SNDTIMEO
|
||||||
IF_SOCKET ("so-sndtimeo", &opt_so_sndtimeo)
|
IF_SOCKET ("so-sndtimeo", &opt_so_sndtimeo)
|
||||||
|
#endif
|
||||||
|
#ifdef SO_TIMESTAMP
|
||||||
|
IF_SOCKET ("so-timestamp", &opt_so_timestamp)
|
||||||
#endif
|
#endif
|
||||||
IF_SOCKET ("so-type", &opt_so_type)
|
IF_SOCKET ("so-type", &opt_so_type)
|
||||||
#ifdef SO_USE_IFBUFS
|
#ifdef SO_USE_IFBUFS
|
||||||
|
@ -1311,10 +1388,14 @@ const struct optname optionnames[] = {
|
||||||
#ifdef SO_USELOOPBACK /* AIX433, Solaris */
|
#ifdef SO_USELOOPBACK /* AIX433, Solaris */
|
||||||
IF_SOCKET ("so-useloopback", &opt_so_useloopback)
|
IF_SOCKET ("so-useloopback", &opt_so_useloopback)
|
||||||
#endif /* SO_USELOOPBACK */
|
#endif /* SO_USELOOPBACK */
|
||||||
|
IF_SOCKET ("sockopt-bin", &opt_setsockopt_bin)
|
||||||
|
IF_SOCKET ("sockopt-int", &opt_setsockopt_int)
|
||||||
|
IF_SOCKET ("sockopt-string", &opt_setsockopt_string)
|
||||||
IF_SOCKS5 ("socks5-password", &opt_socks5_password)
|
IF_SOCKS5 ("socks5-password", &opt_socks5_password)
|
||||||
IF_SOCKS5 ("socks5-username", &opt_socks5_username)
|
IF_SOCKS5 ("socks5-username", &opt_socks5_username)
|
||||||
IF_SOCKS4 ("socksport", &opt_socksport)
|
IF_SOCKS4 ("socksport", &opt_socksport)
|
||||||
IF_SOCKS4 ("socksuser", &opt_socksuser)
|
IF_SOCKS4 ("socksuser", &opt_socksuser)
|
||||||
|
IF_SOCKET ("socktype", &opt_so_type)
|
||||||
IF_IPAPP ("sourceport", &opt_sourceport)
|
IF_IPAPP ("sourceport", &opt_sourceport)
|
||||||
IF_IPAPP ("sp", &opt_sourceport)
|
IF_IPAPP ("sp", &opt_sourceport)
|
||||||
IF_TERMIOS("start", &opt_vstart)
|
IF_TERMIOS("start", &opt_vstart)
|
||||||
|
@ -1326,6 +1407,12 @@ const struct optname optionnames[] = {
|
||||||
IF_TCP ("stdurg", &opt_tcp_stdurg)
|
IF_TCP ("stdurg", &opt_tcp_stdurg)
|
||||||
#endif
|
#endif
|
||||||
IF_TERMIOS("stop", &opt_vstop)
|
IF_TERMIOS("stop", &opt_vstop)
|
||||||
|
#ifdef I_POP
|
||||||
|
IF_ANY ("streams-i-pop-all", &opt_streams_i_pop_all)
|
||||||
|
#endif
|
||||||
|
#ifdef I_PUSH
|
||||||
|
IF_ANY ("streams-i-push", &opt_streams_i_push)
|
||||||
|
#endif
|
||||||
IF_ANY ("su", &opt_substuser)
|
IF_ANY ("su", &opt_substuser)
|
||||||
IF_ANY ("su-d", &opt_substuser_delayed)
|
IF_ANY ("su-d", &opt_substuser_delayed)
|
||||||
IF_ANY ("substuser", &opt_substuser)
|
IF_ANY ("substuser", &opt_substuser)
|
||||||
|
@ -1357,7 +1444,9 @@ const struct optname optionnames[] = {
|
||||||
# ifdef TAB3
|
# ifdef TAB3
|
||||||
IF_TERMIOS("tab3", &opt_tab3)
|
IF_TERMIOS("tab3", &opt_tab3)
|
||||||
# endif
|
# endif
|
||||||
|
# if TABDLY_SHIFT >= 0
|
||||||
IF_TERMIOS("tabdly", &opt_tabdly)
|
IF_TERMIOS("tabdly", &opt_tabdly)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
IF_TERMIOS("tandem", &opt_ixoff)
|
IF_TERMIOS("tandem", &opt_ixoff)
|
||||||
#ifdef TCP_ABORT_THRESHOLD /* HP_UX */
|
#ifdef TCP_ABORT_THRESHOLD /* HP_UX */
|
||||||
|
@ -1452,8 +1541,11 @@ const struct optname optionnames[] = {
|
||||||
#ifdef O_TEXT
|
#ifdef O_TEXT
|
||||||
IF_ANY ("text", &opt_o_text)
|
IF_ANY ("text", &opt_o_text)
|
||||||
#endif
|
#endif
|
||||||
IF_UNIX ("tightsocklen", &opt_unix_tightsocklen)
|
IF_UNIX ("tightsocklen", &xioopt_unix_tightsocklen)
|
||||||
IF_TERMIOS("time", &opt_vtime)
|
IF_TERMIOS("time", &opt_vtime)
|
||||||
|
#ifdef SO_TIMESTAMP
|
||||||
|
IF_SOCKET ("timestamp", &opt_so_timestamp)
|
||||||
|
#endif
|
||||||
IF_TERMIOS("tiocsctty", &opt_tiocsctty)
|
IF_TERMIOS("tiocsctty", &opt_tiocsctty)
|
||||||
#if WITH_EXT2 && defined(EXT2_TOPDIR_FL)
|
#if WITH_EXT2 && defined(EXT2_TOPDIR_FL)
|
||||||
IF_ANY ("topdir", &opt_ext2_topdir)
|
IF_ANY ("topdir", &opt_ext2_topdir)
|
||||||
|
@ -1479,7 +1571,8 @@ const struct optname optionnames[] = {
|
||||||
IF_NAMED ("uid-e", &opt_user_early)
|
IF_NAMED ("uid-e", &opt_user_early)
|
||||||
IF_ANY ("uid-l", &opt_user_late)
|
IF_ANY ("uid-l", &opt_user_late)
|
||||||
IF_NAMED ("umask", &opt_umask)
|
IF_NAMED ("umask", &opt_umask)
|
||||||
IF_UNIX ("unix-tightsocklen", &opt_unix_tightsocklen)
|
IF_IP6 ("unicast-hops", &opt_ipv6_unicast_hops)
|
||||||
|
IF_UNIX ("unix-tightsocklen", &xioopt_unix_tightsocklen)
|
||||||
IF_NAMED ("unlink", &opt_unlink)
|
IF_NAMED ("unlink", &opt_unlink)
|
||||||
IF_NAMED ("unlink-close", &opt_unlink_close)
|
IF_NAMED ("unlink-close", &opt_unlink_close)
|
||||||
IF_NAMED ("unlink-early", &opt_unlink_early)
|
IF_NAMED ("unlink-early", &opt_unlink_early)
|
||||||
|
@ -1723,24 +1816,22 @@ int parseopts_table(const char **a, struct opt **opts,
|
||||||
(*opts)[i].value.u_bin.b_len = optlen;
|
(*opts)[i].value.u_bin.b_len = optlen;
|
||||||
break;
|
break;
|
||||||
case TYPE_BYTE:
|
case TYPE_BYTE:
|
||||||
{
|
if (assign) {
|
||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
if (token) {
|
char *rest;
|
||||||
char *rest;
|
ul = strtoul(token, &rest/*!*/, 0);
|
||||||
ul = strtoul(token, &rest/*!*/, 0);
|
|
||||||
} else {
|
|
||||||
ul = 1;
|
|
||||||
}
|
|
||||||
if (ul > UCHAR_MAX) {
|
if (ul > UCHAR_MAX) {
|
||||||
Error3("parseopts(%s): byte value exceeds limit (%lu vs. %u), using max",
|
Error3("parseopts(%s): byte value exceeds limit (%lu vs. %u), using max",
|
||||||
a0, ul, UCHAR_MAX);
|
a0, ul, UCHAR_MAX);
|
||||||
(*opts)[i].value.u_byte = UCHAR_MAX;
|
(*opts)[i].value.u_byte = UCHAR_MAX;
|
||||||
} else {
|
} else {
|
||||||
Info2("setting option \"%s\" to %d", ent->desc->defname,
|
|
||||||
(*opts)[i].value.u_byte);
|
|
||||||
(*opts)[i].value.u_byte = ul;
|
(*opts)[i].value.u_byte = ul;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
(*opts)[i].value.u_byte = 1;
|
||||||
}
|
}
|
||||||
|
Info2("setting option \"%s\" to %d", ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_byte);
|
||||||
break;
|
break;
|
||||||
case TYPE_INT:
|
case TYPE_INT:
|
||||||
if (assign) {
|
if (assign) {
|
||||||
|
@ -1982,6 +2073,155 @@ int parseopts_table(const char **a, struct opt **opts,
|
||||||
(*opts)[i].value.u_linger.l_linger);
|
(*opts)[i].value.u_linger.l_linger);
|
||||||
break;
|
break;
|
||||||
#endif /* HAVE_STRUCT_LINGER */
|
#endif /* HAVE_STRUCT_LINGER */
|
||||||
|
case TYPE_INT_INT:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 2 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
(*opts)[i].value2.u_int = strtoul(rest, &rest, 0);
|
||||||
|
}
|
||||||
|
Info3("setting option \"%s\" to %d:%d", ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int, (*opts)[i].value2.u_int);
|
||||||
|
break;
|
||||||
|
case TYPE_INT_BIN:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 2 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
optlen = 0;
|
||||||
|
if ((result = dalan(rest, optbuf, &optlen, sizeof(optbuf))) != 0) {
|
||||||
|
Error1("parseopts(): problem with \"%s\" data", rest);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (((*opts)[i].value2.u_bin.b_data = memdup(optbuf, optlen)) == NULL) {
|
||||||
|
Error1("memdup(, "F_Zu"): out of memory", optlen);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
(*opts)[i].value2.u_bin.b_len = optlen;
|
||||||
|
}
|
||||||
|
Info2("setting option \"%s\" to %d:..."/*!!!*/, ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int);
|
||||||
|
break;
|
||||||
|
case TYPE_INT_STRING:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 2 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
if (((*opts)[i].value2.u_string = strdup(rest)) == NULL) {
|
||||||
|
Error("out of memory"); return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Info3("setting option \"%s\" to %d:\"%s\"", ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int, (*opts)[i].value2.u_string);
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT_INT:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
(*opts)[i].value2.u_int = strtoul(rest, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
(*opts)[i].value3.u_int = strtoul(rest, &rest, 0);
|
||||||
|
}
|
||||||
|
Info4("setting option \"%s\" to %d:%d:%d", ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int, (*opts)[i].value2.u_int, (*opts)[i].value3.u_int);
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT_BIN:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
(*opts)[i].value2.u_int = strtoul(rest, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
optlen = 0;
|
||||||
|
if ((result = dalan(rest, optbuf, &optlen, sizeof(optbuf))) != 0) {
|
||||||
|
Error1("parseopts(): problem with \"%s\" data", rest);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (((*opts)[i].value3.u_bin.b_data = memdup(optbuf, optlen)) == NULL) {
|
||||||
|
Error1("memdup(, "F_Zu"): out of memory", optlen);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
(*opts)[i].value3.u_bin.b_len = optlen;
|
||||||
|
}
|
||||||
|
Info3("setting option \"%s\" to %d:%d:..."/*!!!*/, ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int, (*opts)[i].value2.u_int);
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT_STRING:
|
||||||
|
if (!assign) {
|
||||||
|
Error1("option \"%s\": values required", a0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *rest;
|
||||||
|
(*opts)[i].value.u_int = strtoul(token, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
(*opts)[i].value2.u_int = strtoul(rest, &rest, 0);
|
||||||
|
if (*rest != ':') {
|
||||||
|
Error1("option \"%s\": 3 arguments required",
|
||||||
|
ent->desc->defname);
|
||||||
|
}
|
||||||
|
++rest;
|
||||||
|
if (((*opts)[i].value3.u_string = strdup(rest)) == NULL) {
|
||||||
|
Error("out of memory"); return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Info4("setting option \"%s\" to %d:%d:\"%s\"", ent->desc->defname,
|
||||||
|
(*opts)[i].value.u_int, (*opts)[i].value2.u_int,
|
||||||
|
(*opts)[i].value3.u_string);
|
||||||
|
break;
|
||||||
#if defined(HAVE_STRUCT_IP_MREQ) || defined (HAVE_STRUCT_IP_MREQN)
|
#if defined(HAVE_STRUCT_IP_MREQ) || defined (HAVE_STRUCT_IP_MREQN)
|
||||||
case TYPE_IP_MREQN:
|
case TYPE_IP_MREQN:
|
||||||
{
|
{
|
||||||
|
@ -2041,7 +2281,7 @@ int parseopts_table(const char **a, struct opt **opts,
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
case TYPE_IP4NAME:
|
case TYPE_IP4NAME:
|
||||||
{
|
{
|
||||||
struct sockaddr_in sa; size_t salen = sizeof(sa);
|
struct sockaddr_in sa; socklen_t salen = sizeof(sa);
|
||||||
const char *ends[] = { NULL };
|
const char *ends[] = { NULL };
|
||||||
const char *nests[] = { "[","]", NULL };
|
const char *nests[] = { "[","]", NULL };
|
||||||
char buff[512], *buffp=buff; size_t bufspc = sizeof(buff)-1;
|
char buff[512], *buffp=buff; size_t bufspc = sizeof(buff)-1;
|
||||||
|
@ -2059,7 +2299,7 @@ int parseopts_table(const char **a, struct opt **opts,
|
||||||
0, 0/*!!!*/) != STAT_OK) {
|
0, 0/*!!!*/) != STAT_OK) {
|
||||||
opt->desc = ODESC_ERROR; continue;
|
opt->desc = ODESC_ERROR; continue;
|
||||||
}
|
}
|
||||||
opt->value.u_ip4addr = sa.sin_addr.s_addr;
|
opt->value.u_ip4addr = sa.sin_addr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* defined(WITH_IP4) */
|
#endif /* defined(WITH_IP4) */
|
||||||
|
@ -2219,7 +2459,7 @@ int _groupbits(mode_t mode) {
|
||||||
case (S_IFIFO>>12): /* 1, FIFO */
|
case (S_IFIFO>>12): /* 1, FIFO */
|
||||||
result = GROUP_FIFO; break;
|
result = GROUP_FIFO; break;
|
||||||
case (S_IFCHR>>12): /* 2, character device */
|
case (S_IFCHR>>12): /* 2, character device */
|
||||||
result = GROUP_CHR|GROUP_TERMIOS; break;
|
result = GROUP_TERMIOS; break;
|
||||||
case (S_IFDIR>>12): /* 4, directory !!! not supported */
|
case (S_IFDIR>>12): /* 4, directory !!! not supported */
|
||||||
result = GROUP_NONE; break;
|
result = GROUP_NONE; break;
|
||||||
case (S_IFBLK>>12): /* 6, block device */
|
case (S_IFBLK>>12): /* 6, block device */
|
||||||
|
@ -2261,11 +2501,6 @@ int groupbits(int fd) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
result = _groupbits(buf.st_mode&S_IFMT);
|
result = _groupbits(buf.st_mode&S_IFMT);
|
||||||
if (result == GROUP_CHR) {
|
|
||||||
if (Isatty(fd) > 0) {
|
|
||||||
result |= GROUP_TERMIOS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2374,7 +2609,15 @@ int retropt_int(struct opt *opts, int optcode, int *result) {
|
||||||
|
|
||||||
while (opt->desc != ODESC_END) {
|
while (opt->desc != ODESC_END) {
|
||||||
if (opt->desc != ODESC_DONE && opt->desc->optcode == optcode) {
|
if (opt->desc != ODESC_DONE && opt->desc->optcode == optcode) {
|
||||||
*result = opt->value.u_int;
|
switch (opt->desc->type) {
|
||||||
|
case TYPE_INT: *result = opt->value.u_int; break;
|
||||||
|
case TYPE_STRING: *result = strtol(opt->value.u_string, NULL, 0);
|
||||||
|
break;
|
||||||
|
default: Error2("cannot convert type %d of option %s to int",
|
||||||
|
opt->desc->type, opt->desc->defname);
|
||||||
|
opt->desc = ODESC_ERROR;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
opt->desc = ODESC_DONE;
|
opt->desc = ODESC_DONE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2488,13 +2731,13 @@ int retropt_string(struct opt *opts, int optcode, char **result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
/* looks for an bind option and, if found, overwrites the complete contents of
|
/* looks for an bind option and, if found, overwrites the complete contents of
|
||||||
sa with the appropriate value(s).
|
sa with the appropriate value(s).
|
||||||
returns STAT_OK if option exists and could be resolved,
|
returns STAT_OK if option exists and could be resolved,
|
||||||
STAT_NORETRY if option exists but had error,
|
STAT_NORETRY if option exists but had error,
|
||||||
or STAT_NOACTION if it does not exist */
|
or STAT_NOACTION if it does not exist */
|
||||||
/* currently only for IP (v4, v6) */
|
/* currently only for IP (v4, v6) and raw (PF_UNSPEC) */
|
||||||
int retropt_bind(struct opt *opts,
|
int retropt_bind(struct opt *opts,
|
||||||
int af,
|
int af,
|
||||||
int socktype,
|
int socktype,
|
||||||
|
@ -2516,22 +2759,26 @@ int retropt_bind(struct opt *opts,
|
||||||
if (retropt_string(opts, OPT_BIND, &bindname) < 0) {
|
if (retropt_string(opts, OPT_BIND, &bindname) < 0) {
|
||||||
return STAT_NOACTION;
|
return STAT_NOACTION;
|
||||||
}
|
}
|
||||||
addrallowed = true;
|
|
||||||
portallowed = (feats>=2);
|
|
||||||
bindp = bindname;
|
bindp = bindname;
|
||||||
nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests,
|
|
||||||
true, true, false, false);
|
|
||||||
*hostp++ = '\0';
|
|
||||||
if (!strncmp(bindp, portsep, strlen(portsep))) {
|
|
||||||
if (!portallowed) {
|
|
||||||
Error("port specification not allowed in this bind option");
|
|
||||||
return STAT_NORETRY;
|
|
||||||
} else {
|
|
||||||
portp = bindp + strlen(portsep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (af) {
|
switch (af) {
|
||||||
|
|
||||||
|
case AF_UNSPEC:
|
||||||
|
{
|
||||||
|
size_t p = 0;
|
||||||
|
dalan(bindname, (char *)sa->sa_data, &p, *salen-sizeof(sa->sa_family));
|
||||||
|
*salen = p + sizeof(sa->sa_family);
|
||||||
|
*salen = p +
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
sizeof(sa->sa_len) +
|
||||||
|
#endif
|
||||||
|
sizeof(sa->sa_family);
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
sa->sa_len = *salen;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if WITH_IP4 || WITH_IP6
|
#if WITH_IP4 || WITH_IP6
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -2539,6 +2786,19 @@ int retropt_bind(struct opt *opts,
|
||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
#endif /*WITH_IP6 */
|
#endif /*WITH_IP6 */
|
||||||
|
addrallowed = true;
|
||||||
|
portallowed = (feats>=2);
|
||||||
|
nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests,
|
||||||
|
true, false, false, false);
|
||||||
|
*hostp++ = '\0';
|
||||||
|
if (!strncmp(bindp, portsep, strlen(portsep))) {
|
||||||
|
if (!portallowed) {
|
||||||
|
Error("port specification not allowed in this bind option");
|
||||||
|
return STAT_NORETRY;
|
||||||
|
} else {
|
||||||
|
portp = bindp + strlen(portsep);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((result =
|
if ((result =
|
||||||
xiogetaddrinfo(hostname[0]!='\0'?hostname:NULL, portp,
|
xiogetaddrinfo(hostname[0]!='\0'?hostname:NULL, portp,
|
||||||
af, socktype, ipproto,
|
af, socktype, ipproto,
|
||||||
|
@ -2556,7 +2816,7 @@ int retropt_bind(struct opt *opts,
|
||||||
{
|
{
|
||||||
bool tight = false;
|
bool tight = false;
|
||||||
struct sockaddr_un *s_un = (struct sockaddr_un *)sa;
|
struct sockaddr_un *s_un = (struct sockaddr_un *)sa;
|
||||||
*salen = xiosetunix(s_un, bindname, false, tight);
|
*salen = xiosetunix(af, s_un, bindname, false, tight);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* WITH_UNIX */
|
#endif /* WITH_UNIX */
|
||||||
|
@ -2567,14 +2827,14 @@ int retropt_bind(struct opt *opts,
|
||||||
}
|
}
|
||||||
return STAT_OK;
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
/* applies to fd all options belonging to phase */
|
/* applies to fd all options belonging to phase */
|
||||||
/* note: not all options can be applied this way (e.g. OFUNC_SPEC with PH_OPEN)
|
/* note: not all options can be applied this way (e.g. OFUNC_SPEC with PH_OPEN)
|
||||||
implemented are: OFUNC_FCNTL, OFUNC_SOCKOPT (probably not all types),
|
implemented are: OFUNC_FCNTL, OFUNC_SOCKOPT (probably not all types),
|
||||||
OFUNC_TERMIOS_FLAG, OFUNC_TERMIOS_PATTERN, and some OFUNC_SPEC */
|
OFUNC_TERMIOS_FLAG, OFUNC_TERMIOS_PATTERN, and some OFUNC_SPEC */
|
||||||
int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
int applyopts(int fd, struct opt *opts, enum e_phase phase) {
|
||||||
struct opt *opt;
|
struct opt *opt;
|
||||||
|
|
||||||
opt = opts; while (opt && opt->desc != ODESC_END) {
|
opt = opts; while (opt && opt->desc != ODESC_END) {
|
||||||
|
@ -2645,7 +2905,49 @@ int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
||||||
opt->desc = ODESC_ERROR; ++opt; continue;
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_SOCKET
|
} else if (opt->desc->func == OFUNC_IOCTL_GENERIC) {
|
||||||
|
switch (opt->desc->type) {
|
||||||
|
case TYPE_INT:
|
||||||
|
if (Ioctl(fd, opt->value.u_int, NULL) < 0) {
|
||||||
|
Error3("ioctl(%d, 0x%x, NULL): %s",
|
||||||
|
fd, opt->value.u_int, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT:
|
||||||
|
if (Ioctl_int(fd, opt->value.u_int, opt->value2.u_int) < 0) {
|
||||||
|
Error4("ioctl(%d, 0x%x, 0x%x): %s",
|
||||||
|
fd, opt->value.u_int, opt->value2.u_int, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INTP:
|
||||||
|
if (Ioctl(fd, opt->value.u_int, (void *)&opt->value2.u_int) < 0) {
|
||||||
|
Error4("ioctl(%d, 0x%x, %p): %s",
|
||||||
|
fd, opt->value.u_int, (void *)&opt->value2.u_int, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_BIN:
|
||||||
|
if (Ioctl(fd, opt->value.u_int, (void *)opt->value2.u_bin.b_data) < 0) {
|
||||||
|
Error4("ioctl(%d, 0x%x, %p): %s",
|
||||||
|
fd, opt->value.u_int, (void *)opt->value2.u_bin.b_data, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_STRING:
|
||||||
|
if (Ioctl(fd, opt->value.u_int, (void *)opt->value2.u_string) < 0) {
|
||||||
|
Error4("ioctl(%d, 0x%x, %p): %s",
|
||||||
|
fd, opt->value.u_int, (void *)opt->value2.u_string, strerror(errno));
|
||||||
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Error1("ioctl() data type %d not implemented",
|
||||||
|
opt->desc->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
} else if (opt->desc->func == OFUNC_SOCKOPT) {
|
} else if (opt->desc->func == OFUNC_SOCKOPT) {
|
||||||
if (0) {
|
if (0) {
|
||||||
;
|
;
|
||||||
|
@ -2774,7 +3076,7 @@ int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
||||||
&opt->value.u_ip4addr, sizeof(opt->value.u_ip4addr)) < 0) {
|
&opt->value.u_ip4addr, sizeof(opt->value.u_ip4addr)) < 0) {
|
||||||
Error6("setsockopt(%d, %d, %d, {0x%x}, "F_Zu"): %s",
|
Error6("setsockopt(%d, %d, %d, {0x%x}, "F_Zu"): %s",
|
||||||
fd, opt->desc->major, opt->desc->minor,
|
fd, opt->desc->major, opt->desc->minor,
|
||||||
opt->value.u_ip4addr, sizeof(opt->value.u_ip4addr),
|
*(uint32_t *)&opt->value.u_ip4addr, sizeof(opt->value.u_ip4addr),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2822,7 +3124,39 @@ int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
||||||
opt->desc->defname, opt->desc->type);
|
opt->desc->defname, opt->desc->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SOCKET */
|
} else if (opt->desc->func == OFUNC_SOCKOPT_GENERIC) {
|
||||||
|
switch (opt->desc->type) {
|
||||||
|
case TYPE_INT_INT_INT:
|
||||||
|
if (Setsockopt(fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
&opt->value3.u_int, sizeof(int)) < 0) {
|
||||||
|
Error6("setsockopt(%d, %d, %d, {%d}, "F_Zu"): %s",
|
||||||
|
fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
opt->value3.u_int, sizeof(int), strerror(errno));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT_BIN:
|
||||||
|
if (Setsockopt(fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
opt->value3.u_bin.b_data, opt->value3.u_bin.b_len) < 0) {
|
||||||
|
Error5("setsockopt(%d, %d, %d, {...}, "F_Zu"): %s",
|
||||||
|
fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
opt->value3.u_bin.b_len, strerror(errno));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_INT_INT_STRING:
|
||||||
|
if (Setsockopt(fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
opt->value3.u_string,
|
||||||
|
strlen(opt->value3.u_string)+1) < 0) {
|
||||||
|
Error6("setsockopt(%d, %d, %d, \"%s\", "F_Zu"): %s",
|
||||||
|
fd, opt->value.u_int, opt->value2.u_int,
|
||||||
|
opt->value3.u_string, strlen(opt->value3.u_string)+1,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Error1("setsockopt() data type %d not implemented",
|
||||||
|
opt->desc->type);
|
||||||
|
}
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
#if HAVE_FLOCK
|
#if HAVE_FLOCK
|
||||||
} else if (opt->desc->func == OFUNC_FLOCK) {
|
} else if (opt->desc->func == OFUNC_FLOCK) {
|
||||||
|
@ -3040,6 +3374,7 @@ int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: Error1("applyopts(): option \"%s\" not implemented",
|
default: Error1("applyopts(): option \"%s\" not implemented",
|
||||||
opt->desc->defname);
|
opt->desc->defname);
|
||||||
opt->desc = ODESC_ERROR; ++opt; continue;
|
opt->desc = ODESC_ERROR; ++opt; continue;
|
||||||
|
@ -3277,6 +3612,12 @@ int applyopts(int fd, struct opt *opts, unsigned int phase) {
|
||||||
|
|
||||||
#endif /* WITH_TERMIOS */
|
#endif /* WITH_TERMIOS */
|
||||||
|
|
||||||
|
#if WITH_STREAMS
|
||||||
|
#define ENABLE_APPLYOPT
|
||||||
|
#include "xio-streams.c"
|
||||||
|
#undef ENABLE_APPLYOPT
|
||||||
|
#endif /* WITH_STREAMS */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*Error1("applyopts(): function %d not implemented",
|
/*Error1("applyopts(): function %d not implemented",
|
||||||
opt->desc->func);*/
|
opt->desc->func);*/
|
||||||
|
@ -3381,6 +3722,8 @@ static int applyopt_offset(struct single *xfd, struct opt *opt) {
|
||||||
switch (opt->desc->type) {
|
switch (opt->desc->type) {
|
||||||
case TYPE_BOOL:
|
case TYPE_BOOL:
|
||||||
*(bool *)ptr = opt->value.u_bool; break;
|
*(bool *)ptr = opt->value.u_bool; break;
|
||||||
|
case TYPE_INT:
|
||||||
|
*(int *)ptr = opt->value.u_int; break;
|
||||||
case TYPE_UINT:
|
case TYPE_UINT:
|
||||||
*(unsigned int *)ptr = opt->value.u_uint; break;
|
*(unsigned int *)ptr = opt->value.u_uint; break;
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
|
@ -3492,7 +3835,7 @@ int applyopts_single(struct single *xfd, struct opt *opts, enum e_phase phase) {
|
||||||
xfd->lock.intervall.tv_sec = 1;
|
xfd->lock.intervall.tv_sec = 1;
|
||||||
xfd->lock.intervall.tv_nsec = 0;
|
xfd->lock.intervall.tv_nsec = 0;
|
||||||
|
|
||||||
/*! this should be integrated into central select loop */
|
/*! this should be integrated into central select()/poll() loop */
|
||||||
if (xiolock(&xfd->lock) < 0) {
|
if (xiolock(&xfd->lock) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3538,7 +3881,7 @@ int applyopts_single(struct single *xfd, struct opt *opts, enum e_phase phase) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if WITH_SOCKET
|
#if _WITH_SOCKET
|
||||||
case OFUNC_SOCKOPT:
|
case OFUNC_SOCKOPT:
|
||||||
switch (opt->desc->optcode) {
|
switch (opt->desc->optcode) {
|
||||||
#if WITH_IP4 && (defined(HAVE_STRUCT_IP_MREQ) || defined (HAVE_STRUCT_IP_MREQN))
|
#if WITH_IP4 && (defined(HAVE_STRUCT_IP_MREQ) || defined (HAVE_STRUCT_IP_MREQN))
|
||||||
|
@ -3557,9 +3900,9 @@ mc:ifname|ifind
|
||||||
mc:addr
|
mc:addr
|
||||||
*/
|
*/
|
||||||
union sockaddr_union sockaddr1;
|
union sockaddr_union sockaddr1;
|
||||||
size_t socklen1 = sizeof(sockaddr1.ip4);
|
socklen_t socklen1 = sizeof(sockaddr1.ip4);
|
||||||
union sockaddr_union sockaddr2;
|
union sockaddr_union sockaddr2;
|
||||||
size_t socklen2 = sizeof(sockaddr2.ip4);
|
socklen_t socklen2 = sizeof(sockaddr2.ip4);
|
||||||
|
|
||||||
/* first parameter is alway multicast address */
|
/* first parameter is alway multicast address */
|
||||||
/*! result */
|
/*! result */
|
||||||
|
@ -3581,7 +3924,7 @@ mc:addr
|
||||||
ip4_mreqn.mreq.imr_interface = sockaddr2.ip4.sin_addr;
|
ip4_mreqn.mreq.imr_interface = sockaddr2.ip4.sin_addr;
|
||||||
/* third parameter is interface */
|
/* third parameter is interface */
|
||||||
if (ifindex(opt->value.u_ip_mreq.ifindex,
|
if (ifindex(opt->value.u_ip_mreq.ifindex,
|
||||||
(unsigned int *)&ip4_mreqn.mreqn.imr_ifindex)
|
(unsigned int *)&ip4_mreqn.mreqn.imr_ifindex, -1)
|
||||||
< 0) {
|
< 0) {
|
||||||
Error1("cannot resolve interface \"%s\"",
|
Error1("cannot resolve interface \"%s\"",
|
||||||
opt->value.u_ip_mreq.ifindex);
|
opt->value.u_ip_mreq.ifindex);
|
||||||
|
@ -3594,7 +3937,8 @@ mc:addr
|
||||||
#if HAVE_STRUCT_IP_MREQN
|
#if HAVE_STRUCT_IP_MREQN
|
||||||
/* there is a form with two parameters that uses mreqn */
|
/* there is a form with two parameters that uses mreqn */
|
||||||
} else if (ifindex(opt->value.u_ip_mreq.param2,
|
} else if (ifindex(opt->value.u_ip_mreq.param2,
|
||||||
(unsigned int *)&ip4_mreqn.mreqn.imr_ifindex)
|
(unsigned int *)&ip4_mreqn.mreqn.imr_ifindex,
|
||||||
|
-1)
|
||||||
>= 0) {
|
>= 0) {
|
||||||
/* yes, second param converts to interface */
|
/* yes, second param converts to interface */
|
||||||
ip4_mreqn.mreq.imr_interface.s_addr = htonl(0);
|
ip4_mreqn.mreq.imr_interface.s_addr = htonl(0);
|
||||||
|
@ -3655,7 +3999,7 @@ mc:addr
|
||||||
{
|
{
|
||||||
struct ipv6_mreq ip6_mreq = {{{{0}}}};
|
struct ipv6_mreq ip6_mreq = {{{{0}}}};
|
||||||
union sockaddr_union sockaddr1;
|
union sockaddr_union sockaddr1;
|
||||||
size_t socklen1 = sizeof(sockaddr1.ip6);
|
socklen_t socklen1 = sizeof(sockaddr1.ip6);
|
||||||
|
|
||||||
/* always two parameters */
|
/* always two parameters */
|
||||||
/* first parameter is multicast address */
|
/* first parameter is multicast address */
|
||||||
|
@ -3666,7 +4010,8 @@ mc:addr
|
||||||
&sockaddr1, &socklen1, 0, 0);
|
&sockaddr1, &socklen1, 0, 0);
|
||||||
ip6_mreq.ipv6mr_multiaddr = sockaddr1.ip6.sin6_addr;
|
ip6_mreq.ipv6mr_multiaddr = sockaddr1.ip6.sin6_addr;
|
||||||
if (ifindex(opt->value.u_ip_mreq.param2,
|
if (ifindex(opt->value.u_ip_mreq.param2,
|
||||||
&ip6_mreq.ipv6mr_interface) < 0) {
|
&ip6_mreq.ipv6mr_interface, -1)
|
||||||
|
< 0) {
|
||||||
Error1("interface \"%s\" not found",
|
Error1("interface \"%s\" not found",
|
||||||
opt->value.u_ip_mreq.param2);
|
opt->value.u_ip_mreq.param2);
|
||||||
ip6_mreq.ipv6mr_interface = htonl(0);
|
ip6_mreq.ipv6mr_interface = htonl(0);
|
||||||
|
@ -3689,7 +4034,7 @@ mc:addr
|
||||||
++opt; continue;
|
++opt; continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
++opt;
|
++opt;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue