Commit Graph

122 Commits

Author SHA1 Message Date
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Zbigniew Jędrzejewski-Szmek 5abcee286e sd-netlink: remove unused table 2016-01-18 15:21:27 -05:00
Tom Gundersen b69015efd2 sd-netlink: add support for RTA_PREF 2015-11-11 15:42:38 +01:00
Tom Gundersen 8ae4b6d12c sd-netlink: types - let tables be sized implicitly
This way we do not rely on the size MAX* constants from the kernel headers, as these will
be out-of-sync in case we have old headers and new defines in missing.h.
2015-11-11 15:42:38 +01:00
Lennart Poettering 8b43440b7e util-lib: move string table stuff into its own string-table.[ch] 2015-10-27 13:25:56 +01:00
Susant Sahani ced671e105 sd-rtnl: sd-netlink: add support for bridge NL parametrs
Rename rtnl_link_info_data_bridge_types to
rtnl_link_bridge_management_types
as they are of nested types of IFLA_AF_SPEC.
2015-10-05 09:43:29 +05:30
Susant Sahani 452c956933 sd-netlink: add support for vxlan attributes 2015-07-29 11:28:57 +05:30
Susant Sahani d13125752d sd-netlink: Add macvtap support 2015-07-27 11:18:07 +05:30
Zbigniew Jędrzejewski-Szmek 6e74cadeef netlink-types: use consistent whitespace at EOL
Follow up for v222-124-g79e27dbcb1.
2015-07-24 23:43:51 -04:00
Susant Sahani 0c1f248ef6 sd-netlink: add bridge NL params 2015-07-23 15:06:03 +05:30
Susant Sahani 8aee0f1ff3 sd-netlink: add tunnel params 2015-07-22 15:01:58 +05:30
Susant Sahani 79e27dbcb1 sd-netlink: add tunnel NL parameters 2015-07-20 10:17:14 +05:30
David Herrmann dd906398dd sd-netlink: don't export internal type-system details
The kernel bonding layer allows passing an array of ARP IP targets as
bond-configuration. Due to the weird implementation of arrays in netlink
(which we haven't figure out a generic way to support, yet), we usually
hard-code the supported array-sizes. However, this should not be exported
from sd-netlink.

Instead, make sure the caller just uses it's current hack of enumerating
the types, and the sd-netlink core will have it's own list of supported
array-sizes (to be removed in future extensions, btw!). If either does not
match, we will just return a normal error.

Note that we provide 2 constants for ARP_IP_TARGETS_MAX now. However, both
have very different reasons:
 - the constant in netdev-bond.c is used to warn the user that the given
   number of targets might not be supported by the kernel (even though the
   kernel might increase that number at _any_ time)
 - the constant in sd-netlink is solely used due to us missing a proper
   array implementation. Once that's supported in the type-system, it can
   be removed without notice

Last but not least, this patch turns the log_error() into a log_warning().
Given that the previous condition was off-by-one, anyway, it never hit at
the right time. Thus, it was probably of no real use.
2015-06-24 13:46:15 +02:00
David Herrmann 846a6b3d89 sd-netlink: don't treat NULL as root type-system
Explicitly export the root type-system to the type-system callers. This
avoids treating NULL as root, which for one really looks backwards (NULL
is usually a leaf, not root), and secondly prevents us from properly
debugging calling into non-nested types.

Also rename the root to "type_system_root". Once we support more than
rtnl, well will have to revisit that, anyway.
2015-06-24 13:46:11 +02:00
David Herrmann e7de105cf6 sd-netlink: don't treat type_system->count==0 as invalid
Empty type-systems are just fine. Avoid the nasty hack in
union-type-systems that treat empty type-systems as invalid. Instead check
for the actual types-array and make sure it's non-NULL (which is even true
for empty type-systems, due to "empty_types" array).
2015-06-24 13:45:56 +02:00
David Herrmann 979e7eb9cc sd-netlink: drop NETLINK_TYPE_META
The NETLINK_TYPE_META pseudo-type is actually equivalent to an empty
nested type. Drop it and define an empty type-system instead.

This also has the nice side-effect that m->container_type_system[0] is
never NULL (which has really nasty side-effects if you try to read
attributes).
2015-06-24 13:45:56 +02:00
David Herrmann c1df8dee28 sd-netlink: turn 'max' into 'count' to support empty type-systems
Right now we store the maximum type-ID of a type-system. This prevents us
from creating empty type-systems. Store the "count" instead, which should
be treated as max+1.

Note that type_system_union_protocol_get_type_system() currently has a
nasty hack to treat empty type-systems as invalid. This might need some
modification later on as well.
2015-06-24 13:45:47 +02:00
David Herrmann 435bbb0233 sd-netlink: make NLTypeSystem internal
Same as NLType, move NLTypeSystem into netlink-types.c and hide it from
the outside. Provide an accessor function for the 'max' field that is used
to allocate suitable array sizes.

Note that this will probably be removed later on, anyway. Once we support
bigger type-systems, it just seems impractical to allocate such big arrays
for each container entry. An RBTree would probably do just fine.
2015-06-24 13:45:47 +02:00
David Herrmann 817d1cd824 sd-netlink: make NLType internal
If we extend NLType to support arrays and further extended types, we
really want to avoid hard-coding the type-layout outside of
netlink-types.c. We already avoid accessing nl_type->type_system outside
of netlink-types.c, extend this to also avoid accessing any other fields.

Provide accessor functions for nl_type->type and nl_type->size and then
move NLType away from the type-system header.

With this in place, follow-up patches can safely turn "type_system" and
"type_system_union" into a real "union { }", and then add another type for
arrays.
2015-06-24 13:45:47 +02:00
David Herrmann c658008f50 sd-netlink: don't access type->type_system[_union] directly
Make sure we never access type->type_system or type->type_system_union
directly. This is an implementation detail of the type-system and we
should always use the accessors. Right now, they only exist for 2-level
accesses (type-system to type-system). This patch introduces the 1-level
accessors (type to type-system) and makes use of it.

This patch makes sure the proper assertions are in place, so we never
accidentally access sub-type-systems for non-nested/union types.

Note that this places hard-asserts on the accessors. This should be fine,
as we expect callers to only access sub type-systems if they *know*
they're dealing with nested types.
2015-06-24 13:45:47 +02:00
David Herrmann cafbc790d1 sd-netlink: rename NLA_ to NETLINK_TYPE_
The NLA_ names are used to name real datatypes we extract out of netlink
messages. The kernel has an internal enum with the same names
(NLA_foobar), which is *NOT* binary compatible to our types. Furthermore,
we support a different set of types than the kernel (as we try to treat
some kernel peculiarities as our own types to simplify the API).

Rename NLA_ to NETLINK_TYPE_ to make clear that this is our own set of
types.
2015-06-24 13:45:47 +02:00
Tom Gundersen 1c4baffc18 sd-netlink: rename from sd-rtnl 2015-06-13 19:52:54 +02:00
Renamed from src/libsystemd/sd-rtnl/rtnl-types.c (Browse further)