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

23 Commits

Author SHA1 Message Date
Ben Pfaff
9ddf12cc12 netlink: New function nl_msg_put_unspec_zero().
This function already had a few potential users, which this commit
converts.  An upcoming commit adds more users.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-11 13:02:58 -08:00
Ben Pfaff
542024c4c3 ofproto-dpif-xlate: Suppress oversize datapath actions.
If we allow oversize datapath actions to make it out of translation, then
we will assert-fail later when we try to put those actions into a Netlink
attribute.

Bug #19277.
Reported-by: Paul ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2013-10-04 08:48:48 -07:00
Alex Wang
4e022ec09e Create specific types for ofp and odp port
Until now, datapath ports and openflow ports were both represented by
unsigned integers of various sizes. With implicit conversions, etc., it is
easy to mix them up and use one where the other is expected.  This commit
creates two typedefs, ofp_port_t and odp_port_t.  Both of these two types
are marked by "__attribute__((bitwise))" so that sparse can be used to
detect any misuse.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-20 10:42:37 -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
be3330a669 netlink: Refactor and simplify nl_policy_parse(). 2011-11-11 14:07:17 -08:00
Ben Pfaff
f7df9823a0 netlink: New macro NL_POLICY_FOR. 2011-11-11 14:07:17 -08:00
Ben Pfaff
3a706b33aa netlink: New macros for the sizes of Netlink attributes.
I was feeling tempted in some code to just guess "hey, 32 bytes ought to
be big enough" and so on, but really it seems better to just have a
convenient way to measure.
2011-10-14 14:08:44 -07:00
Ben Pfaff
46d34fefc1 netlink: New functions for putting attributes at the beginning of a buffer.
These are really just copies of the corresponding "put" functions.  An
upcoming commit will introduce a user of nl_msg_push_u32().  I thought I
might as well create all of these while I was at it.
2011-10-14 14:08:43 -07:00
Ben Pfaff
6d23c6f422 netlink: New macros NL_NESTED_FOR_EACH, NL_NESTED_FOR_EACH_UNSAFE.
Upcoming commits will introduce more users.
2011-10-11 10:37:25 -07:00
Jesse Gross
0b6c119bb7 netlink: Expose version of nl_attr_find for key and len.
Many of our functions pass around a pointer to Netlink attributes
and a length.  This exposes the version of nl_attr_find that takes
that format so it can be used by callers outside the Netlink library.
2011-09-23 15:27:49 -07:00
Ben Pfaff
08c4a39ef8 netlink: Avoid "cast increases required alignment of target type" on RISC.
This warning doesn't indicate a genuine problem, since 'nla' must be
aligned properly and NLA_ALIGN ensures that the offset is aligned properly
too.  Casting via void * suppresses the warning.
2011-05-26 09:01:29 -07:00
Ben Pfaff
18c58479a1 netlink: Add nl_attr_type constants for big-endian values.
These are semantically identical, so they might as well share existing
values, but they help to document the endianness of attributes in Netlink
attribute policies.

Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-27 09:26:05 -08:00
Ben Pfaff
b18fcf8edd netlink: New functions for finding a specific attribute.
These functions are useful in the occasional case where a piece of code
only cares about one or a few attributes, probably knows that the format
is correct, and doesn't want to go to the trouble of doing a full parse.
Upcoming commits will add a user.

Reviewed by Justin Pettit.
2011-01-27 09:26:05 -08:00
Ben Pfaff
7f8ca6459c netlink: Add macros for iterating through attributes.
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:13:32 -08:00
Ben Pfaff
7c62447839 netlink: New function nl_attr_type().
Linux since v2.6.24 has a couple of couple of bits at the top of
nla_type that one is apparently supposed to ignore.  This commit
starts doing that in Open vSwitch userspace.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:13:31 -08:00
Ben Pfaff
ee913f985d netlink: Add functions for working with big-endian attribute values.
These _be<N> functions are completely equivalent to the corresponding
_u<N> functions, but the names help to make their purpose clear.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:13:31 -08:00
Ben Pfaff
2fe27d5ad2 netlink: Split into generic and Linux-specific parts.
The parts of the netlink module that are related to sockets are
Linux-specific, since only Linux has AF_NETLINK sockets.  The rest can be
built anywhere.  This commit breaks them into two modules, and builds the
generic one on all platforms.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:13:27 -08:00
Ben Pfaff
38a997566d netlink: Improve support for nested Netlink attributes.
Fairly often it happens that nested Netlink attributes must themselves
contain Netlink attributes.  In such a case, nlmsg_put_nested() is not so
convenient, because it requires the contents to be pre-assembled and then
copied into place.  This commit introduces a new interface that instead
allows the nested attributes to be assembled in-place.  As a demonstration,
it updates nl_msg_put_nested() to use this new interface.
2010-06-17 10:30:19 -07:00
Ben Pfaff
974d6a6d0b netlink: Add support for Netlink table dumping. 2010-06-17 10:30:19 -07:00
Ben Pfaff
25eeae6a1e netlink: Add functions for handling nested attributes. 2010-06-17 10:30:18 -07:00
Ben Pfaff
6912370445 netlink: Drop sock parameter from nl_msg_put_(ge)nlmsghdr().
These two functions use their "sock" parameter only to figure out the
nlmsg_pid to put in the nlmsghdr.  But that field can be filled in just
as well right before sending the message.  Since our functions for sending
Netlink messages always modify the nlmsghdr anyhow (to fill in the length),
there is little benefit to filling in the nlmsg_pid in advance.  The cost,
on the other hand, is having to pass another argument to functions that
already have too many.  So this commit removes the argument.
2010-06-17 10:30:18 -07: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