platform: create netlink messages directly without libnl-route-3
Instead of using libnl-route-3 library to serialize netlink messages, construct the netlink messages ourselves. This has several advantages: - Creating the netlink message ourself is actually more straight forward then having an intermediate layer between NM and the kernel. Now it is immediately clear, how a platform request translates to a netlink/kernel request. You can look at the kernel sources how a certain netlink attribute behaves, and then it's immediately clear how to set that (and vice versa). - Older libnl versions might have bugs or missing features for which we needed to workaround (often by offering a reduced/broken/untested functionality). Now we can get rid or workaround like _nl_has_capability(), check_support_libnl_extended_ifa_flags(), HAVE_LIBNL_INET6_TOKEN. Another example is a libnl bug when setting vlan ingress map which isn't even yet fixed in libnl upstream. - We no longer need libnl-route-3 at all and can drop that runtime requirement, saving some 400k. Constructing the messages ourselves also gives better performance because we don't have to create the intermediate libnl object. - In the future we will add more link-type support which is easier to support by basing directly on the plain kernel/netlink API, instead of requiring also libnl3 to expose this functionality. E.g. adding macvtap support: we already parsed macvtap properties ourselves because of missing libnl support. To *add* macvtap support, we also would have to do it ourself (or extend libnl).
This commit is contained in:
@@ -828,14 +828,6 @@ _vt_cmd_obj_is_visible_ipx_route (const NMPObject *obj)
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
struct nl_object *
|
||||
nmp_object_to_nl (NMPlatform *platform, const NMPObject *obj, gboolean id_only)
|
||||
{
|
||||
return NMP_OBJECT_GET_CLASS (obj)->cmd_plobj_to_nl (platform, &obj->object, id_only);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
gboolean
|
||||
nmp_cache_id_equal (const NMPCacheId *a, const NMPCacheId *b)
|
||||
{
|
||||
@@ -1809,7 +1801,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
||||
.cmd_obj_dispose = _vt_cmd_obj_dispose_link,
|
||||
.cmd_obj_is_alive = _vt_cmd_obj_is_alive_link,
|
||||
.cmd_obj_is_visible = _vt_cmd_obj_is_visible_link,
|
||||
.cmd_plobj_to_nl = _nmp_vt_cmd_plobj_to_nl_link,
|
||||
.cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_link,
|
||||
.cmd_plobj_id_equal = _vt_cmd_plobj_id_equal_link,
|
||||
.cmd_plobj_id_hash = _vt_cmd_plobj_id_hash_link,
|
||||
@@ -1829,7 +1820,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
||||
.cmd_obj_stackinit_id = _vt_cmd_obj_stackinit_id_ip4_address,
|
||||
.cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_address,
|
||||
.cmd_obj_is_visible = _vt_cmd_obj_is_visible_ipx_address,
|
||||
.cmd_plobj_to_nl = _nmp_vt_cmd_plobj_to_nl_ip4_address,
|
||||
.cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip4_address,
|
||||
.cmd_plobj_id_equal = _vt_cmd_plobj_id_equal_ip4_address,
|
||||
.cmd_plobj_id_hash = _vt_cmd_plobj_id_hash_ip4_address,
|
||||
@@ -1849,7 +1839,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
||||
.cmd_obj_stackinit_id = _vt_cmd_obj_stackinit_id_ip6_address,
|
||||
.cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_address,
|
||||
.cmd_obj_is_visible = _vt_cmd_obj_is_visible_ipx_address,
|
||||
.cmd_plobj_to_nl = _nmp_vt_cmd_plobj_to_nl_ip6_address,
|
||||
.cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip6_address,
|
||||
.cmd_plobj_id_equal = _vt_cmd_plobj_id_equal_ip6_address,
|
||||
.cmd_plobj_id_hash = _vt_cmd_plobj_id_hash_ip6_address,
|
||||
@@ -1869,7 +1858,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
||||
.cmd_obj_stackinit_id = _vt_cmd_obj_stackinit_id_ip4_route,
|
||||
.cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_route,
|
||||
.cmd_obj_is_visible = _vt_cmd_obj_is_visible_ipx_route,
|
||||
.cmd_plobj_to_nl = _nmp_vt_cmd_plobj_to_nl_ip4_route,
|
||||
.cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip4_route,
|
||||
.cmd_plobj_id_equal = _vt_cmd_plobj_id_equal_ip4_route,
|
||||
.cmd_plobj_id_hash = _vt_cmd_plobj_id_hash_ip4_route,
|
||||
@@ -1889,7 +1877,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
||||
.cmd_obj_stackinit_id = _vt_cmd_obj_stackinit_id_ip6_route,
|
||||
.cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_route,
|
||||
.cmd_obj_is_visible = _vt_cmd_obj_is_visible_ipx_route,
|
||||
.cmd_plobj_to_nl = _nmp_vt_cmd_plobj_to_nl_ip6_route,
|
||||
.cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip6_route,
|
||||
.cmd_plobj_id_equal = _vt_cmd_plobj_id_equal_ip6_route,
|
||||
.cmd_plobj_id_hash = _vt_cmd_plobj_id_hash_ip6_route,
|
||||
|
Reference in New Issue
Block a user