mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 02:10:09 +01:00
platform: introduce function to globally track local route rule
The new function tracks local route rule in the GlobalTracker properly.
It also allow the developer to specify the untrack user tag.
(cherry picked from commit 79611e4fcc)
This commit is contained in:
parent
934e019270
commit
779cf25606
2 changed files with 47 additions and 22 deletions
|
|
@ -1155,17 +1155,7 @@ nmp_global_tracker_track_rule_default(NMPGlobalTracker *self,
|
|||
/* track the default rules. See also `man ip-rule`. */
|
||||
|
||||
if (NM_IN_SET(addr_family, AF_UNSPEC, AF_INET)) {
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET,
|
||||
.priority = 0,
|
||||
.table = RT_TABLE_LOCAL,
|
||||
.action = FR_ACT_TO_TBL,
|
||||
.protocol = RTPROT_KERNEL,
|
||||
}),
|
||||
track_priority,
|
||||
user_tag,
|
||||
NULL);
|
||||
nmp_global_tracker_track_local_rule(self, addr_family, track_priority, user_tag, NULL);
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET,
|
||||
|
|
@ -1190,17 +1180,7 @@ nmp_global_tracker_track_rule_default(NMPGlobalTracker *self,
|
|||
NULL);
|
||||
}
|
||||
if (NM_IN_SET(addr_family, AF_UNSPEC, AF_INET6)) {
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET6,
|
||||
.priority = 0,
|
||||
.table = RT_TABLE_LOCAL,
|
||||
.action = FR_ACT_TO_TBL,
|
||||
.protocol = RTPROT_KERNEL,
|
||||
}),
|
||||
track_priority,
|
||||
user_tag,
|
||||
NULL);
|
||||
nmp_global_tracker_track_local_rule(self, addr_family, track_priority, user_tag, NULL);
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET6,
|
||||
|
|
@ -1215,6 +1195,45 @@ nmp_global_tracker_track_rule_default(NMPGlobalTracker *self,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nmp_global_tracker_track_local_rule(NMPGlobalTracker *self,
|
||||
int addr_family,
|
||||
gint32 track_priority,
|
||||
gconstpointer user_tag,
|
||||
gconstpointer user_tag_untrack)
|
||||
{
|
||||
g_return_if_fail(NMP_IS_GLOBAL_TRACKER(self));
|
||||
|
||||
nm_assert(NM_IN_SET(addr_family, AF_UNSPEC, AF_INET, AF_INET6));
|
||||
|
||||
if (NM_IN_SET(addr_family, AF_UNSPEC, AF_INET)) {
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET,
|
||||
.priority = 0,
|
||||
.table = RT_TABLE_LOCAL,
|
||||
.action = FR_ACT_TO_TBL,
|
||||
.protocol = RTPROT_KERNEL,
|
||||
}),
|
||||
track_priority,
|
||||
user_tag,
|
||||
user_tag_untrack);
|
||||
}
|
||||
if (NM_IN_SET(addr_family, AF_UNSPEC, AF_INET6)) {
|
||||
nmp_global_tracker_track_rule(self,
|
||||
&((NMPlatformRoutingRule){
|
||||
.addr_family = AF_INET6,
|
||||
.priority = 0,
|
||||
.table = RT_TABLE_LOCAL,
|
||||
.action = FR_ACT_TO_TBL,
|
||||
.protocol = RTPROT_KERNEL,
|
||||
}),
|
||||
track_priority,
|
||||
user_tag,
|
||||
user_tag_untrack);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMPGlobalTracker *
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ void nmp_global_tracker_track_rule_default(NMPGlobalTracker *self,
|
|||
gint32 track_priority,
|
||||
gconstpointer user_tag);
|
||||
|
||||
void nmp_global_tracker_track_local_rule(NMPGlobalTracker *self,
|
||||
int addr_family,
|
||||
gint32 track_priority,
|
||||
gconstpointer user_tag,
|
||||
gconstpointer user_tag_untrack);
|
||||
|
||||
void nmp_global_tracker_track_rule_from_platform(NMPGlobalTracker *self,
|
||||
NMPlatform *platform,
|
||||
int addr_family,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue