Messages in this thread | | | Subject | Re: [PATCH v5 06/13] xen/pvcalls: implement bind command | From | Boris Ostrovsky <> | Date | Tue, 17 Oct 2017 13:39:10 -0400 |
| |
On 10/06/2017 08:30 PM, Stefano Stabellini wrote: > Send PVCALLS_BIND to the backend. Introduce a new structure, part of > struct sock_mapping, to store information specific to passive sockets. > > Introduce a status field to keep track of the status of the passive > socket. > > Signed-off-by: Stefano Stabellini <stefano@aporeto.com> > CC: boris.ostrovsky@oracle.com > CC: jgross@suse.com > --- > drivers/xen/pvcalls-front.c | 66 +++++++++++++++++++++++++++++++++++++++++++++ > drivers/xen/pvcalls-front.h | 3 +++ > 2 files changed, 69 insertions(+) > > diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c > index 7c9261b..4cafd9b 100644 > --- a/drivers/xen/pvcalls-front.c > +++ b/drivers/xen/pvcalls-front.c > @@ -71,6 +71,13 @@ struct sock_mapping { > > wait_queue_head_t inflight_conn_req; > } active; > + struct { > + /* Socket status */ > +#define PVCALLS_STATUS_UNINITALIZED 0 > +#define PVCALLS_STATUS_BIND 1 > +#define PVCALLS_STATUS_LISTEN 2 > + uint8_t status; > + } passive; > }; > }; > > @@ -347,6 +354,65 @@ int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr, > return ret; > } > > +int pvcalls_front_bind(struct socket *sock, struct sockaddr *addr, int addr_len) > +{ > + struct pvcalls_bedata *bedata; > + struct sock_mapping *map = NULL; > + struct xen_pvcalls_request *req; > + int notify, req_id, ret; > + > + if (addr->sa_family != AF_INET || sock->type != SOCK_STREAM) > + return -ENOTSUPP; > + > + pvcalls_enter(); > + if (!pvcalls_front_dev) { > + pvcalls_exit(); > + return -ENOTCONN;
The connect patch returns -ENETUNREACH here. Is there a deliberate distinction between these cases?
Other than that
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
| |