summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_engine.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:21:27 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:21:27 +0000
commita50b256dde29028a056176a2bef99096f6c5b619 (patch)
tree2380b51100fa82d3f8bbfbe7d6b57447266adb6f /src/libs6dns/s6dns_engine.c
parent36fa9ff7abbc5a7ab8979073f401d84cba609322 (diff)
downloads6-dns-a50b256dde29028a056176a2bef99096f6c5b619.tar.xz
Port to the new librandom API.
Diffstat (limited to 'src/libs6dns/s6dns_engine.c')
-rw-r--r--src/libs6dns/s6dns_engine.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index 6cf7797..f903ea9 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -71,7 +71,7 @@ static int randombind (int fd, int flag)
{
register unsigned int i = 0 ;
for (; i < 10 ; i++)
- if (socketbind46(fd, S6DNS_ENGINE_LOCAL0, 1025 + badrandom_int(64510), flag) >= 0) return 1 ;
+ if (socketbind46(fd, S6DNS_ENGINE_LOCAL0, 1025 + random_uint32(64510), flag) >= 0) return 1 ;
return (socketbind46(fd, S6DNS_ENGINE_LOCAL0, 0, flag) >= 0) ;
}
@@ -86,7 +86,7 @@ static int thisudp (s6dns_engine_t *dt, tain_t const *stamp)
}
if (byte_diff(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE, S6DNS_ENGINE_LOCAL0)) break ;
}
- if (badrandom_string(dt->sa.s + 2, 2) < 2) return -1 ; /* random query id */
+ random_string(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)))
@@ -117,7 +117,7 @@ static int thistcp (s6dns_engine_t *dt, tain_t const *stamp)
for (; dt->curserver < S6DNS_MAX_SERVERS ; dt->curserver++)
if (byte_diff(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE, S6DNS_ENGINE_LOCAL0)) break ;
if (dt->curserver >= S6DNS_MAX_SERVERS) return -2 ;
- if (badrandom_string(dt->sa.s + 2, 2) < 2) return -1 ;
+ random_string(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)))