platform: pass @platform instance to build_rtnl_addr()
This commit is contained in:
@@ -3599,7 +3599,8 @@ ip4_is_link_local (const struct in_addr *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct nl_object *
|
static struct nl_object *
|
||||||
build_rtnl_addr (int family,
|
build_rtnl_addr (NMPlatform *platform,
|
||||||
|
int family,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
gconstpointer addr,
|
gconstpointer addr,
|
||||||
gconstpointer peer_addr,
|
gconstpointer peer_addr,
|
||||||
@@ -3661,7 +3662,7 @@ build_rtnl_addr (int family,
|
|||||||
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
|
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
|
||||||
}
|
}
|
||||||
if (flags) {
|
if (flags) {
|
||||||
if ((flags & ~0xFF) && !check_support_kernel_extended_ifa_flags (nm_platform_get ())) {
|
if ((flags & ~0xFF) && !check_support_kernel_extended_ifa_flags (platform)) {
|
||||||
/* Older kernels don't accept unknown netlink attributes.
|
/* Older kernels don't accept unknown netlink attributes.
|
||||||
*
|
*
|
||||||
* With commit libnl commit 5206c050504f8676a24854519b9c351470fb7cc6, libnl will only set
|
* With commit libnl commit 5206c050504f8676a24854519b9c351470fb7cc6, libnl will only set
|
||||||
@@ -3691,7 +3692,7 @@ ip4_address_add (NMPlatform *platform,
|
|||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
const char *label)
|
const char *label)
|
||||||
{
|
{
|
||||||
return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr,
|
return add_object (platform, build_rtnl_addr (platform, AF_INET, ifindex, &addr,
|
||||||
peer_addr ? &peer_addr : NULL,
|
peer_addr ? &peer_addr : NULL,
|
||||||
plen, lifetime, preferred, 0,
|
plen, lifetime, preferred, 0,
|
||||||
label));
|
label));
|
||||||
@@ -3707,7 +3708,7 @@ ip6_address_add (NMPlatform *platform,
|
|||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint flags)
|
guint flags)
|
||||||
{
|
{
|
||||||
return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr,
|
return add_object (platform, build_rtnl_addr (platform, AF_INET6, ifindex, &addr,
|
||||||
IN6_IS_ADDR_UNSPECIFIED (&peer_addr) ? NULL : &peer_addr,
|
IN6_IS_ADDR_UNSPECIFIED (&peer_addr) ? NULL : &peer_addr,
|
||||||
plen, lifetime, preferred, flags,
|
plen, lifetime, preferred, flags,
|
||||||
NULL));
|
NULL));
|
||||||
@@ -3716,19 +3717,19 @@ ip6_address_add (NMPlatform *platform,
|
|||||||
static gboolean
|
static gboolean
|
||||||
ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, in_addr_t peer_address)
|
ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, in_addr_t peer_address)
|
||||||
{
|
{
|
||||||
return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, peer_address ? &peer_address : NULL, plen, 0, 0, 0, NULL), TRUE);
|
return delete_object (platform, build_rtnl_addr (platform, AF_INET, ifindex, &addr, peer_address ? &peer_address : NULL, plen, 0, 0, 0, NULL), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen)
|
ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen)
|
||||||
{
|
{
|
||||||
return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, NULL, plen, 0, 0, 0, NULL), TRUE);
|
return delete_object (platform, build_rtnl_addr (platform, AF_INET6, ifindex, &addr, NULL, plen, 0, 0, 0, NULL), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ip_address_exists (NMPlatform *platform, int family, int ifindex, gconstpointer addr, int plen)
|
ip_address_exists (NMPlatform *platform, int family, int ifindex, gconstpointer addr, int plen)
|
||||||
{
|
{
|
||||||
auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, NULL, plen, 0, 0, 0, NULL);
|
auto_nl_object struct nl_object *object = build_rtnl_addr (platform, family, ifindex, addr, NULL, plen, 0, 0, 0, NULL);
|
||||||
auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object);
|
auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object);
|
||||||
|
|
||||||
return !!cached_object;
|
return !!cached_object;
|
||||||
|
Reference in New Issue
Block a user