Skip to content

Commit fb02987

Browse files
sstabelliniBoris Ostrovsky
authored andcommitted
xen/pvcalls: implement socket command
Just reply with success to the other end for now. Delay the allocation of the actual socket to bind and/or connect. Signed-off-by: Stefano Stabellini <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Reviewed-by: Juergen Gross <[email protected]> CC: [email protected] CC: [email protected] Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent b1efa69 commit fb02987

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

drivers/xen/pvcalls-back.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
* GNU General Public License for more details.
1313
*/
1414

15+
#include <linux/inet.h>
1516
#include <linux/kthread.h>
1617
#include <linux/list.h>
1718
#include <linux/radix-tree.h>
1819
#include <linux/module.h>
1920
#include <linux/semaphore.h>
2021
#include <linux/wait.h>
22+
#include <net/sock.h>
23+
#include <net/inet_common.h>
24+
#include <net/inet_connection_sock.h>
25+
#include <net/request_sock.h>
2126

2227
#include <xen/events.h>
2328
#include <xen/grant_table.h>
@@ -52,6 +57,28 @@ struct pvcalls_fedata {
5257
static int pvcalls_back_socket(struct xenbus_device *dev,
5358
struct xen_pvcalls_request *req)
5459
{
60+
struct pvcalls_fedata *fedata;
61+
int ret;
62+
struct xen_pvcalls_response *rsp;
63+
64+
fedata = dev_get_drvdata(&dev->dev);
65+
66+
if (req->u.socket.domain != AF_INET ||
67+
req->u.socket.type != SOCK_STREAM ||
68+
(req->u.socket.protocol != IPPROTO_IP &&
69+
req->u.socket.protocol != AF_INET))
70+
ret = -EAFNOSUPPORT;
71+
else
72+
ret = 0;
73+
74+
/* leave the actual socket allocation for later */
75+
76+
rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++);
77+
rsp->req_id = req->req_id;
78+
rsp->cmd = req->cmd;
79+
rsp->u.socket.id = req->u.socket.id;
80+
rsp->ret = ret;
81+
5582
return 0;
5683
}
5784

0 commit comments

Comments
 (0)