|
| From: | Paolo Bonzini |
| Subject: | Re: [Qemu-devel] [PATCH 1/2] nbd: Handle fixed new-style clients. |
| Date: | Tue, 27 May 2014 16:46:46 +0200 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Il 25/05/2014 11:50, Hani Benhabiles ha scritto:
@@ -236,9 +236,10 @@ static int nbd_receive_options(NBDClient *client)
LOG("read failed");
goto fail;
}
- TRACE("Checking reserved");
- if (tmp != 0) {
- LOG("Bad reserved received");
+ TRACE("Checking client flags");
+ tmp = be32_to_cpu(tmp);
+ if (tmp != 0 && tmp != NBD_FLAG_C_FIXED_NEWSTYLE) {
+ LOG("Bad client flags received");
goto fail;
}
@@ -246,7 +247,7 @@ static int nbd_receive_options(NBDClient *client)
LOG("read failed");
goto fail;
}
- TRACE("Checking reserved");
+ TRACE("Checking opts magic");
if (magic != be64_to_cpu(NBD_OPTS_MAGIC)) {
LOG("Bad magic received");
goto fail;
Here, if the client used "fixed new-style negotiation" you should reply with NBD_REP_ERR_UNSUP. You also need to turn this into a while loop. With these changes here, the logic in patch 2 should be okay.
Thanks, Paolo
| [Prev in Thread] | Current Thread | [Next in Thread] |