summaryrefslogtreecommitdiff
path: root/src/conn-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/conn-tools')
-rw-r--r--src/conn-tools/s6-ident-client.c6
-rw-r--r--src/conn-tools/s6-tcpclient.c20
-rw-r--r--src/conn-tools/s6-tcpserver-access.c33
-rw-r--r--src/conn-tools/s6-tcpserver.c4
-rw-r--r--src/conn-tools/s6-tcpserver4-socketbinder.c2
-rw-r--r--src/conn-tools/s6-tcpserver4.c2
-rw-r--r--src/conn-tools/s6-tcpserver4d.c7
-rw-r--r--src/conn-tools/s6-tcpserver6-socketbinder.c2
-rw-r--r--src/conn-tools/s6-tcpserver6.c2
-rw-r--r--src/conn-tools/s6-tcpserver6d.c7
10 files changed, 36 insertions, 49 deletions
diff --git a/src/conn-tools/s6-ident-client.c b/src/conn-tools/s6-ident-client.c
index 9485de3..8cb9ce1 100644
--- a/src/conn-tools/s6-ident-client.c
+++ b/src/conn-tools/s6-ident-client.c
@@ -17,13 +17,13 @@
int main (int argc, char const *const *argv)
{
- tain_t deadline ;
- ip46_t ra, la ;
+ tain deadline ;
+ ip46 ra, la ;
uint16_t rp, lp ;
PROG = "s6-ident-client" ;
{
unsigned int t = 0 ;
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "t:", &l) ;
diff --git a/src/conn-tools/s6-tcpclient.c b/src/conn-tools/s6-tcpclient.c
index c439812..d567d54 100644
--- a/src/conn-tools/s6-tcpclient.c
+++ b/src/conn-tools/s6-tcpclient.c
@@ -42,7 +42,7 @@ struct tflags_s
char const *localname ;
unsigned int timeout ;
unsigned int timeoutconn[2] ;
- ip46_t localip ;
+ ip46 localip ;
uint16_t localport ;
unsigned int verbosity : 2 ;
#ifdef SKALIBS_IPV6_ENABLED
@@ -55,7 +55,7 @@ struct tflags_s
unsigned int qualif : 1 ;
} ;
-static tain_t deadline ;
+static tain deadline ;
int main (int argc, char const *const *argv)
{
@@ -65,7 +65,7 @@ int main (int argc, char const *const *argv)
uint16_t remoteport ;
PROG = "s6-tcpclient" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, OPTSTRING, &l) ;
@@ -120,7 +120,7 @@ int main (int argc, char const *const *argv)
else tain_add_g(&deadline, &tain_infinite_relative) ;
if (!s6dns_init()) strerr_diefu1sys(111, "init DNS") ;
{
- ip46_t ip[2][MAXIP] ;
+ ip46 ip[2][MAXIP] ;
unsigned int j = 0 ;
size_t n[2] = { 0, 0 } ;
if (!**argv || ((**argv == '0') && !argv[0][1]))
@@ -164,10 +164,10 @@ int main (int argc, char const *const *argv)
size_t i = 0 ;
if (s6dns_resolve_aaaaa_g(&ips, argv[0], strlen(argv[0]), flags.qualif, &deadline) <= 0)
strerr_diefu4x(111, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
- n[0] = genalloc_len(ip46_t, &ips) ;
+ n[0] = genalloc_len(ip46, &ips) ;
if (n[0] >= MAXIP) n[0] = MAXIP ;
- for (; i < n[0] ; i++) ip[0][i] = genalloc_s(ip46_t, &ips)[i] ;
- genalloc_free(ip46_t, &ips) ;
+ for (; i < n[0] ; i++) ip[0][i] = genalloc_s(ip46, &ips)[i] ;
+ genalloc_free(ip46, &ips) ;
}
}
else if (flags.ip6)
@@ -226,7 +226,7 @@ int main (int argc, char const *const *argv)
size_t i = 0 ;
for (; i < n[j] ; i++)
{
- tain_t localdeadline ;
+ tain localdeadline ;
#ifdef SKALIBS_IPV6_ENABLED
if(!localip) flags.localip.is6 = ip46_is6(&ip[j][i]);
#endif
@@ -261,7 +261,7 @@ int main (int argc, char const *const *argv)
strerr_diefu2sys(111, "get local", " address and port") ;
{
- ip46_t remoteip ;
+ ip46 remoteip ;
char fmtip[IP46_FMT] ;
char fmtport[UINT16_FMT] ;
@@ -314,7 +314,7 @@ int main (int argc, char const *const *argv)
data[1].rtype = S6DNS_T_PTR ;
}
{
- tain_t infinite = TAIN_INFINITE ;
+ tain infinite = TAIN_INFINITE ;
if (!s6dns_resolven_parse_g(blob + !!flags.localname, !flags.localname + !!flags.remotehost, &infinite))
strerr_diefu2x(111, "resolve IP addresses: ", s6dns_constants_error_str(errno)) ;
}
diff --git a/src/conn-tools/s6-tcpserver-access.c b/src/conn-tools/s6-tcpserver-access.c
index 4dc6a5b..6d4e044 100644
--- a/src/conn-tools/s6-tcpserver-access.c
+++ b/src/conn-tools/s6-tcpserver-access.c
@@ -39,7 +39,7 @@
#define X() strerr_dief1x(101, "internal inconsistency. Please submit a bug-report.")
-static void logit (pid_t pid, ip46_t const *ip, int h)
+static void logit (pid_t pid, ip46 const *ip, int h)
{
char fmtpid[PID_FMT] ;
char fmtip[IP46_FMT] ;
@@ -49,12 +49,12 @@ static void logit (pid_t pid, ip46_t const *ip, int h)
else strerr_warni5sys("deny", " pid ", fmtpid, " ip ", fmtip) ;
}
-static inline void log_accept (pid_t pid, ip46_t const *ip)
+static inline void log_accept (pid_t pid, ip46 const *ip)
{
logit(pid, ip, 1) ;
}
-static inline void log_deny (pid_t pid, ip46_t const *ip)
+static inline void log_deny (pid_t pid, ip46 const *ip)
{
logit(pid, ip, 0) ;
}
@@ -64,25 +64,24 @@ int main (int argc, char const *const *argv)
{
s6_accessrules_params_t params = S6_ACCESSRULES_PARAMS_ZERO ;
stralloc modifs = STRALLOC_ZERO ;
- tain_t deadline, tto ;
+ tain deadline, tto ;
char const *rulestypestr[3] = { "no", "fs", "cdb" } ;
char const *rules = 0 ;
char const *localname = 0 ;
char const *proto ;
- struct cdb c = CDB_ZERO ;
- int cdbfd = -1 ;
+ cdb c = CDB_ZERO ;
unsigned int rulestype = 0 ;
unsigned int verbosity = 1 ;
size_t protolen ;
s6_accessrules_result_t accepted ;
- ip46_t remoteip, localip ;
+ ip46 remoteip, localip ;
int flagfatal = 1, flagnodelay = 0, flagdnslookup = 1,
flagident = 0, flagparanoid = 0, e = 0 ;
uint16_t remoteport, localport ;
PROG = "s6-tcpserver-access" ;
{
unsigned int timeout = 0 ;
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "WwDdHhRrPpv:l:B:t:i:x:", &l) ;
@@ -158,15 +157,9 @@ int main (int argc, char const *const *argv)
accepted = s6_accessrules_ip46_fs(&remoteip, (void *)rules, &params) ;
break ;
case 2 :
- cdbfd = open_readb(rules) ;
- if (cdbfd < 0) strerr_diefu2sys(111, "open_readb ", rules) ;
- if (cdb_init(&c, cdbfd) < 0) strerr_diefu2sys(111, "cdb_init ", rules) ;
+ if (!cdb_init(&c, rules)) strerr_diefu2sys(111, "cdb_init ", rules) ;
accepted = s6_accessrules_ip46_cdb(&remoteip, &c, &params) ;
- if (accepted == S6_ACCESSRULES_ALLOW)
- {
- cdb_free(&c) ;
- fd_close(cdbfd) ;
- }
+ if (accepted == S6_ACCESSRULES_ALLOW) cdb_free(&c) ;
break ;
default : X() ;
}
@@ -238,7 +231,7 @@ int main (int argc, char const *const *argv)
}
else
{
- tain_t infinite ;
+ tain infinite ;
s6dns_dpag_t data[2] = { S6DNS_DPAG_ZERO, S6DNS_DPAG_ZERO } ;
s6dns_resolve_t blob[2] ;
char remotebuf[256] ;
@@ -363,11 +356,7 @@ int main (int argc, char const *const *argv)
}
}
- if ((rulestype == 2) && (accepted != S6_ACCESSRULES_ALLOW))
- {
- cdb_free(&c) ;
- fd_close(cdbfd) ;
- }
+ if ((rulestype == 2) && (accepted != S6_ACCESSRULES_ALLOW)) cdb_free(&c) ;
switch (accepted)
{
diff --git a/src/conn-tools/s6-tcpserver.c b/src/conn-tools/s6-tcpserver.c
index ed874b6..077b5ad 100644
--- a/src/conn-tools/s6-tcpserver.c
+++ b/src/conn-tools/s6-tcpserver.c
@@ -32,7 +32,7 @@ int main (int argc, char const *const *argv)
unsigned int what = 0 ;
PROG = "s6-tcpserver" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "qQvDd1U46c:C:b:u:g:G:", &l) ;
@@ -63,7 +63,7 @@ int main (int argc, char const *const *argv)
if (!what)
{
- ip46_t ip ;
+ ip46 ip ;
if (!ip46_scan(argv[0], &ip)) dieusage() ;
what = ip46_is6(&ip) ? 6 : 4 ;
}
diff --git a/src/conn-tools/s6-tcpserver4-socketbinder.c b/src/conn-tools/s6-tcpserver4-socketbinder.c
index c02c3a6..69c5262 100644
--- a/src/conn-tools/s6-tcpserver4-socketbinder.c
+++ b/src/conn-tools/s6-tcpserver4-socketbinder.c
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
uint16_t port ;
PROG = "s6-tcpserver4-socketbinder" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "DdMmBb:", &l) ;
diff --git a/src/conn-tools/s6-tcpserver4.c b/src/conn-tools/s6-tcpserver4.c
index 144e16a..734435c 100644
--- a/src/conn-tools/s6-tcpserver4.c
+++ b/src/conn-tools/s6-tcpserver4.c
@@ -30,7 +30,7 @@ int main (int argc, char const *const *argv)
unsigned int backlog = (unsigned int)-1 ;
PROG = "s6-tcpserver4" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "Dd1Uv:c:C:b:u:g:G:", &l) ;
diff --git a/src/conn-tools/s6-tcpserver4d.c b/src/conn-tools/s6-tcpserver4d.c
index ace550a..e8dbb3a 100644
--- a/src/conn-tools/s6-tcpserver4d.c
+++ b/src/conn-tools/s6-tcpserver4d.c
@@ -253,7 +253,6 @@ static inline void new_connection (int s, uint32_t ip, uint16_t port, char const
else if (!pid)
{
selfpipe_finish() ;
- sig_restore(SIGPIPE) ;
run_child(s, ip, port, num+1, argv) ;
}
@@ -280,7 +279,7 @@ int main (int argc, char const *const *argv)
iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .fd = 0, .events = IOPAUSE_READ | IOPAUSE_EXCEPT } } ;
PROG = "s6-tcpserver4d" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
int flag1 = 0 ;
for (;;)
{
@@ -315,7 +314,7 @@ int main (int argc, char const *const *argv)
x[0].fd = selfpipe_init() ;
if (x[0].fd == -1) strerr_diefu1sys(111, "create selfpipe") ;
- if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ;
+ if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ;
{
sigset_t set ;
sigemptyset(&set) ;
@@ -324,7 +323,7 @@ int main (int argc, char const *const *argv)
sigaddset(&set, SIGHUP) ;
sigaddset(&set, SIGQUIT) ;
sigaddset(&set, SIGABRT) ;
- if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ;
+ if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ;
}
fmtlocalmaxconn[1+uint_fmt(fmtlocalmaxconn+1, localmaxconn)] = 0 ;
if (verbosity >= 2)
diff --git a/src/conn-tools/s6-tcpserver6-socketbinder.c b/src/conn-tools/s6-tcpserver6-socketbinder.c
index 6890d7e..6ce2c50 100644
--- a/src/conn-tools/s6-tcpserver6-socketbinder.c
+++ b/src/conn-tools/s6-tcpserver6-socketbinder.c
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
uint16_t port ;
PROG = "s6-tcpserver6-socketbinder" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "DdMmBb:", &l) ;
diff --git a/src/conn-tools/s6-tcpserver6.c b/src/conn-tools/s6-tcpserver6.c
index 51ad4a1..b186ee5 100644
--- a/src/conn-tools/s6-tcpserver6.c
+++ b/src/conn-tools/s6-tcpserver6.c
@@ -30,7 +30,7 @@ int main (int argc, char const *const *argv)
unsigned int backlog = (unsigned int)-1 ;
PROG = "s6-tcpserver6" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
int opt = subgetopt_r(argc, argv, "Dd1Uv:c:C:b:u:g:G:", &l) ;
diff --git a/src/conn-tools/s6-tcpserver6d.c b/src/conn-tools/s6-tcpserver6d.c
index 7f0135b..455b41c 100644
--- a/src/conn-tools/s6-tcpserver6d.c
+++ b/src/conn-tools/s6-tcpserver6d.c
@@ -259,7 +259,6 @@ static inline void new_connection (int s, char const *ip, uint16_t port, char co
else if (!pid)
{
selfpipe_finish() ;
- sig_restore(SIGPIPE) ;
run_child(s, ip, port, num+1, argv) ;
}
@@ -284,7 +283,7 @@ int main (int argc, char const *const *argv)
iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .fd = 0, .events = IOPAUSE_READ | IOPAUSE_EXCEPT } } ;
PROG = "s6-tcpserver6d" ;
{
- subgetopt_t l = SUBGETOPT_ZERO ;
+ subgetopt l = SUBGETOPT_ZERO ;
int flag1 = 0 ;
for (;;)
{
@@ -319,7 +318,7 @@ int main (int argc, char const *const *argv)
x[0].fd = selfpipe_init() ;
if (x[0].fd == -1) strerr_diefu1sys(111, "create selfpipe") ;
- if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ;
+ if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ;
{
sigset_t set ;
sigemptyset(&set) ;
@@ -328,7 +327,7 @@ int main (int argc, char const *const *argv)
sigaddset(&set, SIGHUP) ;
sigaddset(&set, SIGQUIT) ;
sigaddset(&set, SIGABRT) ;
- if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ;
+ if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ;
}
if (flag1)
{