2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00
Commit Graph

16 Commits

Author SHA1 Message Date
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