mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 13:30:28 +01:00
platform: add nm_platform_ip6_address_match()
This commit is contained in:
parent
345aeefaf3
commit
94fbc7bdba
2 changed files with 37 additions and 0 deletions
|
|
@ -3400,6 +3400,38 @@ nm_platform_ip6_address_get_peer (const NMPlatformIP6Address *addr)
|
|||
return &addr->peer_address;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_ip6_address_match (const NMPlatformIP6Address *addr,
|
||||
NMPlatformMatchFlags match_flag)
|
||||
{
|
||||
nm_assert (!NM_FLAGS_ANY (match_flag, ~( NM_PLATFORM_MATCH_WITH_ADDRTYPE__ANY
|
||||
| NM_PLATFORM_MATCH_WITH_ADDRSTATE__ANY)));
|
||||
nm_assert (NM_FLAGS_ANY (match_flag, NM_PLATFORM_MATCH_WITH_ADDRTYPE__ANY));
|
||||
nm_assert (NM_FLAGS_ANY (match_flag, NM_PLATFORM_MATCH_WITH_ADDRSTATE__ANY));
|
||||
|
||||
if (IN6_IS_ADDR_LINKLOCAL (&addr->address)) {
|
||||
if (!NM_FLAGS_HAS (match_flag, NM_PLATFORM_MATCH_WITH_ADDRTYPE_LINKLOCAL))
|
||||
return FALSE;
|
||||
} else {
|
||||
if (!NM_FLAGS_HAS (match_flag, NM_PLATFORM_MATCH_WITH_ADDRTYPE_NORMAL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NM_FLAGS_HAS (addr->n_ifa_flags, IFA_F_DADFAILED)) {
|
||||
if (!NM_FLAGS_HAS (match_flag, NM_PLATFORM_MATCH_WITH_ADDRSTATE_DADFAILED))
|
||||
return FALSE;
|
||||
} else if ( NM_FLAGS_HAS (addr->n_ifa_flags, IFA_F_TENTATIVE)
|
||||
&& !NM_FLAGS_HAS (addr->n_ifa_flags, IFA_F_OPTIMISTIC)) {
|
||||
if (!NM_FLAGS_HAS (match_flag, NM_PLATFORM_MATCH_WITH_ADDRSTATE_TENTATIVE))
|
||||
return FALSE;
|
||||
} else {
|
||||
if (!NM_FLAGS_HAS (match_flag, NM_PLATFORM_MATCH_WITH_ADDRSTATE_NORMAL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_ip4_address_add (NMPlatform *self,
|
||||
int ifindex,
|
||||
|
|
|
|||
|
|
@ -2158,4 +2158,9 @@ void nm_platform_ip4_dev_route_blacklist_set (NMPlatform *self,
|
|||
|
||||
struct _NMDedupMultiIndex *nm_platform_get_multi_idx (NMPlatform *self);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nm_platform_ip6_address_match (const NMPlatformIP6Address *addr,
|
||||
NMPlatformMatchFlags match_flag);
|
||||
|
||||
#endif /* __NETWORKMANAGER_PLATFORM_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue