[ovs-dev] [PATCH] sFlow: clear the padding

Ben Pfaff blp at nicira.com
Mon Jan 13 21:33:11 UTC 2014


Thanks.

I applied this to master and branches for 2.1, 2.0, 1.11, 1.9, and
1.4.

On Mon, Jan 13, 2014 at 12:16:01PM -0800, Neil McKee wrote:
> Sorry for the delay.  Looks good.  And thanks for pointing this out.
> 
> Neil
> 
> ------
> Neil McKee
> InMon Corp.
> http://www.inmon.com
> 
> 
> On Tue, Jan 7, 2014 at 1:28 AM, Francesco Fusco <ffusco at redhat.com> wrote:
> > Neil,
> > did you have a chance to have a look at the patch?
> >
> > Best,
> > Francesco
> >
> >
> > On 12/19/2013 06:28 PM, Ben Pfaff wrote:
> >>
> >> Hi Francesco.  Thanks for the patch.
> >>
> >> The sFlow code comes almost unmodified from InMon.  I'm adding Neil
> >> McKee from InMon to the thread to review this change.  Neil, can you
> >> take a look?  (And that reminds me, I need to review your patch too.
> >> I'll do that now.)
> >>
> >> Thanks,
> >>
> >> Ben.
> >>
> >> On Thu, Dec 19, 2013 at 06:16:24PM +0100, Francesco Fusco wrote:
> >>>
> >>> putString pads the string to the 4-byte boundary without
> >>> clearing the "padded" memory. This patch simply set the
> >>> padding to zero.
> >>>
> >>> Signed-off-by: Francesco Fusco <ffusco at redhat.com>
> >>> ---
> >>>   lib/sflow_receiver.c | 4 ++++
> >>>   1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c
> >>> index 3e5a67a..e6fc9a7 100644
> >>> --- a/lib/sflow_receiver.c
> >>> +++ b/lib/sflow_receiver.c
> >>> @@ -198,6 +198,10 @@ inline static void putString(SFLReceiver *receiver,
> >>> SFLString *s)
> >>>       putNet32(receiver, s->len);
> >>>       memcpy(receiver->sampleCollector.datap, s->str, s->len);
> >>>       receiver->sampleCollector.datap += (s->len + 3) / 4; /* pad to
> >>> 4-byte boundary */
> >>> +    if ((s->len % 4) != 0){
> >>> +        u_int8_t padding = 4 - (s->len % 4);
> >>> +        memset(((u_int8_t*)receiver->sampleCollector.datap)-padding, 0,
> >>> padding);
> >>> +    }
> >>>   }
> >>>
> >>>   inline static u_int32_t stringEncodingLength(SFLString *s) {
> >
> >



More information about the dev mailing list