From nobody Sun Feb 8 19:21:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638977453; cv=none; d=zohomail.com; s=zohoarc; b=Mh2YQz31G00Yx51ge7SKn1Q9mq7hDFk9qpsQCvhnpi70nM4iDLPfLGd74QG+wZRTpCT/GZiwYTojPs8PSNLnQ6iZfYhVSHh+3B5QLtx2RtColkDEpwdGaQlkKXUChFbfcXSXOK5kx2b+CzlY8ILLXED/9eTLuAyIWjORCUujhGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638977453; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K7s8ESsC8mtq6ZNygKaTM7BLT2/y3c2/ejPxc8ZKuPo=; b=O/mUyB6KsheirILKPn2CdNruuttdGMwNANMPLhYXwFYkGQHA/HY3j58Mj9K/fvHv/EJgSbUJebYyAvcby0IJKGhy5KosdVDwK+3ipNJlFMmANhzyyjeXI2FcpapbuJjEsY7J6A+31B80tM6JY2FDPpuvWyQ32sBHIILRZEPpn4M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638977453433153.1470925880776; Wed, 8 Dec 2021 07:30:53 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-234-voyfq9CAN-ePhgxgoyKLyg-1; Wed, 08 Dec 2021 10:30:49 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6F1D0190B2A6; Wed, 8 Dec 2021 15:30:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C7005D6D5; Wed, 8 Dec 2021 15:30:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1BECB1809CB8; Wed, 8 Dec 2021 15:30:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B8FTVGH032083 for ; Wed, 8 Dec 2021 10:29:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 84D31794DC; Wed, 8 Dec 2021 15:29:31 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B619794DB for ; Wed, 8 Dec 2021 15:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638977452; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=K7s8ESsC8mtq6ZNygKaTM7BLT2/y3c2/ejPxc8ZKuPo=; b=WlFDVn268GbZbs9R5m9FTi2dzmKKh3m2a9pk97DrV7xdQzWa4jSbHjU8Y14MlBo1WpyZHG jZw3/YGgqF3HwLeim2ISUrLV+QPwpAC2H/8cx8vYbrweVKr/0DFBQnyoa8M35sG9ZfZAp3 jmQq7Vz7G7NhqgQX9LD5TBUCqgDnffg= X-MC-Unique: voyfq9CAN-ePhgxgoyKLyg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 2/7] rpc: Separate out socket code into another static lib Date: Wed, 8 Dec 2021 16:29:04 +0100 Message-Id: <123a23cee062f87424e759d4ad4b10b614e238cc.1638977134.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638977454012100001 Content-Type: text/plain; charset="utf-8" There's nothing RPC specific about virnettlscontext.c or virnetsocket.c. We use TLS for other things than just RPC encryption (e.g. for generating random numbers) and sockets can be used even without RPC. Move these two sources into a static library (virt_socket) so that other areas can use it even when RPC is disabled. Signed-off-by: Michal Privoznik --- src/libvirt_remote.syms | 56 ----------------------------------- src/libvirt_socket.syms | 65 +++++++++++++++++++++++++++++++++++++++++ src/rpc/meson.build | 24 +++++++++++++-- 3 files changed, 87 insertions(+), 58 deletions(-) create mode 100644 src/libvirt_socket.syms diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 942e1013a6..1089796066 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -225,62 +225,6 @@ virNetServerServiceTimerActive; virNetServerServiceToggle; =20 =20 -# rpc/virnetsocket.h -virNetSocketAccept; -virNetSocketAddIOCallback; -virNetSocketCheckProtocols; -virNetSocketClose; -virNetSocketDupFD; -virNetSocketGetFD; -virNetSocketGetPath; -virNetSocketGetPort; -virNetSocketGetSELinuxContext; -virNetSocketGetUNIXIdentity; -virNetSocketHasCachedData; -virNetSocketHasPassFD; -virNetSocketHasPendingData; -virNetSocketIsLocal; -virNetSocketListen; -virNetSocketLocalAddrStringSASL; -virNetSocketNewConnectCommand; -virNetSocketNewConnectExternal; -virNetSocketNewConnectLibSSH2; -virNetSocketNewConnectSockFD; -virNetSocketNewConnectSSH; -virNetSocketNewConnectTCP; -virNetSocketNewConnectUNIX; -virNetSocketNewListenFD; -virNetSocketNewListenTCP; -virNetSocketNewListenUNIX; -virNetSocketNewPostExecRestart; -virNetSocketPreExecRestart; -virNetSocketRead; -virNetSocketRecvFD; -virNetSocketRemoteAddrStringSASL; -virNetSocketRemoteAddrStringURI; -virNetSocketRemoveIOCallback; -virNetSocketSendFD; -virNetSocketSetBlocking; -virNetSocketSetTLSSession; -virNetSocketUpdateIOCallback; -virNetSocketWrite; - - -# rpc/virnettlscontext.h -virNetTLSContextCheckCertificate; -virNetTLSContextNewClient; -virNetTLSContextNewClientPath; -virNetTLSContextNewServer; -virNetTLSContextNewServerPath; -virNetTLSInit; -virNetTLSSessionGetHandshakeStatus; -virNetTLSSessionGetKeySize; -virNetTLSSessionGetX509DName; -virNetTLSSessionHandshake; -virNetTLSSessionNew; -virNetTLSSessionRead; -virNetTLSSessionSetIOCallbacks; -virNetTLSSessionWrite; =20 =20 # Let emacs know we want case-insensitive sorting diff --git a/src/libvirt_socket.syms b/src/libvirt_socket.syms new file mode 100644 index 0000000000..3669166225 --- /dev/null +++ b/src/libvirt_socket.syms @@ -0,0 +1,65 @@ +# +# TLS and socket specific symbols +# + +# rpc/virnetsocket.h +virNetSocketAccept; +virNetSocketAddIOCallback; +virNetSocketCheckProtocols; +virNetSocketClose; +virNetSocketDupFD; +virNetSocketGetFD; +virNetSocketGetPath; +virNetSocketGetPort; +virNetSocketGetSELinuxContext; +virNetSocketGetUNIXIdentity; +virNetSocketHasCachedData; +virNetSocketHasPassFD; +virNetSocketHasPendingData; +virNetSocketIsLocal; +virNetSocketListen; +virNetSocketLocalAddrStringSASL; +virNetSocketNewConnectCommand; +virNetSocketNewConnectExternal; +virNetSocketNewConnectLibSSH2; +virNetSocketNewConnectSockFD; +virNetSocketNewConnectSSH; +virNetSocketNewConnectTCP; +virNetSocketNewConnectUNIX; +virNetSocketNewListenFD; +virNetSocketNewListenTCP; +virNetSocketNewListenUNIX; +virNetSocketNewPostExecRestart; +virNetSocketPreExecRestart; +virNetSocketRead; +virNetSocketRecvFD; +virNetSocketRemoteAddrStringSASL; +virNetSocketRemoteAddrStringURI; +virNetSocketRemoveIOCallback; +virNetSocketSendFD; +virNetSocketSetBlocking; +virNetSocketSetTLSSession; +virNetSocketUpdateIOCallback; +virNetSocketWrite; + + +# rpc/virnettlscontext.h +virNetTLSContextCheckCertificate; +virNetTLSContextNewClient; +virNetTLSContextNewClientPath; +virNetTLSContextNewServer; +virNetTLSContextNewServerPath; +virNetTLSInit; +virNetTLSSessionGetHandshakeStatus; +virNetTLSSessionGetKeySize; +virNetTLSSessionGetX509DName; +virNetTLSSessionHandshake; +virNetTLSSessionNew; +virNetTLSSessionRead; +virNetTLSSessionSetIOCallbacks; +virNetTLSSessionWrite; + +# Let emacs know we want case-insensitive sorting +# Local Variables: +# sort-fold-case: t +# End: diff --git a/src/rpc/meson.build b/src/rpc/meson.build index cc1424140a..6c32610d29 100644 --- a/src/rpc/meson.build +++ b/src/rpc/meson.build @@ -1,10 +1,30 @@ genprotocol_prog =3D find_program('genprotocol.pl') gendispatch_prog =3D find_program('gendispatch.pl') =20 -rpc_sources =3D [ - 'virnetmessage.c', +socket_sources =3D [ 'virnettlscontext.c', 'virnetsocket.c', +] + +virt_socket_lib =3D static_library( + 'virt_socket', + [ + socket_sources, + ], + dependencies: [ + gnutls_dep, + src_dep, + ], +) + +libvirt_libs +=3D [ + virt_socket_lib +] + +used_sym_files +=3D 'libvirt_socket.syms' + +rpc_sources =3D [ + 'virnetmessage.c', 'virkeepalive.c', ] =20 --=20 2.32.0