Fixed long-standing bug with h2r functions being back to front

h2r seemd to be using beXXtoh functions instead of htobeXX.  Foruntately
ROT13 works symmetrically on our systems..!
This commit is contained in:
Patrick J Cherry
2018-02-05 16:16:17 +00:00
parent d1dc7392c2
commit ad2014ac9d
2 changed files with 16 additions and 16 deletions

View File

@@ -26,16 +26,6 @@ void nbd_h2r_init( struct nbd_init * from, struct nbd_init_raw * to)
void nbd_r2h_request( struct nbd_request_raw *from, struct nbd_request * to )
{
to->magic = htobe32( from->magic );
to->flags = htobe16( from->flags );
to->type = htobe16( from->type );
to->handle.w = from->handle.w;
to->from = htobe64( from->from );
to->len = htobe32( from->len );
}
void nbd_h2r_request( struct nbd_request * from, struct nbd_request_raw * to )
{
to->magic = be32toh( from->magic );
to->flags = be16toh( from->flags );
@@ -45,18 +35,28 @@ void nbd_h2r_request( struct nbd_request * from, struct nbd_request_raw * to )
to->len = be32toh( from->len );
}
void nbd_r2h_reply( struct nbd_reply_raw * from, struct nbd_reply * to )
void nbd_h2r_request( struct nbd_request * from, struct nbd_request_raw * to )
{
to->magic = htobe32( from->magic );
to->error = htobe32( from->error );
to->flags = htobe16( from->flags );
to->type = htobe16( from->type );
to->handle.w = from->handle.w;
to->from = htobe64( from->from );
to->len = htobe32( from->len );
}
void nbd_h2r_reply( struct nbd_reply * from, struct nbd_reply_raw * to )
void nbd_r2h_reply( struct nbd_reply_raw * from, struct nbd_reply * to )
{
to->magic = be32toh( from->magic );
to->error = be32toh( from->error );
to->handle.w = from->handle.w;
}
void nbd_h2r_reply( struct nbd_reply * from, struct nbd_reply_raw * to )
{
to->magic = htobe32( from->magic );
to->error = htobe32( from->error );
to->handle.w = from->handle.w;
}

View File

@@ -471,8 +471,8 @@ int proxy_read_from_downstream( struct proxier *proxy, int state )
if ( proxy->req.needle == proxy->req.size ) {
debug(
"Received NBD request from downstream. type=%"PRIu32" from=%"PRIu64" len=%"PRIu32,
request->type, request->from, request->len
"Received NBD request from downstream. type=%"PRIu16" flags=%"PRIu16" from=%"PRIu64" len=%"PRIu32,
request->type, request->flags, request->from, request->len
);
/* Finished reading, so advance state. Leave size untouched so the next