Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / lib / sflow_receiver.c
index 019f38f..e6fc9a7 100644 (file)
@@ -1,5 +1,9 @@
-/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of the InMon sFlow licence: */
-/* http://www.inmon.com/technology/sflowlicense.txt */
+/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of either the
+ *   Sun Industry Standards Source License 1.1, that is available at:
+ *    http://host-sflow.sourceforge.net/sissl.html
+ * or the InMon sFlow License, that is available at:
+ *    http://www.inmon.com/technology/sflowlicense.txt
+ */
 
 #ifndef __CHECKER__            /* Don't run sparse on anything in this file. */
 
@@ -194,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) {