2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

33 Commits

Author SHA1 Message Date
Ben Pfaff
8a07709cb8 configure: Remove --with-build-number.
From early days, Nicira used the --with-build-number option to configure to
stamp our internal builds.  We've since switched to another scheme, so
this option is obsolete.

Good riddance.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-19 10:07:09 -07:00
Ben Pfaff
6cc7ea5ea0 util: New function bitwise_zero().
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-01 14:15:11 -08:00
Ben Pfaff
ddc4f8e27f util: Move bitwise_copy() here, add new bitwise functions, add a test.
bitwise_copy() is generally useful so make it a general utility function.
Also add a comment.

Upcoming commits will introduce users for the new functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-01 14:15:07 -08:00
Ben Pfaff
300c69464c multipath: Correctly calculate number of required destination bits.
The previous calculation was wrong when n_links was a power of 2.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-12 16:51:29 -08:00
Ben Pfaff
75a7504356 Implement new "learn" action.
There are a few loose ends here.  First, learning actions cause too much
flow revalidation.  Upcoming commits will fix that problem.  The following
additional issues have not yet been addressed:

    * Resource limits: nothing yet limits the maximum number of flows that
      can be learned.  It is possible to exhaust all system memory.

    * Age reporting: there is no way to find out how soon a learned table
      entry is due to be evicted.

To try this action out, here's a recipe for a very simple-minded MAC
learning switch.  It uses a 10-second MAC expiration time to make it easier
to see what's going on:

ovs-vsctl del-controller br0
ovs-ofctl del-flows br0
ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=10, \
	NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
	output:NXM_OF_IN_PORT[]), resubmit(,1)"
ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

You can then dump the MAC learning table with:

ovs-ofctl dump-flows br0 table=1
2011-09-13 11:46:09 -07:00
Ben Pfaff
aad29cd1a1 packets: Add more utility functions for IPv4 and IPv6 addresses.
We had these functions scattered around the source tree anyway.  packets.h
is a good place to centralize them.

I do plan to introduce some additional callers.
2011-09-13 11:46:08 -07:00
Ethan Jackson
b53055f4da lib: Whitespace cleanup. 2011-08-12 15:05:41 -07:00
Ethan Jackson
c71c6043a7 util: Fix non-ANSI function declaration.
This patch fixes the following sparse warning:
"non-ANSI function declaration of function 'get_program_version'"
2011-08-04 13:21:38 -07:00
Justin Pettit
55d5bb44cb util: Introduce get_program_version function.
Useful in an upcoming commit.
2011-08-04 11:15:43 -07:00
Ben Pfaff
711e0157cf util: New function log_2_floor().
Calculates the position of the most significant bit in a 32 bit
word.
2011-07-22 17:46:48 -07:00
Ben Pfaff
44b4d050d4 util: New function for forming English lists.
This follows the rules I learned in school.  Some locales may prefer to
omit the comma before "and" in a list of three or more items.
2011-06-06 08:58:02 -07:00
Ben Pfaff
fcaddd4dd1 util: New function ovs_fatal_valist().
This commit adds a few initial users but more are coming up.
2011-04-04 10:58:55 -07:00
Ben Pfaff
c1c8308a39 util: Make out_of_memory() call abort() instead of exit(EXIT_FAILURE).
exit(EXIT_FAILURE) will make a monitoring process (the one created by
--monitor) think that it should exit.  But the most likely reason for
out_of_memory() to be called is a bug: probably, the process is trying
to allocate more memory than there is available address space, e.g.
something like malloc(-1).  So it's better, in my opinion, to call abort()
instead, so that the monitor process restarts the daemon and we are more
likely to stay alive and, in addition, get a core dump and a useful bug
report.

I decided to implement a new general-purpose function for this purpose in
case we run into other similar situations in the future.

(I haven't actually run into this problem in practice.  This commit is
just speculation about what is better behavior.)
2011-02-23 15:43:34 -08:00
Ben Pfaff
71d7c22f54 util: New function ovs_strzcpy().
Static analyzers hate strncpy().  This new function shares its property of
initializing an entire buffer, without its nasty habit of failing to
null-terminate long strings.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.
2011-02-22 16:33:58 -08:00
Ben Pfaff
e868fb3d32 util: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().
The blind replacement of strncpy() by ovs_strlcpy() is risky because
strncpy() never reads more bytes from its source string than necessary to
write its destination string, but ovs_strlcpy() and the OpenBSD function
that inspired it both read the entire source string.  This avoids that
problem.

