summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-04-09 15:48:31 +0000
committerLaurent Bercot <ska@appnovation.com>2022-04-09 15:48:31 +0000
commitedb658eb85f0546ee72655f1b5cbacda7853db41 (patch)
tree671d1aa550cd1dac5433ba4b275b3fe1868fb2f3 /src
parent199a1f4b807b7dd3e12b0dd6c1c0a86e6ed2b4b3 (diff)
downloads6-dns-edb658eb85f0546ee72655f1b5cbacda7853db41.tar.xz
Prepare for 2.3.5.4; adapt to skalibs-2.12.0.0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r--src/clients/s6-randomip.c7
-rw-r--r--src/libs6dns/s6dns_engine.c4
-rw-r--r--src/libs6dns/s6dns_init.c2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c
index 9419454..3ab98bb 100644
--- a/src/clients/s6-randomip.c
+++ b/src/clients/s6-randomip.c
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <errno.h>
+
#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
@@ -39,16 +40,16 @@ int main (int argc, char const *const *argv)
argc -= subgetopt_here.ind ; argv += subgetopt_here.ind ;
if (!what) what = 1 ;
what = 1 << (1 << what) ;
- if (!random_init()) strerr_diefu1sys(111, "init random generator") ;
for (i = 0 ; !finite || (i < n) ; i++)
{
size_t len = what ;
if (len > 16)
{
- unsigned char c = random_char() ;
+ char c ;
+ random_buf(&c, 1) ;
len = (c & 1) ? 16 : 4 ;
}
- random_string(ip, len) ;
+ random_buf(ip, len) ;
len = (len == 16) ? ip6_fmt(fmt, ip) : ip4_fmt(fmt, ip) ;
fmt[len++] = '\n' ;
if (buffer_put(buffer_1, fmt, len) < (ssize_t)len)
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index 2d07357..10f588c 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -126,7 +126,7 @@ static int thisudp (s6dns_engine_t *dt, tain const *stamp)
}
if (memcmp(s6dns_ip46list_ip(&dt->servers, dt->curserver), S6DNS_ENGINE_LOCAL0, SKALIBS_IP_SIZE)) break ;
}
- random_string(dt->sa.s + 2, 2) ; /* random query id */
+ random_buf(dt->sa.s + 2, 2) ; /* random query id */
dt->fd = socketudp46(s6dns_ip46list_is6(&dt->servers, dt->curserver)) ;
if (dt->fd < 0) return -1 ;
if (!randombind(dt->fd, s6dns_ip46list_is6(&dt->servers, dt->curserver)))
@@ -153,7 +153,7 @@ static int thistcp (s6dns_engine_t *dt, tain const *stamp)
for (; dt->curserver < S6DNS_MAX_SERVERS ; dt->curserver++)
if (memcmp(s6dns_ip46list_ip(&dt->servers, dt->curserver), S6DNS_ENGINE_LOCAL0, SKALIBS_IP_SIZE)) break ;
if (dt->curserver >= S6DNS_MAX_SERVERS) return -2 ;
- random_string(dt->sa.s + 2, 2) ;
+ random_buf(dt->sa.s + 2, 2) ;
dt->fd = sockettcp46(s6dns_ip46list_is6(&dt->servers, dt->curserver)) ;
if (dt->fd < 0) return -1 ;
if (!randombind(dt->fd, s6dns_ip46list_is6(&dt->servers, dt->curserver)))
diff --git a/src/libs6dns/s6dns_init.c b/src/libs6dns/s6dns_init.c
index f3cab32..7f98d13 100644
--- a/src/libs6dns/s6dns_init.c
+++ b/src/libs6dns/s6dns_init.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <skalibs/random.h>
#include <s6-dns/s6dns-rci.h>
#include <s6-dns/s6dns.h>
int s6dns_init (void)
{
- if (!random_init()) return 0 ;
if (!s6dns_rci_init(&s6dns_rci_here, "/etc/resolv.conf")) return 0 ;
return 1 ;
}