chiark / gitweb /
iaddr_to_string: Do not falsely claim bad addrs are scoped IPv6
[secnet.git] / util.c
diff --git a/util.c b/util.c
index 5200e18ef3bbb315f9e3a233077883732ff1b3c4..2ce3ade37e1228b2effe9f84671dd1efdc0eb76d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -484,6 +484,14 @@ int consttime_memeq(const void *s1in, const void *s2in, size_t n)
     return accumulator;
 }
 
+void hash_hash(const struct hash_if *hashi, const void *msg, int32_t len,
+              uint8_t *digest) {
+    uint8_t hst[hashi->slen];
+    hashi->init(hst);
+    hashi->update(hst,msg,len);
+    hashi->final(hst,digest);
+}
+
 void util_module(dict_t *dict)
 {
     add_closure(dict,"sysbuffer",buffer_apply);
@@ -582,7 +590,7 @@ const char *iaddr_to_string(const union iaddr *ia)
 
     int r = adns_addr2text(&ia->sa, 0, addrbuf, &addrbuflen, &port);
     if (r) {
-       const char fmt[]= "scoped IPv6 addr, error: %.*s";
+       const char fmt[]= "bad addr, error: %.*s";
        sprintf(addrbuf, fmt,
                (int)(ADNS_ADDR2TEXT_BUFLEN - sizeof(fmt)) /* underestimate */,
                strerror(r));