[ovs-dev] [PATCH v1 2/5] datapath-windows: Added the API for getting unused space in nlbuf.

Ankur Sharma ankursharma at vmware.com
Fri Oct 3 17:33:50 UTC 2014


Hi Nithin,

Now that i think of the change in NlBufAt again, i think the previous code was correct.
 if ((offset + bufLen) > NL_BUF_USED_SPACE(nlBuf)) will make sure that the request buffer is within tail boundaries.

I'll revert my fix in  NlBufAt in v2.

Regards,
Ankur
________________________________________
From: Nithin Raju
Sent: Wednesday, October 1, 2014 8:50 PM
To: Ankur Sharma
Cc: <dev at openvswitch.org>
Subject: Re: [ovs-dev] [PATCH v1 2/5] datapath-windows: Added the API for       getting unused space in nlbuf.

> diff --git a/datapath-windows/ovsext/Netlink/NetlinkBuf.c b/datapath-windows/ovsext/Netlink/NetlinkBuf.c
> index 918bddd..bc079ef 100644
> --- a/datapath-windows/ovsext/Netlink/NetlinkBuf.c
> +++ b/datapath-windows/ovsext/Netlink/NetlinkBuf.c
> @@ -291,7 +291,7 @@ NlBufAt(PNL_BUFFER nlBuf, UINT32 offset, UINT32 bufLen)
>         goto done;
>     }
>
> -    if ((offset + bufLen) > NL_BUF_USED_SPACE(nlBuf)) {
> +    if ((offset + bufLen) > nlBuf->bufRemLen) {

Should this not be?
    if ((offset + bufLen) > nlBuf->bufLen) {

Basically, lets say total buffer size is 48, and you have used up 40 bytes. So:
nlBuf->bufLen is 48
nlBuf->bufRemLen is 8

If offset = 40, and bufLen = 16, you want to fail the API.
If offset = 40, and bufLen = 4, you want to succeed the API.

Looks good otherwise.

Thanks,
-- Nithin



More information about the dev mailing list