Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
NetworkManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ludek Janda
NetworkManager
Commits
b7856257
Commit
b7856257
authored
Apr 13, 2017
by
Thomas Haller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: ignore host part when comparing routes for route-manager
parent
5c54b7a3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
11 deletions
+36
-11
src/nm-route-manager.c
src/nm-route-manager.c
+1
-1
src/platform/nm-platform.c
src/platform/nm-platform.c
+19
-6
src/platform/nm-platform.h
src/platform/nm-platform.h
+15
-3
src/tests/test-route-manager.c
src/tests/test-route-manager.c
+1
-1
No files found.
src/nm-route-manager.c
View file @
b7856257
...
@@ -377,7 +377,7 @@ _route_equals_ignoring_ifindex (const VTableIP *vtable, const NMPlatformIPXRoute
...
@@ -377,7 +377,7 @@ _route_equals_ignoring_ifindex (const VTableIP *vtable, const NMPlatformIPXRoute
r2_backup
.
rx
.
metric
=
(
guint32
)
r2_metric
;
r2_backup
.
rx
.
metric
=
(
guint32
)
r2_metric
;
r2
=
&
r2_backup
;
r2
=
&
r2_backup
;
}
}
return
vtable
->
vt
->
route_cmp
(
r1
,
r2
)
==
0
;
return
vtable
->
vt
->
route_cmp
(
r1
,
r2
,
FALSE
)
==
0
;
}
}
static
NMPlatformIPXRoute
*
static
NMPlatformIPXRoute
*
...
...
src/platform/nm-platform.c
View file @
b7856257
...
@@ -4291,11 +4291,16 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
...
@@ -4291,11 +4291,16 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
}
}
int
int
nm_platform_ip4_route_cmp
(
const
NMPlatformIP4Route
*
a
,
const
NMPlatformIP4Route
*
b
)
nm_platform_ip4_route_cmp
_full
(
const
NMPlatformIP4Route
*
a
,
const
NMPlatformIP4Route
*
b
,
gboolean
consider_host_part
)
{
{
_CMP_SELF
(
a
,
b
);
_CMP_SELF
(
a
,
b
);
_CMP_FIELD
(
a
,
b
,
ifindex
);
_CMP_FIELD
(
a
,
b
,
ifindex
);
if
(
consider_host_part
)
_CMP_FIELD
(
a
,
b
,
network
);
_CMP_FIELD
(
a
,
b
,
network
);
else
{
_CMP_DIRECT
(
nm_utils_ip4_address_clear_host_address
(
a
->
network
,
a
->
plen
),
nm_utils_ip4_address_clear_host_address
(
b
->
network
,
b
->
plen
));
}
_CMP_FIELD
(
a
,
b
,
plen
);
_CMP_FIELD
(
a
,
b
,
plen
);
_CMP_FIELD
(
a
,
b
,
metric
);
_CMP_FIELD
(
a
,
b
,
metric
);
_CMP_FIELD
(
a
,
b
,
gateway
);
_CMP_FIELD
(
a
,
b
,
gateway
);
...
@@ -4319,11 +4324,19 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
...
@@ -4319,11 +4324,19 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
}
}
int
int
nm_platform_ip6_route_cmp
(
const
NMPlatformIP6Route
*
a
,
const
NMPlatformIP6Route
*
b
)
nm_platform_ip6_route_cmp
_full
(
const
NMPlatformIP6Route
*
a
,
const
NMPlatformIP6Route
*
b
,
gboolean
consider_host_part
)
{
{
_CMP_SELF
(
a
,
b
);
_CMP_SELF
(
a
,
b
);
_CMP_FIELD
(
a
,
b
,
ifindex
);
_CMP_FIELD
(
a
,
b
,
ifindex
);
if
(
consider_host_part
)
_CMP_FIELD_MEMCMP
(
a
,
b
,
network
);
_CMP_FIELD_MEMCMP
(
a
,
b
,
network
);
else
{
struct
in6_addr
n1
,
n2
;
nm_utils_ip6_address_clear_host_address
(
&
n1
,
&
a
->
network
,
a
->
plen
);
nm_utils_ip6_address_clear_host_address
(
&
n2
,
&
b
->
network
,
b
->
plen
);
_CMP_DIRECT_MEMCMP
(
&
n1
,
&
n2
,
sizeof
(
struct
in6_addr
));
}
_CMP_FIELD
(
a
,
b
,
plen
);
_CMP_FIELD
(
a
,
b
,
plen
);
_CMP_FIELD
(
a
,
b
,
metric
);
_CMP_FIELD
(
a
,
b
,
metric
);
_CMP_FIELD_MEMCMP
(
a
,
b
,
gateway
);
_CMP_FIELD_MEMCMP
(
a
,
b
,
gateway
);
...
@@ -4541,7 +4554,7 @@ const NMPlatformVTableRoute nm_platform_vtable_route_v4 = {
...
@@ -4541,7 +4554,7 @@ const NMPlatformVTableRoute nm_platform_vtable_route_v4 = {
.
is_ip4
=
TRUE
,
.
is_ip4
=
TRUE
,
.
addr_family
=
AF_INET
,
.
addr_family
=
AF_INET
,
.
sizeof_route
=
sizeof
(
NMPlatformIP4Route
),
.
sizeof_route
=
sizeof
(
NMPlatformIP4Route
),
.
route_cmp
=
(
int
(
*
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
))
nm_platform_ip4_route_cmp
,
.
route_cmp
=
(
int
(
*
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
,
gboolean
consider_host_part
))
nm_platform_ip4_route_cmp_full
,
.
route_to_string
=
(
const
char
*
(
*
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
))
nm_platform_ip4_route_to_string
,
.
route_to_string
=
(
const
char
*
(
*
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
))
nm_platform_ip4_route_to_string
,
.
route_get_all
=
nm_platform_ip4_route_get_all
,
.
route_get_all
=
nm_platform_ip4_route_get_all
,
.
route_add
=
_vtr_v4_route_add
,
.
route_add
=
_vtr_v4_route_add
,
...
@@ -4554,7 +4567,7 @@ const NMPlatformVTableRoute nm_platform_vtable_route_v6 = {
...
@@ -4554,7 +4567,7 @@ const NMPlatformVTableRoute nm_platform_vtable_route_v6 = {
.
is_ip4
=
FALSE
,
.
is_ip4
=
FALSE
,
.
addr_family
=
AF_INET6
,
.
addr_family
=
AF_INET6
,
.
sizeof_route
=
sizeof
(
NMPlatformIP6Route
),
.
sizeof_route
=
sizeof
(
NMPlatformIP6Route
),
.
route_cmp
=
(
int
(
*
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
))
nm_platform_ip6_route_cmp
,
.
route_cmp
=
(
int
(
*
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
,
gboolean
consider_host_part
))
nm_platform_ip6_route_cmp_full
,
.
route_to_string
=
(
const
char
*
(
*
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
))
nm_platform_ip6_route_to_string
,
.
route_to_string
=
(
const
char
*
(
*
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
))
nm_platform_ip6_route_to_string
,
.
route_get_all
=
nm_platform_ip6_route_get_all
,
.
route_get_all
=
nm_platform_ip6_route_get_all
,
.
route_add
=
_vtr_v6_route_add
,
.
route_add
=
_vtr_v6_route_add
,
...
...
src/platform/nm-platform.h
View file @
b7856257
...
@@ -392,7 +392,7 @@ typedef struct {
...
@@ -392,7 +392,7 @@ typedef struct {
gboolean
is_ip4
;
gboolean
is_ip4
;
int
addr_family
;
int
addr_family
;
gsize
sizeof_route
;
gsize
sizeof_route
;
int
(
*
route_cmp
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
);
int
(
*
route_cmp
)
(
const
NMPlatformIPXRoute
*
a
,
const
NMPlatformIPXRoute
*
b
,
gboolean
consider_host_part
);
const
char
*
(
*
route_to_string
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
);
const
char
*
(
*
route_to_string
)
(
const
NMPlatformIPXRoute
*
route
,
char
*
buf
,
gsize
len
);
GArray
*
(
*
route_get_all
)
(
NMPlatform
*
self
,
int
ifindex
,
NMPlatformGetRouteFlags
flags
);
GArray
*
(
*
route_get_all
)
(
NMPlatform
*
self
,
int
ifindex
,
NMPlatformGetRouteFlags
flags
);
gboolean
(
*
route_add
)
(
NMPlatform
*
self
,
int
ifindex
,
const
NMPlatformIPXRoute
*
route
,
gint64
metric
);
gboolean
(
*
route_add
)
(
NMPlatform
*
self
,
int
ifindex
,
const
NMPlatformIPXRoute
*
route
,
gint64
metric
);
...
@@ -1019,8 +1019,20 @@ int nm_platform_lnk_vlan_cmp (const NMPlatformLnkVlan *a, const NMPlatformLnkVla
...
@@ -1019,8 +1019,20 @@ int nm_platform_lnk_vlan_cmp (const NMPlatformLnkVlan *a, const NMPlatformLnkVla
int
nm_platform_lnk_vxlan_cmp
(
const
NMPlatformLnkVxlan
*
a
,
const
NMPlatformLnkVxlan
*
b
);
int
nm_platform_lnk_vxlan_cmp
(
const
NMPlatformLnkVxlan
*
a
,
const
NMPlatformLnkVxlan
*
b
);
int
nm_platform_ip4_address_cmp
(
const
NMPlatformIP4Address
*
a
,
const
NMPlatformIP4Address
*
b
);
int
nm_platform_ip4_address_cmp
(
const
NMPlatformIP4Address
*
a
,
const
NMPlatformIP4Address
*
b
);
int
nm_platform_ip6_address_cmp
(
const
NMPlatformIP6Address
*
a
,
const
NMPlatformIP6Address
*
b
);
int
nm_platform_ip6_address_cmp
(
const
NMPlatformIP6Address
*
a
,
const
NMPlatformIP6Address
*
b
);
int
nm_platform_ip4_route_cmp
(
const
NMPlatformIP4Route
*
a
,
const
NMPlatformIP4Route
*
b
);
int
nm_platform_ip4_route_cmp_full
(
const
NMPlatformIP4Route
*
a
,
const
NMPlatformIP4Route
*
b
,
gboolean
consider_host_part
);
int
nm_platform_ip6_route_cmp
(
const
NMPlatformIP6Route
*
a
,
const
NMPlatformIP6Route
*
b
);
int
nm_platform_ip6_route_cmp_full
(
const
NMPlatformIP6Route
*
a
,
const
NMPlatformIP6Route
*
b
,
gboolean
consider_host_part
);
static
inline
int
nm_platform_ip4_route_cmp
(
const
NMPlatformIP4Route
*
a
,
const
NMPlatformIP4Route
*
b
)
{
return
nm_platform_ip4_route_cmp_full
(
a
,
b
,
TRUE
);
}
static
inline
int
nm_platform_ip6_route_cmp
(
const
NMPlatformIP6Route
*
a
,
const
NMPlatformIP6Route
*
b
)
{
return
nm_platform_ip6_route_cmp_full
(
a
,
b
,
TRUE
);
}
gboolean
nm_platform_check_support_kernel_extended_ifa_flags
(
NMPlatform
*
self
);
gboolean
nm_platform_check_support_kernel_extended_ifa_flags
(
NMPlatform
*
self
);
gboolean
nm_platform_check_support_user_ipv6ll
(
NMPlatform
*
self
);
gboolean
nm_platform_check_support_user_ipv6ll
(
NMPlatform
*
self
);
...
...
src/tests/test-route-manager.c
View file @
b7856257
...
@@ -806,7 +806,7 @@ _assert_route_check (const NMPlatformVTableRoute *vtable, gboolean has, const NM
...
@@ -806,7 +806,7 @@ _assert_route_check (const NMPlatformVTableRoute *vtable, gboolean has, const NM
c
.
r6
=
route
->
r6
;
c
.
r6
=
route
->
r6
;
c
.
rx
.
rt_source
=
nmp_utils_ip_config_source_round_trip_rtprot
(
c
.
rx
.
rt_source
);
c
.
rx
.
rt_source
=
nmp_utils_ip_config_source_round_trip_rtprot
(
c
.
rx
.
rt_source
);
}
}
if
(
!
r
||
vtable
->
route_cmp
(
r
,
&
c
)
!=
0
)
{
if
(
!
r
||
vtable
->
route_cmp
(
r
,
&
c
,
TRUE
)
!=
0
)
{
g_error
(
"Invalid route. Expect %s, has %s"
,
g_error
(
"Invalid route. Expect %s, has %s"
,
vtable
->
route_to_string
(
&
c
,
NULL
,
0
),
vtable
->
route_to_string
(
&
c
,
NULL
,
0
),
vtable
->
route_to_string
(
r
,
buf
,
sizeof
(
buf
)));
vtable
->
route_to_string
(
r
,
buf
,
sizeof
(
buf
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment