aboutsummaryrefslogtreecommitdiff
path: root/crypto/bio
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-02-05 19:40:44 +0000
committerMatt Caswell <matt@openssl.org>2016-02-05 20:47:36 +0000
commit7d1d48a2d0a08567f5c8e14d50d89a9b47c02f1d (patch)
tree4e06fa9430101a0f83e3876575c4c39eebf7f4a1 /crypto/bio
parent0d4fb8439092ff8253af72ac6bc193e77ebbcf2f (diff)
downloadopenssl-7d1d48a2d0a08567f5c8e14d50d89a9b47c02f1d.zip
openssl-7d1d48a2d0a08567f5c8e14d50d89a9b47c02f1d.tar.gz
openssl-7d1d48a2d0a08567f5c8e14d50d89a9b47c02f1d.tar.bz2
Add a BIO_ADDR_clear function
Adds a new function BIO_ADDR_clear to reset a BIO_ADDR back to an unitialised state, and to set the family to AF_UNSPEC. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_addr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 20cb66d..f1ff5fe 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -76,6 +76,7 @@
BIO_ADDR *BIO_ADDR_new(void)
{
BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
+ ret->sa.sa_family = AF_UNSPEC;
return ret;
}
@@ -84,6 +85,12 @@ void BIO_ADDR_free(BIO_ADDR *ap)
OPENSSL_free(ap);
}
+void BIO_ADDR_clear(BIO_ADDR *ap)
+{
+ memset(ap, 0, sizeof(*ap));
+ ap->sa.sa_family = AF_UNSPEC;
+}
+
/*
* BIO_ADDR_make - non-public routine to fill a BIO_ADDR with the contents
* of a struct sockaddr.