Given that change, we can use ovs_strlcpy() in a few more places, and
this commit does that too.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.
2011-02-22 16:33:35 -08:00
Andrew Evans
c18ea70d06 util: New ovs_retval_to_string() function.
Many OVS functions return 0, EOF, or errno. There are several places in the
codebase where a return value is converted to a string. All must decide whether
the return value is set, and if it is, whether it is an errno value, EOF, or
otherwise invalid. This commit consolidates that code.

Reviewed by Ben Pfaff.
2011-01-30 17:54:59 -08:00
Ben Pfaff
d76f09ea77 coverage: Make the coverage counters catalog program-specific.
Until now, the collection of coverage counters supported by a given OVS
program was not specific to that program.  That means that, for example,
even though ovs-dpctl does not have anything to do with mac_learning, it
still has a coverage counter for it.  This is confusing, at best.

This commit fixes the problem on some systems, in particular on ones that
use GCC and the GNU linker.  It uses the feature of the GNU linker
described in its manual as:

    If an orphaned section's name is representable as a C identifier then
    the linker will automatically see PROVIDE two symbols: __start_SECNAME
    and __end_SECNAME, where SECNAME is the name of the section.  These
    indicate the start address and end address of the orphaned section
    respectively.

Systems that don't support these features retain the earlier behavior.

This commit also fixes the annoyance that files that include coverage
counters must be listed on COVERAGE_FILES in lib/automake.mk.

This commit also fixes the annoyance that modifying any source file that
includes a coverage counter caused all programs that link against
libopenvswitch.a to relink, even programs that the source file was not
linked into.  For example, modifying ofproto/ofproto.c (which includes
coverage counters) caused tests/test-aes128 to relink, even though
test-aes128 does not link again ofproto.o.
2010-11-30 10:30:30 -08:00
Ben Pfaff
bf9712678f util: Add function hexits_value() for parsing multiple hex digits.
Suggested-by: Justin Pettit <jpettit@nicira.com>
2010-11-15 10:18:10 -08:00
Ben Pfaff
e1aff6f9f7 util: New function base_name(). 2010-11-10 10:56:01 -08:00
Ben Pfaff
09246b99d1 ofproto: Implement Nicira Extended Match flexible flow match (NXM). 2010-11-09 17:08:09 -08:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Joe Perches
d295e8e97a treewide: Remove trailing whitespace
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-30 13:23:08 -07:00
Ben Pfaff
e2c1a82010 util: Make ovs_fatal() understand EOF also.
ovs_error() interprets EOF as "end of file" when printing an error message,
so ovs_fatal() might as well.
2010-08-12 15:45:50 -07:00
Ben Pfaff
5136ce492c vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined.  A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.
2010-07-21 15:47:09 -07:00
Ben Pfaff
daf03c53ee util: New functions get_cwd(), abs_file_name().
These will be used further in an upcoming commit.
2010-03-18 11:23:50 -07:00
Ben Pfaff
c69ee87c10 Merge "master" into "next".
The main change here is the need to update all of the uses of UNUSED in
the next branch to OVS_UNUSED as it is now spelled on "master".
2010-02-11 11:11:23 -08:00
Justin Pettit
18b9283b98 Clean-up compiler warnings about ignoring return values
Some systems complain when certain functions' return values are not
checked.  This commit fixes those warnings.

Creating ignore() function suggested by Ben Pfaff.
2009-12-15 00:14:32 -08:00
Ben Pfaff
29d4af6016 New dir_name() function plus tests. 2009-11-04 15:24:40 -08:00
Ben Pfaff
0fec26b00b util: Make ovs_error() understand that EOF means "end of file".
This convention is in use in a few places in the source tree, and so it
seems to be about time to start putting it into central places.
2009-11-04 15:24:40 -08:00
Ben Pfaff
f38b84ea2b Implement JSON parsing and serialization.
This will be used by the upcoming Open vSwitch configuration database.
2009-11-04 15:24:40 -08:00
Ben Pfaff
ec6fde61c8 Add new function xzalloc(n) as a shorthand for xcalloc(1, n). 2009-11-04 14:52:32 -08:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00