summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver-access.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-30 05:40:04 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-30 05:40:04 +0000
commitbef76b45f480aa41209efdec09fc6bb0bfde7cbe (patch)
treebb3945da0504c569ff325829bf5f895f8e355039 /src/conn-tools/s6-tcpserver-access.c
parenta068a3256fab3b77b7d1bc9ce201c954a9b00c94 (diff)
downloads6-networking-bef76b45f480aa41209efdec09fc6bb0bfde7cbe.tar.xz
Great Tcpserver Unification. Prepare for 2.6.0.0.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/conn-tools/s6-tcpserver-access.c')
-rw-r--r--src/conn-tools/s6-tcpserver-access.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/conn-tools/s6-tcpserver-access.c b/src/conn-tools/s6-tcpserver-access.c
index addf66b..ddd6072 100644
--- a/src/conn-tools/s6-tcpserver-access.c
+++ b/src/conn-tools/s6-tcpserver-access.c
@@ -127,6 +127,14 @@ int main (int argc, char const *const *argv)
char const *x ;
char tmp[protolen + 11] ;
memcpy(tmp, proto, protolen) ;
+ memcpy(tmp + protolen, "LOCALIP", 8) ;
+ x = getenv(tmp) ;
+ if (!x) strerr_dienotset(100, tmp) ;
+ if (!ip46_scan(x, &localip)) strerr_dieinvalid(100, tmp) ;
+ memcpy(tmp + protolen + 5, "PORT", 5) ;
+ x = getenv(tmp) ;
+ if (!x) strerr_dienotset(100, tmp) ;
+ if (!uint160_scan(x, &localport)) strerr_dieinvalid(100, tmp) ;
memcpy(tmp + protolen, "REMOTEIP", 9) ;
x = getenv(tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
@@ -180,17 +188,8 @@ int main (int argc, char const *const *argv)
{
char const *x = 0 ;
char idbuf[S6NET_IDENT_ID_SIZE] ;
- char fmt[IP46_FMT] ;
char tmp[protolen + 11] ;
- if (socket_local46(0, &localip, &localport) < 0)
- strerr_diefu1sys(111, "socket_local") ;
- fmt[ip46_fmt(fmt, &localip)] = 0 ;
memcpy(tmp, proto, protolen) ;
- memcpy(tmp + protolen, "LOCALIP", 8) ;
- if (!env_addmodif(&modifs, tmp, fmt)) dienomem() ;
- fmt[uint16_fmt(fmt, localport)] = 0 ;
- memcpy(tmp + protolen + 5, "PORT", 5) ;
- if (!env_addmodif(&modifs, tmp, fmt)) dienomem() ;
memcpy(tmp + protolen, "REMOTEINFO", 11) ;
if (flagident)
{
@@ -215,7 +214,6 @@ int main (int argc, char const *const *argv)
}
else x = idbuf ;
}
-
if (!env_addmodif(&modifs, tmp, x)) dienomem() ;
}