rpc_binder: Specify CID for vsock RpcServer
Currently RpcServer only allows to start a server listening for connections from VMHOST_CID_ANY. This is not always desirable as clients may want to listen only for connections from specific CIDs, eg. only the host or only local. This can be partially solved by setting the bind CID of the virtual socket. The server can bind to VMADDR_CID_LOCAL for local interface only. VMADDR_CID_ANY same as its own CID will bind to the remote interface and accept connections from all clients. To this end, add a callback for filtering accepted connections in RpcServer. This may already be possible with per-session root object. However, the root object is selected very late, after initial negotiation with the client. For both performance and safety, add the callback immediately after accept() to reject the connection as early as possible. Bug: 245727626 Test: atest binderRpcTest Change-Id: I5b3e6fd5119c77ef8c5c4fbbfead9892c5de1a07
Loading
Please register or sign in to comment