chiark / gitweb /
sd-netlink: don't export internal type-system details
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 24 Jun 2015 11:27:34 +0000 (13:27 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:05:25 +0000 (10:05 +0100)
commit77d0a7c24d6024eb4db2e8a5808b66a0b6dbf7bb
treea19bd30901f0160db8c4edaca772c56ed192c06d
parent1f4b0911241d05c7651b876aff5bc9bb40913a15
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.
src/libsystemd/sd-netlink/netlink-types.c
src/libsystemd/sd-netlink/netlink-types.h