2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

15 Commits

Author SHA1 Message Date
Ben Pfaff
b2befd5bb2 sparse: Add guards to prevent FreeBSD-incompatible #include order.
FreeBSD insists that <sys/types.h> be included before <netinet/in.h> and
that <netinet/in.h> be included before <arpa/inet.h>.  This adds guards to
the "sparse" headers to yield a warning if this order is violated.  This
commit also adjusts the order of many #includes to suit this requirement.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-22 12:58:02 -08:00
Flavio Leitner
2f86335b8a test-csum: endianess fix
The math is done in network byte order so the 32 bits won't
match between big and little endian, so the assert fails.

Reduce to 16 bits and then compare to the converted constant.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2015-04-10 08:45:45 -07:00
Jesse Gross
0292a0c9d9 packet: Add IP pseudoheader checksum calculation.
As OVS adds userspace support for being the endpoint in protocols
like tunnels, it will need to be able to calculate pseudoheaders
as part of the checksum calculation.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
2015-04-07 16:51:57 -07:00
Jarno Rajahalme
3f636c7e22 ovs_assert, tests: Support NDEBUG.
./configure accepts --enable-ndebug option.  Make ovs_assert() honor
it, and make sure all test programs disable it.

The order of include files in test programs is also made uniform:

1. #include <config.h>
2. #undef NDEBUG
3. Include file of the test subject (to make sure it itself has
   sufficient include directives).
4. System includes in alphapetical order.
5. OVS includes in aplhapetical order.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-10-30 09:14:46 -07:00
Andy Zhou
eadd16449c unit-test: Link 29 test programs into ovstest
Improve link speed by linking 29 test programs into ovstest.

On my machine, running the following command against a fully
built tree:

  $ touch lib/random.c; time make

Improve the overall build time from 7 seconds to 3.5 seconds.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-04-03 11:17:17 -07:00
Joe Stringer
97025b23a7 lib: Add CRC32C Implementation
This implementation was derived from FreeBSD:
http://svnweb.freebsd.org/base/head/sys/libkern/crc32.c

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-22 09:29:39 -07:00
Ethan Jackson
8d32c1d34b csum: Suppress sparse warning.
The latest version of sparse triggers the following warning in the
checksum tests.  This patch suppresses it.

warning: too long initializer-string for array of char

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-07-09 15:19:57 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
e7b3e606b2 test-csum: Avoid "cast increases required alignment of target type" warning.
Casting a character pointer to uint16_t * or uint32_t * provokes this
warning on sparc.  There is no actual problem, because all of the accesses
to data occurs through calls to the get_unaligned_*() functions, so this
commit suppresses the warning by using "void *" as an intermediate type.
2011-05-26 09:03:05 -07:00
Ben Pfaff
d84d4b88d2 Fix incorrect byte order annotations.
These are not actual bugs, just deceptive use of the wrong function or
type.

Found by sparse.
2011-05-16 13:40:47 -07:00
Ben Pfaff
8064219064 csum: Avoid misaligned data access.
This should fix a checksum test failure observed on Alpha in Debian's
buildds.
2010-11-16 12:52:10 -08:00
Ben Pfaff
d932cf70b1 test-csum: Make test_case requirements clear.
This test code only works properly with test cases whose data is a multiple
of 4, so make that clear in the code and the data.
2010-11-16 12:51:08 -08:00
Ben Pfaff
2a022368f4 Avoid shadowing local variable names.
All of these changes avoid using the same name for two local variables
within a same function.  None of them are actual bugs as far as I can tell,
but any of them could be confusing to the casual reader.

The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer
loops both using (different) variables named 'i'.

Found with GCC -Wshadow.
2010-09-20 09:39:54 -07:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
21effc0384 Add unit test for TCP/IP checksumming code. 2009-06-09 17:10:18 -07:00