diff options
author | Thomas Haller <thaller@redhat.com> | 2015-06-20 12:05:01 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-06-22 09:56:06 +0200 |
commit | 1fb84b1688710b3607321c97d6161d7b6f7584a2 (patch) | |
tree | ba3f24b5c46f27653ffbf8d47d3b31e0ff5ae5ef /contrib | |
parent | c01a9d059c5d260164b33557cb0b2102314c3bfd (diff) | |
download | NetworkManager-1fb84b1688710b3607321c97d6161d7b6f7584a2.tar.gz |
platform: refactor virtual methods for link objects in NMPlatform
Change nm_platform_link_get() to return the cached NMPlatformLink
instance. Now what all our implementations (fake and linux) have such a
cache internal object, let's just expose it directly.
Note that the lifetime of the exposed link object is possibly quite
short. A caller must copy the returned value if he intends to preserve
it for later.
Also add nm_platform_link_get_by_ifname() and modify nm_platform_link_get_by_address()
to return the instance.
Certain functions, such as nm_platform_link_get_name(),
nm_platform_link_get_ifindex(), etc. are solely implemented based
on looking at the returned NMPlatformLink object. No longer implement
them as virtual functions but instead implement them in the base class
(nm-platform.c).
This removes code and eliminates the redundancy of the exposed
NMPlatformLink instance and the nm_platform_link_get_*() accessors.
Thereby also fix a bug in NMFakePlatform that tracked the link address
in a separate "address" field, instead of using "link.addr". That was
a case where the redundancy actually led to a bug in fake platform.
Also remove some stub implementations in NMFakePlatform that just
bail out. Instead allow for a missing virtual functions and perform
the "default" action in the accessor.
An example for that is nm_platform_link_get_permanent_address().
(cherry picked from commit e8e455817b340f60b396ba5d41425ed4de4c8554)
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions