mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 02:28:18 +02:00
platform/trivial: s/ADDRROUTE/OBJECT/ for the cache lookup
It's going to be useful for other objects that have a type (of course) and an ifindex.
This commit is contained in:
parent
18dd937b81
commit
93ac0e455b
11 changed files with 98 additions and 98 deletions
|
|
@ -3020,9 +3020,9 @@ _v4_has_shadowed_routes_detect (NMDevice *self)
|
||||||
platform = nm_device_get_platform (self);
|
platform = nm_device_get_platform (self);
|
||||||
|
|
||||||
head_entry = nm_platform_lookup (platform,
|
head_entry = nm_platform_lookup (platform,
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
ifindex));
|
ifindex));
|
||||||
if (!head_entry)
|
if (!head_entry)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 - 2014 Red Hat, Inc.
|
* Copyright (C) 2005 - 2017 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -611,9 +611,9 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
|
||||||
self = nm_ip4_config_new (multi_idx, ifindex);
|
self = nm_ip4_config_new (multi_idx, ifindex);
|
||||||
priv = NM_IP4_CONFIG_GET_PRIVATE (self);
|
priv = NM_IP4_CONFIG_GET_PRIVATE (self);
|
||||||
|
|
||||||
head_entry = nm_platform_lookup_addrroute (platform,
|
head_entry = nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||||
ifindex);
|
ifindex);
|
||||||
if (head_entry) {
|
if (head_entry) {
|
||||||
nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
|
nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
|
||||||
if (!_nm_ip_config_add_obj (priv->multi_idx,
|
if (!_nm_ip_config_add_obj (priv->multi_idx,
|
||||||
|
|
@ -636,9 +636,9 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
|
||||||
_notify_addresses (self);
|
_notify_addresses (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
head_entry = nm_platform_lookup_addrroute (platform,
|
head_entry = nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
ifindex);
|
ifindex);
|
||||||
|
|
||||||
/* Extract gateway from default route */
|
/* Extract gateway from default route */
|
||||||
nmp_cache_iter_for_each (&iter, head_entry, &plobj)
|
nmp_cache_iter_for_each (&iter, head_entry, &plobj)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 - 2013 Red Hat, Inc.
|
* Copyright (C) 2005 - 2017 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -395,9 +395,9 @@ nm_ip6_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
|
||||||
self = nm_ip6_config_new (multi_idx, ifindex);
|
self = nm_ip6_config_new (multi_idx, ifindex);
|
||||||
priv = NM_IP6_CONFIG_GET_PRIVATE (self);
|
priv = NM_IP6_CONFIG_GET_PRIVATE (self);
|
||||||
|
|
||||||
head_entry = nm_platform_lookup_addrroute (platform,
|
head_entry = nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
ifindex);
|
ifindex);
|
||||||
if (head_entry) {
|
if (head_entry) {
|
||||||
nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
|
nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
|
||||||
if (!_nm_ip_config_add_obj (priv->multi_idx,
|
if (!_nm_ip_config_add_obj (priv->multi_idx,
|
||||||
|
|
@ -420,9 +420,9 @@ nm_ip6_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
|
||||||
_notify_addresses (self);
|
_notify_addresses (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
head_entry = nm_platform_lookup_addrroute (platform,
|
head_entry = nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP6_ROUTE,
|
NMP_OBJECT_TYPE_IP6_ROUTE,
|
||||||
ifindex);
|
ifindex);
|
||||||
|
|
||||||
nmp_cache_iter_for_each (&iter, head_entry, &plobj)
|
nmp_cache_iter_for_each (&iter, head_entry, &plobj)
|
||||||
_add_route (self, plobj, NULL, NULL);
|
_add_route (self, plobj, NULL, NULL);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012–2013 Red Hat, Inc.
|
* Copyright (C) 2012–2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
@ -1056,11 +1056,11 @@ ipx_address_delete (NMPlatform *platform,
|
||||||
peer_addr_i = peer_addr ? *((guint32 *) peer_addr) : 0;
|
peer_addr_i = peer_addr ? *((guint32 *) peer_addr) : 0;
|
||||||
|
|
||||||
nmp_cache_iter_for_each (&iter,
|
nmp_cache_iter_for_each (&iter,
|
||||||
nm_platform_lookup_addrroute (platform,
|
nm_platform_lookup_object (platform,
|
||||||
addr_family == AF_INET
|
addr_family == AF_INET
|
||||||
? NMP_OBJECT_TYPE_IP4_ADDRESS
|
? NMP_OBJECT_TYPE_IP4_ADDRESS
|
||||||
: NMP_OBJECT_TYPE_IP6_ADDRESS,
|
: NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
0),
|
0),
|
||||||
&o) {
|
&o) {
|
||||||
const NMPObject *obj_old = NULL;
|
const NMPObject *obj_old = NULL;
|
||||||
|
|
||||||
|
|
@ -1144,9 +1144,9 @@ ipx_route_delete (NMPlatform *platform,
|
||||||
}
|
}
|
||||||
|
|
||||||
nmp_cache_iter_for_each (&iter,
|
nmp_cache_iter_for_each (&iter,
|
||||||
nm_platform_lookup_addrroute (platform,
|
nm_platform_lookup_object (platform,
|
||||||
obj_type,
|
obj_type,
|
||||||
ifindex),
|
ifindex),
|
||||||
&o) {
|
&o) {
|
||||||
const NMPObject *obj_old = NULL;
|
const NMPObject *obj_old = NULL;
|
||||||
|
|
||||||
|
|
@ -1254,9 +1254,9 @@ ip_route_add (NMPlatform *platform,
|
||||||
gboolean has_route_to_gw = FALSE;
|
gboolean has_route_to_gw = FALSE;
|
||||||
|
|
||||||
nmp_cache_iter_for_each (&iter,
|
nmp_cache_iter_for_each (&iter,
|
||||||
nm_platform_lookup_addrroute (platform,
|
nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_GET_TYPE (obj),
|
NMP_OBJECT_GET_TYPE (obj),
|
||||||
0),
|
0),
|
||||||
&o) {
|
&o) {
|
||||||
if (addr_family == AF_INET) {
|
if (addr_family == AF_INET) {
|
||||||
const NMPlatformIP4Route *item = NMP_OBJECT_CAST_IP4_ROUTE (o);
|
const NMPlatformIP4Route *item = NMP_OBJECT_CAST_IP4_ROUTE (o);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Red Hat, Inc.
|
* Copyright (C) 2012 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
||||||
|
|
@ -5878,15 +5878,15 @@ link_can_assume (NMPlatform *platform, int ifindex)
|
||||||
if (link->link.master > 0)
|
if (link->link.master > 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||||
ifindex);
|
ifindex);
|
||||||
if (nmp_cache_lookup (cache, &lookup))
|
if (nmp_cache_lookup (cache, &lookup))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
ifindex);
|
ifindex);
|
||||||
nmp_cache_iter_for_each (&iter,
|
nmp_cache_iter_for_each (&iter,
|
||||||
nmp_cache_lookup (cache, &lookup),
|
nmp_cache_lookup (cache, &lookup),
|
||||||
&o) {
|
&o) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Red Hat, Inc.
|
* Copyright (C) 2012 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
@ -3346,9 +3346,9 @@ delete_and_next:
|
||||||
}
|
}
|
||||||
|
|
||||||
plat_addresses = nm_platform_lookup_clone (self,
|
plat_addresses = nm_platform_lookup_clone (self,
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||||
ifindex),
|
ifindex),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (plat_addresses)
|
if (plat_addresses)
|
||||||
plat_subnets = ip4_addr_subnets_build_index (plat_addresses, TRUE, TRUE);
|
plat_subnets = ip4_addr_subnets_build_index (plat_addresses, TRUE, TRUE);
|
||||||
|
|
@ -3488,9 +3488,9 @@ nm_platform_ip6_address_sync (NMPlatform *self,
|
||||||
|
|
||||||
/* Delete unknown addresses */
|
/* Delete unknown addresses */
|
||||||
plat_addresses = nm_platform_lookup_clone (self,
|
plat_addresses = nm_platform_lookup_clone (self,
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
ifindex),
|
ifindex),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (plat_addresses) {
|
if (plat_addresses) {
|
||||||
for (i = 0; i < plat_addresses->len; i++) {
|
for (i = 0; i < plat_addresses->len; i++) {
|
||||||
|
|
@ -3611,11 +3611,11 @@ nm_platform_ip_route_get_prune_list (NMPlatform *self,
|
||||||
NM_IP_ROUTE_TABLE_SYNC_MODE_FULL,
|
NM_IP_ROUTE_TABLE_SYNC_MODE_FULL,
|
||||||
NM_IP_ROUTE_TABLE_SYNC_MODE_ALL));
|
NM_IP_ROUTE_TABLE_SYNC_MODE_ALL));
|
||||||
|
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
addr_family == AF_INET
|
addr_family == AF_INET
|
||||||
? NMP_OBJECT_TYPE_IP4_ROUTE
|
? NMP_OBJECT_TYPE_IP4_ROUTE
|
||||||
: NMP_OBJECT_TYPE_IP6_ROUTE,
|
: NMP_OBJECT_TYPE_IP6_ROUTE,
|
||||||
ifindex);
|
ifindex);
|
||||||
head_entry = nm_platform_lookup (self, &lookup);
|
head_entry = nm_platform_lookup (self, &lookup);
|
||||||
if (!head_entry)
|
if (!head_entry)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Red Hat, Inc.
|
* Copyright (C) 2015 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
@ -186,7 +186,7 @@ _idx_obj_part (const DedupMultiIdxType *idx_type,
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX:
|
case NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX:
|
||||||
if ( !NM_IN_SET (NMP_OBJECT_GET_TYPE (obj_a), NMP_OBJECT_TYPE_IP4_ADDRESS,
|
if ( !NM_IN_SET (NMP_OBJECT_GET_TYPE (obj_a), NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
|
|
@ -1205,13 +1205,13 @@ static const guint8 _supported_cache_ids_link[] = {
|
||||||
|
|
||||||
static const guint8 _supported_cache_ids_ipx_address[] = {
|
static const guint8 _supported_cache_ids_ipx_address[] = {
|
||||||
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
||||||
NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX,
|
NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const guint8 _supported_cache_ids_ipx_route[] = {
|
static const guint8 _supported_cache_ids_ipx_route[] = {
|
||||||
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
|
||||||
NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX,
|
NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX,
|
||||||
NMP_CACHE_ID_TYPE_DEFAULT_ROUTES,
|
NMP_CACHE_ID_TYPE_DEFAULT_ROUTES,
|
||||||
NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID,
|
NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID,
|
||||||
0,
|
0,
|
||||||
|
|
@ -1523,9 +1523,9 @@ nmp_lookup_init_link_by_ifname (NMPLookup *lookup,
|
||||||
}
|
}
|
||||||
|
|
||||||
const NMPLookup *
|
const NMPLookup *
|
||||||
nmp_lookup_init_addrroute (NMPLookup *lookup,
|
nmp_lookup_init_object (NMPLookup *lookup,
|
||||||
NMPObjectType obj_type,
|
NMPObjectType obj_type,
|
||||||
int ifindex)
|
int ifindex)
|
||||||
{
|
{
|
||||||
NMPObject *o;
|
NMPObject *o;
|
||||||
|
|
||||||
|
|
@ -1542,7 +1542,7 @@ nmp_lookup_init_addrroute (NMPLookup *lookup,
|
||||||
|
|
||||||
o = _nmp_object_stackinit_from_type (&lookup->selector_obj, obj_type);
|
o = _nmp_object_stackinit_from_type (&lookup->selector_obj, obj_type);
|
||||||
o->object.ifindex = ifindex;
|
o->object.ifindex = ifindex;
|
||||||
lookup->cache_id_type = NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX;
|
lookup->cache_id_type = NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX;
|
||||||
return _L (lookup);
|
return _L (lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Red Hat, Inc.
|
* Copyright (C) 2015 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __NMP_OBJECT_H__
|
#ifndef __NMP_OBJECT_H__
|
||||||
|
|
@ -48,12 +48,12 @@ typedef enum { /*< skip >*/
|
||||||
* but only route objects can be indexed by NMP_CACHE_ID_TYPE_ROUTES_VISIBLE_NO_DEFAULT.
|
* but only route objects can be indexed by NMP_CACHE_ID_TYPE_ROUTES_VISIBLE_NO_DEFAULT.
|
||||||
*
|
*
|
||||||
* Of one index type, there can be multiple indexes or not.
|
* Of one index type, there can be multiple indexes or not.
|
||||||
* For example, of the index type NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX there
|
* For example, of the index type NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX there
|
||||||
* are multiple instances (for different route/addresses, v4/v6, per-ifindex).
|
* are multiple instances (for different route/addresses, v4/v6, per-ifindex).
|
||||||
*
|
*
|
||||||
* But one object, can only be indexed by one particular index of a
|
* But one object, can only be indexed by one particular index of a
|
||||||
* type. For example, a certain address instance is only indexed by
|
* type. For example, a certain address instance is only indexed by
|
||||||
* the index NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX with
|
* the index NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX with
|
||||||
* matching v4/v6 and ifindex -- or maybe not at all if it isn't visible.
|
* matching v4/v6 and ifindex -- or maybe not at all if it isn't visible.
|
||||||
* */
|
* */
|
||||||
typedef enum { /*< skip >*/
|
typedef enum { /*< skip >*/
|
||||||
|
|
@ -82,8 +82,8 @@ typedef enum { /*< skip >*/
|
||||||
* separate for IPv4 and IPv6. */
|
* separate for IPv4 and IPv6. */
|
||||||
NMP_CACHE_ID_TYPE_DEFAULT_ROUTES,
|
NMP_CACHE_ID_TYPE_DEFAULT_ROUTES,
|
||||||
|
|
||||||
/* all the addresses/routes (by object-type) for an ifindex. */
|
/* all the objects that have an ifindex (by object-type) for an ifindex. */
|
||||||
NMP_CACHE_ID_TYPE_ADDRROUTE_BY_IFINDEX,
|
NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX,
|
||||||
|
|
||||||
/* Consider all the destination fields of a route, that is, the ID without the ifindex
|
/* Consider all the destination fields of a route, that is, the ID without the ifindex
|
||||||
* and gateway (meaning: network/plen,metric).
|
* and gateway (meaning: network/plen,metric).
|
||||||
|
|
@ -542,9 +542,9 @@ const NMPLookup *nmp_lookup_init_obj_type (NMPLookup *lookup,
|
||||||
NMPObjectType obj_type);
|
NMPObjectType obj_type);
|
||||||
const NMPLookup *nmp_lookup_init_link_by_ifname (NMPLookup *lookup,
|
const NMPLookup *nmp_lookup_init_link_by_ifname (NMPLookup *lookup,
|
||||||
const char *ifname);
|
const char *ifname);
|
||||||
const NMPLookup *nmp_lookup_init_addrroute (NMPLookup *lookup,
|
const NMPLookup *nmp_lookup_init_object (NMPLookup *lookup,
|
||||||
NMPObjectType obj_type,
|
NMPObjectType obj_type,
|
||||||
int ifindex);
|
int ifindex);
|
||||||
const NMPLookup *nmp_lookup_init_route_default (NMPLookup *lookup,
|
const NMPLookup *nmp_lookup_init_route_default (NMPLookup *lookup,
|
||||||
NMPObjectType obj_type);
|
NMPObjectType obj_type);
|
||||||
const NMPLookup *nmp_lookup_init_route_by_weak_id (NMPLookup *lookup,
|
const NMPLookup *nmp_lookup_init_route_by_weak_id (NMPLookup *lookup,
|
||||||
|
|
@ -723,26 +723,26 @@ nm_platform_lookup_link_by_ifname (NMPlatform *platform,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const NMDedupMultiHeadEntry *
|
static inline const NMDedupMultiHeadEntry *
|
||||||
nm_platform_lookup_addrroute (NMPlatform *platform,
|
nm_platform_lookup_object (NMPlatform *platform,
|
||||||
NMPObjectType obj_type,
|
NMPObjectType obj_type,
|
||||||
int ifindex)
|
int ifindex)
|
||||||
{
|
{
|
||||||
NMPLookup lookup;
|
NMPLookup lookup;
|
||||||
|
|
||||||
nmp_lookup_init_addrroute (&lookup, obj_type, ifindex);
|
nmp_lookup_init_object (&lookup, obj_type, ifindex);
|
||||||
return nm_platform_lookup (platform, &lookup);
|
return nm_platform_lookup (platform, &lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GPtrArray *
|
static inline GPtrArray *
|
||||||
nm_platform_lookup_addrroute_clone (NMPlatform *platform,
|
nm_platform_lookup_object_clone (NMPlatform *platform,
|
||||||
NMPObjectType obj_type,
|
NMPObjectType obj_type,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
NMPObjectPredicateFunc predicate,
|
NMPObjectPredicateFunc predicate,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMPLookup lookup;
|
NMPLookup lookup;
|
||||||
|
|
||||||
nmp_lookup_init_addrroute (&lookup, obj_type, ifindex);
|
nmp_lookup_init_object (&lookup, obj_type, ifindex);
|
||||||
return nm_platform_lookup_clone (platform, &lookup, predicate, user_data);
|
return nm_platform_lookup_clone (platform, &lookup, predicate, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright 2016 Red Hat, Inc.
|
* Copyright 2016 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
@ -77,9 +77,9 @@ _ipx_address_get_all (NMPlatform *self, int ifindex, NMPObjectType obj_type)
|
||||||
g_assert (NM_IS_PLATFORM (self));
|
g_assert (NM_IS_PLATFORM (self));
|
||||||
g_assert (ifindex > 0);
|
g_assert (ifindex > 0);
|
||||||
g_assert (NM_IN_SET (obj_type, NMP_OBJECT_TYPE_IP4_ADDRESS, NMP_OBJECT_TYPE_IP6_ADDRESS));
|
g_assert (NM_IN_SET (obj_type, NMP_OBJECT_TYPE_IP4_ADDRESS, NMP_OBJECT_TYPE_IP6_ADDRESS));
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
obj_type,
|
obj_type,
|
||||||
ifindex);
|
ifindex);
|
||||||
return nmp_cache_lookup_to_array (nm_platform_lookup (self, &lookup),
|
return nmp_cache_lookup_to_array (nm_platform_lookup (self, &lookup),
|
||||||
obj_type,
|
obj_type,
|
||||||
FALSE /*addresses are always visible. */);
|
FALSE /*addresses are always visible. */);
|
||||||
|
|
@ -107,9 +107,9 @@ nmtstp_platform_ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t n
|
||||||
nm_platform_process_events (platform);
|
nm_platform_process_events (platform);
|
||||||
|
|
||||||
nm_dedup_multi_iter_for_each (&iter,
|
nm_dedup_multi_iter_for_each (&iter,
|
||||||
nm_platform_lookup_addrroute (platform,
|
nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
ifindex)) {
|
ifindex)) {
|
||||||
const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (iter.current->obj);
|
const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (iter.current->obj);
|
||||||
|
|
||||||
if ( r->ifindex != ifindex
|
if ( r->ifindex != ifindex
|
||||||
|
|
@ -133,9 +133,9 @@ nmtstp_platform_ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_
|
||||||
nm_platform_process_events (platform);
|
nm_platform_process_events (platform);
|
||||||
|
|
||||||
nm_dedup_multi_iter_for_each (&iter,
|
nm_dedup_multi_iter_for_each (&iter,
|
||||||
nm_platform_lookup_addrroute (platform,
|
nm_platform_lookup_object (platform,
|
||||||
NMP_OBJECT_TYPE_IP6_ROUTE,
|
NMP_OBJECT_TYPE_IP6_ROUTE,
|
||||||
ifindex)) {
|
ifindex)) {
|
||||||
const NMPlatformIP6Route *r = NMP_OBJECT_CAST_IP6_ROUTE (iter.current->obj);
|
const NMPlatformIP6Route *r = NMP_OBJECT_CAST_IP6_ROUTE (iter.current->obj);
|
||||||
|
|
||||||
if ( r->ifindex != ifindex
|
if ( r->ifindex != ifindex
|
||||||
|
|
|
||||||
|
|
@ -245,22 +245,22 @@ static inline GPtrArray *
|
||||||
nmtstp_ip4_route_get_all (NMPlatform *platform,
|
nmtstp_ip4_route_get_all (NMPlatform *platform,
|
||||||
int ifindex)
|
int ifindex)
|
||||||
{
|
{
|
||||||
return nm_platform_lookup_addrroute_clone (platform,
|
return nm_platform_lookup_object_clone (platform,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
ifindex,
|
ifindex,
|
||||||
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
|
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GPtrArray *
|
static inline GPtrArray *
|
||||||
nmtstp_ip6_route_get_all (NMPlatform *platform,
|
nmtstp_ip6_route_get_all (NMPlatform *platform,
|
||||||
int ifindex)
|
int ifindex)
|
||||||
{
|
{
|
||||||
return nm_platform_lookup_addrroute_clone (platform,
|
return nm_platform_lookup_object_clone (platform,
|
||||||
NMP_OBJECT_TYPE_IP6_ROUTE,
|
NMP_OBJECT_TYPE_IP6_ROUTE,
|
||||||
ifindex,
|
ifindex,
|
||||||
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
|
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright 2016 Red Hat, Inc.
|
* Copyright 2016 - 2017 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nm-default.h"
|
#include "nm-default.h"
|
||||||
|
|
@ -47,9 +47,9 @@ _wait_for_ipv4_addr_device_route (NMPlatform *platform,
|
||||||
|
|
||||||
nmp_cache_iter_for_each (&iter,
|
nmp_cache_iter_for_each (&iter,
|
||||||
nm_platform_lookup (platform,
|
nm_platform_lookup (platform,
|
||||||
nmp_lookup_init_addrroute (&lookup,
|
nmp_lookup_init_object (&lookup,
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
ifindex)),
|
ifindex)),
|
||||||
&o) {
|
&o) {
|
||||||
const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (o);
|
const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (o);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue