aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/tls.c
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-12-07 13:51:46 +0000
committerMichael Brown <mcb30@ipxe.org>2020-12-07 13:51:46 +0000
commit2b6b02ee7eaad2539e26eb9507833aa3c1c9c15e (patch)
treed2864dc3e9753855829be554b6a58b6a5f2ac230 /src/net/tls.c
parent09fe2bbd343a46010e89d848e5887bfb5fc3f6f6 (diff)
downloadipxe-2b6b02ee7eaad2539e26eb9507833aa3c1c9c15e.tar.gz
[tls] Use intf_insert() to add TLS to an interface
Restructure the use of add_tls() to insert a TLS filter onto an existing interface. This allows for the possibility of using add_tls() to start TLS on an existing connection (as used in several protocols which will negotiate the choice to use TLS before the ClientHello is sent). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tls.c')
-rw-r--r--src/net/tls.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/net/tls.c b/src/net/tls.c
index ea827600f..482200650 100644
--- a/src/net/tls.c
+++ b/src/net/tls.c
@@ -3088,8 +3088,14 @@ static int tls_session ( struct tls_connection *tls, const char *name ) {
******************************************************************************
*/
-int add_tls ( struct interface *xfer, const char *name,
- struct interface **next ) {
+/**
+ * Add TLS on an interface
+ *
+ * @v xfer Data transfer interface
+ * @v name Host name
+ * @ret rc Return status code
+ */
+int add_tls ( struct interface *xfer, const char *name ) {
struct tls_connection *tls;
int rc;
@@ -3133,8 +3139,7 @@ int add_tls ( struct interface *xfer, const char *name,
tls_restart ( tls );
/* Attach to parent interface, mortalise self, and return */
- intf_plug_plug ( &tls->plainstream, xfer );
- *next = &tls->cipherstream;
+ intf_insert ( xfer, &tls->plainstream, &tls->cipherstream );
ref_put ( &tls->refcnt );
return 0;