Compare commits

..

355 Commits
f20 ... rawhide

Author SHA1 Message Date
Beniamino Galvani e481288c3e Update to 1.43.6 release (development) 2023-04-20 11:58:54 +02:00
Beniamino Galvani 229955ef0b Sync the spec file with upstream 2023-04-20 11:58:54 +02:00
Adam Williamson ef05be83e2 Fix ppp version discovery 2023-04-18 18:02:18 -07:00
Kevin Fenzi 948f57c7bf Add upstream patch for ppp-2.5.0
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2023-04-18 16:24:30 -07:00
Adam Williamson c609302693 Rebuild for ppp 2.5.0 2023-04-18 14:51:11 -07:00
Lubomir Rintel 86df8c88db Actually bump the version 2023-04-05 14:39:21 +02:00
Lubomir Rintel d4cbc3d2d2 Update to 1.43.5 release (development) 2023-04-05 13:54:59 +02:00
Thomas Haller 3562d94a12
Update to 1.43.4 release (development) 2023-03-22 20:43:13 +01:00
Lubomir Rintel 0a4365e5af Remove an old patch 2023-03-08 18:36:35 +01:00
Lubomir Rintel 589a1c573c Update to an early 1.44 snapshot 2023-03-08 16:11:50 +01:00
Thomas Haller 3049c2df9a
libnm/docs: fix gtk-doc generation for settings 2023-02-10 17:38:30 +01:00
Thomas Haller 9aa462c3d5
Upgrade to 1.42.0 release 2023-02-10 10:13:48 +01:00
Yaakov Selkowitz 268730fdde Fix flatpak build 2023-01-31 17:30:10 +00:00
Lubomir Rintel d11b67721a Update to 1.41.91 release (release candidate) 2023-01-26 10:37:02 +01:00
Fernando Fernandez Mancera 4a5d12e071 Upgrade to 1.42-rc1 (1.41.90) (release candidate) 2023-01-20 12:49:37 +01:00
Fedora Release Engineering 2cb10e4348 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-18 19:55:54 +00:00
Beniamino Galvani 97dcdaaf53 Update to 1.41.8 release (development) 2023-01-16 17:13:12 +01:00
Lubomir Rintel 9e45edd668 Update to 1.41.7 release (development) 2022-12-15 17:11:05 +01:00
Thomas Haller 0f59c7739b
Update to 1.41.6 release (development) 2022-11-30 18:39:05 +01:00
Thomas Haller 8932641c49
Upgrade to 1.41.5 development snapshot 2022-11-18 08:31:29 +01:00
Thomas Haller fe89fe48df
fix generating stable UUIDs for keyfile (gitlab#1130) 2022-11-03 09:30:01 +01:00
Wen Liang 971a5b8ee2 Update to 1.41.4 release (development) 2022-11-02 16:43:10 -04:00
Beniamino Galvani c5811ea797 Update to 1.41.3 release (development) 2022-10-18 12:11:48 +02:00
Thomas Haller 3177397698
Upgrade to 1.40.0 release 2022-08-26 19:41:20 +02:00
Ana Cabral eb5fbe00af Upgrade to 1.40-rc1 (1.39.90) (release candidate) 2022-08-16 18:51:15 -03:00
Beniamino Galvani e27d4677d1 Update to 1.39.11 release (development) 2022-07-28 10:43:10 +02:00
Fedora Release Engineering 460034d95b Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-20 18:49:28 +00:00
Vojtech Bubela 022b5635e4 Update to 1.39.10 release (development) 2022-07-14 15:26:50 +02:00
Lubomir Rintel e83c290128 Update to 1.39.8 release (development) 2022-06-30 16:51:10 +02:00
Ana Cabral e41df17cd6 Bump release number 2022-05-30 14:03:39 +02:00
Ana Cabral 136952f729 rpm: include an informational file in ifcfg files directory 2022-05-30 10:28:35 +02:00
Thomas Haller 53393c4b58
Upgrade to 1.38.0 release 2022-05-13 11:32:19 +02:00
Thomas Haller a745e634cf
Upgrade to 1.38-rc3 (1.37.92) (release candidate) 2022-05-04 15:10:17 +02:00
Thomas Haller 42ff700916
Upgrade to 1.38-rc2 (1.37.91) (release candidate) 2022-04-14 12:48:41 +02:00
Ana Cabral 49cb2c5734 Update to 1.38.0-rc1 (1.37.90) (release candidate) 2022-04-07 11:33:46 +02:00
Lubomir Rintel 7cf2ae3afa Upgrade to 1.37.3 release (development) 2022-03-24 22:06:17 +01:00
Beniamino Galvani f403f8efc4 Update to 1.36.4 release 2022-03-22 21:50:12 +01:00
Michael Scherer 50b8516937 Fix RHBZ 2066849 2022-03-22 16:36:30 +01:00
Beniamino Galvani 8bcd242d34 Update to 1.36.2 release 2022-03-07 12:03:57 +01:00
Lubomir Rintel 9dc614162a Update to 1.36.0 release 2022-02-24 16:59:47 +01:00
Lubomir Rintel 29841c7d57 Update to 1.36-rc3 (1.35.92) (release candidate) 2022-02-19 14:11:54 +01:00
Lubomir Rintel 0b5c393efe Fix build 2022-02-10 15:42:33 +01:00
Lubomir Rintel c3b4682a03 Update to 1.36-rc2 (1.35.91) (release candidate) 2022-02-10 15:21:20 +01:00
Lubomir Rintel ca43676e5e Update to 1.36-rc1 (1.35.90) (release candidate) 2022-02-04 18:39:45 +01:00
Thomas Haller 993bfd4a39
update to an early 1.36 snapshot (1.35.7) 2022-01-28 15:27:31 +01:00
Thomas Haller 73ea8c0c0f
Revert rework of DHCP client that causes crash
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1066#note_1233210
2022-01-27 01:00:50 +01:00
Thomas Haller bf5f80eb09
fix version 2022-01-26 23:13:20 +01:00
Thomas Haller 2daaa0dfe3
update to an early 1.36 snapshot (1.35.6) 2022-01-26 23:06:06 +01:00
Fedora Release Engineering 8c1c57be16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-19 19:30:29 +00:00
Thomas Haller 88df317665
update to an early 1.36 snapshot (1.35.4) 2022-01-13 13:44:19 +01:00
Wen Liang 341972ce75 update to an early 1.36 snapshot (1.35.3) 2021-12-15 20:06:10 -05:00
Wen Liang 93fb0bf10a update to an early 1.36 snapshot (1.35.2) 2021-12-02 12:37:26 -05:00
Beniamino Galvani f839faf6ba update to an early 1.36 snapshot (1.35.1) 2021-11-19 18:04:21 +01:00
Beniamino Galvani 0130e35f80 core: better handle sd-resolved errors when resolving hostnames
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/833
2021-10-29 17:00:59 +02:00
Beniamino Galvani 8594b59280 Update to 1.32.12 release 2021-09-22 12:01:58 +02:00
Thomas Haller 2c2c15fe51
platform: fix capturing IPv4 addresses from platform for assuming after restart 2021-08-19 18:58:38 +02:00
Wen Liang 0bf341083e
Update to 1.32.10 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2021-08-19 13:27:49 +02:00
Fernando Fernandez Mancera 4a6b3fc1cc Update to 1.32.8 release
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2021-08-10 20:19:24 +02:00
Thomas Haller 373fa8cd0f
update to 1.32.6 release 2021-07-28 18:29:34 +02:00
Thomas Haller 76947cefc7
changelog: whitespace fixes 2021-07-27 10:46:25 +02:00
Fedora Release Engineering aa51858262 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 15:55:23 +00:00
Fedora Release Engineering 4f80c65cb1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 11:00:51 +00:00
Thomas Haller 2be3b50b5c
update to 1.32.4 release 2021-07-20 17:30:06 +02:00
Thomas Haller 74a5d6efed
update to 1.32.0 release 2021-06-16 22:46:43 +02:00
Thomas Haller c6fd1f3181
update to 1.32-rc1 (1.31.90) (release candidate) 2021-06-04 18:24:17 +02:00
Beniamino Galvani c649704e87 update to an early 1.32 snapshot (1.31.4) 2021-05-05 21:33:52 +02:00
Beniamino Galvani 0c125af8fe update to an early 1.32 snapshot (1.31.3) 2021-04-23 14:22:09 +02:00
Beniamino Galvani c83d942eaf update sources 2021-04-12 15:49:12 +02:00
Beniamino Galvani b069eff77c update to an early 1.32 snapshot (1.31.2) 2021-03-25 14:01:44 +01:00
Beniamino Galvani 58024e4031 update to 1.30.2 release 2021-03-12 17:11:18 +01:00
Thomas Haller 923d3d1d99
update to 1.30.0 release 2021-02-18 20:25:05 +01:00
Thomas Haller dbfd35a1ec
update to 1.30-rc1 (1.29.90-dev) snapshot 2021-02-11 17:13:31 +01:00
Thomas Haller 598b6a70ba
update to 1.29.11-dev snapshot 2021-02-09 09:21:49 +01:00
Fedora Release Engineering 6db3c9359d - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-25 22:32:05 +00:00
Thomas Haller d08e71d9e7
update to 1.29.9-dev snapshot 2021-01-19 20:12:24 +01:00
Thomas Haller a6813af4b6
resync spec file with upstream
- extend "Requires:" to work with Centos8 and older. We maintain
  upstream a preferred spec file that should work with all distros
  that we support.

- fix to not package manual page for "nm-cloud-setup" in NetworkManager
  package.
2021-01-18 13:02:01 +01:00
Peter Robinson d106900593
Require wireless-regdb for wifi support so WiFi region is set
https://src.fedoraproject.org/rpms/NetworkManager/pull-request/7
2021-01-18 10:27:43 +01:00
Tom Stellard 8f93680134
Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/4
2021-01-15 17:16:06 +01:00
Thomas Haller 7a48b33607
update to 1.29.8-dev snapshot 2021-01-14 22:42:22 +01:00
Jonathan Lebon 3240dc5220
Don't trigger udev if socket doesn't exist
On rpm-ostree systems, we don't want scriptlets to affect the running
system because a major part of the value is "background updates".
Scriptlets are run in a containerized environment where e.g. udev is not
available.

Add a check for the udev socket before triggering it to handle this.
This also helps the container use case.

This doesn't break rpm-ostree strictly, because it uses `|| :`, but it
still spams error messages during the compose. I kept the `|| :` to be
safe, but it's likely fine to remove them now.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1352154
See also: https://src.fedoraproject.org/rpms/udisks2/pull-request/3
See also: https://github.com/coreos/fedora-coreos-tracker/issues/703

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/6
2021-01-14 22:32:41 +01:00
Tom Stellard 85ab70ffcd Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-07 05:44:09 +00:00
Mohan Boddu 1130677af4 Rebuild for ppp-2.4.9-1
Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
2021-01-06 11:21:44 -05:00
Thomas Haller a18e85809f
update to 1.28.0 2020-12-06 16:29:45 +01:00
Beniamino Galvani 1d764a957f update to 1.28-rc2 (1.27.91) 2020-10-20 18:55:54 +02:00
Thomas Haller 36c0fdc256
update to 1.28-rc1 (1.27.90) 2020-10-06 10:13:47 +02:00
Thomas Haller 103896827d
reword changelog and re-generate patch
- patches should be in `git format-patch` format and have a
  "cherry picked from" line that refers to the respective upstream
  patch. This way the patch contains meta data like the commit
  message and a reference to the upstream commit ID.

- the change log referred to the commit ID from master branch, when
  it should refer to the batch from nm-1-26 branch (which is upstream
  for 1.26.2, which is currently packaged).

- the change log seem line seems too long. Reword. Also, the main
  purpose of the change is to fix the build (not to backport a patch).
2020-09-21 14:55:20 +02:00
Yaroslav Fedevych 46a78c9b14
Backport a XML generation fix so the package builds correctly
https://src.fedoraproject.org/rpms/NetworkManager/pull-request/5
2020-09-21 14:51:11 +02:00
Thomas Haller a32a9e28b5
adjust version number 2020-08-19 11:07:30 +02:00
Thomas Haller d6f04ca2cf
update to 1.26.2 2020-08-19 09:49:31 +02:00
Fedora Release Engineering 8de97ab4ed - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 10:29:45 +00:00
Thomas Haller acbaadae23
prefer keyfile settings plugin from Fedora 33 and newer
https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00002.html
https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://pagure.io/fesco/issue/2432

https://bugzilla.redhat.com/show_bug.cgi?id=1857391
2020-07-16 12:28:39 +02:00
Thomas Haller f6133686c9
Update to 1.26.0 2020-07-13 21:22:34 +02:00
Thomas Haller a06b38bcbe
update to 1.26-rc1 (1.25.90) 2020-06-15 19:33:09 +02:00
Thomas Haller 28e6474b9c
Update to 1.24.2 release 2020-05-29 17:28:37 +02:00
Thomas Haller bea355fedb
Update to 1.24.0 2020-05-08 14:48:12 +02:00
Thomas Haller b190302070
Update to 1.24-rc2 (1.23.91) 2020-05-02 23:02:28 +02:00
Thomas Haller c2f5bb45e9 Update to 1.24-rc1 (1.23.90) 2020-04-11 20:30:16 +02:00
Björn Esser 660f94e1b0
Bump release 2020-04-02 13:33:12 +02:00
Björn Esser 5eadbbce7e
Fix string quoting for rpm >= 4.16 2020-04-02 13:09:18 +02:00
Thomas Haller f2a09782d5 fix date in changelog 2020-03-12 16:17:24 +01:00
Thomas Haller 505f80e176 Update to 1.22.10 2020-03-12 16:11:58 +01:00
Adam Williamson bbc5f98e67 Rebuild for new ppp 2020-02-22 09:16:42 -08:00
Antonio Cardace e3ace6b76e Update to 1.22.8 2020-02-18 17:23:28 +01:00
Beniamino Galvani c4c77b9ac1 Fix build with GCC 10 2020-02-03 16:15:23 +01:00
Beniamino Galvani 7ff623281c Update to 1.22.6 2020-02-03 12:04:35 +01:00
Fedora Release Engineering 8d16f6e4dc - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 09:33:39 +00:00
Beniamino Galvani 3722052671 Update to 1.22.4 2020-01-10 10:36:27 +01:00
Thomas Haller b3a325009e Update to 1.22.2 2019-12-25 20:18:47 +01:00
Thomas Haller e4027e3b1a Update to 1.22.0 2019-12-17 11:27:16 +01:00
Thomas Haller ebb5317dc1 Update to 1.21.90 (1.22-rc1) (fix spec file) 2019-11-29 18:56:32 +01:00
Thomas Haller 110dba26d8 Update to 1.21.90 (1.22-rc1) 2019-11-29 18:38:29 +01:00
Lubomir Rintel 001af63c4e Update to an early 1.22.0 snapshot 2019-11-03 13:04:48 +01:00
Thomas Haller ac21445f51 Update to 1.20.4 release 2019-09-30 09:11:12 +02:00
Lubomir Rintel 81023c35a5 Bring back the boolean dep for the wireless daemon 2019-09-07 14:58:28 +02:00
Lubomir Rintel 5ef97724b1 Bring back the boolean dep for the wireless daemon
Hopefully this will allow installing iwd while still preferring
wpa_supplicant.

Suggested-by: Rex Dieter <rdieter@gmail.com>
Suggested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>>
2019-09-06 14:25:32 +02:00
Lubomir Rintel 48c1f98497 Update to 1.20.2 release
- Bring back the hard wpa_supplicant dependency (rh #1743585)
2019-09-05 14:57:36 +02:00
Lubomir Rintel f3de64e64d wifi: detect FT support per interface and avoid enabling it 2019-08-23 08:58:55 +02:00
Lubomir Rintel 231f1105ed contrib/rpm: install our dispatcher scripts into /usr/lib/NetworkManager
That's where they always should have been.
2019-08-23 08:58:40 +02:00
Lubomir Rintel 84788c4cfd Enable iwd support 2019-08-15 23:10:41 +02:00
Thomas Haller da0c931f46 Update to 1.20.0 release 2019-08-06 14:00:42 +02:00
Thomas Haller 2875b62a86 Update to 1.20-rc1 upstream release candidate 2019-07-29 21:53:55 +02:00
Fedora Release Engineering 885bee8178 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-24 15:59:39 +00:00
Lubomir Rintel 0dda1bed32 settings: fix a reversed conditional in have_connection_for_device() (rh #1727411) 2019-07-08 18:11:38 +02:00
Lubomir Rintel 184dfaf298 Update the 1.20.0 snapshot
- initrd: skip ethernet hwtype in BOOTIF (rh #1726240)
- initrd: allow specifying the net mask in form of a prefix (rh #1725872)
2019-07-03 09:48:56 +02:00
Lubomir Rintel 040ae392e7 Re-enable the initrd generator 2019-06-04 16:09:06 +02:00
Lubomir Rintel 6cfba5306d Update the 1.20.0 snapshot 2019-06-04 16:07:58 +02:00
Lubomir Rintel fd6f6acab8 Update to an early 1.20.0 snapshot 2019-05-03 11:49:05 +02:00
Lubomir Rintel a2e07e734d Sync SPEC with NM git 2019-04-26 18:06:42 +02:00
Lubomir Rintel ed4473292d Update to 1.18.0 release 2019-04-26 17:54:47 +02:00
Thomas Haller 746be5eb7f Update to 1.16.0 release 2019-03-15 16:39:03 +01:00
Thomas Haller b19e5ac269 Fix compilation error on rawhide for gettid() compat implementation 2019-03-11 19:16:32 +01:00
Thomas Haller 6cdec870c5 Update to 1.15.91 release (1.16-rc2) 2019-03-11 17:23:38 +01:00
Thomas Haller 91b043a18a Revert "Remove obsolete Group tag"
We maintain an upstream specfile of NetworkManager [1] that shall be suitable
for all Fedora/RHEL releases. As such, there are still releases for
which we want to keep the group tag.

Revert the patch, so that the difference between Fedora's and upstream's
specfile is minimized.

[1] https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/contrib/fedora/rpm/NetworkManager.spec?id=96be30cbcc59494d45e3b2f3bd605e00050674ed

This reverts commit 62adcbc888.
2019-03-11 17:19:37 +01:00
Thomas Haller 2a9113a2f9 Update to 1.15.90 release (1.16-rc1) 2019-02-23 10:57:15 +01:00
Igor Gnatenko 3fcb0e3703 Rebuild for readline 8.0 2019-02-17 09:30:52 +01:00
Kalev Lember f6c878a04a Update BRs for vala packaging changes 2019-02-04 12:24:46 +01:00
Fedora Release Engineering bcdcd326ad - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-01-31 11:42:26 +00:00
Igor Gnatenko 62adcbc888 Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:24:18 +01:00
Igor Gnatenko 5c6421bc88
Remove obsolete ldconfig scriptlets
References: https://fedoraproject.org/wiki/Changes/RemoveObsoleteScriptlets
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-01-22 18:40:29 +01:00
Thomas Haller 7d883dd95e dhcp: fix out-of-bounds heap write for DHCPv6 with internal plugin (CVE-2018-15688) 2018-10-29 14:43:36 +01:00
Lubomir Rintel dd82c1e921 Drop unnecessary patches 2018-10-24 11:43:44 +02:00
Lubomir Rintel 7d3054a9e3 Update to 1.14.4 release
Temporarily disable the initrd generator (rh #1641832)
2018-10-24 11:36:00 +02:00
Thomas Haller 67ec5442e9 device: fix crash in nm_device_generate_connection() (1:1.14.2-2)
Also "dhcp: dhclient: fix memory leak".
2018-10-23 12:14:03 +02:00
Lubomir Rintel 6fd65f9fd5 Update to 1.14.2 release 2018-10-19 16:58:26 +02:00
Thomas Haller 92d36d7fb0 Update to 1.14.0 release 2018-09-18 15:15:56 +02:00
Lubomir Rintel ac2eac23f7 Fix Rawhide build 2018-08-11 11:13:19 +02:00
Lubomir Rintel 1117a6f1f7 fix compile error due to NM_AVAILABLE_IN_1_12_2 2018-08-11 09:53:52 +02:00
Lubomir Rintel e49edc693e Update to 1.12.2 release 2018-07-25 12:52:04 +02:00
Fedora Release Engineering cba19ad11e - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-12 19:08:11 +00:00
Thomas Haller c362687d27 Update to 1.12.0 release 2018-06-29 19:19:30 +02:00
Thomas Haller 5743a963d8 fix build failure due to unstable tests 2018-06-18 11:00:20 +02:00
Thomas Haller fff3d1de66 Update to 1.12-rc1 pre-release 2018-06-16 08:19:26 +02:00
Lubomir Rintel 29a9c41bea Update to a development snapshot of NetworkManager 1.12
- Switch crypto to gnutls
- Add dispatcher-routing-rules subpackage
- Switch to Python 3-only build root
2018-05-31 17:10:30 +02:00
Vladimir Benes 98525d7834 tests: add F28 CI tests using the Standard Test Interface
Adding initial set of basic functionality tests for NetworkManager
according to the Standard Test Interface [1]. See Quick Start Guide
for brief introduction about how to run these tests [2].

[1] https://fedoraproject.org/wiki/CI/Standard_Test_Interface
[2] https://fedoraproject.org/wiki/CI/Quick_Start_Guide

[thaller@redhat.com: at this point, NetworkManager package on rawhide
  is essentially the same as on f28. So, when cherry-picking the
  tests, also intentionally keep testing the "fedora28" profile.
   1) until the packages that we test diverge, there is usually
      little reason to run a different set of tests (unless it
      makes sense due to differences in the Fedora version).
   2) as long as the set of tests that we want to run is identical,
      there is no reason to clone the test profile and bump the
      profile number.
  It follows: we stick to "fedora28" for the time being.]

(cherry picked from commit c8e00774af)
2018-05-24 09:51:01 +02:00
Beniamino Galvani d72f282e41 Update to 1.10.8 release 2018-05-14 15:55:00 +02:00
Beniamino Galvani e4a9ce242d dhcp: better handle expiry and nacks (rh #1575370)
https://bugzilla.gnome.org/show_bug.cgi?id=783391
https://bugzilla.redhat.com/show_bug.cgi?id=1575370
2018-05-06 14:28:03 +02:00
Beniamino Galvani 9fa973f15f device: fix setting 'rp_filter' value (rh #1565529) 2018-04-17 10:09:19 +02:00
Beniamino Galvani e712bef644 Fix build 2018-04-12 14:40:49 +02:00
Iryna Shcherbina 4797640ddf Update Python 2 dependency declarations to new packaging standards 2018-03-14 22:39:40 +01:00
Thomas Haller 17941a667b Update to 1.10.6 release 2018-03-12 14:15:23 +01:00
Thomas Haller 9c37f0c674 policy: fix blocking autoconnect for no-secrets (rh #1553773) 2018-03-09 15:38:47 +01:00
Thomas Haller 014828b918 trivial: rename patch 2018-03-09 15:34:53 +01:00
Lubomir Rintel b8041505cb Another attempt at fixing gcc 8 build 2018-02-07 11:53:56 +01:00
Lubomir Rintel 1f3baf8c8d Fix build 2018-02-06 17:31:32 +01:00
Lubomir Rintel 8b792ad0ef Fix build 2018-02-06 17:30:36 +01:00
Lubomir Rintel dc410627f6 Update to 1.10.4 release 2018-02-05 11:37:29 +01:00
Lubomir Rintel e5d9e5bbb2 Revert "Switch to %ldconfig_scriptlets"
This breaks build on basically everything we support. Needs more
thought.

This reverts commit 3dc75bb968.
2018-02-05 11:32:15 +01:00
Igor Gnatenko 3dc75bb968
Switch to %ldconfig_scriptlets
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-02 11:25:09 +01:00
Thomas Haller 2f601f9c53 Update to 1.10.2 release 2017-12-15 11:33:34 +01:00
Björn Esser 2b734c644d
Apply patch from previous commit 2017-11-17 20:08:52 +01:00
Thomas Haller f484465e78 libnm: fix accessing enabled and metered properties 2017-11-02 16:23:09 +01:00
Thomas Haller 44c7179885 systemd: let NM-w-o.service require NetworkManager service (rh #1452866)
- systemd: let NM-w-o.service require NetworkManager service (rh #1452866)
  Related to rh #1455704.
  See also: https://github.com/systemd/systemd/pull/6065

- platform: really treat dsa devices as regular wired ethernet (rh #1371289)
  actually apply patch.

- in spec file, explicitly set dhclient as default (resync with upstream
  spec file).
2017-11-02 15:50:34 +01:00
Lubomir Rintel 7a812558d6 Actually add the patch 2017-10-09 19:47:27 +02:00
Lubomir Rintel e74c1e7f0a Actually bump the release number 2017-10-09 19:45:24 +02:00
Lubomir Rintel cfe40a7c6d platform: treat dsa devices as regular wired ethernet 2017-10-09 19:43:54 +02:00
Thomas Haller 8e0f2bf38d device: fix delay startup complete for unrealized devices (1:1.8.4-4)
And 2 more fixes from upstream.
2017-10-05 10:57:10 +02:00
Thomas Haller 11bdf5039f backport 3 patches for crashes (1.8.4-3) 2017-09-29 13:13:52 +02:00
Thomas Haller de4dee2405 enable NetworkManager-wait-online.service on package upgrade (rh#1455704) 2017-09-27 18:05:03 +02:00
Thomas Haller 354ea1ca0d Update to 1.8.4 release 2017-09-20 14:07:51 +02:00
Fedora Release Engineering 10dfa87029 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 17:01:01 +00:00
Fedora Release Engineering bbd538ac0e - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 01:56:03 +00:00
Lubomir Rintel 24d35df5f2 contrib/rpm: provide NetworkManager-devel
The package no longer exists.
2017-07-21 17:40:01 +02:00
Stephen Gallagher 0cc505ca29 Fix Requires/Provides on subpackages
NetworkManager-wifi and NetworkManager-glib-devel should require
NetworkManager, not provide it.

https://bugzilla.redhat.com/show_bug.cgi?id=1454505
2017-07-20 22:11:18 +02:00
Beniamino Galvani 46b9e17739 Import upstream patches after 1.8.2 2017-07-18 11:03:01 +02:00
Beniamino Galvani 8ca68d8c30 Update to 1.8.2 release 2017-07-18 11:03:01 +02:00
Lubomir Rintel a2ab3fed9e Add upstream patches that went into RHEL
- device: don't change MTU unless explicitly configured (rh #1460760)
- core: don't remove external IPv4 addresses (rh #1459813)
- cli: fix output of iface in overview output (rh#1460219)
- ppp: unexport NMPPPManager instance on dispose (rh#1459579)
- cli: remove spurious device names from wifi subcommands output (rh#1460527)
2017-06-22 12:52:23 +02:00
Lubomir Rintel ebf02b63fe Add upstream patches that went into RHEL
- bond: fix crash comparing mode while generating bond connection (rh #1459580)
- connectivity: fix route penalty if WWAN and BT device using ip-ifindex (rh #1459932)
- device: persist nm-owned in run state (rh #1376199)
- device: fix assuming master device on restart (rh #1452062)
- device: apply route metric penality only when the default route exists (rh #1459604)
- connectivity: fix periodic connectivity check (rh #1458399)
- bond: improve option matching on daemon restart (rh #1457909)
- device: fix touching device after external activation (rh #1457242)
2017-06-09 17:27:09 +02:00
Thomas Haller a53c203b20 import patches from rhel-7.4 (1.8.0-5.el7) as 1.8.0-4 2017-06-04 19:47:58 +02:00
Thomas Haller b018266780 update spec file from upstream 2017-05-24 13:02:31 +02:00
Thomas Haller b67ac8dd76 device: update external configuration before commit (fix bug) (rh #1449873) 2017-05-22 11:30:21 +02:00
Thomas Haller 5539474cc7 update NetworkManager.spec file with upstream
Resync spec file with upstream's contrib/fedora/rpm
NetworkManager.spec file.
2017-05-20 11:12:59 +02:00
Thomas Haller 5ac481bbc0 import patches from rhel-7.4
Let's keep rhel-7.4 and Fedora package in sync, so Fedora benefits
from bugfixes during rhel-7.4 development and RHEL benefits from
additional testing by the community.

These are all upstream patches originally cherry-picked from
nm-1-8 branch.
2017-05-20 11:07:37 +02:00
Thomas Haller 085f84674b fix version number 2017-05-10 16:48:53 +02:00
Thomas Haller 4b63db2a3c Update to 1.8.0 release 2017-05-10 16:00:37 +02:00
Lubomir Rintel 20a1eb6b48 Update to third Release Candidate of NetworkManager 1.8 2017-04-20 17:29:21 +02:00
Lubomir Rintel c2e258e5bf Update to second Release Candidate of NetworkManager 1.8 2017-04-06 14:58:15 +02:00
Lubomir Rintel a486a68256 Update to a snapshot of 1.8.x series
And sync SPEC file changes from upstream
2017-03-23 18:00:08 +01:00
Lubomir Rintel e6eb5ade9b Update to a 1.6.2 release 2017-02-16 15:39:48 +01:00
Fedora Release Engineering 9082b9c2c9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 05:13:45 +00:00
Lubomir Rintel 02c2422a55 Drop old patches 2017-01-25 18:49:37 +01:00
Lubomir Rintel 6fe2ab4151 Update to a 1.6.0 release 2017-01-25 18:29:09 +01:00
Thomas Haller a920fbcc16 Update with fixes from upstream nm-1-6 branch 1.6-0.2.rc1 2017-01-20 17:26:50 +01:00
Lubomir Rintel d142b15bef Fix FTBFS 2017-01-17 16:23:42 +01:00
Thomas Haller 263dac5e9f drop unused patch 0001-bitwise-clash.patch 2017-01-17 15:54:13 +01:00
Thomas Haller dcba8d0c1b update NetworkManager.conf default file 2017-01-17 15:53:57 +01:00
Lubomir Rintel ffc584dc8e Actually upload the file... 2017-01-17 15:48:54 +01:00
Lubomir Rintel 9b6a7107cd Fix up merge trouble 2017-01-17 15:15:53 +01:00
Lubomir Rintel f6516fc10b Update to a 1.6-rc1 2017-01-17 15:12:38 +01:00
Thomas Haller 0727cc1c28 fix build failure due to clash of bitwise defines
Also fixup the changelog for past release versions.
2017-01-12 22:29:43 +01:00
Igor Gnatenko 49933b2c3f Rebuild for readline 7.x
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-01-12 17:30:34 +01:00
Lubomir Rintel 162dc7bc1d Update to a newer development snapshot 2016-12-15 20:51:26 +01:00
Lubomir Rintel bdcc136a74 sync 2016-12-15 20:24:28 +01:00
Thomas Haller 499383592f Rebuild package for vala generation error (rh#1398738) 2016-12-06 21:11:01 +01:00
Thomas Haller f6cdb7df44 fix enabling ifcfg-rh plugin by default for +=/-= operations (rh#1397938) 2016-11-25 18:27:33 +01:00
Thomas Haller 85fff454e7 fix enabling ifcfg-rh plugin by default (rh#1397938) 2016-11-23 19:00:27 +01:00
Lubomir Rintel 86376290a3 Drop an extra rebuild that breaks on 32bit 2016-11-06 15:43:33 +01:00
Lubomir Rintel 8c478edba5 Fix a timestamp typo 2016-11-06 14:42:36 +01:00
Lubomir Rintel ce85c6f3ef Update to a development snapshot 2016-11-06 14:37:55 +01:00
Lubomir Rintel 3a1a8315bc Update to 1.4.2 2016-10-10 19:17:57 +02:00
Thomas Haller 76dec7d585 wifi: fix another activation failure when changing MAC address (rh#1371478, bgo#770456, bgo#770504) 2016-09-13 11:31:09 +02:00
Thomas Haller 2c68942743 dhcp: fix race to miss DHCP lease event (rh#1372854) 2016-09-08 00:40:29 +02:00
Thomas Haller 475c2e000a wifi: fix activation failure due to error changing MAC address (rh#1371478, bgo#770456) 2016-08-30 12:34:35 +02:00
Thomas Haller 7802605bbc update spec file with upstream's contrib/rpm 2016-08-25 12:03:03 +02:00
Lubomir Rintel ab73a3a118 Update to NetworkManager 1.4.0 release 2016-08-24 21:18:49 +02:00
Thomas Haller 26675d15eb update spec file with upstream's contrib/rpm 2016-08-11 16:03:54 +02:00
Thomas Haller 0eea3092fc fix stale Wi-Fi after resume from suspend (rh#1362165) 2016-08-11 15:45:03 +02:00
Matthias Clasen d4f66ff72e Actually bump rev 2016-07-21 08:17:44 -04:00
Matthias Clasen 42a976d0d2 Rebuild 2016-07-21 08:15:32 -04:00
Lubomir Rintel 5a338dc86f Add source 2016-07-19 15:21:33 +02:00
Lubomir Rintel aeb4a90471 Update to a later Git snapshot 2016-07-19 15:19:57 +02:00
Thomas Haller 3ce491100f clear cache of dnsmasq when updating DNS configuration (rh#1338731) 2016-06-02 20:55:53 +02:00
Lubomir Rintel 8228d8b507 Update to NetworkManager 1.2.2 release 2016-05-11 15:17:28 +02:00
Thomas Haller 7f9e845bcf spec: update definition of global "snap"
Make it more similar to upstream's spec file from contrib/rpm.
2016-05-06 16:02:35 +02:00
Lubomir Rintel eb0b7592f8 Update to NetworkManager 1.2.0 release 2016-04-20 18:54:07 +02:00
Lubomir Rintel 6405114730 Update to NetworkManager 1.2-rc2 2016-04-14 17:18:41 +02:00
Lubomir Rintel 3983d3a9b8 Fix udev dir 2016-04-06 00:52:55 +02:00
Lubomir Rintel 2880cda73d Drop an useless and evil patch 2016-04-05 23:43:52 +02:00
Lubomir Rintel 04c92a6fe9 Sync the SPEC file from upstream 2016-04-05 23:35:54 +02:00
Lubomir Rintel 1c56626f3d Update to NetworkManager 2016-04-05 23:19:19 +02:00
Lubomir Rintel 2ec678c923 Fix link detection on 4.5 when build with 4.6 kernel 2016-03-30 13:28:21 +02:00
Lubomir Rintel 9093f6263e Update to NetworkManager 1.2-beta3 2016-03-29 17:36:47 +02:00
Lubomir Rintel bb908ed4e4 Fix obtaining the hostname from DNS (rh #1308974) 2016-03-22 10:20:24 +01:00
Dan Williams f561df45ac Fix activating connections in some cases (rh #1316488) 2016-03-17 15:56:07 -05:00
Lubomir Rintel de82b42eba If we generate docs then install them 2016-03-17 16:45:53 +01:00
Lubomir Rintel 5dd9e740f5 Update to NetworkManager 1.2-beta2 2016-03-01 17:47:06 +01:00
Thomas Haller 180858e3be core: backport fix for missing braces bug in platform
It's only beta1, but it breaks compilation for rawhide due
to -Werror=misleading-indentation.
2016-02-03 17:08:11 +01:00
Thomas Haller 98b39fff30 spec-file: update spec file and sync with contrib/rpm
Also:

  - no longer install '10-ibft-plugin.conf'

  - updade NetworkManager.conf with content from contrib/rpm
2016-02-03 17:08:11 +01:00
Dennis Gilmore 0bf1c597c3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-03 15:31:24 +00:00
Lubomir Rintel 810ab20ff1 Update to NetworkManager 1.2-beta1 2016-01-19 15:36:07 +01:00
David King 13724a4562 Add upstream fix for AP list hash function (#1288867) 2016-01-08 19:48:22 +00:00
Lubomir Rintel b880770c84 Update to a later snapshot
Enables RFC7217 addressing for new IPv6 connections
2015-11-12 14:33:54 +01:00
Lubomir Rintel 205526f8f8 Update to a later snapshot 2015-10-23 15:49:57 +02:00
Lubomir Rintel 90b40e50ba Sync the SPEC file with upstream 2015-10-23 15:43:43 +02:00
Lubomir Rintel ff71c668f4 Sync the SPEC file with upstream 2015-10-09 14:29:50 +02:00
Lubomir Rintel 7e935f32b3 Import a newer 1.2 git snapshot 2015-10-07 18:04:26 +02:00
Lubomir Rintel a57aed4ba3 Drop a couple of uneeded dependencies 2015-09-07 11:00:30 +02:00
Lubomir Rintel cfb1add408 Fix build 2015-09-04 12:51:02 +02:00
Lubomir Rintel a52dff45c7 Fix tests 2015-09-04 12:20:24 +02:00
Lubomir Rintel 802334e303 Just disable the tests for now 2015-09-03 18:44:51 +02:00
Lubomir Rintel 73f1b972fe Actually add the patch 2015-09-03 18:27:06 +02:00
Lubomir Rintel 1dbee5b66e Fix the tests 2015-09-03 18:22:54 +02:00
Lubomir Rintel 4ce1d89c98 Add missing postun to libnm
Makes rpmlint happy.
2015-09-03 17:51:46 +02:00
Lubomir Rintel f0b1252d42 Wimax is gone for good 2015-09-03 17:51:46 +02:00
Lubomir Rintel 24c657222a Use global instead of define
Makes package guidelines happy.
2015-09-03 17:51:46 +02:00
Lubomir Rintel 21cb2c5c51 Modernize the SPEC file a bit
Remove obsolete sections, use more modern tags.
2015-09-03 17:51:46 +02:00
Lubomir Rintel 2fd3f595f9 Use macros consistently
%__* macros are internal to RPM and not supposed to be used in SPEC files.
Moreover, we're inconsistent at times already (%__mkdir_p vs. mkdir -p).
2015-09-03 17:51:46 +02:00
Lubomir Rintel 2caedee556 Pull in 1.2 snapshot
Sync SPEC with contrib/rpm
2015-09-03 17:51:46 +02:00
Lubomir Rintel 4e5d69edc4 Bump release 2015-08-28 13:37:01 +02:00
Lubomir Rintel b6e54e7865 Fix command line parsing 2015-08-28 13:36:31 +02:00
Lubomir Rintel c4ef9cfc18 Update to 1.0.6 2015-08-27 18:56:02 +02:00
Thomas Haller 5af6ac65a3 fix crash on device deactivate (rh 1253949)
Also:
  - backport new wifi scan options from nm-1-0 upstream branch.
  - update the URI for connectivty checking
2015-08-18 11:59:43 +02:00
Lubomir Rintel 82c263b833 Fix up a bad merge 2015-08-13 17:19:29 +02:00
Lubomir Rintel 5cf28a408a Merge branch 'master' into f22 2015-08-13 17:11:55 +02:00
Lubomir Rintel 0fc556a450 Update to a Git snapshot
...so that we have a fresh build for the test day.
2015-08-13 17:09:50 +02:00
Lubomir Rintel a7a867bbd9 Add a missing patch 2015-07-22 16:09:36 +02:00
Lubomir Rintel b8517196f9 Add a missing patch 2015-07-22 16:09:10 +02:00
Lubomir Rintel 17428f13c9 Fix default route handling on assumed connections (rh #1245648) 2015-07-22 16:07:26 +02:00
Lubomir Rintel 7c6d783d88 Fix an assertion failure in nmcli (rh #1244048) 2015-07-22 16:07:17 +02:00
Lubomir Rintel 5b0295533e Include the correct patch 2015-07-22 16:05:36 +02:00
Lubomir Rintel bf1633d033 Fix default route handling on assumed connections (rh #1245648) 2015-07-22 15:59:50 +02:00
Lubomir Rintel 5088926494 Fix an assertion failure in nmcli (rh #1244048) 2015-07-22 15:56:35 +02:00
Lubomir Rintel 802930598f Update to 1.0.4 release 2015-07-14 19:01:23 +02:00
Lubomir Rintel 0431b736fd Update to 1.0.4 release 2015-07-14 19:00:19 +02:00
Dan Horák fc0d89fb1a - WEXT depends on enabled wifi 2015-07-14 09:18:19 +02:00
Dan Horák bc5d9f2871 - WEXT depends on enabled wifi 2015-07-14 09:17:43 +02:00
Lubomir Rintel 48b6e780a3 A bit more recent Git snapshot 2015-07-13 19:39:02 +02:00
Lubomir Rintel f37fc20755 A bit more recent Git snapshot 2015-07-13 19:37:54 +02:00
Jiří Klimeš 394c4da0c3 spec: update path to trusted CA store to /etc/pki/tls/cert.pem (rh #1236548)
The code change dealing with it will be pushed to dist-git later with 1.0.4 release
(or new snapshot).

(cherry picked from commit 59e92f03e8)
2015-07-08 18:09:10 +02:00
Jiří Klimeš 59e92f03e8 spec: update path to trusted CA store to /etc/pki/tls/cert.pem (rh #1236548)
The code change dealing with it will be pushed to dist-git later with 1.0.4 release
(or new snapshot).
2015-07-08 18:03:57 +02:00
Lubomir Rintel 7a7741e087 Merge branch 'master' into f22 2015-07-07 18:04:45 +02:00
Lubomir Rintel 8beaf4caca A bit more recent Git snapshot
This one fixes a regression with default route management
2015-07-07 17:58:29 +02:00
Jiří Klimeš e33e672fc2 Update to a new 1.0.3 development snapshot (git20150707) 2015-07-07 09:58:19 +02:00
Jiří Klimeš c4c14e098a Update to a new 1.0.3 development snapshot (git20150707) 2015-07-07 09:05:31 +02:00
Lubomir Rintel 7b87670b2e A bit more recent Git snapshot 2015-06-24 18:44:24 +02:00
Lubomir Rintel 5bbc03fec6 Import a more recent 1.0 snapshot
Something reasonably close to this will hopefully make it into upstream 1.0.4
release. Let's see if it works well enough.
2015-06-18 22:53:53 +02:00
Dennis Gilmore 77a7723ef2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-16 22:58:33 +00:00
Lubomir Rintel 8b1516571d Merge branch 'f22' 2015-05-05 14:48:38 +02:00
Lubomir Rintel 46c1d97ea6 Update to 1.0.2 release 2015-05-05 14:35:22 +02:00
Jiří Klimeš 8232e9c632 Update to 1.0.2 development snapshot (git20150429) 2015-04-29 14:44:50 +02:00
Jiří Klimeš 87260524cc platform: use driver name to detect IBM z-System CTC devices (rh #1212118)
https://bugzilla.redhat.com/show_bug.cgi?id=1212118
2015-04-29 13:38:32 +02:00
Dan Williams 2a59fdf6e4 Turn off keepalive for connectivity checking 2015-03-16 10:59:22 -05:00
Dan Williams 7f0cf671db Update to 1.0.2 development snapshot 2015-03-05 11:43:10 -06:00
Dan Williams ee316b279f dns: revert resolv.conf symlink stuff (should only be in F23+, not F22) 2015-03-05 08:54:01 -06:00
Dan Williams dda57934f7 connectivity: fix checking when no valid DNS servers are present (rh #1199098) 2015-03-05 08:07:30 -06:00
Dan Williams 093d623156 core: flush IPv6LL address when deconfiguring managed devices (rh #1193127) (rh #1184997) 2015-03-04 17:51:36 -06:00
Adam Williamson de0318f42b core: resume bridged connections properly (rh #1162636) 2015-01-29 14:37:46 -08:00
Thomas Haller 4fc11861c4 dns: manage resolv.conf as symlink to private file in /run directory (rh #1116999) 2015-01-21 17:52:10 +01:00
Thomas Haller 452c0cf3c6 remove obsolete makerepo.gitignore file 2015-01-21 13:48:10 +01:00
Dan Winship b2e230bb1a sync spec file with RHEL version
build: fix NetworkManager-bluetooth dep on NetworkManager-wwan
build: re-enable hardware plugins on s390
2015-01-09 11:29:05 -05:00
Dan Williams a13136f87b Whitespace fix 2014-12-22 11:17:50 -06:00
Dan Williams f249abd921 Update to 1.0 2014-12-22 10:47:26 -06:00
Jiří Klimeš 8b454ba75e Fix two incorrect assertion bugs causing NetworkManager crashes 2014-11-24 17:32:36 +01:00
Jiří Klimeš 2c85ca4d0d cli: fix crash in `nmcli device wifi` with multiple wifi devices (rh #1159408)
https://bugzilla.redhat.com/show_bug.cgi?id=1159408
2014-11-06 10:55:04 +01:00
Dan Winship ae5363f941 platform: fix a routing-related bug that could cause NM and other apps to spin (rh #1151665) 2014-11-01 23:05:35 +01:00
Lubomir Rintel 9cbebd1da6 Fix a typo 2014-10-29 12:19:04 +01:00
Lubomir Rintel 301c10dd77 Fix IPv6 next hop default setting 2014-10-29 12:15:04 +01:00
Lubomir Rintel b55f63aee8 Avoid unowned /etc/NetworkManager in config-connectivity-fedora 2014-10-24 18:56:13 +02:00
Adam Williamson bf3b3a8a46 connectivity-fedora: don't require NetworkManager (#1156198) 2014-10-24 18:56:13 +02:00
Jiří Klimeš b2c2088992 Do not override configuration files on updates (rh #1153901)
Rather leave modified configuration files untouched and save the new files
with .rpmnew suffix.

http://stackoverflow.com/questions/14511334/rpm-upgrade-handling-of-config-files

https://bugzilla.redhat.com/show_bug.cgi?id=1153901
2014-10-21 15:29:07 +02:00
Lubomir Rintel d22bbaaa17 bluetooth: Restore DUN support (rh #1055628) 2014-10-16 14:27:07 +02:00
Stef Walter 92d4bfc879 Allow non-local users network control after PolicyKit authentication (rh #1145646) 2014-10-16 14:27:07 +02:00
Jiří Klimeš 8890459ab6 connectivity: use HTTPS for connectivity checking (rh #113577)
https://bugzilla.redhat.com/show_bug.cgi?id=1135777
2014-09-06 00:09:24 +02:00
Peter Robinson cbce54a480 adsl plugin needs rp-pppoe to work otherwise you get these errors and the ADSL link doesn't come up
Jan 01 01:21:47 localhost NetworkManager[3128]: <info> Activation (eth1) starting connection 'pppoe-isp'
Jan 01 01:21:48 localhost NetworkManager[3128]: <warn> (eth1): PPPoE failed to start: Could not find pppoe binary.
Jan 01 01:21:48 localhost NetworkManager[3128]: <info> Disabling autoconnect for connection 'pppoe-isp'.
Jan 01 01:21:48 localhost NetworkManager[3128]: <warn> Activation (eth1) failed for connection 'pppoe-isp'
2014-08-30 18:57:43 +01:00
Dan Horák 6637d9e75b - always include ModemManager-glib-devel (#1129632) 2014-08-18 17:09:49 +02:00
Peter Robinson c4d68f6c20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-15 18:49:00 +00:00
Kalev Lember a66b4def38 Rebuilt for ppp 2.4.7 2014-08-11 18:49:52 +02:00
Dan Williams 05a1e014e2 connectivity: ensure interval is set to enable connectivity checking (rh #1123772)
Patch by Elad Alfassa <el.il@doom.co.il>
2014-07-30 08:46:59 -05:00
Kalev Lember 2d43347aad Rebuilt for gobject-introspection 1.41.4 2014-07-22 20:13:59 +02:00
Thomas Haller 3f9b32f187 Update to upstream 0.9.10.0 release snapshot
I took the official upstream build and recompressed it with bzip2.
66a88346bb04d4f402540281181340313b2ec433e75aa9d9ea13f31697f9487e NetworkManager-0.9.10.0.tar.xz
2014-07-04 15:40:40 +02:00
Thomas Haller 672348a955 update spec file to make ppp_version dependent on fedora version
This way we can build rawhide packages against F20.

To build master on F20, you need to specify --dist
  fedpkg --dist f20 local
2014-07-04 14:04:47 +02:00
Dan Williams 11e58160ed add new NetworkManager-config-connectivity-fedora RPM
Adds defaults for using Fedora servers for connectivity checking.
2014-07-04 11:57:50 +02:00
Thomas Haller 5053e90cec update .gitignore file and remove makerepo.sh script
Use instead the newest version of the makerepo.sh script from upstream.
2014-07-04 10:23:19 +02:00
Thomas Haller f285c1502b Update to upstream 0.9.9.98 (0.9.10-rc1) release snapshot
I took the official upstream build and recompressed it with bzip2.
f5f859ad76bd8cf32d866a6c2b9504f9bc89d8a317ca51939a45949a6a312513 NetworkManager-0.9.9.98.tar.xz
2014-06-25 18:40:30 +02:00
Thomas Haller 41a1662e75 update spec file to make it more similar to the upstream contrib spec file
also fix --with-teamdctl
2014-06-25 18:33:36 +02:00
Dan Williams e09ac81902 Update to upstream 0.9.9.95 (0.9.10-beta1) release snapshot 2014-06-09 11:09:28 -05:00
Dennis Gilmore bdaabccf5c - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-06 17:52:38 -05:00
Jiří Klimeš dd37ad8fc1 Own some missing directories (rh #1099789)
https://bugzilla.redhat.com/show_bug.cgi?id=1099789

Based on a hint from jpopelka@redhat.com
2014-05-21 16:05:55 +02:00
Dan Williams 3f6d3ea213 Rebuild against ppp 2.4.6 2014-04-11 11:17:43 -05:00
Dan Winship 74e11b0e43 Update snapshot, rename two plugins
- Update to a git snapshot (git20140319 git:3980806)
- Rename NetworkManager-atm package to NetworkManager-adsl
- Rename NetworkManager-bt package to NetworkManager-bluetooth
2014-03-19 17:19:35 -04:00
Jiří Klimeš 4815a8a9bc Update to a git snapshot (git20140317 git:1e89b4)
Fixes:
- platform: fix NM crash if link has no name (e.g. for failed VPN connection)
- libnm-util/cli: fix bridge priority default value (rh #1073664)
2014-03-17 14:46:19 +01:00
Jiří Klimeš 251fa91d5d Update to a git snapshot (git20140314 git:45a326d) and fix Obsoletes
Fix obsoleting and requiring packages due to splitout of -atm, -bt and -wwan.
It is needed so that new packages are installed on update.
2014-03-14 12:46:04 +01:00
Jiří Klimeš a36fa77d88 Install new plugins as separate packages
NetworkManager-atm  - libnm-device-plugin-atm.so
NetworkManager-bt   - libnm-device-plugin-bt.so
NetworkManager-wwan - libnm-device-plugin-wwan.so, libnm-wwan.so

Upstream commit:
c1a064b merge: move ATM, Bluetooth, and WWAN into device plugins (bgo #724324)
2014-03-10 17:04:54 +01:00
Jiří Klimeš b18c4ca63f Update to a git snapshot (git20140310 git:350b6d6) 2014-03-10 16:10:39 +01:00
Thomas Haller b749848e40 update to snapshot from new development release 0.9.9.1 2014-02-28 14:53:00 +01:00
Thomas Haller 691505aed9 bugfix caching of libnl objects (caused error with new libnl3 version when activating bridges) (rh #1063290)
and cherry-pick diverse other patches from upstream.
2014-02-22 00:00:40 +01:00
Thomas Haller 13de8b49e8 make spec file similar to NetworkManager.spec from automation branch
upstream branch automation contains a template spec file that is supposed
to work for all kind of RHEL and Fedora versions. Make the spec file of
rawhide similar to that one, so that it's easier to compare them.
2014-02-22 00:00:40 +01:00
Thomas Haller fdc10f83b5 cleanup *spec file and add nmtui package
Make the spec file more similar to the one from f20.
2014-02-22 00:00:40 +01:00
Thomas Haller 8166579897 update makerepo.sh script 2014-02-22 00:00:40 +01:00
Thomas Haller 9ab3949bca Fix crash in libnm-glib getting secrets 2014-02-02 11:37:02 +01:00
Thomas Haller 8db2aec80d rename patch file (to order them) 2014-02-02 11:26:55 +01:00
Thomas Haller e5c57c6bae add makerepo.sh script 2014-02-02 11:17:11 +01:00
Jiří Klimeš 4ec14888d4 Update to a git snapshot (git20140131) 2014-01-31 11:34:12 +01:00
Jiří Klimeš 1ceac5a09d Update to a git snapshot (git20140117) 2014-01-17 09:28:43 +01:00
Jiří Klimeš 143c9f6955 Remove old patches 2014-01-15 10:26:47 +01:00
Jiří Klimeš 85e37a3d52 Update to a git snapshot (git20140114) 2014-01-14 18:24:46 +01:00
89 changed files with 2105 additions and 27125 deletions

135
.gitignore vendored
View File

@ -297,4 +297,137 @@ network-manager-applet-0.8.1.tar.bz2
/NetworkManager-0.9.9.0.git20130913.tar.bz2
/NetworkManager-0.9.9.0.git20131001.tar.bz2
/NetworkManager-0.9.9.0.git20131003.tar.bz2
/NetworkManager-0.9.9.0.git20140131.tar.bz2
/NetworkManager-0.9.9.0.git20140114.4dd6ab8.tar.bz2
/NetworkManager-0.9.9.0.git20140117.94c2993.tar.bz2
/NetworkManager-0.9.9.0.git20140131.5d6a5f8.tar.bz2
/NetworkManager-0.9.9.1.git20140228.16bbc90.tar.bz2
/NetworkManager-0.9.9.1.git20140310.350b6d6.tar.bz2
/NetworkManager-0.9.9.1.git20140314.45a326d.tar.bz2
/NetworkManager-0.9.9.1.git20140317.a1e89b4.tar.bz2
/NetworkManager-0.9.9.1.git20140319.3980806.tar.bz2
/NetworkManager-0.9.9.95.git20140609.1963adda.tar.bz2
/NetworkManager-0.9.9.98.git20140620.63b0a2f5.tar.bz2
/NetworkManager-0.9.10.0.git20140704.6eb82acd.tar.bz2
/NetworkManager-1.0.0.tar.xz
/NetworkManager-1.0.1.git20150305.2a72527c.tar.bz2
/NetworkManager-1.0.1.git20150429.a658561.tar.bz2
/NetworkManager-1.0.2.tar.xz
/NetworkManager-1.0.3.tar.bz2
/NetworkManager-1.0.3.git20160624.f245b49a.tar.bz2
/NetworkManager-1.0.3.git20150707.cf15f2a.tar.bz2
/NetworkManager-1.0.3.git20150707.e3bd4e1.tar.bz2
/NetworkManager-1.0.4.git20150713.38bf2cb0.tar.bz2
/NetworkManager-1.0.4.tar.xz
/NetworkManager-1.0.6.tar.xz
/NetworkManager-1.2.0.tar.xz
/NetworkManager-1.1.90.tar.xz
/NetworkManager-1.1.91.tar.xz
/NetworkManager-1.1.92.tar.xz
/NetworkManager-1.1.93.tar.xz
/NetworkManager-1.1.94.tar.xz
/NetworkManager-1.2.2.tar.xz
/NetworkManager-1.3.0.git20160621.072358da.tar.xz
/NetworkManager-1.4.0.tar.xz
/NetworkManager-1.4.2.tar.xz
/NetworkManager-1.5.2.tar.xz
/NetworkManager-1.5.3.tar.xz
/NetworkManager-1.5.90.tar.xz
/NetworkManager-1.6.0.tar.xz
/NetworkManager-1.6.2.tar.xz
/NetworkManager-1.7.2.tar.xz
/NetworkManager-1.7.91.tar.xz
/NetworkManager-1.7.92.tar.xz
/NetworkManager-1.8.0.tar.xz
/NetworkManager-1.8.2.tar.xz
/NetworkManager-1.8.4.tar.xz
/NetworkManager-1.10.2.tar.xz
/NetworkManager-1.10.4.tar.xz
/NetworkManager-1.10.6.tar.xz
/NetworkManager-1.10.8.tar.xz
/NetworkManager-1.11.4.tar.xz
/NetworkManager-1.11.90.tar.xz
/NetworkManager-1.12.0.tar.xz
/NetworkManager-1.12.2.tar.xz
/NetworkManager-1.14.0.tar.xz
/NetworkManager-1.14.2.tar.xz
/NetworkManager-1.14.4.tar.xz
/NetworkManager-1.15.90.tar.xz
/NetworkManager-1.15.91.tar.xz
/NetworkManager-1.16.0.tar.xz
/NetworkManager-1.18.0.tar.xz
/NetworkManager-1.19.2.tar.xz
/NetworkManager-1.19.3.tar.xz
/NetworkManager-1.19.5.tar.xz
/NetworkManager-1.19.90.tar.xz
/NetworkManager-1.20.0.tar.xz
/NetworkManager-1.20.2.tar.xz
/NetworkManager-1.20.4.tar.xz
/NetworkManager-1.21.3.tar.xz
/NetworkManager-1.21.90.tar.xz
/NetworkManager-1.22.0.tar.xz
/NetworkManager-1.22.2.tar.xz
/NetworkManager-1.22.4.tar.xz
/NetworkManager-1.22.6.tar.xz
/NetworkManager-1.22.8.tar.xz
/NetworkManager-1.22.10.tar.xz
/NetworkManager-1.23.90.tar.xz
/NetworkManager-1.23.91.tar.xz
/NetworkManager-1.24.0.tar.xz
/NetworkManager-1.24.2.tar.xz
/NetworkManager-1.25.90.tar.xz
/NetworkManager-1.26.0.tar.xz
/NetworkManager-1.26.2.tar.xz
/NetworkManager-1.27.90.tar.xz
/NetworkManager-1.27.91.tar.xz
/NetworkManager-1.28.0.tar.xz
/NetworkManager-1.29.8.tar.xz
/NetworkManager-1.29.9.tar.xz
/NetworkManager-1.29.11.tar.xz
/NetworkManager-1.29.90.tar.xz
/NetworkManager-1.30.0.tar.xz
/NetworkManager-1.30.2.tar.xz
/NetworkManager-1.31.2.tar.xz
/NetworkManager-1.31.3.tar.xz
/NetworkManager-1.31.4.tar.xz
/NetworkManager-1.31.90.tar.xz
/NetworkManager-1.32.0.tar.xz
/NetworkManager-1.32.4.tar.xz
/NetworkManager-1.32.6.tar.xz
/NetworkManager-1.32.8.tar.xz
/NetworkManager-1.32.10.tar.xz
/NetworkManager-1.32.12.tar.xz
/NetworkManager-1.35.1.tar.xz
/NetworkManager-1.35.2.tar.xz
/NetworkManager-1.35.3.tar.xz
/NetworkManager-1.35.4.tar.xz
/NetworkManager-1.35.6.tar.xz
/NetworkManager-1.35.7.tar.xz
/NetworkManager-1.35.90.tar.xz
/NetworkManager-1.35.91.tar.xz
/NetworkManager-1.35.92.tar.xz
/NetworkManager-1.36.0.tar.xz
/NetworkManager-1.36.2.tar.xz
/NetworkManager-1.36.4.tar.xz
/NetworkManager-1.37.3.tar.xz
/NetworkManager-1.37.90.tar.xz
/NetworkManager-1.37.91.tar.xz
/NetworkManager-1.37.92.tar.xz
/NetworkManager-1.38.0.tar.xz
/NetworkManager-1.39.8.tar.xz
/NetworkManager-1.39.10.tar.xz
/NetworkManager-1.39.11.tar.xz
/NetworkManager-1.39.90.tar.xz
/NetworkManager-1.40.0.tar.xz
/NetworkManager-1.41.3.tar.xz
/NetworkManager-1.41.4.tar.xz
/NetworkManager-1.41.5.tar.xz
/NetworkManager-1.41.6.tar.xz
/NetworkManager-1.41.7.tar.xz
/NetworkManager-1.41.8.tar.xz
/NetworkManager-1.41.90.tar.xz
/NetworkManager-1.41.91.tar.xz
/NetworkManager-1.42.0.tar.xz
/NetworkManager-1.43.3.tar.xz
/NetworkManager-1.43.4.tar.xz
/NetworkManager-1.43.5.tar.xz
/NetworkManager-1.43.6.tar.xz

View File

@ -1,14 +1,8 @@
# This configuration file, when placed into into
# /etc/NetworkManager/conf.d changes NetworkManager's behavior to
# This configuration file changes NetworkManager's behavior to
# what's expected on "traditional UNIX server" type deployments.
#
# See "man NetworkManager.conf" for more information about these
# and other keys.
#
# Do not edit this file; it will be overwritten on upgrades. If you
# want to override the values here, or set additional values, you can
# do so by adding another file (eg, "99-local.conf") to this directory
# and setting keys there.
[main]
# Do not do automatic (DHCP/SLAAC) configuration on ethernet devices

View File

@ -1,27 +0,0 @@
diff -up NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c
--- NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 2010-10-18 18:44:05.000000000 -0500
+++ NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c 2010-11-03 13:51:56.614584001 -0500
@@ -358,7 +358,7 @@ write_resolv_conf (FILE *f, const char *
str = g_string_new ("");
- if (nameservers) {
+ if (nameservers && g_strv_length (nameservers)) {
int num = g_strv_length (nameservers);
for (i = 0; i < num; i++) {
@@ -374,6 +374,14 @@ write_resolv_conf (FILE *f, const char *
g_string_append (str, nameservers[i]);
g_string_append_c (str, '\n');
}
+ } else {
+ g_string_append_printf (str, "\n\n%s%s%s%s%s%s",
+ "# No nameservers found; try putting DNS servers into your\n",
+ "# ifcfg files in /etc/sysconfig/network-scripts like so:\n",
+ "#\n",
+ "# DNS1=xxx.xxx.xxx.xxx\n",
+ "# DNS2=xxx.xxx.xxx.xxx\n",
+ "# DOMAIN=lab.foo.com bar.foo.com\n");
}
nameservers_str = g_string_free (str, FALSE);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,285 +0,0 @@
From eec3d95eb286a6cb57430714d0f16a1a414251f4 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 21 Jan 2014 11:23:16 +0100
Subject: [PATCH 1/3] platform: add parameter to nm_platform_sysctl_get() to
suppress logging error
In some cases, an error when reading the sysctl value can be expected.
In this case, we want to suppress the error message
(cherry picked from commit 634e4c99c3907f1b9fc0dbff4a6d4065182e9b09)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-fake-platform.c | 6 +++---
src/platform/nm-linux-platform.c | 15 ++++++++-------
src/platform/nm-platform.c | 8 +++++---
src/platform/nm-platform.h | 4 ++--
src/platform/tests/platform.c | 2 +-
5 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 803015c..dbad71e 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -72,7 +72,7 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
}
static char *
-sysctl_get (NMPlatform *platform, const char *path)
+sysctl_get (NMPlatform *platform, const char *path, gboolean silent_on_error)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
@@ -566,7 +566,7 @@ master_get_option (NMPlatform *platform, int master, const char *option)
{
auto_g_free char *path = g_strdup_printf ("master:%d:%s", master, option);
- return sysctl_get (platform, path);
+ return sysctl_get (platform, path, FALSE);
}
static gboolean
@@ -582,7 +582,7 @@ slave_get_option (NMPlatform *platform, int slave, const char *option)
{
auto_g_free char *path = g_strdup_printf ("slave:%d:%s", slave, option);
- return sysctl_get (platform, path);
+ return sysctl_get (platform, path, FALSE);
}
static gboolean
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index df1b33a..f935af4 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1454,13 +1454,14 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
}
static char *
-sysctl_get (NMPlatform *platform, const char *path)
+sysctl_get (NMPlatform *platform, const char *path, gboolean silent_on_error)
{
GError *error = NULL;
char *contents;
if (!g_file_get_contents (path, &contents, NULL, &error)) {
- error ("error reading %s: %s", path, error->message);
+ if (!silent_on_error)
+ error ("error reading %s: %s", path, error->message);
g_clear_error (&error);
return NULL;
}
@@ -1869,7 +1870,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
if (g_file_test (path, G_FILE_TEST_EXISTS))
- id = sysctl_get (platform, path);
+ id = sysctl_get (platform, path, FALSE);
else
id = NULL;
g_free (path);
@@ -1990,7 +1991,7 @@ link_get_option (int master, const char *category, const char *option)
{
auto_g_free char *path = link_option_path (master, category, option);
- return path ? nm_platform_sysctl_get (path) : NULL;
+ return path ? nm_platform_sysctl_get (path, FALSE) : NULL;
}
static const char *
@@ -2116,7 +2117,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
return FALSE;
path = g_strdup_printf ("/sys/class/net/%s/owner", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
@@ -2124,7 +2125,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
g_free (val);
path = g_strdup_printf ("/sys/class/net/%s/group", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
@@ -2132,7 +2133,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
g_free (val);
path = g_strdup_printf ("/sys/class/net/%s/tun_flags", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 87a7ef9..0b56464 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -267,18 +267,20 @@ nm_platform_sysctl_set (const char *path, const char *value)
/**
* nm_platform_sysctl_get:
* @path: Absolute path to sysctl
+ * @silent_on_error: don't log an error message when the value
+ * could not be read.
*
* Returns: (transfer full): Contents of the virtual sysctl file.
*/
char *
-nm_platform_sysctl_get (const char *path)
+nm_platform_sysctl_get (const char *path, gboolean silent_on_error)
{
reset_error ();
g_return_val_if_fail (path, NULL);
g_return_val_if_fail (klass->sysctl_get, NULL);
- return klass->sysctl_get (platform, path);
+ return klass->sysctl_get (platform, path, silent_on_error);
}
/**
@@ -300,7 +302,7 @@ nm_platform_sysctl_get_int32 (const char *path, gint32 fallback)
g_return_val_if_fail (path, fallback);
if (path)
- value = nm_platform_sysctl_get (path);
+ value = nm_platform_sysctl_get (path, FALSE);
if (!value) {
errno = EINVAL;
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index d5b3672..9375148 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -231,7 +231,7 @@ typedef struct {
gboolean (*setup) (NMPlatform *);
gboolean (*sysctl_set) (NMPlatform *, const char *path, const char *value);
- char * (*sysctl_get) (NMPlatform *, const char *path);
+ char * (*sysctl_get) (NMPlatform *, const char *path, gboolean silent_on_error);
GArray *(*link_get_all) (NMPlatform *);
gboolean (*link_add) (NMPlatform *, const char *name, NMLinkType type);
@@ -350,7 +350,7 @@ const char *nm_platform_get_error_msg (void);
void nm_platform_query_devices (void);
gboolean nm_platform_sysctl_set (const char *path, const char *value);
-char *nm_platform_sysctl_get (const char *path);
+char *nm_platform_sysctl_get (const char *path, gboolean silent_on_error);
gint32 nm_platform_sysctl_get_int32 (const char *path, gint32 fallback);
GArray *nm_platform_link_get_all (void);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index 7ca2cb5..3c636f5 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -47,7 +47,7 @@ do_sysctl_set (char **argv)
static gboolean
do_sysctl_get (char **argv)
{
- auto_g_free char *value = nm_platform_sysctl_get (argv[0]);
+ auto_g_free char *value = nm_platform_sysctl_get (argv[0], FALSE);
printf ("%s\n", value);
--
1.8.5.3
From 4901ef3d1259c7038c1011ced874773cfe4dfbaf Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 30 Jan 2014 16:33:55 +0100
Subject: [PATCH 2/3] core/platform: silence error about reading sysctl file
phys_port_id
It is common that the file exists, but cannot be read
(Operation not supported). So, silence any error when
reading the phys_port_id file.
(cherry picked from commit 2fd8d40a5a009aaf33365a9a985d1c72fb20324d)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-linux-platform.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index f935af4..55646d4 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1869,10 +1869,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
return NULL;
path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
- id = sysctl_get (platform, path, FALSE);
- else
- id = NULL;
+ id = sysctl_get (platform, path, TRUE);
g_free (path);
return id;
--
1.8.5.3
From 4f128334dad91cff426bc3ca44e5500ce3950277 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 13 Feb 2014 12:32:58 +0100
Subject: [PATCH 3/3] core: suppress error message ZONE_ALREADY_SET when adding
firewalld zone
See also https://bugzilla.redhat.com/show_bug.cgi?id=886432, where
firewalld was changed, not to return ZONE_ALREADY_SET for 'changeZone'.
However, 'addInterface' can still fail with this error.
Suppress the following error lines:
<debug> [1392290031.179280] [firewall-manager/nm-firewall-manager.c:117] nm_firewall_manager_add_or_change_zone(): (em1) firewall zone add -> (null)
...
<warn> (em1) firewall zone add/change failed: (32) ZONE_ALREADY_SET
(cherry picked from commit 71cce80f1f54da76766af4105211608bd50ab44d)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/firewall-manager/nm-firewall-manager.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/firewall-manager/nm-firewall-manager.c b/src/firewall-manager/nm-firewall-manager.c
index d73069f..ffe0649 100644
--- a/src/firewall-manager/nm-firewall-manager.c
+++ b/src/firewall-manager/nm-firewall-manager.c
@@ -82,8 +82,13 @@ add_or_change_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data
G_TYPE_STRING, &zone,
G_TYPE_INVALID)) {
g_assert (error);
- nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
- info->iface, error->code, error->message);
+ if (g_strcmp0 (error->message, "ZONE_ALREADY_SET") != 0) {
+ nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
+ info->iface, error->code, error->message);
+ } else {
+ nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
+ info->iface, error->code, error->message);
+ }
}
info->callback (error, info->user_data);
@@ -114,7 +119,8 @@ nm_firewall_manager_add_or_change_zone (NMFirewallManager *self,
info->callback = callback;
info->user_data = user_data;
- nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone %s -> %s", iface, add ? "add" : "change", zone);
+ nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone %s -> %s%s%s", iface, add ? "add" : "change",
+ zone?"\"":"", zone ? zone : "default", zone?"\"":"");
return dbus_g_proxy_begin_call_with_timeout (priv->proxy,
add ? "addInterface" : "changeZone",
add_or_change_cb,
--
1.8.5.3

View File

@ -1,60 +0,0 @@
From 739faab9f5d8c2b5542da733df6fece45f8873d6 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 16 Jan 2014 20:20:35 +0100
Subject: [PATCH 1/1] core/platform: fix wrong calculation of address
lifetime/preferred for kernel addresses
When receiving an IPv4/IPv6 address from the kernel, platform set the
timestamp to an invalid value before. The address timestamp must be set
to *now*, because the lifetime and preferred arguments are counting from
now.
(cherry picked from commit 177c767320578c490ff94e723115d830d1753ae1)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-linux-platform.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 55646d4..b5e3618 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -834,6 +834,16 @@ hack_empty_master_iff_lower_up (NMPlatform *platform, struct nl_object *object)
rtnl_link_unset_flags (rtnllink, IFF_LOWER_UP);
}
+static guint32
+get_time (void)
+{
+ struct timespec tp;
+
+ clock_gettime (CLOCK_MONOTONIC, &tp);
+
+ return tp.tv_sec;
+}
+
static void
init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
{
@@ -846,7 +856,7 @@ init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
- address->timestamp = rtnl_addr_get_create_time (rtnladdr);
+ address->timestamp = get_time ();
address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr);
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
g_assert (nl_addr_get_len (nladdr) == sizeof (address->address));
@@ -867,7 +877,7 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
- address->timestamp = rtnl_addr_get_create_time (rtnladdr);
+ address->timestamp = get_time ();
address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr);
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
address->flags = rtnl_addr_get_flags (rtnladdr);
--
1.8.5.3

View File

@ -1,384 +0,0 @@
From 21a9b646ed49d1269c65a7ffca946c9340972bab Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 21 Oct 2013 14:36:59 +0200
Subject: [PATCH 1/3] core: omit "dev -" for *_to_string of NMPlatformIP*
addresses and routes
The NMPlatformIP[46]Address and NMPlatformIP[46]Route structs have a
field 'dev'. Before this field was always printed in the *_to_string
functions and a missing device was signaled as ' dev -'.
This had the advantage, that the output contained the same fields
regardless whether there was a device set or not.
Change it, not to print the device if it is not set. This has the
advantage, that it looks better in the logfiles.
(cherry picked from commit 69d154012d5f144c97d07f965bad35e1d9306900)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0b56464..da6c72d 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1714,15 +1714,20 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET, &address->address, s_address, sizeof (s_address));
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
- (guint)address->timestamp, s_dev ? s_dev : "-");
+ (guint)address->timestamp,
+ str_dev ? str_dev : "");
+ g_free (str_dev);
return buffer;
}
@@ -1746,11 +1751,14 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
char s_address[INET6_ADDRSTRLEN];
const char *s_dev;
char *str_flags;
+ char *str_dev;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET6, &address->address, s_address, sizeof (s_address));
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
rtnl_addr_flags2str(address->flags, s_flags, sizeof (s_flags));
@@ -1770,11 +1778,13 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_flags = s_flags[0] ? g_strconcat (" flags ", s_flags, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
- (guint)address->timestamp, s_dev ? s_dev : "-",
+ (guint)address->timestamp,
+ str_dev ? str_dev : "",
str_flags ? str_flags : "");
g_free (str_flags);
+ g_free (str_dev);
return buffer;
}
@@ -1796,16 +1806,21 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route)
static char buffer[256];
char s_network[INET_ADDRSTRLEN], s_gateway[INET_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET, &route->gateway, s_gateway, sizeof(s_gateway));
+
s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d via %s dev %s metric %u mss %u",
- s_network, route->plen, s_gateway, s_dev ? s_dev : "-",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
+ s_network, route->plen, s_gateway,
+ str_dev ? str_dev : "",
route->metric, route->mss);
+ g_free (str_dev);
return buffer;
}
@@ -1827,16 +1842,21 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route)
static char buffer[256];
char s_network[INET6_ADDRSTRLEN], s_gateway[INET6_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET6, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET6, &route->gateway, s_gateway, sizeof(s_gateway));
+
s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d via %s dev %s metric %u mss %u",
- s_network, route->plen, s_gateway, s_dev ? s_dev : "-",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
+ s_network, route->plen, s_gateway,
+ str_dev ? str_dev : "",
route->metric, route->mss);
+ g_free (str_dev);
return buffer;
}
--
1.8.5.3
From 442d7195c74e415f15fa0264eca6e7bcf7f278e6 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 2 Dec 2013 21:12:05 +0100
Subject: [PATCH 2/3] core: print peer_address in NMPlatform address_to_string
(cherry picked from commit 1b0f832c7f7c02d29b9421005c78d52ad6a47905)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index da6c72d..677c23a 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1713,21 +1713,30 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
{
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
+ char s_peer[INET_ADDRSTRLEN];
const char *s_dev;
char *str_dev;
+ char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET, &address->address, s_address, sizeof (s_address));
+ if (address->peer_address) {
+ inet_ntop (AF_INET, &address->peer_address, s_peer, sizeof (s_peer));
+ str_peer = g_strconcat (" ptp ", s_peer, NULL);
+ }
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
+ str_peer ? str_peer : "",
str_dev ? str_dev : "");
g_free (str_dev);
+ g_free (str_peer);
return buffer;
}
@@ -1749,14 +1758,21 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
static char buffer[256];
char s_flags[256];
char s_address[INET6_ADDRSTRLEN];
+ char s_peer[INET6_ADDRSTRLEN];
const char *s_dev;
char *str_flags;
char *str_dev;
+ char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET6, &address->address, s_address, sizeof (s_address));
+ if (!IN6_IS_ADDR_UNSPECIFIED (&address->peer_address)) {
+ inet_ntop (AF_INET6, &address->peer_address, s_peer, sizeof (s_peer));
+ str_peer = g_strconcat (" ptp ", s_peer, NULL);
+ }
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
@@ -1778,13 +1794,15 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_flags = s_flags[0] ? g_strconcat (" flags ", s_flags, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
+ str_peer ? str_peer : "",
str_dev ? str_dev : "",
str_flags ? str_flags : "");
g_free (str_flags);
g_free (str_dev);
+ g_free (str_peer);
return buffer;
}
--
1.8.5.3
From aaa86cd61058c8a97c8149b2ebd6eca449aae5b7 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 18 Feb 2014 12:52:16 +0100
Subject: [PATCH 3/3] platform: refactor address_to_string() to return device
as numeric if ifname is unknown
(cherry picked from commit a6767f215e0b7ab55949e4410d399f315a225578)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 57 +++++++++++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 677c23a..37d4318 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1696,6 +1696,27 @@ nm_platform_route_flush (int ifindex)
/******************************************************************/
+#define TO_STRING_DEV_BUF_SIZE (5+15+1)
+static void
+_to_string_dev (int ifindex, char *buf, size_t size)
+{
+ g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
+
+ if (ifindex){
+ const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
+
+ strcpy (buf, " dev ");
+ buf += 5;
+ size -= 5;
+
+ if (name)
+ g_strlcpy (buf, name, size);
+ else
+ g_snprintf (buf, size, "%d", ifindex);
+ } else
+ buf[0] = 0;
+}
+
/**
* nm_platform_ip4_address_to_string:
* @route: pointer to NMPlatformIP4Address address structure
@@ -1714,8 +1735,7 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
char s_peer[INET_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
@@ -1727,15 +1747,13 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
str_peer = g_strconcat (" ptp ", s_peer, NULL);
}
- s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (address->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
str_peer ? str_peer : "",
- str_dev ? str_dev : "");
- g_free (str_dev);
+ str_dev);
g_free (str_peer);
return buffer;
}
@@ -1759,9 +1777,8 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
char s_flags[256];
char s_address[INET6_ADDRSTRLEN];
char s_peer[INET6_ADDRSTRLEN];
- const char *s_dev;
char *str_flags;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
@@ -1773,8 +1790,7 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_peer = g_strconcat (" ptp ", s_peer, NULL);
}
- s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (address->ifindex, str_dev, sizeof (str_dev));
rtnl_addr_flags2str(address->flags, s_flags, sizeof (s_flags));
@@ -1798,10 +1814,9 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
str_peer ? str_peer : "",
- str_dev ? str_dev : "",
+ str_dev,
str_flags ? str_flags : "");
g_free (str_flags);
- g_free (str_dev);
g_free (str_peer);
return buffer;
}
@@ -1823,22 +1838,19 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route)
{
static char buffer[256];
char s_network[INET_ADDRSTRLEN], s_gateway[INET_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET, &route->gateway, s_gateway, sizeof(s_gateway));
- s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (route->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
s_network, route->plen, s_gateway,
- str_dev ? str_dev : "",
+ str_dev,
route->metric, route->mss);
- g_free (str_dev);
return buffer;
}
@@ -1859,22 +1871,19 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route)
{
static char buffer[256];
char s_network[INET6_ADDRSTRLEN], s_gateway[INET6_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET6, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET6, &route->gateway, s_gateway, sizeof(s_gateway));
- s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (route->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
s_network, route->plen, s_gateway,
- str_dev ? str_dev : "",
+ str_dev,
route->metric, route->mss);
- g_free (str_dev);
return buffer;
}
--
1.8.5.3

File diff suppressed because it is too large Load Diff

View File

@ -1,708 +0,0 @@
From ee9be9cef769cdfb3a14ec65741f1c36d0b1ac32 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:32:46 +0100
Subject: [PATCH 01/10] core: fix adding gateway routes within the own subnet
Before, when adding a gateway route to a destination within the
current subnets, it would be skipped because of the wrong assumption
that we already have a prefix route to that destination.
This assumption is wrong, because we want to reach the more specific
subnet via a gateway and not directly on the link.
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 4f7b1cabc063bfda96cb5c129d6a233e5d5cff68)
---
src/nm-ip4-config.c | 3 ++-
src/nm-ip6-config.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index bb85926..b7ae161 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -169,7 +169,8 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
- if (nm_ip4_config_destination_is_direct (config, route.network, route.plen))
+ if ( route.gateway == 0
+ && nm_ip4_config_destination_is_direct (config, route.network, route.plen))
continue;
/* Don't add the default route when and the connection
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 3a56f4f..2a6c8a3 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -168,7 +168,8 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
- if (nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
+ if ( IN6_IS_ADDR_UNSPECIFIED (&route.gateway)
+ && nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
continue;
/* Don't add the default route when and the connection
--
1.8.5.3
From 9efbadda08792db99d708a89586be31445d61f83 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:30:01 +0100
Subject: [PATCH 02/10] tivial/core: move common #defines to header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 8cd0de231a27d26e719f1b747f95ae53f5fec59e)
---
src/devices/nm-device.c | 8 --------
src/platform/nm-platform.c | 8 --------
src/platform/nm-platform.h | 8 ++++++++
3 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 7757153..6f3213a 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -69,14 +69,6 @@
#include "nm-config.h"
#include "nm-platform.h"
-/* workaround for older libnl version, that does not define these flags. */
-#ifndef IFA_F_MANAGETEMPADDR
-#define IFA_F_MANAGETEMPADDR 0x100
-#endif
-#ifndef IFA_F_NOPREFIXROUTE
-#define IFA_F_NOPREFIXROUTE 0x200
-#endif
-
static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
#include "nm-device-glue.h"
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 37d4318..97540fc 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -33,14 +33,6 @@
#include "nm-logging.h"
#include "nm-enum-types.h"
-/* workaround for older libnl version, that does not define these flags. */
-#ifndef IFA_F_MANAGETEMPADDR
-#define IFA_F_MANAGETEMPADDR 0x100
-#endif
-#ifndef IFA_F_NOPREFIXROUTE
-#define IFA_F_NOPREFIXROUTE 0x200
-#endif
-
#define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__)
#define NM_PLATFORM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PLATFORM, NMPlatformPrivate))
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 9375148..2725dd9 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -35,6 +35,14 @@
/******************************************************************/
+/* workaround for older libnl version, that does not define these flags. */
+#ifndef IFA_F_MANAGETEMPADDR
+#define IFA_F_MANAGETEMPADDR 0x100
+#endif
+#ifndef IFA_F_NOPREFIXROUTE
+#define IFA_F_NOPREFIXROUTE 0x200
+#endif
+
typedef enum {
/* no error specified, sometimes this means the arguments were wrong */
NM_PLATFORM_ERROR_NONE,
--
1.8.5.3
From b35e2118ac4c4380e3b7536b98f64bec195898ff Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:34:12 +0100
Subject: [PATCH 03/10] core: fix adding gateway route for IPv6
Setting the address flag IFA_F_NOPREFIXROUTE broke adding the device route to
the IPv6 prefix because the check for nm_ip6_config_destination_is_direct()
caused the route to be skipped. This, together with the kernel no
longer adding the prefix route resulted in no device route for autoconf
/64 prefixes.
https://bugzilla.redhat.com/show_bug.cgi?id=1068632
https://bugzilla.redhat.com/show_bug.cgi?id=1072410
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit d6f6ccef432fb45a30b0b642975acd36d08410fb)
---
src/devices/nm-device.c | 9 +++++----
src/nm-ip6-config.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 6f3213a..c7f72b8 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3282,13 +3282,14 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
nm_platform_check_support_kernel_extended_ifa_flags ();
}
- /* without system_support, these flags will be ignored.
- * Still, we set them (why not?).
- **/
- ifa_flags = IFA_F_NOPREFIXROUTE;
+ if (system_support)
+ ifa_flags = IFA_F_NOPREFIXROUTE;
if (priv->rdisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR
|| priv->rdisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR)
+ {
+ /* without system_support, this flag will be ignored. Still set it, doesn't seem to do any harm. */
ifa_flags |= IFA_F_MANAGETEMPADDR;
+ }
g_return_if_fail (priv->act_request);
connection = nm_device_get_connection (device);
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 2a6c8a3..58ad2e0 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -398,7 +398,8 @@ nm_ip6_config_destination_is_direct (const NMIP6Config *config, const struct in6
for (i = 0; i < num; i++) {
const NMPlatformIP6Address *item = nm_ip6_config_get_address (config, i);
- if (item->plen <= plen && same_prefix (&item->address, network, item->plen))
+ if (item->plen <= plen && same_prefix (&item->address, network, item->plen) &&
+ !(item->flags & IFA_F_NOPREFIXROUTE))
return TRUE;
}
--
1.8.5.3
From cf576344d6f2e7616daf50b5e3dcd1dd1bbbf663 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 6 Mar 2014 11:58:50 -0500
Subject: [PATCH 04/10] rdisc: set the expiration timer correctly (rh #1073560)
check_timestamps() was mixing up absolute and relative timestamps,
which meant that IPv6 expiration checks more-or-less stopped happening
after a while, allowing expired IPv6 routes, etc, to remain applied.
(cherry picked from commit 5ec9b9e97c1e1647c7bb45c79518f1c49cb23cd6)
---
src/rdisc/nm-lndp-rdisc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index 7d61b59..048cae9 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -380,8 +380,10 @@ check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed)
g_signal_emit_by_name (rdisc, NM_RDISC_CONFIG_CHANGED, changed);
if (nextevent != never) {
- debug ("(%s): scheduling next now/lifetime check: %u seconds", rdisc->ifname, nextevent);
- priv->timeout_id = g_timeout_add_seconds (nextevent, timeout_cb, rdisc);
+ g_return_if_fail (nextevent > now);
+ debug ("(%s): scheduling next now/lifetime check: %u seconds",
+ rdisc->ifname, nextevent - now);
+ priv->timeout_id = g_timeout_add_seconds (nextevent - now, timeout_cb, rdisc);
}
}
--
1.8.5.3
From 97aefecea0465f0a56733d42cf19393e42c4fa03 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Tue, 4 Mar 2014 18:18:13 -0500
Subject: [PATCH 05/10] libnm-glib: fix a double free in NMDeviceVlan
(cherry picked from commit 6300ea57ab4ee57a1afa4c76cb1d9503d78385a7)
---
libnm-glib/nm-device-vlan.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libnm-glib/nm-device-vlan.c b/libnm-glib/nm-device-vlan.c
index bd4cb78..3e20240 100644
--- a/libnm-glib/nm-device-vlan.c
+++ b/libnm-glib/nm-device-vlan.c
@@ -198,7 +198,6 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
if (!g_strcmp0 (mac_address_str, NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address)) {
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_MAC_MISMATCH,
"The hardware address of the device and the connection didn't match.");
- g_free (mac_address_str);
}
g_free (mac_address_str);
}
--
1.8.5.3
From e2ba3d96521c032dc88f6e9a8ae77d2c381f3cbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 15:27:20 +0100
Subject: [PATCH 06/10] ifcfg-rh: add missing functionality for reading/writing
subject matches
subject-match - IEEE_8021X_SUBJECT_MATCH
altsubject-matches - IEEE_8021X_ALTSUBJECT_MATCHES
phase2-subject-match - IEEE_8021X_PHASE2_SUBJECT_MATCH
phase2-altsubject-matches - IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES
And a testcase of course.
(cherry picked from commit cb680c5b54fdb5453d04e3dcdb3d33f445f00a95)
---
src/settings/plugins/ifcfg-rh/reader.c | 46 ++++++++++++++
.../ifcfg-rh/tests/network-scripts/Makefile.am | 1 +
.../ifcfg-test-wired-802-1X-subj-matches | 17 +++++
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 74 ++++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 38 ++++++++++-
5 files changed, 175 insertions(+), 1 deletion(-)
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 4586b5c..e512402 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -2720,6 +2720,39 @@ static EAPReader eap_readers[] = {
{ NULL, NULL }
};
+static void
+read_8021x_list_value (shvarFile *ifcfg,
+ const char *ifcfg_var_name,
+ NMSetting8021x *setting,
+ const char *prop_name)
+{
+ char *value;
+ char **strv, **iter;
+ GSList *gslist = NULL;
+
+ g_return_if_fail (ifcfg != NULL);
+ g_return_if_fail (ifcfg_var_name != NULL);
+ g_return_if_fail (prop_name != NULL);
+
+ value = svGetValue (ifcfg, ifcfg_var_name, FALSE);
+ if (!value)
+ return;
+
+ strv = g_strsplit_set (value, " \t", 0);
+ for (iter = strv; iter && *iter; iter++) {
+ if (*iter[0] == '\0')
+ continue;
+ gslist = g_slist_prepend (gslist, *iter);
+ }
+ if (gslist) {
+ gslist = g_slist_reverse (gslist);
+ g_object_set (setting, prop_name, gslist, NULL);
+ g_slist_free (gslist);
+ }
+ g_strfreev (strv);
+ g_free (value);
+}
+
static NMSetting8021x *
fill_8021x (shvarFile *ifcfg,
const char *file,
@@ -2796,6 +2829,19 @@ fill_8021x (shvarFile *ifcfg,
goto error;
}
+ value = svGetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH", FALSE);
+ g_object_set (s_8021x, NM_SETTING_802_1X_SUBJECT_MATCH, value, NULL);
+ g_free (value);
+
+ value = svGetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH", FALSE);
+ g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, value, NULL);
+ g_free (value);
+
+ read_8021x_list_value (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES",
+ s_8021x, NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
+ read_8021x_list_value (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES",
+ s_8021x, NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
+
if (list)
g_strfreev (list);
if (keys)
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
index 9f0c733..2f24fc3 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -17,6 +17,7 @@ EXTRA_DIST = \
keys-test-wired-8021x-peap-mschapv2 \
ifcfg-test-wired-8021x-tls-agent \
ifcfg-test-wired-8021x-tls-always \
+ ifcfg-test-wired-802-1X-subj-matches \
ifcfg-test-onboot-no \
ifcfg-test-noip \
ifcfg-test-wifi-open \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
new file mode 100644
index 0000000..70d69bf
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
@@ -0,0 +1,17 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Ethernet
+DEVICE=eth0
+HWADDR=00:11:22:33:44:ee
+BOOTPROTO=dhcp
+ONBOOT=yes
+NM_CONTROLLED=yes
+KEY_MGMT=IEEE8021X
+IEEE_8021X_EAP_METHODS=PEAP
+IEEE_8021X_IDENTITY="Jara Cimrman"
+IEEE_8021X_PEAP_VERSION=1
+IEEE_8021X_INNER_AUTH_METHODS=GTC
+IEEE_8021X_PASSWORD_FLAGS="user ask"
+IEEE_8021X_SUBJECT_MATCH=server1.yourdomain.tld
+IEEE_8021X_ALTSUBJECT_MATCHES="a.yourdomain.tld b.yourdomain.tld c.yourdomain.tld"
+IEEE_8021X_PHASE2_SUBJECT_MATCH=server2.yourdomain.tld
+IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES="x.yourdomain.tld y.yourdomain.tld"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 7c3d989..fc7119d 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -2614,6 +2614,79 @@ test_read_wired_8021x_tls_secret_flags (const char *ifcfg, NMSettingSecretFlags
g_object_unref (connection);
}
+static void
+test_read_write_802_1X_subj_matches (void)
+{
+ NMConnection *connection, *reread;
+ NMSetting8021x *s_8021x;
+ char *written = NULL;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1X-subj-matches",
+ NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ g_assert_no_error (error);
+ g_assert (connection != NULL);
+
+ /* ===== 802.1x SETTING ===== */
+ s_8021x = nm_connection_get_setting_802_1x (connection);
+ g_assert (s_8021x);
+ g_assert_cmpint (nm_setting_802_1x_get_num_eap_methods (s_8021x), ==, 1);
+ g_assert_cmpstr (nm_setting_802_1x_get_eap_method (s_8021x, 0), ==, "peap");
+ g_assert_cmpstr (nm_setting_802_1x_get_identity (s_8021x), ==, "Jara Cimrman");
+ g_assert_cmpstr (nm_setting_802_1x_get_subject_match (s_8021x), ==, "server1.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_subject_match (s_8021x), ==, "server2.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_altsubject_matches (s_8021x), ==, 3);
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 0), ==, "a.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 1), ==, "b.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 2), ==, "c.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x), ==, 2);
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 0), ==, "x.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 1), ==, "y.yourdomain.tld");
+
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &written,
+ &error);
+ g_assert (success);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (written, NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ unlink (written);
+ g_free (written);
+
+ g_assert_no_error (error);
+ g_assert (reread != NULL);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT);
+ g_assert (success);
+
+ /* Check 802.1X stuff of the re-read connection. */
+ s_8021x = nm_connection_get_setting_802_1x (reread);
+ g_assert (s_8021x);
+ g_assert_cmpint (nm_setting_802_1x_get_num_eap_methods (s_8021x), ==, 1);
+ g_assert_cmpstr (nm_setting_802_1x_get_eap_method (s_8021x, 0), ==, "peap");
+ g_assert_cmpstr (nm_setting_802_1x_get_identity (s_8021x), ==, "Jara Cimrman");
+ g_assert_cmpstr (nm_setting_802_1x_get_subject_match (s_8021x), ==, "server1.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_subject_match (s_8021x), ==, "server2.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_altsubject_matches (s_8021x), ==, 3);
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 0), ==, "a.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 1), ==, "b.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 2), ==, "c.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x), ==, 2);
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 0), ==, "x.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 1), ==, "y.yourdomain.tld");
+
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
#define TEST_IFCFG_WIFI_OPEN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open"
static void
@@ -12522,6 +12595,7 @@ int main (int argc, char **argv)
test_read_wired_8021x_tls_secret_flags (TEST_IFCFG_WIRED_8021X_TLS_AGENT, NM_SETTING_SECRET_FLAG_AGENT_OWNED);
test_read_wired_8021x_tls_secret_flags (TEST_IFCFG_WIRED_8021X_TLS_ALWAYS,
NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED);
+ g_test_add_func (TPATH "802-1x/subj-mathes", test_read_write_802_1X_subj_matches);
test_read_wifi_open ();
test_read_wifi_open_auto ();
test_read_wifi_open_ssid_hex ();
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 11e1d7b..4a18d14 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -447,10 +447,12 @@ write_8021x_setting (NMConnection *connection,
GError **error)
{
NMSetting8021x *s_8021x;
- const char *value;
+ const char *value, *match;
char *tmp = NULL;
gboolean success = FALSE;
GString *phase2_auth;
+ GString *str;
+ guint32 i, num;
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
@@ -545,6 +547,40 @@ write_8021x_setting (NMConnection *connection,
g_string_free (phase2_auth, TRUE);
+ svSetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH",
+ nm_setting_802_1x_get_subject_match (s_8021x),
+ FALSE);
+
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH",
+ nm_setting_802_1x_get_phase2_subject_match (s_8021x),
+ FALSE);
+
+ svSetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", NULL, FALSE);
+ str = g_string_new (NULL);
+ num = nm_setting_802_1x_get_num_altsubject_matches (s_8021x);
+ for (i = 0; i < num; i++) {
+ if (i > 0)
+ g_string_append_c (str, ' ');
+ match = nm_setting_802_1x_get_altsubject_match (s_8021x, i);
+ g_string_append (str, match);
+ }
+ if (str->len > 0)
+ svSetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str, FALSE);
+ g_string_free (str, TRUE);
+
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", NULL, FALSE);
+ str = g_string_new (NULL);
+ num = nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x);
+ for (i = 0; i < num; i++) {
+ if (i > 0)
+ g_string_append_c (str, ' ');
+ match = nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, i);
+ g_string_append (str, match);
+ }
+ if (str->len > 0)
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str, FALSE);
+ g_string_free (str, TRUE);
+
success = write_8021x_certs (s_8021x, FALSE, ifcfg, error);
if (success) {
/* phase2/inner certs */
--
1.8.5.3
From b0e648e7f40d16943e2e531e220b926993b2f7f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 18:40:13 +0100
Subject: [PATCH 07/10] libnm-util: fix adding values to
'phase2-altsubject-matches'
It was mixed up with 'altsubject-matches'.
(cherry picked from commit 37894121605014781810add19169ba8cbbe4394c)
---
libnm-util/nm-setting-8021x.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index 58b2a44..ae03cd2 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -638,7 +638,7 @@ nm_setting_802_1x_get_altsubject_match (NMSetting8021x *setting, guint32 i)
**/
gboolean
nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
- const char *altsubject_match)
+ const char *altsubject_match)
{
NMSetting8021xPrivate *priv;
GSList *iter;
@@ -652,7 +652,8 @@ nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
return FALSE;
}
- priv->altsubject_matches = g_slist_append (priv->altsubject_matches, g_strdup (altsubject_match));
+ priv->altsubject_matches = g_slist_append (priv->altsubject_matches,
+ g_strdup (altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
return TRUE;
}
@@ -1184,7 +1185,7 @@ nm_setting_802_1x_get_phase2_altsubject_match (NMSetting8021x *setting, guint32
**/
gboolean
nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
- const char *phase2_altsubject_match)
+ const char *phase2_altsubject_match)
{
NMSetting8021xPrivate *priv;
GSList *iter;
@@ -1198,8 +1199,8 @@ nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
return FALSE;
}
- priv->phase2_altsubject_matches = g_slist_append (priv->altsubject_matches,
- g_strdup (phase2_altsubject_match));
+ priv->phase2_altsubject_matches = g_slist_append (priv->phase2_altsubject_matches,
+ g_strdup (phase2_altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
return TRUE;
}
--
1.8.5.3
From 01198ca5c733624d6a4238e00b067a173679588a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 15:52:45 +0100
Subject: [PATCH 08/10] libnm-util: fix verify_identity() in '802-1x' setting
We need to return FALSE on error, otherwise we pile GErrors and assert in
nm_setting_verify().
(cherry picked from commit 68066b40f2704ee069201cfa7f9c0f3b976e690f)
---
libnm-util/nm-setting-8021x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index ae03cd2..7777e02 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -2363,12 +2363,14 @@ verify_identity (NMSetting8021x *self, gboolean phase2, GError **error)
NM_SETTING_802_1X_ERROR_MISSING_PROPERTY,
_("property is missing"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_802_1X_SETTING_NAME, NM_SETTING_802_1X_IDENTITY);
+ return FALSE;
} else if (!strlen (priv->identity)) {
g_set_error_literal (error,
NM_SETTING_802_1X_ERROR,
NM_SETTING_802_1X_ERROR_INVALID_PROPERTY,
_("property is empty"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_802_1X_SETTING_NAME, NM_SETTING_802_1X_IDENTITY);
+ return FALSE;
}
return TRUE;
--
1.8.5.3
From 044309eae71b908cdc01852e22ed2a5127293c40 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 21:44:07 +0100
Subject: [PATCH 09/10] platform: fix converting address flags in
nm_platform_ip6_address_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit eca6a49e2d91c21ff9f525dd34259e3ad6c12272)
---
src/platform/nm-platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 97540fc..0477477 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1791,11 +1791,11 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
* These two flags were introduced together with the extended ifa_flags,
* so, check for that.
**/
- if ((address->flags && IFA_F_MANAGETEMPADDR) & !nm_platform_check_support_libnl_extended_ifa_flags ()) {
+ if ((address->flags & IFA_F_MANAGETEMPADDR) && !nm_platform_check_support_libnl_extended_ifa_flags ()) {
strncat (s_flags, s_flags[0] ? "," IFA_F_MANAGETEMPADDR_STR : IFA_F_MANAGETEMPADDR_STR,
sizeof (s_flags) - strlen (s_flags) - 1);
}
- if ((address->flags && IFA_F_NOPREFIXROUTE) & !nm_platform_check_support_libnl_extended_ifa_flags ()) {
+ if ((address->flags & IFA_F_NOPREFIXROUTE) && !nm_platform_check_support_libnl_extended_ifa_flags ()) {
strncat (s_flags, s_flags[0] ? "," IFA_F_NOPREFIXROUTE_STR : IFA_F_NOPREFIXROUTE_STR,
sizeof (s_flags) - strlen (s_flags) - 1);
}
--
1.8.5.3
From 917b799a1ce86963d41834c3bd5d24f945855ec0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 4 Mar 2014 16:51:01 +0100
Subject: [PATCH 10/10] policy: fix crash caused by calling functions on
connection==NULL
Crash appeared in:
nm_settings_connection_set_autoconnect_blocked_reason()
(partially cherry picked from commit b8915dae3c5d2a077a0615941cfa363c0efcb428)
---
src/nm-policy.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index a5a372a..408056e 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1307,7 +1307,7 @@ reset_connections_retries (gpointer user_data)
static void schedule_activate_all (NMPolicy *policy);
static void
-activate_slave_connections (NMPolicy *policy, NMConnection *connection,
+activate_slave_connections (NMPolicy *policy,
NMDevice *device)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
@@ -1414,7 +1414,7 @@ device_state_changed (NMDevice *device,
const char *ip_iface = nm_device_get_ip_iface (device);
NMIP4Config *ip4_config;
NMIP6Config *ip6_config;
- NMSettingConnection *s_con;
+ NMSettingConnection *s_con = NULL;
if (connection)
g_object_set_data (G_OBJECT (connection), FAILURE_REASON_TAG, GUINT_TO_POINTER (0));
@@ -1506,10 +1506,11 @@ device_state_changed (NMDevice *device,
case NM_DEVICE_STATE_PREPARE:
/* Reset auto-connect retries of all slaves and schedule them for
* activation. */
- activate_slave_connections (policy, connection, device);
+ activate_slave_connections (policy, device);
break;
case NM_DEVICE_STATE_SECONDARIES:
- s_con = nm_connection_get_setting_connection (connection);
+ if (connection)
+ s_con = nm_connection_get_setting_connection (connection);
if (s_con && nm_setting_connection_get_num_secondaries (s_con) > 0) {
/* Make routes and DNS up-to-date before activating dependent connections */
update_routing_and_dns (policy, FALSE);
--
1.8.5.3

View File

@ -1,50 +0,0 @@
From 07bf4eb802166edc737f2c742f3987a1aa39189e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 12 Nov 2013 15:04:15 +0100
Subject: [PATCH] keyfile: don't crash when in-memory-only connections don't
have paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the connection has never been saved to disk, it won't have a path yet,
but that doesn't mean we should crash. Next, when reloading connections,
only try to do connection matching on connections that have paths, otherwise
all in-memory-only connections would be removed at the end of
read_connections().
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/plugins/keyfile/plugin.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c
index c5fb9e0..950f566 100644
--- a/src/settings/plugins/keyfile/plugin.c
+++ b/src/settings/plugins/keyfile/plugin.c
@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2008 Novell, Inc.
- * Copyright (C) 2008 - 2012 Red Hat, Inc.
+ * Copyright (C) 2008 - 2013 Red Hat, Inc.
*/
#include <config.h>
@@ -345,8 +345,11 @@ read_connections (NMSystemConfigInterface *config)
oldconns = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
g_hash_table_iter_init (&iter, priv->connections);
- while (g_hash_table_iter_next (&iter, NULL, &data))
- g_hash_table_insert (oldconns, g_strdup (nm_keyfile_connection_get_path (data)), data);
+ while (g_hash_table_iter_next (&iter, NULL, &data)) {
+ const char *con_path = nm_keyfile_connection_get_path (data);
+ if (con_path)
+ g_hash_table_insert (oldconns, g_strdup (con_path), data);
+ }
while ((item = g_dir_read_name (dir))) {
NMKeyfileConnection *connection;
--
1.7.11.7

View File

@ -1,272 +0,0 @@
From fafbc0388636379414caa3b8cb9de14b9a60c551 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 12 Mar 2014 13:34:13 +0100
Subject: [PATCH 1/4] nm-online: fix nm-online to report online status
correctly (rh #1054364)
This fixes a behaviour change made by 44ac1020daccfeeb1dc88566adda6e5d8bd87aea.
That commit make nm-online to wait for NM finishing startup instead of waiting
for a real connection. So for NetworkManager fully initialized, but
disconnected nm-online would return 0.
$ nmcli -f RUNNING,STATE,STARTUP,CONNECTIVITY gen status
RUNNING STATE STARTUP CONNECTIVITY
running disconnected started none
Revert back to the original behaviour of waiting for a connection. And
introduce a new option '--wait-for-startup' waiting for NetworkManager
finishing its startup, which is useful in some cases, like
NetworkManager-wait-online.service.
https://bugzilla.redhat.com/show_bug.cgi?id=1054364
(cherry picked from commit 20fb078dd6b10c10539f62449ac2a0b36f0e67ce)
---
man/nm-online.1.in | 7 +++++--
test/nm-online.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/man/nm-online.1.in b/man/nm-online.1.in
index 941f006..ddb2b17 100644
--- a/man/nm-online.1.in
+++ b/man/nm-online.1.in
@@ -19,9 +19,9 @@
.\" with this manual; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
-.\" Copyright (C) 2010 Red Hat, Inc.
+.\" Copyright (C) 2010 - 2014 Red Hat, Inc.
.\"
-.TH NM-ONLINE "1" "11 July 2013"
+.TH NM-ONLINE "1" "25 March 2014"
.SH NAME
nm-online \- ask NetworkManager whether the network is connected
@@ -47,6 +47,9 @@ Exit immediately if NetworkManager is not running or connecting.
.TP
.B \-q, \-\-quiet
Don't print anything.
+.TP
+.B \-s, \-\-wait-for-startup
+Wait for NetworkManager finishing its startup instead of establishing a connection.
.SH EXIT STATUS
diff --git a/test/nm-online.c b/test/nm-online.c
index 7df66c2..03737b2 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -15,6 +15,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2006 - 2008 Novell, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*
*/
@@ -42,6 +43,7 @@
#include "nm-client.h"
#define PROGRESS_STEPS 15
+#define WAIT_STARTUP_TAG "wait-startup"
typedef struct
{
@@ -56,11 +58,22 @@ client_properties_changed (GObject *object,
gpointer loop)
{
NMClient *client = NM_CLIENT (object);
+ NMState state;
+ gboolean wait_startup = GPOINTER_TO_UINT (g_object_get_data (object, WAIT_STARTUP_TAG));
if (!nm_client_get_manager_running (client))
return;
- if (!nm_client_get_startup (client))
- g_main_loop_quit (loop);
+
+ if (wait_startup) {
+ if (!nm_client_get_startup (client))
+ g_main_loop_quit (loop);
+ } else {
+ state = nm_client_get_state (client);
+ if ( state == NM_STATE_CONNECTED_LOCAL
+ || state == NM_STATE_CONNECTED_SITE
+ || state == NM_STATE_CONNECTED_GLOBAL)
+ g_main_loop_quit (loop);
+ }
}
static gboolean
@@ -94,16 +107,19 @@ main (int argc, char *argv[])
gint t_secs = -1;
gboolean exit_no_nm = FALSE;
gboolean quiet = FALSE;
+ gboolean wait_startup = FALSE;
Timeout timeout;
GOptionContext *opt_ctx = NULL;
gboolean success;
NMClient *client;
+ NMState state = NM_STATE_UNKNOWN;
GMainLoop *loop;
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running"), NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
+ {"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
};
@@ -147,13 +163,35 @@ main (int argc, char *argv[])
client = nm_client_new ();
+ g_object_set_data (G_OBJECT (client), WAIT_STARTUP_TAG, GUINT_TO_POINTER (wait_startup));
+ state = nm_client_get_state (client);
if (!nm_client_get_manager_running (client)) {
- if (exit_no_nm)
+ if (exit_no_nm) {
+ g_object_unref (client);
return 1;
- } else if (!nm_client_get_startup (client))
- return 0;
- if (!timeout.value)
+ }
+ } else if (wait_startup) {
+ if (!nm_client_get_startup (client)) {
+ g_object_unref (client);
+ return 0;
+ }
+ } else {
+ if ( state == NM_STATE_CONNECTED_LOCAL
+ || state == NM_STATE_CONNECTED_SITE
+ || state == NM_STATE_CONNECTED_GLOBAL) {
+ g_object_unref (client);
+ return 0;
+ }
+ }
+ if (exit_no_nm && (state != NM_STATE_CONNECTING)) {
+ g_object_unref (client);
return 1;
+ }
+
+ if (!timeout.value) {
+ g_object_unref (client);
+ return 1;
+ }
timeout.norm = (double) timeout.value / (double) PROGRESS_STEPS;
g_timeout_add_seconds (1, handle_timeout, &timeout);
--
1.9.0
From f247a3c86e71d7ae419c3401fff310d2e836a2ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 26 Mar 2014 18:14:04 +0100
Subject: [PATCH 2/4] systemd: update NetworkManager-wait-online.service to
wait for startup
(cherry picked from commit 520d2814ba720cf8aee9d6f91fca4e3ea0d8555f)
---
data/NetworkManager-wait-online-systemd-pre200.service.in | 2 +-
data/NetworkManager-wait-online.service.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/NetworkManager-wait-online-systemd-pre200.service.in b/data/NetworkManager-wait-online-systemd-pre200.service.in
index fd9be41..d145a79 100644
--- a/data/NetworkManager-wait-online-systemd-pre200.service.in
+++ b/data/NetworkManager-wait-online-systemd-pre200.service.in
@@ -7,7 +7,7 @@ Before=network.target
[Service]
Type=oneshot
-ExecStart=@bindir@/nm-online -q --timeout=30
+ExecStart=@bindir@/nm-online -s -q --timeout=30
[Install]
WantedBy=network.target
diff --git a/data/NetworkManager-wait-online.service.in b/data/NetworkManager-wait-online.service.in
index b81c5b0..6ad6942 100644
--- a/data/NetworkManager-wait-online.service.in
+++ b/data/NetworkManager-wait-online.service.in
@@ -7,7 +7,7 @@ Before=network.target network-online.target
[Service]
Type=oneshot
-ExecStart=@bindir@/nm-online -q --timeout=30
+ExecStart=@bindir@/nm-online -s -q --timeout=30
[Install]
WantedBy=multi-user.target
--
1.9.0
From 749647f7ab034eb7eb43877fe957cc71a82d9773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Mar 2014 10:13:08 +0100
Subject: [PATCH 3/4] trivial: correct nm-online's '--exit' option description
(cherry picked from commit ea962ce4112ccf3b25efe5b9661c1a48090dc4e4)
---
test/nm-online.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/nm-online.c b/test/nm-online.c
index 03737b2..53b0465 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -117,7 +117,7 @@ main (int argc, char *argv[])
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
- {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running"), NULL},
+ {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
--
1.9.0
From f3804ce1e2a0229a6ef32cb1ddb0d750822fb2d8 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 12 Mar 2014 14:44:27 +0100
Subject: [PATCH 4/4] nm-online: fix considering the --quiet option
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 0a85bff70a65d5a205b56bc9f74fc2b0237ad05a)
---
test/nm-online.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/nm-online.c b/test/nm-online.c
index 53b0465..681df18 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -106,7 +106,6 @@ main (int argc, char *argv[])
{
gint t_secs = -1;
gboolean exit_no_nm = FALSE;
- gboolean quiet = FALSE;
gboolean wait_startup = FALSE;
Timeout timeout;
GOptionContext *opt_ctx = NULL;
@@ -118,11 +117,13 @@ main (int argc, char *argv[])
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
- {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
+ {"quiet", 'q', 0, G_OPTION_ARG_NONE, &timeout.quiet, N_("Don't print anything"), NULL},
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
};
+ timeout.quiet = FALSE;
+
/* Set locale to be able to use environment variables */
setlocale (LC_ALL, "");
--
1.9.0

View File

@ -1,81 +0,0 @@
From 2cea29f22882571ac92fedccd3cbe664d31eab10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 11 Feb 2014 13:58:17 +0100
Subject: [PATCH 1/1] settings: free memory in finalize(), not in dispose() in
NMSecretAgent (rh #1061911)
Even if the code changed in master compared to the bug report, the issues would
still occur when we freed members in dispose.
https://bugzilla.redhat.com/show_bug.cgi?id=1061911
(cherry picked from commit 4141e69b3a368f5b450fbc99a37557f77ef2fd08)
Conflicts:
src/settings/nm-secret-agent.c
---
src/settings/nm-secret-agent.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c
index 5a8a73f..c7c1a26 100644
--- a/src/settings/nm-secret-agent.c
+++ b/src/settings/nm-secret-agent.c
@@ -40,8 +40,6 @@ G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
NMSecretAgentPrivate))
typedef struct {
- gboolean disposed;
-
char *description;
char *owner;
char *identifier;
@@ -499,25 +497,25 @@ nm_secret_agent_init (NMSecretAgent *self)
static void
dispose (GObject *object)
{
- NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
-
- if (!priv->disposed) {
- priv->disposed = TRUE;
+ proxy_cleanup (NM_SECRET_AGENT (object));
- g_free (priv->description);
- g_free (priv->owner);
- g_free (priv->identifier);
- g_free (priv->owner_username);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+}
- g_slist_foreach (priv->permissions, (GFunc) g_free, NULL);
- g_slist_free (priv->permissions);
+static void
+finalize (GObject *object)
+{
+ NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
- g_hash_table_destroy (priv->requests);
+ g_free (priv->description);
+ g_free (priv->owner);
+ g_free (priv->identifier);
+ g_free (priv->owner_username);
- proxy_cleanup (NM_SECRET_AGENT (object));
- }
+ g_slist_free_full (priv->permissions, g_free);
+ g_hash_table_destroy (priv->requests);
- G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->finalize (object);
}
static void
@@ -529,5 +527,6 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
/* virtual methods */
object_class->dispose = dispose;
+ object_class->finalize = finalize;
}
--
1.9.0

View File

@ -1,55 +0,0 @@
From d4e54f22ff4550b27f0c2953191f65a69bdb814c Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 4 Apr 2014 16:14:46 +0200
Subject: [PATCH 1/1] platform: workaround older kernels that don't accept
extended address flags via netlink
Extended address flags are represented by the additional netlink
attribute IFA_FLAGS. Older kernels don't know this flag and refuse
the messages RTM_NEWADDR and RTMDEL_ADDR when it contains unknown
attributes. See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was
fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.
libnl was fixed in commit 5206c050504f8676a24854519b9c351470fb7cc6 only to
send the additional netlink attribute, when there are actually flags
that make this necessary.
This commit changes nm-platform to strip the flags to &= 0xFF, if we detect
that the kernel does not understand extended address flags.
https://bugzilla.redhat.com/show_bug.cgi?id=1063885
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit dac51747ab5853b00557d7d97d4b2eae05968c03)
---
src/platform/nm-linux-platform.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index b5e3618..dacdc16 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2405,8 +2405,19 @@ build_rtnl_addr (int family,
rtnl_addr_set_valid_lifetime (rtnladdr, lifetime);
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
}
- if (flags)
+ if (flags) {
+ if ((flags & ~0xFF) && !check_support_kernel_extended_ifa_flags (nm_platform_get ())) {
+ /* Older kernels don't accept unknown netlink attributes.
+ *
+ * With commit libnl commit 5206c050504f8676a24854519b9c351470fb7cc6, libnl will only set
+ * the extended address flags attribute IFA_FLAGS when necessary (> 8 bit). But it's up to
+ * us not to shove those extended flags on to older kernels.
+ *
+ * Just silently clear them. The kernel should ignore those unknown flags anyway. */
+ flags &= 0xFF;
+ }
rtnl_addr_set_flags (rtnladdr, flags);
+ }
return (struct nl_object *) rtnladdr;
}
--
1.9.0

View File

@ -1,873 +0,0 @@
From c1dfa412dccec7ce2a27a1da36b2e0e4679cbc6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 14:53:00 +0200
Subject: [PATCH 1/5] trivial: make clear the maximum bitrate is in kbit/s
(cherry picked from commit 759236681ca1d1a472c136aef4c571a0ee954056)
---
libnm-glib/nm-access-point.c | 6 +++---
libnm-glib/nm-device-wifi.c | 6 +++---
src/nm-wifi-ap.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c
index 56dcb11..6c090c0 100644
--- a/libnm-glib/nm-access-point.c
+++ b/libnm-glib/nm-access-point.c
@@ -236,9 +236,9 @@ nm_access_point_get_mode (NMAccessPoint *ap)
* nm_access_point_get_max_bitrate:
* @ap: a #NMAccessPoint
*
- * Gets the maximum bit rate of the access point.
+ * Gets the maximum bit rate of the access point in kbit/s.
*
- * Returns: the maximum bit rate
+ * Returns: the maximum bit rate (kbit/s)
**/
guint32
nm_access_point_get_max_bitrate (NMAccessPoint *ap)
@@ -661,7 +661,7 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
/**
* NMAccessPoint:max-bitrate:
*
- * The maximum bit rate of the access point.
+ * The maximum bit rate of the access point in kbit/s.
**/
g_object_class_install_property
(object_class, PROP_MAX_BITRATE,
diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c
index cda8eb0..8ffdf42 100644
--- a/libnm-glib/nm-device-wifi.c
+++ b/libnm-glib/nm-device-wifi.c
@@ -185,9 +185,9 @@ nm_device_wifi_get_mode (NMDeviceWifi *device)
* nm_device_wifi_get_bitrate:
* @device: a #NMDeviceWifi
*
- * Gets the bit rate of the #NMDeviceWifi.
+ * Gets the bit rate of the #NMDeviceWifi in kbit/s.
*
- * Returns: the bit rate
+ * Returns: the bit rate (kbit/s)
**/
guint32
nm_device_wifi_get_bitrate (NMDeviceWifi *device)
@@ -744,7 +744,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
/**
* NMDeviceWifi:bitrate:
*
- * The bit rate of the device.
+ * The bit rate of the device in kbit/s.
**/
g_object_class_install_property
(object_class, PROP_BITRATE,
diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c
index fb12754..06be315 100644
--- a/src/nm-wifi-ap.c
+++ b/src/nm-wifi-ap.c
@@ -1023,7 +1023,7 @@ nm_ap_set_freq (NMAccessPoint *ap,
/*
- * Get/set functions for max bitrate
+ * Get/set functions for max bitrate (in kbit/s)
*
*/
guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap)
--
1.9.0
From 0bcda31fe413ee681b02ce131fa3d47f319861f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 14:56:32 +0200
Subject: [PATCH 2/5] nmcli: use correct Mbit/s units for maximal bitrate (rh
#1080474)
https://bugzilla.redhat.com/show_bug.cgi?id=1080474
(cherry picked from commit c1e5493117dac1c57e02b0f30c12a0f8903133c3)
---
cli/src/devices.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cli/src/devices.c b/cli/src/devices.c
index bcbf287..03eefbc 100644
--- a/cli/src/devices.c
+++ b/cli/src/devices.c
@@ -433,7 +433,7 @@ fill_output_access_point (gpointer data, gpointer user_data)
}
channel_str = g_strdup_printf ("%u", nm_utils_wifi_freq_to_channel (freq));
freq_str = g_strdup_printf (_("%u MHz"), freq);
- bitrate_str = g_strdup_printf (_("%u MB/s"), bitrate/1000);
+ bitrate_str = g_strdup_printf (_("%u Mbit/s"), bitrate/1000);
strength_str = g_strdup_printf ("%u", strength);
wpa_flags_str = ap_wpa_rsn_flags_to_string (wpa_flags);
rsn_flags_str = ap_wpa_rsn_flags_to_string (rsn_flags);
--
1.9.0
From 73abea116465955c64550e49629159ed7098a63f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:07:22 +0200
Subject: [PATCH 3/5] examples: use correct Mbit/s for bitrates
(cherry picked from commit 7211d82f7726824f7967242a104aa3a1f2fed4b3)
---
examples/C/glib/get-ap-info-libnm-glib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/C/glib/get-ap-info-libnm-glib.c b/examples/C/glib/get-ap-info-libnm-glib.c
index e72ce54..c144be2 100644
--- a/examples/C/glib/get-ap-info-libnm-glib.c
+++ b/examples/C/glib/get-ap-info-libnm-glib.c
@@ -105,7 +105,7 @@ show_access_point_info (NMAccessPoint *ap)
/* Convert to strings */
ssid_str = nm_utils_ssid_to_utf8 (ssid);
freq_str = g_strdup_printf ("%u MHz", freq);
- bitrate_str = g_strdup_printf ("%u MB/s", bitrate/1000);
+ bitrate_str = g_strdup_printf ("%u Mbit/s", bitrate/1000);
strength_str = g_strdup_printf ("%u", strength);
wpa_flags_str = ap_wpa_rsn_flags_to_string (wpa_flags);
rsn_flags_str = ap_wpa_rsn_flags_to_string (rsn_flags);
@@ -178,7 +178,7 @@ show_wifi_device_info (NMDevice *device)
speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (device));
speed /= 1000;
- printf ("Device: %s ---- Driver: %s ---- Speed: %d MB/s ---- Active AP: %s\n",
+ printf ("Device: %s ---- Driver: %s ---- Speed: %d Mbit/s ---- Active AP: %s\n",
iface, driver, speed, active_ssid_str ? active_ssid_str : "none");
printf ("=================================================================================\n");
g_free (active_ssid_str);
--
1.9.0
From 884fb928636176fd9dc6c6e6bc5e0935c2411e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:09:34 +0200
Subject: [PATCH 4/5] man: use correct Mbit/s for maximum bitrate in
nmcli-examples
(cherry picked from commit b3cbb260ef601a37a7d986563f02646e1b00d660)
Conflicts:
man/nmcli-examples.xml
---
man/nmcli-examples.5 | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/man/nmcli-examples.5 b/man/nmcli-examples.5
index 9d05ec6..44b5f4e 100644
--- a/man/nmcli-examples.5
+++ b/man/nmcli-examples.5
@@ -64,17 +64,17 @@ $ nmcli device wifi list
.\}
.nf
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
- netdatacomm_local Infra 6 54 MB/s 37 ▂▄__ WEP
-* F1 Infra 11 54 MB/s 98 ▂▄▆█ WPA1
- LoremCorp Infra 1 54 MB/s 62 ▂▄▆_ WPA2 802\&.1X
- Internet Infra 6 54 MB/s 29 ▂___ WPA1
- HPB110a\&.F2672A Ad\-Hoc 6 54 MB/s 22 ▂___ \-\-
- Jozinet Infra 1 54 MB/s 19 ▂___ WEP
- VOIP Infra 1 54 MB/s 20 ▂___ WEP
- MARTINA Infra 4 54 MB/s 32 ▂▄__ WPA2
- N24PU1 Infra 7 11 MB/s 22 ▂___ \-\-
- alfa Infra 1 54 MB/s 67 ▂▄▆_ WPA2
- bertnet Infra 5 54 MB/s 20 ▂___ WPA1 WPA2
+ netdatacomm_local Infra 6 54 MBit/s 37 ▂▄__ WEP
+* F1 Infra 11 54 MBit/s 98 ▂▄▆█ WPA1
+ LoremCorp Infra 1 54 MBit/s 62 ▂▄▆_ WPA2 802\&.1X
+ Internet Infra 6 54 MBit/s 29 ▂___ WPA1
+ HPB110a\&.F2672A Ad\-Hoc 6 54 MBit/s 22 ▂___ \-\-
+ Jozinet Infra 1 54 MBit/s 19 ▂___ WEP
+ VOIP Infra 1 54 MBit/s 20 ▂___ WEP
+ MARTINA Infra 4 54 MBit/s 32 ▂▄__ WPA2
+ N24PU1 Infra 7 11 MBit/s 22 ▂___ \-\-
+ alfa Infra 1 54 MBit/s 67 ▂▄▆_ WPA2
+ bertnet Infra 5 54 MBit/s 20 ▂___ WPA1 WPA2
.fi
.if n \{\
--
1.9.0
From 88c40d47437cfa25d7a5075923096ba6c067bcfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:12:09 +0200
Subject: [PATCH 5/5] po: fix "MB/s" -> "Mbit/s"
(cherry picked from commit cb80daa94225b5ef459b503768fa63463b33a5de)
Conflicts:
po/as.po
po/uk.po
---
po/as.po | 4 ++--
po/bg.po | 4 ++--
po/bn_IN.po | 2 +-
po/ca.po | 4 ++--
po/cs.po | 4 ++--
po/da.po | 4 ++--
po/de.po | 4 ++--
po/el.po | 4 ++--
po/en_GB.po | 4 ++--
po/eo.po | 4 ++--
po/es.po | 4 ++--
po/eu.po | 4 ++--
po/fi.po | 2 +-
po/fr.po | 2 +-
po/gl.po | 4 ++--
po/gu.po | 4 ++--
po/hi.po | 4 ++--
po/hr.po | 4 ++--
po/hu.po | 4 ++--
po/id.po | 4 ++--
po/it.po | 4 ++--
po/ja.po | 4 ++--
po/kn.po | 4 ++--
po/ko.po | 4 ++--
po/lt.po | 4 ++--
po/ml.po | 4 ++--
po/mr.po | 4 ++--
po/or.po | 4 ++--
po/pa.po | 4 ++--
po/pl.po | 4 ++--
po/pt_BR.po | 4 ++--
po/ru.po | 2 +-
po/sl.po | 4 ++--
po/sr.po | 4 ++--
po/sr@latin.po | 4 ++--
po/sv.po | 4 ++--
po/ta.po | 4 ++--
po/te.po | 4 ++--
po/tr.po | 4 ++--
po/uk.po | 2 +-
po/zh_CN.po | 4 ++--
po/zh_TW.po | 4 ++--
42 files changed, 79 insertions(+), 79 deletions(-)
diff --git a/po/as.po b/po/as.po
index 2e62dff..c6dc17b 100644
--- a/po/as.po
+++ b/po/as.po
@@ -1723,8 +1723,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u MBit/s"
+msgstr "%u MBit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/bg.po b/po/bg.po
index cda45f1..0269643 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -774,8 +774,8 @@ msgstr "%uMHz"
#: ../cli/src/devices.c:431
#, c-format
-msgid "%u MB/s"
-msgstr "%uMB/s"
+msgid "%u Mbit/s"
+msgstr "%uMbit/s"
#: ../cli/src/devices.c:440
msgid "Encrypted: "
diff --git a/po/bn_IN.po b/po/bn_IN.po
index 6d3f830..02a511d 100644
--- a/po/bn_IN.po
+++ b/po/bn_IN.po
@@ -1170,7 +1170,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:401
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u মেগাবাইট/সেকেন্ড"
#: ../cli/src/devices.c:410
diff --git a/po/ca.po b/po/ca.po
index d4e6c8e..c3940b9 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -766,8 +766,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:431
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:440
msgid "Encrypted: "
diff --git a/po/cs.po b/po/cs.po
index 0cb1482..25b2be1 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -820,8 +820,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:470
msgid "Encrypted: "
diff --git a/po/da.po b/po/da.po
index bbcde42..82f456c 100644
--- a/po/da.po
+++ b/po/da.po
@@ -797,8 +797,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:395
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:404
msgid "Encrypted: "
diff --git a/po/de.po b/po/de.po
index 3eb730e..2162091 100644
--- a/po/de.po
+++ b/po/de.po
@@ -2701,8 +2701,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/el.po b/po/el.po
index 355249d..db8cf54 100644
--- a/po/el.po
+++ b/po/el.po
@@ -1160,8 +1160,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/en_GB.po b/po/en_GB.po
index 32235ce..3997ed5 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -1157,8 +1157,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/eo.po b/po/eo.po
index 0284ae6..c466a5d 100644
--- a/po/eo.po
+++ b/po/eo.po
@@ -1122,8 +1122,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:557
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:566
msgid "Encrypted: "
diff --git a/po/es.po b/po/es.po
index 5c1bde6..7b72529 100644
--- a/po/es.po
+++ b/po/es.po
@@ -814,8 +814,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:470
msgid "Encrypted: "
diff --git a/po/eu.po b/po/eu.po
index 68b8204..20026f9 100644
--- a/po/eu.po
+++ b/po/eu.po
@@ -638,8 +638,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:863
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:869 ../cli/src/devices.c:871
msgid "AP parameters"
diff --git a/po/fi.po b/po/fi.po
index 8a7517f..b4deae7 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -761,7 +761,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr ""
#: ../cli/src/devices.c:470
diff --git a/po/fr.po b/po/fr.po
index b56bf3f..378831e 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -787,7 +787,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u Mo/s"
#: ../cli/src/devices.c:470
diff --git a/po/gl.po b/po/gl.po
index 310b66f..5dc613d 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -1210,8 +1210,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:404
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:413
msgid "Encrypted: "
diff --git a/po/gu.po b/po/gu.po
index 9459218..eb3a185 100644
--- a/po/gu.po
+++ b/po/gu.po
@@ -1713,8 +1713,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/hi.po b/po/hi.po
index aa0b3bf..c6e7938 100644
--- a/po/hi.po
+++ b/po/hi.po
@@ -1267,8 +1267,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/hr.po b/po/hr.po
index 4e24565..3cc5e45 100644
--- a/po/hr.po
+++ b/po/hr.po
@@ -794,8 +794,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:471
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:480
msgid "Encrypted: "
diff --git a/po/hu.po b/po/hu.po
index 237cce7..00d95bc 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -1257,8 +1257,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/id.po b/po/id.po
index 42cc406..0288338 100644
--- a/po/id.po
+++ b/po/id.po
@@ -1135,8 +1135,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/it.po b/po/it.po
index 6b2eb9e..867109a 100644
--- a/po/it.po
+++ b/po/it.po
@@ -2400,8 +2400,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ja.po b/po/ja.po
index 02d7515..ddf8578 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -2671,8 +2671,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/kn.po b/po/kn.po
index e19c121..a1891fd 100644
--- a/po/kn.po
+++ b/po/kn.po
@@ -1665,8 +1665,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ko.po b/po/ko.po
index ba6bb0b..a5e95b4 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -780,8 +780,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:471
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:480
msgid "Encrypted: "
diff --git a/po/lt.po b/po/lt.po
index 8b17832..bfa26a1 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -2837,8 +2837,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ml.po b/po/ml.po
index f5d6841..7a289a2 100644
--- a/po/ml.po
+++ b/po/ml.po
@@ -1211,8 +1211,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/mr.po b/po/mr.po
index 45c81fc..e202592 100644
--- a/po/mr.po
+++ b/po/mr.po
@@ -2491,8 +2491,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/or.po b/po/or.po
index ed220ec..5801d61 100644
--- a/po/or.po
+++ b/po/or.po
@@ -1727,8 +1727,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/pa.po b/po/pa.po
index 0fd0275..3b8ee45 100644
--- a/po/pa.po
+++ b/po/pa.po
@@ -1213,8 +1213,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/pl.po b/po/pl.po
index 7686ae4..9711670 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -2743,8 +2743,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index e188af3..b4008b5 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -2753,8 +2753,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ru.po b/po/ru.po
index 56f3fce..490f69d 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -1165,7 +1165,7 @@ msgstr "%u МГц"
#: ../cli/src/devices.c:400
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u МБ/с"
#: ../cli/src/devices.c:409
diff --git a/po/sl.po b/po/sl.po
index 744beb3..ddd4e08 100644
--- a/po/sl.po
+++ b/po/sl.po
@@ -1274,8 +1274,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/sr.po b/po/sr.po
index 160630c..baefbaf 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -711,8 +711,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/sr@latin.po b/po/sr@latin.po
index 3158fac..b4f9f28 100644
--- a/po/sr@latin.po
+++ b/po/sr@latin.po
@@ -711,8 +711,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/sv.po b/po/sv.po
index 9f66eb6..7bcc960 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -1229,8 +1229,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:557
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:566
msgid "Encrypted: "
diff --git a/po/ta.po b/po/ta.po
index 058b8fd..16ba218 100644
--- a/po/ta.po
+++ b/po/ta.po
@@ -1266,8 +1266,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/te.po b/po/te.po
index 5ba12a0..d4fa28d 100644
--- a/po/te.po
+++ b/po/te.po
@@ -1753,8 +1753,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/tr.po b/po/tr.po
index 867c95e..713163b 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -1231,8 +1231,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/uk.po b/po/uk.po
index 8891829..c92e757 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -1215,7 +1215,7 @@ msgstr "%u МГц"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
+msgid "%u MBit/s"
msgstr "%u МБ/с"
#: ../cli/src/devices.c:427
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 5f4b64f..742e084 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -708,8 +708,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/zh_TW.po b/po/zh_TW.po
index d6e530f..7d5e1fe 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -698,8 +698,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:350
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:359
msgid "Encrypted: "
--
1.9.0

View File

@ -1,67 +0,0 @@
From 6e99f5d9850d06cb2743c906843b429cb02173d2 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 4 Apr 2014 14:55:37 +0200
Subject: [PATCH] core: fix hanging pending_action "queued state lock"
This bug caused nm-online to hang because "startup complete" state
is never reached. Sometimes you also see this error in the logfile:
<warn> (em1): add_pending_action (3): 'queued state lock' already added
file devices/nm-device.c: line 7178 (nm_device_add_pending_action): should not be reached
https://bugzilla.redhat.com/show_bug.cgi?id=1084554
https://bugzilla.redhat.com/show_bug.cgi?id=1084556
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1082045
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit fc1351504db557b942c121b480fca661162702f7)
---
src/devices/nm-device.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index c7f72b8..9cb79f2 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6485,29 +6485,25 @@ nm_device_queue_state (NMDevice *self,
priv = NM_DEVICE_GET_PRIVATE (self);
- /* "lock" the pending actions so that if there was a previously
- * queued action that's about to be cleared, that doesn't drop
- * the pending actions to 0 before we add the new pending action.
- */
- nm_device_add_pending_action (self, "queued state lock");
+ if (priv->queued_state.id && priv->queued_state.state == state)
+ return;
+
+ /* Add pending action for the new state before clearing the queued states, so
+ * that we don't accidently pop all pending states and reach 'startup complete' */
+ nm_device_add_pending_action (self, queued_state_to_string (state));
/* We should only ever have one delayed state transition at a time */
if (priv->queued_state.id) {
- if (priv->queued_state.state == state)
- return;
nm_log_warn (LOGD_DEVICE, "(%s): overwriting previously queued state change to %s (%s)",
- nm_device_get_iface (self),
- state_to_string (priv->queued_state.state),
- reason_to_string (priv->queued_state.reason));
+ nm_device_get_iface (self),
+ state_to_string (priv->queued_state.state),
+ reason_to_string (priv->queued_state.reason));
nm_device_queued_state_clear (self);
}
priv->queued_state.state = state;
priv->queued_state.reason = reason;
priv->queued_state.id = g_idle_add (queued_set_state, self);
- nm_device_add_pending_action (self, queued_state_to_string (state));
-
- nm_device_remove_pending_action (self, "queued state lock");
nm_log_dbg (LOGD_DEVICE, "(%s): queued state change to %s due to %s (id %d)",
nm_device_get_iface (self), state_to_string (state), reason_to_string (reason),
--
1.9.0

View File

@ -1,29 +0,0 @@
From 12b46b77359115a32ac406794586b886d8cb2587 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 18 Mar 2014 15:37:12 -0500
Subject: [PATCH 1/1] core: emit PropertyChanged signal for ActiveConnection
when disconnecting
(cherry picked from commit 73d128bbd17120225bb4986e3f05566f10fab581)
Conflicts:
src/devices/nm-device.c
---
src/devices/nm-device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 9cb79f2..e50e1c2 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4364,6 +4364,7 @@ clear_act_request (NMDevice *self)
g_object_unref (priv->act_request);
priv->act_request = NULL;
+ g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION);
}
static void
--
1.9.0

View File

@ -1,32 +0,0 @@
This patch fixes rh #1086132. It is an extracted part of bigger upstream patch 97935382.
diff -up NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c.foo
--- NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c 2013-10-01 20:43:57.000000000 +0200
+++ NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c.foo 2014-04-10 10:33:52.556199775 +0200
@@ -302,7 +302,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
/* Ad-Hoc WPA requires 'wpa' proto, 'none' pairwise, and 'tkip' group */
n = nm_setting_wireless_security_get_num_protos (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_proto (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "wpa")) {
+ if (n > 1 || g_strcmp0 (tmp, "wpa")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
@@ -312,7 +312,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
n = nm_setting_wireless_security_get_num_pairwise (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_pairwise (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "none")) {
+ if (n > 1 || g_strcmp0 (tmp, "none")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
@@ -322,7 +322,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
n = nm_setting_wireless_security_get_num_groups (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_group (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "tkip")) {
+ if (n > 1 || g_strcmp0 (tmp, "tkip")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,

View File

@ -1,70 +0,0 @@
From 5c1dee10cde3cc7cf74718650702dd124d46aa75 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Sun, 9 Feb 2014 03:31:21 -0600
Subject: [PATCH] mobile: only change state to NEED_AUTH during activation (rh
#1058308)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Auth requests only happen during activation and there's no need to
request secrets at any other time. Ensure that the device state
won't change to NEED_AUTH except when activating.
(There's a case in NMModemBroadband where set_mm_enabled()
when the modem is locked may cause this, but we'll solve this
a different way later.)
https://bugzilla.redhat.com/show_bug.cgi?id=1058308
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-bt.c | 10 +++++++++-
src/devices/nm-device-modem.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/devices/nm-device-bt.c b/src/devices/nm-device-bt.c
index e22c96e..3e5b693 100644
--- a/src/devices/nm-device-bt.c
+++ b/src/devices/nm-device-bt.c
@@ -423,7 +423,15 @@ ppp_failed (NMModem *modem, NMDeviceStateReason reason, gpointer user_data)
static void
modem_auth_requested (NMModem *modem, gpointer user_data)
{
- nm_device_state_changed (NM_DEVICE (user_data),
+ NMDevice *device = NM_DEVICE (user_data);
+
+ /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled
+ * during activation.
+ */
+ if (!nm_device_is_activating (device))
+ return;
+
+ nm_device_state_changed (device,
NM_DEVICE_STATE_NEED_AUTH,
NM_DEVICE_STATE_REASON_NONE);
}
diff --git a/src/devices/nm-device-modem.c b/src/devices/nm-device-modem.c
index 0bed60c..e047c03 100644
--- a/src/devices/nm-device-modem.c
+++ b/src/devices/nm-device-modem.c
@@ -113,7 +113,15 @@ modem_prepare_result (NMModem *modem,
static void
modem_auth_requested (NMModem *modem, gpointer user_data)
{
- nm_device_state_changed (NM_DEVICE (user_data),
+ NMDevice *device = NM_DEVICE (user_data);
+
+ /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled
+ * during activation.
+ */
+ if (!nm_device_is_activating (device))
+ return;
+
+ nm_device_state_changed (device,
NM_DEVICE_STATE_NEED_AUTH,
NM_DEVICE_STATE_REASON_NONE);
}
--
1.7.11.7

View File

@ -1,52 +0,0 @@
From e7570b398c6a658732cdc5cc0566beaf2f23e6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 15 Apr 2014 11:51:56 +0200
Subject: [PATCH] policy: check device state before changing it for
secondaries (rh #1055099)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check the previous base device state in process_secondaries() when
making a state change. The device might got disconnected in the meantime and
thus the transition from DISCONNECTED to ACTIVATED or FAILED would have been
incorrect.
https://bugzilla.redhat.com/show_bug.cgi?id=1055099
https://bugzilla.redhat.com/show_bug.cgi?id=1055101
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index f454d90..fa31d6c 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1087,7 +1087,8 @@ process_secondaries (NMPolicy *policy,
/* None secondary UUID remained -> remove the secondary data item */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
+ if (nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
return;
}
} else {
@@ -1098,8 +1099,10 @@ process_secondaries (NMPolicy *policy,
/* Secondary connection failed -> do not watch other connections */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
- NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
+ if ( nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES
+ || nm_device_get_state (item_device) == NM_DEVICE_STATE_ACTIVATED)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
return;
}
}
--
1.7.11.7

View File

@ -1,33 +0,0 @@
From 6b6265ebebd7342a0d414bd1370e7af0e472d522 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 8 Nov 2013 15:34:55 -0600
Subject: [PATCH] team: fix possible crash by ensuring teamd context is
cleared
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
teamd_cleanup() might get called multiple times, and since the rest
of the function is safe against multi-calls, make priv->tdc safe
against being called again too.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-team.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 734cf4d..1fe7caf 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -270,6 +270,7 @@ teamd_cleanup (NMDevice *dev, gboolean device_state_failed)
if (priv->tdc) {
teamdctl_disconnect (priv->tdc);
teamdctl_free (priv->tdc);
+ priv->tdc = NULL;
}
#endif
--
1.7.11.7

View File

@ -1,37 +0,0 @@
From acb6a0d305dddccb6d73575c88aefad60faa173a Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 27 Mar 2014 12:16:46 -0400
Subject: [PATCH] core: update NMManager:devices before emitting
notify::devices (rh #1078720)
NMClient's "devices" property was getting out of sync because the
daemon was emitting "notify" before actually changing the property
value. This resulted in problems with re-activating virtual devices
that had previously been deactivated in gnome-control-center and
anaconda. (And probably gnome-shell and nm-applet?)
---
src/nm-manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index be2f118..48ce061 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -752,12 +752,12 @@ remove_device (NMManager *manager, NMDevice *device)
g_signal_handlers_disconnect_matched (device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, manager);
nm_settings_device_removed (priv->settings, device);
+ priv->devices = g_slist_remove (priv->devices, device);
+
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
g_object_unref (device);
- priv->devices = g_slist_remove (priv->devices, device);
-
if (priv->startup)
check_if_startup_complete (manager);
}
--
1.9.0

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
From f6151a2d43f60414589910357cb6e4ee7cfa0f9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 12 Jun 2014 12:00:33 +0200
Subject: [PATCH] bluetooth: don't crash on switching off bluetooth
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reproducer:
- activate bluetooth on a computer and a phone
- pair the devices
- $ nmcli con add type blue con-name myphone bt-type panu addr 00:17:EA:84:E7:41
- turn off bluetooth on computer (either with a hardware or software switch)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/bluetooth/nm-bluez-device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/bluez-manager/nm-bluez-device.c b/src/bluez-manager/nm-bluez-device.c
index e04e8d4..d81343b 100644
--- a/src/bluez-manager/nm-bluez-device.c
+++ b/src/bluez-manager/nm-bluez-device.c
@@ -410,6 +410,8 @@ bluez_disconnect_cb (GDBusConnection *dbus_connection,
g_error_free (error);
} else
g_variant_unref (variant);
+
+ g_object_unref (NM_BLUEZ_DEVICE (user_data));
}
void
@@ -449,7 +451,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self)
10000,
NULL,
(GAsyncReadyCallback) bluez_disconnect_cb,
- self);
+ g_object_ref (self));
priv->connection_bt_type = NM_BT_CAPABILITY_NONE;
}
--
1.7.11.7

View File

@ -1,209 +0,0 @@
From 593f1aadec7536944efe21a1e8941ced4746df86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 21 Nov 2013 10:31:28 +0100
Subject: [PATCH 1/2] agents: fix removing requests from hash table while
iterating it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GLib-CRITICAL **: g_hash_table_iter_next: assertion 'ri->version == ri->hash_table->version' failed
It is not allowed to modify hash table while it is iterated. Unfortunately,
request_remove_agent() may remove the request from the 'requests' hash table,
making it not usable in the loop hash table looping.
We need to store the request into a temporary list and call request_next_agent()
on them later (after the hash loop).
Test case:
1. start NM and nm-applet
2. activate a Wi-Fi WPA connection
3. nm-applet displays a dialog asking for a password
4. kill nm-applet
5. NetworkManager removes the nm-applet's secret agent
and runs into removing the request from hash table in the
iterating loop (via get_complete_cb)
#0 get_complete_cb (parent=0x7f3f250f2970, secrets=0x0, agent_dbus_owner=0x0, agent_username=0x0, error=0x7f3f250f7830, user_data=0x7f3f25020e10)
at settings/nm-agent-manager.c:1111
#1 0x00007f3f23b46ea5 in req_complete_error (error=0x7f3f250f7830, req=0x7f3f250f2970) at settings/nm-agent-manager.c:509
#2 request_next_agent (req=0x7f3f250f2970) at settings/nm-agent-manager.c:615
#3 0x00007f3f23b48596 in request_remove_agent (agent=0x7f3f250f4a20, req=0x7f3f250f2970) at settings/nm-agent-manager.c:631
#4 remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:130
#5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374
#0 0x00007f3f1fb9c4e9 in g_logv (log_domain=0x7f3f1fbfef4e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff156b77c0) at gmessages.c:989
#1 0x00007f3f1fb9c63f in g_log (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL,
format=format@entry=0x7f3f1fc0889a "%s: assertion '%s' failed") at gmessages.c:1025
#2 0x00007f3f1fb9c679 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib",
pretty_function=pretty_function@entry=0x7f3f1fc03c30 <__PRETTY_FUNCTION__.4571> "g_hash_table_iter_next",
expression=expression@entry=0x7f3f1fc038f0 "ri->version == ri->hash_table->version") at gmessages.c:1034
#3 0x00007f3f1fb849c0 in g_hash_table_iter_next (iter=<optimized out>, key=<optimized out>, value=<optimized out>) at ghash.c:733
#4 0x00007f3f23b484e5 in remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:129
#5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/nm-agent-manager.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 89cfd30..8644293 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2010 - 2011 Red Hat, Inc.
+ * Copyright (C) 2010 - 2013 Red Hat, Inc.
*/
#include <config.h>
@@ -74,7 +74,9 @@ static void request_add_agent (Request *req,
NMSecretAgent *agent,
NMSessionMonitor *session_monitor);
-static void request_remove_agent (Request *req, NMSecretAgent *agent);
+static void request_remove_agent (Request *req, NMSecretAgent *agent, GSList **pending_reqs);
+
+static void request_next_agent (Request *req);
static void impl_agent_manager_register (NMAgentManager *self,
const char *identifier,
@@ -113,6 +115,7 @@ remove_agent (NMAgentManager *self, const char *owner)
NMSecretAgent *agent;
GHashTableIter iter;
gpointer data;
+ GSList *pending_reqs = NULL;
g_return_val_if_fail (owner != NULL, FALSE);
@@ -124,10 +127,17 @@ remove_agent (NMAgentManager *self, const char *owner)
nm_log_dbg (LOGD_AGENTS, "(%s) agent unregistered or disappeared",
nm_secret_agent_get_description (agent));
- /* Remove this agent to any in-progress secrets requests */
+ /* Remove this agent from any in-progress secrets requests */
g_hash_table_iter_init (&iter, priv->requests);
while (g_hash_table_iter_next (&iter, NULL, &data))
- request_remove_agent ((Request *) data, agent);
+ request_remove_agent ((Request *) data, agent, &pending_reqs);
+
+ /* We cannot call request_next_agent() from from within hash iterating loop,
+ * because it may remove the request from the hash table, which invalidates
+ * the iterator. So, only remove the agent from requests. And store the requests
+ * that should be sent to other agent to a temporary list to proceed afterwards.
+ */
+ g_slist_free_full (pending_reqs, (GDestroyNotify) request_next_agent);
/* And dispose of the agent */
g_hash_table_remove (priv->agents, owner);
@@ -619,7 +629,7 @@ request_next_agent (Request *req)
}
static void
-request_remove_agent (Request *req, NMSecretAgent *agent)
+request_remove_agent (Request *req, NMSecretAgent *agent, GSList **pending_reqs)
{
g_return_if_fail (req != NULL);
g_return_if_fail (agent != NULL);
@@ -629,7 +639,7 @@ request_remove_agent (Request *req, NMSecretAgent *agent)
if (agent == req->current) {
nm_log_dbg (LOGD_AGENTS, "(%s) current agent removed from secrets request %p/%s",
nm_secret_agent_get_description (agent), req, req->detail);
- request_next_agent (req);
+ *pending_reqs = g_slist_prepend (*pending_reqs, req);
} else {
nm_log_dbg (LOGD_AGENTS, "(%s) agent removed from secrets request %p/%s",
nm_secret_agent_get_description (agent), req, req->detail);
--
1.7.11.7
From 91a95dd9165023966b4377ad49cd8342eab5d776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 21 Nov 2013 13:40:04 +0100
Subject: [PATCH 2/2] agents: fix crash in nm_secret_agent_cancel_secrets()
(rh #922855)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When request for getting secrets is being freed in request_free(),
cancel_callback is get_cancel_cb(). It uses parent->current as a secret agent
object. However, this object can be already freed and thus there is a problem
getting priv in nm_secret_agent_cancel_secrets:
g_return_if_fail (self != NULL);
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
(gdb) p self
$66 = (NMSecretAgent *) 0x7fae9afd42e0
(gdb) p *self
$67 = {parent = {g_type_instance = {g_class = 0x0}, ref_count = 0, qdata = 0x0}}
#0 nm_secret_agent_cancel_secrets (self=0x7fae9afd42e0, call=0x1) at settings/nm-secret-agent.c:325
#1 0x00007fae9a774882 in request_free (req=0x7fae9afc48f0) at settings/nm-agent-manager.c:496
#2 0x00007fae967b251a in g_hash_table_remove_internal (hash_table=0x7fae9aefdf00, key=0x2, notify=1) at ghash.c:1276
#3 0x00007fae9a72b340 in dispose (object=0x7fae9af77200) at nm-activation-request.c:446
#4 0x00007fae96cbeee8 in g_object_unref (_object=0x7fae9af77200) at gobject.c:3160
#5 0x00007fae9a73d87c in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:359
#6 0x00007fae967c32a6 in g_main_dispatch (context=0x7fae9aedb180) at gmain.c:3066
#7 g_main_context_dispatch (context=context@entry=0x7fae9aedb180) at gmain.c:3642
#8 0x00007fae967c3628 in g_main_context_iterate (context=0x7fae9aedb180, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
#9 0x00007fae967c3a3a in g_main_loop_run (loop=0x7fae9aedb860) at gmain.c:3907
So we need to ref() 'agent' when adding it to pending list, so that the object
is not freed if the secret agent unregisters and is removed.
Test case:
1. run NM and nm-applet
2. activate a Wi-Fi network
3. nm-applet will ask for a password; ignore the popup window and kill nm-applet
4. start nm-applet again
5. click the same Wi-Fi network in nm-applet
6. NM will experience problems in nm_secret_agent_cancel_secrets() or crashes
(the procedure may not be 100%, but reproduces most of the time)
https://bugzilla.redhat.com/show_bug.cgi?id=922855
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/nm-agent-manager.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 8644293..7fb8aea 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -492,7 +492,7 @@ request_free (Request *req)
g_free (req->detail);
g_free (req->verb);
- g_slist_free (req->pending);
+ g_slist_free_full (req->pending, g_object_unref);
g_slist_free (req->asked);
memset (req, 0, sizeof (Request));
g_free (req);
@@ -582,7 +582,7 @@ request_add_agent (Request *req,
/* Add this agent to the list, preferring active sessions */
req->pending = g_slist_insert_sorted_with_data (req->pending,
- agent,
+ g_object_ref (agent),
(GCompareDataFunc) agent_compare_func,
session_monitor);
}
@@ -607,6 +607,8 @@ request_next_agent (Request *req)
if (req->pending) {
/* Send the request to the next agent */
req->current_call_id = NULL;
+ if (req->current)
+ g_object_unref (req->current);
req->current = req->pending->data;
req->pending = g_slist_remove (req->pending, req->current);
--
1.7.11.7

View File

@ -1,50 +0,0 @@
From d90b9ff2c855bf4350070957a72b267f7edb7898 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 31 Mar 2014 11:19:45 +0200
Subject: [PATCH] platform: fix setting preferred time for address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Before nm_platform_ip4_address_sync() set the preferred time to the same value
as the address lifetime. The result was that the preferred time was
always identical to valid lifetime.
This will lead to the kernel using the address longer then the desired
preferred time (until validity of the address expires).
https://bugzilla.redhat.com/show_bug.cgi?id=1082041
https://bugzilla.redhat.com/show_bug.cgi?id=1083283
Reported-by: Kai Engert <kengert@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0477477..c7e5d2b 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1354,7 +1354,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
guint32 shift = subtract_guint32 (now, known_address->timestamp + 5);
lifetime = subtract_guint32 (known_address->lifetime, shift);
- preferred = subtract_guint32 (known_address->lifetime, shift);
+ preferred = subtract_guint32 (known_address->preferred, shift);
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
@@ -1411,7 +1411,7 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses)
guint32 shift = subtract_guint32 (now, known_address->timestamp + 5);
lifetime = subtract_guint32 (known_address->lifetime, shift);
- preferred = subtract_guint32 (known_address->lifetime, shift);
+ preferred = subtract_guint32 (known_address->preferred, shift);
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
--
1.7.11.7

View File

@ -1,75 +0,0 @@
From 0103063caa63d4fa72ca6e78399569416465030d Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 29 Apr 2014 16:42:57 -0500
Subject: [PATCH 1/1] core: emit dhcp4/dhcp6-change dispatcher events if other
IP completes first (rh #1091296) (bgo #729284)
If IPv6 completes first it would emit the "up" dispatcher event with IPv6
details and move the device to ACTIVATED state. But if DHCPv4 was still
running, no dispatcher event would be emitted with the DHCPv4 information
until the first lease renew. Thus dispatcher scripts would not receive
DHCPv4 information for quite some time.
Ensure that if the other IP version completes first, that when the slower
method's DHCP completes, that it emits the appropriate dhcp4-change
or dhcp6-change event so that dispatcher scripts get the information
as soon as it's available.
https://bugzilla.gnome.org/show_bug.cgi?id=729284
(cherry picked from commit 11f9855223966c4fd927fe83e2cd9a623a74acad)
Conflicts:
src/devices/nm-device.c
---
src/devices/nm-device.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1e8704c..5fc6cb7 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4219,6 +4219,20 @@ nm_device_activate_ip4_config_commit (gpointer user_data)
}
}
+ /* If IPv4 wasn't the first to complete, and DHCP was used, then ensure
+ * dispatcher scripts get the DHCP lease information.
+ */
+ if ( priv->dhcp4_client
+ && nm_device_activate_ip4_state_in_conf (self)
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
+ /* Notify dispatcher scripts of new DHCP4 config */
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP4_CHANGE,
+ nm_device_get_connection (self),
+ self,
+ NULL,
+ NULL);
+ }
+
/* Enter the IP_CHECK state if this is the first method to complete */
priv->ip4_state = IP_DONE;
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
@@ -4297,6 +4311,20 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self);
if (ip6_config_merge_and_apply (self, TRUE, &reason)) {
+ /* If IPv6 wasn't the first IP to complete, and DHCP was used,
+ * then ensure dispatcher scripts get the DHCP lease information.
+ */
+ if ( priv->dhcp6_client
+ && nm_device_activate_ip6_state_in_conf (self)
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
+ /* Notify dispatcher scripts of new DHCP6 config */
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE,
+ nm_device_get_connection (self),
+ self,
+ NULL,
+ NULL);
+ }
+
/* Enter the IP_CHECK state if this is the first method to complete */
priv->ip6_state = IP_DONE;
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
--
1.9.3

View File

@ -1,61 +0,0 @@
From 92a4443a0f9645a6147ded3d3d799eb264c4af38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 14 Apr 2014 13:00:35 +0200
Subject: [PATCH 1/1] cli/bash-completion: escape spaces in profile names (rh
#1041901) (bgo #709426)
We need to escape spaces and quotes in connection names, so that a connection
name containing spaces (quotes) is regarded as a single argument by bash.
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
https://bugzilla.redhat.com/show_bug.cgi?id=1041901
https://bugzilla.gnome.org/show_bug.cgi?id=709426
(cherry picked from commit b911d663d8a9df739a9311efe99c21af362c5738)
---
cli/completion/nmcli | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/cli/completion/nmcli b/cli/completion/nmcli
index 9ed1c03..e5a1555 100644
--- a/cli/completion/nmcli
+++ b/cli/completion/nmcli
@@ -11,6 +11,36 @@ _nmcli_list_nl()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W '$1' -- $cur ) )
+
+ # Now escape special characters (spaces, single and double quotes),
+ # so that the argument is really regarded a single argument by bash.
+ # See http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
+ local escaped_single_quote="'\''"
+ local i=0
+ local entry
+ for entry in ${COMPREPLY[*]}
+ do
+ if [[ "${cur:0:1}" == "'" ]]; then
+ # started with single quote, escaping only other single quotes
+ # [']bla'bla"bla\bla bla --> [']bla'\''bla"bla\bla bla
+ COMPREPLY[$i]="${entry//\'/${escaped_single_quote}}"
+ elif [[ "${cur:0:1}" == '"' ]]; then
+ # started with double quote, escaping all double quotes and all backslashes
+ # ["]bla'bla"bla\bla bla --> ["]bla'bla\"bla\\bla bla
+ entry="${entry//\\/\\\\}"
+ entry="${entry//\"/\\\"}"
+ COMPREPLY[$i]="$entry"
+ else
+ # no quotes in front, escaping _everything_
+ # [ ]bla'bla"bla\bla bla --> [ ]bla\'bla\"bla\\bla\ bla
+ entry="${entry//\\/\\\\}"
+ entry="${entry//\'/\'}"
+ entry="${entry//\"/\\\"}"
+ entry="${entry// /\\ }"
+ COMPREPLY[$i]="$entry"
+ fi
+ (( i++ ))
+ done
}
_nmcli_con_id()
--
1.9.3

View File

@ -1,36 +0,0 @@
From c3f062a63a732d55abf7e090b13743677e81f214 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 2 Jul 2014 10:58:49 +0200
Subject: [PATCH 1/1] supplicant: fix crash passing invalid parameter to
AddBlob when adding network
The DBUS method 'AddBlob' expects a data argument of type 'ay'.
Instead we passed the hash table 'blobs'.
This must be broken for a long time and surprisingly stayed unnoticed.
https://mail.gnome.org/archives/networkmanager-list/2014-July/msg00001.html
Fixes: fb6cde508c1417765684ae940f72d639067ddf0a
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit e343c45ebbb7976e15241a241f2876de8619ca3c)
---
src/supplicant-manager/nm-supplicant-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c
index 4063085..e81dd61 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -1080,7 +1080,7 @@ add_network_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
self,
NULL,
DBUS_TYPE_STRING, name,
- DBUS_TYPE_G_UCHAR_ARRAY, blobs,
+ DBUS_TYPE_G_UCHAR_ARRAY, data,
G_TYPE_INVALID);
nm_call_store_add (priv->assoc_pcalls, priv->iface_proxy, call);
}
--
1.9.3

View File

@ -1,156 +0,0 @@
From e8be37613784c96c48c18e23790c7c246d2c750b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 17 Apr 2014 11:15:36 +0200
Subject: [PATCH 1/1] core: fix MTU handling while merging/subtracting IP
configs (bgo #721420)
https://bugzilla.gnome.org/show_bug.cgi?id=721420
https://bugzilla.redhat.com/show_bug.cgi?id=1047083
(cherry picked from commit 0757e33e746f0a203b4a4c5f386307e3a8ed9766)
Conflicts:
src/tests/test-ip4-config.c
---
src/nm-ip4-config.c | 12 ++++++++++-
src/tests/test-ip4-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index b7ae161..23be6d7 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2005 - 2013 Red Hat, Inc.
+ * Copyright (C) 2005 - 2014 Red Hat, Inc.
* Copyright (C) 2006 - 2008 Novell, Inc.
*/
@@ -386,9 +386,14 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src)
for (i = 0; i < nm_ip4_config_get_num_searches (src); i++)
nm_ip4_config_add_search (dst, nm_ip4_config_get_search (src, i));
+ /* MSS */
if (!nm_ip4_config_get_mss (dst))
nm_ip4_config_set_mss (dst, nm_ip4_config_get_mss (src));
+ /* MTU */
+ if (!nm_ip4_config_get_mtu (dst))
+ nm_ip4_config_set_mtu (dst, nm_ip4_config_get_mtu (src));
+
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++)
nm_ip4_config_add_nis_server (dst, nm_ip4_config_get_nis_server (src, i));
@@ -495,9 +500,14 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src)
}
}
+ /* MSS */
if (nm_ip4_config_get_mss (src) == nm_ip4_config_get_mss (dst))
nm_ip4_config_set_mss (dst, 0);
+ /* MTU */
+ if (nm_ip4_config_get_mtu (src) == nm_ip4_config_get_mtu (dst))
+ nm_ip4_config_set_mtu (dst, 0);
+
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++) {
guint32 src_nis = nm_ip4_config_get_nis_server (src, i);
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index fde4a40..1f2c968 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013 - 2014 Red Hat, Inc.
*
*/
@@ -116,6 +116,8 @@ test_subtract (void)
const char *expected_search = "somewhere.com";
guint32 expected_nis = addr_to_num ("1.2.3.13");
guint32 expected_wins = addr_to_num ("2.3.4.5");
+ guint32 expected_mss = 1400;
+ guint32 expected_mtu = 1492;
src = build_test_config ();
@@ -135,6 +137,9 @@ test_subtract (void)
nm_ip4_config_add_nis_server (dst, expected_nis);
nm_ip4_config_add_wins (dst, expected_wins);
+ nm_ip4_config_set_mss (dst, expected_mss);
+ nm_ip4_config_set_mtu (dst, expected_mtu);
+
nm_ip4_config_subtract (dst, src);
/* ensure what's left is what we expect */
@@ -169,10 +174,52 @@ test_subtract (void)
g_assert_cmpuint (nm_ip4_config_get_num_wins (dst), ==, 1);
g_assert_cmpuint (nm_ip4_config_get_wins (dst, 0), ==, expected_wins);
+ g_assert_cmpuint (nm_ip4_config_get_mss (dst), ==, expected_mss);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (dst), ==, expected_mtu);
+
g_object_unref (src);
g_object_unref (dst);
}
+static void
+test_merge_subtract_mss_mtu (void)
+{
+ NMIP4Config *cfg1, *cfg2, *cfg3;
+ guint32 expected_mss2 = 1400;
+ guint32 expected_mtu2 = 1492;
+ guint32 expected_mss3 = 555;
+ guint32 expected_mtu3 = 666;
+
+ cfg1 = build_test_config ();
+ cfg2 = build_test_config ();
+ cfg3 = build_test_config ();
+
+ /* add MSS, MTU to configs to test them */
+ nm_ip4_config_set_mss (cfg2, expected_mss2);
+ nm_ip4_config_set_mtu (cfg2, expected_mtu2);
+ nm_ip4_config_set_mss (cfg3, expected_mss3);
+ nm_ip4_config_set_mtu (cfg3, expected_mtu3);
+
+ nm_ip4_config_merge (cfg1, cfg2);
+ /* ensure MSS and MTU are in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+ nm_ip4_config_merge (cfg1, cfg3);
+ /* ensure again the same MSS and MTU are in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+ nm_ip4_config_subtract (cfg1, cfg2);
+ /* ensure MSS and MTU are zero in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, 0);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, 0);
+
+ g_object_unref (cfg1);
+ g_object_unref (cfg2);
+ g_object_unref (cfg3);
+}
+
/*******************************************/
int
@@ -183,6 +230,7 @@ main (int argc, char **argv)
g_type_init ();
g_test_add_func ("/ip4-config/subtract", test_subtract);
+ g_test_add_func ("/ip4-config/merge-subtract-mss-mtu", test_merge_subtract_mss_mtu);
return g_test_run ();
}
--
1.9.3

View File

@ -1,52 +0,0 @@
From f6f216f0a96942aaaacea26ffb7af72aab86f38c Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna@src.gnome.org>
Date: Mon, 17 Feb 2014 15:41:04 +0100
Subject: [PATCH] manager: fix notification of the connectivity property
Notify DBus clients at the end of a connectivity check, and when
NMConnectivity reports a change.
https://bugzilla.gnome.org/show_bug.cgi?id=724550
---
src/nm-manager.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 8d37f4b..3ae48c8 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -643,14 +643,15 @@ checked_connectivity (GObject *object, GAsyncResult *result, gpointer user_data)
connectivity = nm_connectivity_check_finish (priv->connectivity, result, NULL);
if (connectivity == NM_CONNECTIVITY_FULL)
set_state (manager, NM_STATE_CONNECTED_GLOBAL);
else if ( connectivity == NM_CONNECTIVITY_PORTAL
|| connectivity == NM_CONNECTIVITY_LIMITED)
set_state (manager, NM_STATE_CONNECTED_SITE);
+ g_object_notify (G_OBJECT (manager), NM_MANAGER_CONNECTIVITY);
}
g_object_unref (manager);
}
static void
nm_manager_update_state (NMManager *manager)
@@ -4286,14 +4287,15 @@ connectivity_changed (NMConnectivity *connectivity,
static const char *connectivity_states[] = { "UNKNOWN", "NONE", "PORTAL", "LIMITED", "FULL" };
state = nm_connectivity_get_state (connectivity);
nm_log_dbg (LOGD_CORE, "connectivity checking indicates %s",
connectivity_states[state]);
nm_manager_update_state (self);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_CONNECTIVITY);
}
static void
firmware_dir_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
--
1.9.3

View File

@ -1,104 +0,0 @@
From 570b9b362db0372e90d1598519132ce805a01d4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Fri, 11 Oct 2013 11:14:05 +0200
Subject: [PATCH] libnm-glib: fix a crash in nm_client_new() (rh #1010288)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check if 'client' is valid when calling _nm_object_ensure_inited().
Creation of NMClient object can fail, because its parent NMObject's
constructor() returns NULL for D-Bus errors.
https://bugzilla.redhat.com/show_bug.cgi?id=1010288
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-client.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index f34b685..15c708a 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2012 Red Hat, Inc.
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
*/
#include <dbus/dbus-glib.h>
@@ -1616,7 +1616,7 @@ nm_client_check_connectivity_finish (NMClient *client,
* control them. To access and modify network configuration data, use the
* #NMRemoteSettings object.
*
- * Returns: a new #NMClient
+ * Returns: a new #NMClient or NULL on an error
**/
NMClient *
nm_client_new (void)
@@ -1624,7 +1624,13 @@ nm_client_new (void)
NMClient *client;
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
- _nm_object_ensure_inited (NM_OBJECT (client));
+
+ /* NMObject's constructor() can fail on a D-Bus connection error. So we can
+ * get NULL here instead of a valid NMClient object.
+ */
+ if (client)
+ _nm_object_ensure_inited (NM_OBJECT (client));
+
return client;
}
@@ -1650,7 +1656,8 @@ client_inited (GObject *source, GAsyncResult *result, gpointer user_data)
*
* Creates a new #NMClient and begins asynchronously initializing it.
* @callback will be called when it is done; use
- * nm_client_new_finish() to get the result.
+ * nm_client_new_finish() to get the result. Note that on an error,
+ * the callback can be invoked with two first parameters as NULL.
*
* NOTE: #NMClient provides information about devices and a mechanism to
* control them. To access and modify network configuration data, use the
@@ -1664,8 +1671,16 @@ nm_client_new_async (GCancellable *cancellable,
NMClient *client;
GSimpleAsyncResult *simple;
- simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
+ /* When client is NULL, do no continue with initialization and run callback
+ * directly with result == NULL indicating NMClient creation failure.
+ */
+ if (!client) {
+ callback (NULL, NULL, user_data);
+ return;
+ }
+
+ simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
g_async_initable_init_async (G_ASYNC_INITABLE (client), G_PRIORITY_DEFAULT,
cancellable, client_inited, simple);
}
@@ -1684,6 +1699,16 @@ nm_client_new_finish (GAsyncResult *result, GError **error)
{
GSimpleAsyncResult *simple;
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (!result) {
+ g_set_error_literal (error,
+ NM_CLIENT_ERROR,
+ NM_CLIENT_ERROR_UNKNOWN,
+ "NMClient initialization failed (or you passed NULL 'result' by mistake)");
+ return NULL;
+ }
+
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, nm_client_new_async), NULL);
simple = G_SIMPLE_ASYNC_RESULT (result);
--
1.7.11.7

View File

@ -1,282 +0,0 @@
From 3b76ae18a52b44dbe577557e038fdc263edc5715 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@lanedo.com>
Date: Thu, 31 Oct 2013 09:14:13 +0100
Subject: [PATCH] modem-manager: if building systemd support, assume it manages
the MM lifecycle
We will not explicitly poke MM to start it if NetworkManager is built with
systemd support.
https://bugzilla.gnome.org/show_bug.cgi?id=703040
---
configure.ac | 3 ++
src/modem-manager/nm-modem-manager.c | 71 ++++++++++++++++++++++--------------
2 files changed, 47 insertions(+), 27 deletions(-)
diff --git a/configure.ac b/configure.ac
index 174b6bf..895ab09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -300,14 +300,17 @@ AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=
AS_IF([test -z "$with_systemdsystemunitdir" && $PKG_CONFIG systemd],
with_systemdsystemunitdir="\$(prefix)/lib/systemd/system")
AS_IF([test -z "$with_systemdsystemunitdir"], with_systemdsystemunitdir=no)
# add conditional and subst
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$with_systemdsystemunitdir" != no])
if test "$with_systemdsystemunitdir" != no; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd support is available])
+else
+ AC_DEFINE(HAVE_SYSTEMD, 0, [Define if systemd support is available])
fi
PKG_CHECK_MODULES(SYSTEMD_200, [systemd >= 200], [have_systemd_200=yes],[have_systemd_200=no])
AM_CONDITIONAL(HAVE_SYSTEMD_200, test "${have_systemd_200}" = "yes")
# session tracking support
AC_MSG_CHECKING([Session tracking support])
diff --git a/src/modem-manager/nm-modem-manager.c b/src/modem-manager/nm-modem-manager.c
index 427d98c..bb85b77 100644
--- a/src/modem-manager/nm-modem-manager.c
+++ b/src/modem-manager/nm-modem-manager.c
@@ -45,15 +45,15 @@ struct _NMModemManagerPrivate {
DBusGProxy *proxy;
guint poke_id;
#if WITH_MODEM_MANAGER_1
/* ModemManager >= 0.7 */
GDBusConnection *dbus_connection;
MMManager *modem_manager_1;
- guint modem_manager_1_poke_id;
+ guint modem_manager_1_launch_id;
gboolean old_modem_manager_found;
gboolean new_modem_manager_found;
guint modem_manager_1_name_owner_changed_id;
guint modem_manager_1_object_added_id;
guint modem_manager_1_object_removed_id;
#endif
@@ -355,17 +355,17 @@ modem_manager_1_clear_signals (NMModemManager *self)
self->priv->modem_manager_1_object_removed_id = 0;
}
}
static void
clear_modem_manager_1_support (NMModemManager *self)
{
- if (self->priv->modem_manager_1_poke_id) {
- g_source_remove (self->priv->modem_manager_1_poke_id);
- self->priv->modem_manager_1_poke_id = 0;
+ if (self->priv->modem_manager_1_launch_id) {
+ g_source_remove (self->priv->modem_manager_1_launch_id);
+ self->priv->modem_manager_1_launch_id = 0;
}
modem_manager_1_clear_signals (self);
g_clear_object (&self->priv->modem_manager_1);
g_clear_object (&self->priv->dbus_connection);
}
@@ -458,23 +458,28 @@ static void
modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
GParamSpec *pspec,
NMModemManager *self)
{
gchar *name_owner;
/* Quit poking, if any */
- if (self->priv->modem_manager_1_poke_id) {
- g_source_remove (self->priv->modem_manager_1_poke_id);
- self->priv->modem_manager_1_poke_id = 0;
+ if (self->priv->modem_manager_1_launch_id) {
+ g_source_remove (self->priv->modem_manager_1_launch_id);
+ self->priv->modem_manager_1_launch_id = 0;
}
name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (modem_manager_1));
if (!name_owner) {
nm_log_info (LOGD_MB, "ModemManager disappeared from bus");
+
+#if !HAVE_SYSTEMD
+ /* If not managed by systemd, schedule relaunch */
schedule_modem_manager_1_relaunch (self, 0);
+#endif
+
return;
}
/* Available! */
g_free (name_owner);
/* Hack alert: GDBusObjectManagerClient won't signal neither 'object-added'
@@ -486,14 +491,16 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
ensure_client (self);
/* Whenever GDBusObjectManagerClient is fixed, we can just do the following:
* modem_manager_1_available (self);
*/
}
+#if !HAVE_SYSTEMD
+
static void
modem_manager_1_poke_cb (GDBusConnection *connection,
GAsyncResult *res,
NMModemManager *self)
{
GError *error = NULL;
GVariant *result;
@@ -519,40 +526,50 @@ modem_manager_1_poke_cb (GDBusConnection *connection,
/* Balance refcount */
g_object_unref (self);
}
static void
modem_manager_1_poke (NMModemManager *self)
{
- gchar *name_owner;
-
/* If there is no current owner right away, ensure we poke to get one */
- name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->modem_manager_1));
- if (name_owner) {
- /* Available! */
- modem_manager_1_available (self);
- g_free (name_owner);
- return;
- }
-
- /* Poke! */
g_dbus_connection_call (self->priv->dbus_connection,
"org.freedesktop.ModemManager1",
"/org/freedesktop/ModemManager1",
"org.freedesktop.DBus.Peer",
"Ping",
NULL, /* inputs */
NULL, /* outputs */
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL, /* cancellable */
(GAsyncReadyCallback)modem_manager_1_poke_cb, /* callback */
g_object_ref (self)); /* user_data */
}
+#endif /* HAVE_SYSTEMD */
+
+static void
+modem_manager_1_check_name_owner (NMModemManager *self)
+{
+ gchar *name_owner;
+
+ name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->modem_manager_1));
+ if (name_owner) {
+ /* Available! */
+ modem_manager_1_available (self);
+ g_free (name_owner);
+ return;
+ }
+
+#if !HAVE_SYSTEMD
+ /* If the lifecycle is not managed by systemd, poke */
+ modem_manager_1_poke (self);
+#endif
+}
+
static void
manager_new_ready (GObject *source,
GAsyncResult *res,
NMModemManager *self)
{
/* Note we always get an extra reference to self here */
@@ -584,16 +601,16 @@ manager_new_ready (GObject *source,
G_CALLBACK (modem_object_added),
self);
self->priv->modem_manager_1_object_removed_id =
g_signal_connect (self->priv->modem_manager_1,
"object-removed",
G_CALLBACK (modem_object_removed),
self);
- /* Poke the MMManager! */
- modem_manager_1_poke (self);
+
+ modem_manager_1_check_name_owner (self);
}
/* Balance refcount */
g_object_unref (self);
}
static void
@@ -609,16 +626,16 @@ ensure_client (NMModemManager *self)
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START,
NULL,
(GAsyncReadyCallback)manager_new_ready,
g_object_ref (self));
return;
}
- /* If already available, poke! */
- modem_manager_1_poke (self);
+ /* If already available, recheck name owner! */
+ modem_manager_1_check_name_owner (self);
}
static void
bus_get_ready (GObject *source,
GAsyncResult *res,
NMModemManager *self)
{
@@ -632,27 +649,27 @@ bus_get_ready (GObject *source,
g_error_free (error);
/* Setup timeout to relaunch */
schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL);
} else if (self->priv->old_modem_manager_found) {
/* If we found the old MM, abort */
clear_modem_manager_1_support (self);
} else {
- /* Got the bus, create new ModemManager client. */
+ /* Got the bus, ensure client */
ensure_client (self);
}
/* Balance refcount */
g_object_unref (self);
}
static gboolean
ensure_bus (NMModemManager *self)
{
- /* Clear poke ID */
- self->priv->modem_manager_1_poke_id = 0;
+ /* Clear launch ID */
+ self->priv->modem_manager_1_launch_id = 0;
if (!self->priv->dbus_connection)
g_bus_get (G_BUS_TYPE_SYSTEM,
NULL,
(GAsyncReadyCallback)bus_get_ready,
g_object_ref (self));
else
@@ -666,17 +683,17 @@ static void
schedule_modem_manager_1_relaunch (NMModemManager *self,
guint n_seconds)
{
/* No need to pass an extra reference to self; timeout/idle will be
* cancelled if the object gets disposed. */
if (n_seconds)
- self->priv->modem_manager_1_poke_id = g_timeout_add_seconds (n_seconds, (GSourceFunc)ensure_bus, self);
+ self->priv->modem_manager_1_launch_id = g_timeout_add_seconds (n_seconds, (GSourceFunc)ensure_bus, self);
else
- self->priv->modem_manager_1_poke_id = g_idle_add ((GSourceFunc)ensure_bus, self);
+ self->priv->modem_manager_1_launch_id = g_idle_add ((GSourceFunc)ensure_bus, self);
}
#endif /* WITH_MODEM_MANAGER_1 */
/************************************************************************/
static void
--
1.9.3

View File

@ -1,235 +0,0 @@
From e554ef606f0dfd5ab07057824bb3d3dd52170228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Jun 2014 15:43:51 +0200
Subject: [PATCH] ifcfg-rh: write GATEWAY instead of GATEWAY0 to be
ifup-compatible (rh #771673)
https://bugzilla.redhat.com/show_bug.cgi?id=771673
https://bugzilla.redhat.com/show_bug.cgi?id=1105770
---
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 147 +++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 25 +++-
2 files changed, 168 insertions(+), 4 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 0e5be5d..ff45550 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -7408,6 +7408,153 @@ test_write_wired_8021x_tls (NMSetting802
}
static void
+test_write_gateway (void)
+{
+ NMConnection *connection, *reread;
+ NMSettingConnection *s_con;
+ NMSettingWired *s_wired;
+ NMSettingIP4Config *s_ip4;
+ NMSettingIP6Config *s_ip6;
+ char *uuid, *testfile = NULL, *val;
+ gboolean success;
+ GError *error = NULL;
+ shvarFile *f;
+ NMIP4Address *addr;
+ const char *ip1_str = "1.1.1.3";
+ const char *ip2_str = "2.2.2.5";
+ const char *gw1_str = "1.1.1.254";
+ const char *gw2_str = "2.2.2.254";
+ struct in_addr ip1, ip2, gw1, gw2;
+ const guint32 prefix = 24;
+
+ connection = nm_connection_new ();
+
+ /* Connection setting */
+ s_con = (NMSettingConnection *) nm_setting_connection_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_con));
+
+ uuid = nm_utils_uuid_generate ();
+ g_object_set (s_con,
+ NM_SETTING_CONNECTION_ID, "Test Write Static Addresses Gateway",
+ NM_SETTING_CONNECTION_UUID, uuid,
+ NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
+ NULL);
+ g_free (uuid);
+
+ /* Wired setting */
+ s_wired = (NMSettingWired *) nm_setting_wired_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_wired));
+
+ /* IP4 setting */
+ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_ip4));
+
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NULL);
+
+ inet_pton (AF_INET, ip1_str, &ip1);
+ inet_pton (AF_INET, ip2_str, &ip2);
+ inet_pton (AF_INET, gw1_str, &gw1);
+ inet_pton (AF_INET, gw2_str, &gw2);
+
+ addr = nm_ip4_address_new ();
+ nm_ip4_address_set_address (addr, ip1.s_addr);
+ nm_ip4_address_set_prefix (addr, prefix);
+ nm_ip4_address_set_gateway (addr, gw1.s_addr);
+ nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_ip4_address_unref (addr);
+
+ addr = nm_ip4_address_new ();
+ nm_ip4_address_set_address (addr, ip2.s_addr);
+ nm_ip4_address_set_prefix (addr, prefix);
+ nm_ip4_address_set_gateway (addr, gw2.s_addr);
+ nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_ip4_address_unref (addr);
+
+ success = nm_connection_verify (connection, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ /* IP6 setting */
+ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_ip6));
+ g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+
+ /* Save the ifcfg */
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &testfile,
+ &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ f = svNewFile (testfile);
+ g_assert (f);
+
+ /* re-read the file to check that the keys was written as IPADDR, GATEWAY and IPADDR1, GATEWAY1 */
+ val = svGetValue (f, "IPADDR", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, ip1_str);
+ g_free (val);
+
+ val = svGetValue (f, "IPADDR1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, ip2_str);
+ g_free (val);
+
+ val = svGetValue (f, "IPADDR0", FALSE);
+ g_assert (val == NULL);
+
+ val = svGetValue (f, "PREFIX", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, "24");
+ g_free (val);
+
+ val = svGetValue (f, "PREFIX1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, "24");
+ g_free (val);
+
+ val = svGetValue (f, "PREFIX0", FALSE);
+ g_assert (val == NULL);
+
+ val = svGetValue (f, "GATEWAY", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, gw1_str);
+ g_free (val);
+
+ val = svGetValue (f, "GATEWAY1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, gw2_str);
+ g_free (val);
+
+ val = svGetValue (f, "GATEWAY0", FALSE);
+ g_assert (val == NULL);
+
+ svCloseFile (f);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL,
+ NULL, NULL, NULL, NULL, &error, NULL);
+ unlink (testfile);
+ g_assert_no_error (error);
+ g_assert (reread);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT));
+
+ g_free (testfile);
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
+
+static void
test_write_wifi_open (void)
{
NMConnection *connection;
@@ -12643,6 +12790,7 @@ int main (int argc, char **argv)
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_NOT_SAVED);
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED);
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_BLOB, NM_SETTING_SECRET_FLAG_NONE);
+ g_test_add_func (TPATH "ipv4/write-static-addresses-GATEWAY", test_write_gateway);
test_write_wifi_open ();
test_write_wifi_open_hex_ssid ();
test_write_wifi_wep ();
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index f583366..b9c108c 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1718,22 +1718,41 @@ write_ip4_setting (NMConnection *connect
else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
svSetValue (ifcfg, "BOOTPROTO", "shared", FALSE);
- /* Write out IPADDR0 .. IPADDR255, PREFIX0 .. PREFIX255, GATEWAY0 .. GATEWAY255
- * Possible NETMASK<n> is removed only (it's obsolete) */
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ /* Clear out un-numbered IP address fields */
svSetValue (ifcfg, "IPADDR", NULL, FALSE);
svSetValue (ifcfg, "PREFIX", NULL, FALSE);
svSetValue (ifcfg, "NETMASK", NULL, FALSE);
svSetValue (ifcfg, "GATEWAY", NULL, FALSE);
+ /* Clear out zero-indexed IP address fields */
+ svSetValue (ifcfg, "IPADDR0", NULL, FALSE);
+ svSetValue (ifcfg, "PREFIX0", NULL, FALSE);
+ svSetValue (ifcfg, "NETMASK0", NULL, FALSE);
+ svSetValue (ifcfg, "GATEWAY0", NULL, FALSE);
+
+ /* Write out IPADDR0 .. IPADDR255, PREFIX0 .. PREFIX255, GATEWAY0 .. GATEWAY255
+ * Possible NETMASK<n> is removed only (it's obsolete) */
+ num = nm_setting_ip4_config_get_num_addresses (s_ip4);
for (i = 0; i < 256; i++) {
char buf[INET_ADDRSTRLEN];
NMIP4Address *addr;
guint32 ip;
- addr_key = g_strdup_printf ("IPADDR%d", i);
- prefix_key = g_strdup_printf ("PREFIX%d", i);
- netmask_key = g_strdup_printf ("NETMASK%d", i);
- gw_key = g_strdup_printf ("GATEWAY%d", i);
+ if (i == 0) {
+ /* Instead of index 0 use un-numbered variables.
+ * It's needed for compatibility with ifup that only recognizes 'GATEAWAY'
+ * See https://bugzilla.redhat.com/show_bug.cgi?id=771673
+ * and https://bugzilla.redhat.com/show_bug.cgi?id=1105770
+ */
+ addr_key = g_strdup ("IPADDR");
+ prefix_key = g_strdup ("PREFIX");
+ netmask_key = g_strdup ("NETMASK");
+ gw_key = g_strdup ("GATEWAY");
+ } else {
+ addr_key = g_strdup_printf ("IPADDR%d", i);
+ prefix_key = g_strdup_printf ("PREFIX%d", i);
+ netmask_key = g_strdup_printf ("NETMASK%d", i);
+ gw_key = g_strdup_printf ("GATEWAY%d", i);
+ }
if (i >= num) {
svSetValue (ifcfg, addr_key, NULL, FALSE);
--
1.9.3

View File

@ -1,127 +0,0 @@
From 01b1d3de8018087114455c60b9bac53dbbffc329 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 15:24:07 -0600
Subject: [PATCH] platform: don't replace routes that already exist
If a route already exists that matches the network, prefix, gateway,
and metric of a route NM would like to add, don't try to overwrite
the route.
Unlike IP addresses, the kernel doesn't update the details, it
appears to completely replace that route, which might screw up
external tools that added the route originally.
One example of this is IPSec via openswan/libreswan. They add the
routes to the kernel upon connection, and if NM replaces those routes,
IPSec no longer works. While this may be due to kernel bugs or
bad handling of route replacement, there's no reason for NM to touch
routes that it wouldn't materially change anyway.
(yes, we could perhaps use NLM_F_REPLACE in add_kernel_object() only
when we really wanted to replace something, but why ask the kernel
to do the work when it's not required anyway?)
(cherry picked from commit 8d9bfcdd5a1d8d716e8503f88e7b2e239408f667)
---
src/platform/nm-platform.c | 48 ++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index f5a4c9b..d40e652 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1484,6 +1484,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
GArray *routes;
NMPlatformIP4Route *route;
const NMPlatformIP4Route *known_route;
+ gboolean success;
int i;
/* Delete unknown routes */
@@ -1495,22 +1496,29 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
if (!array_contains_ip4_route (known_routes, route))
nm_platform_ip4_route_delete (ifindex, route->network, route->plen, route->metric);
}
- g_array_free (routes, TRUE);
- if (!known_routes)
+ if (!known_routes) {
+ g_array_free (routes, TRUE);
return TRUE;
+ }
/* Add missing routes */
- for (i = 0; i < known_routes->len; i++) {
+ for (i = 0, success = TRUE; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP4Route, i);
- if (!nm_platform_ip4_route_add (ifindex,
- known_route->network, known_route->plen, known_route->gateway,
- known_route->metric, known_route->mss))
- return FALSE;
+ /* Ignore routes that already exist */
+ if (!array_contains_ip4_route (routes, known_route)) {
+ success = nm_platform_ip4_route_add (ifindex,
+ known_route->network,
+ known_route->plen,
+ known_route->gateway,
+ known_route->metric,
+ known_route->mss);
+ }
}
- return TRUE;
+ g_array_free (routes, TRUE);
+ return success;
}
/**
@@ -1530,6 +1538,7 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
GArray *routes;
NMPlatformIP6Route *route;
const NMPlatformIP6Route *known_route;
+ gboolean success;
int i;
/* Delete unknown routes */
@@ -1541,22 +1550,29 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
if (!array_contains_ip6_route (known_routes, route))
nm_platform_ip6_route_delete (ifindex, route->network, route->plen, route->metric);
}
- g_array_free (routes, TRUE);
- if (!known_routes)
+ if (!known_routes) {
+ g_array_free (routes, TRUE);
return TRUE;
+ }
/* Add missing routes */
- for (i = 0; i < known_routes->len; i++) {
+ for (i = 0, success = TRUE; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP6Route, i);
- if (!nm_platform_ip6_route_add (ifindex,
- known_route->network, known_route->plen, known_route->gateway,
- known_route->metric, known_route->mss))
- return FALSE;
+ /* Ignore routes that already exist */
+ if (!array_contains_ip6_route (routes, known_route)) {
+ success = nm_platform_ip6_route_add (ifindex,
+ known_route->network,
+ known_route->plen,
+ known_route->gateway,
+ known_route->metric,
+ known_route->mss);
+ }
}
- return TRUE;
+ g_array_free (routes, TRUE);
+ return success;
}
gboolean
--
1.9.3

File diff suppressed because it is too large Load Diff

View File

@ -1,336 +0,0 @@
From 98bcbd2d2417e965f673220e8ec087a8d3b22ad5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 5 Dec 2013 12:11:36 +0100
Subject: [PATCH] libnm-util: don't touch dhcp-send-hostname when setting
dhcp-hostname (rh #1001529)
It is better to leave it to user whether he wants to enable sending hostname,
because he probably disabled it manually (dhcp-send-hostname is TRUE by default).
Also, this would not work for plugins that read and set dhcp-hostname after
dhcp-send-hostname.
https://bugzilla.redhat.com/show_bug.cgi?id=1001529
---
libnm-util/nm-setting-ip4-config.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c
index 5fd1cfd..b019a14 100644
--- a/libnm-util/nm-setting-ip4-config.c
+++ b/libnm-util/nm-setting-ip4-config.c
@@ -904,17 +904,14 @@ set_property (GObject *object, guint prop_id,
break;
case PROP_DHCP_SEND_HOSTNAME:
priv->dhcp_send_hostname = g_value_get_boolean (value);
break;
case PROP_DHCP_HOSTNAME:
g_free (priv->dhcp_hostname);
priv->dhcp_hostname = g_value_dup_string (value);
- /* FIXME: Is this a good idea? */
- if (priv->dhcp_hostname)
- priv->dhcp_send_hostname = TRUE;
break;
case PROP_NEVER_DEFAULT:
priv->never_default = g_value_get_boolean (value);
break;
case PROP_MAY_FAIL:
priv->may_fail = g_value_get_boolean (value);
break;
--
1.9.3
From 97af7e6ee58d8b419bc93f5d9b789b342c61a727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 5 Dec 2013 14:27:08 +0100
Subject: [PATCH] ifcfg-rh: read/write dhcp-send-hostname as DHCP_SEND_HOSTNAME
(rh #1001529)
It is an extension compared to initscripts (not in sysconfig.txt). But it is
necessary for preserving dhcp-send-hostname. Missing DHCP_SEND_HOSTNAME is
treated as "yes", which matches dhcp-send-hostname default value being TRUE.
https://bugzilla.redhat.com/show_bug.cgi?id=1001529
---
src/settings/plugins/ifcfg-rh/reader.c | 8 ++-
.../ifcfg-rh/tests/network-scripts/Makefile.am | 1 +
.../ifcfg-test-wired-dhcp-send-hostname | 12 ++++
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 70 ++++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 9 ++-
5 files changed, 97 insertions(+), 3 deletions(-)
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index e2cff0b..2c808cf 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -11,15 +11,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2008 - 2012 Red Hat, Inc.
+ * Copyright (C) 2008 - 2013 Red Hat, Inc.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -1361,15 +1361,19 @@ make_ip4_setting (shvarFile *ifcfg,
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: duplicate IP4 address");
nm_ip4_address_unref (addr);
}
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value,
+ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
+ svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
+ NULL);
g_free (value);
value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);
if (value && strlen (value))
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL);
g_free (value);
}
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
index a7d009e..113c5ca 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -4,14 +4,15 @@ EXTRA_DIST = \
EXTRA_DIST = \
ifcfg-test-minimal \
ifcfg-test-variables-corner-cases-1 \
ifcfg-test-nm-controlled \
ifcfg-test-wired-static \
ifcfg-test-wired-static-bootproto \
ifcfg-test-wired-dhcp \
+ ifcfg-test-wired-dhcp-send-hostname \
ifcfg-test-wired-dhcp6-only \
ifcfg-test-wired-global-gateway \
network-test-wired-global-gateway \
ifcfg-test-wired-never-default \
network-test-wired-never-default \
ifcfg-test-wired-defroute-no \
ifcfg-test-wired-defroute-no-gatewaydev-yes \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
new file mode 100644
index 0000000..cba380d
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
@@ -0,0 +1,12 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Ethernet
+DEVICE=eth0
+HWADDR=00:11:22:33:44:ee
+BOOTPROTO=dhcp
+ONBOOT=yes
+IPV6INIT=yes
+IPV6_AUTOCONF=yes
+USERCTL=yes
+NM_CONTROLLED=yes
+PEERDNS=no
+DHCP_HOSTNAME="svata-pulec"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 14c4fb9..771cf17 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -6558,14 +6558,80 @@ test_write_wired_dhcp_plus_ip (void)
g_free (routefile);
g_free (route6file);
g_object_unref (connection);
g_object_unref (reread);
}
static void
+test_read_write_wired_dhcp_send_hostname (void)
+{
+ NMConnection *connection, *reread;
+ NMSettingIP4Config *s_ip4;
+ NMSettingIP6Config *s_ip6;
+ const char * dhcp_hostname = "kamil-patka";
+ char *written = NULL;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp-send-hostname",
+ NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ g_assert_no_error (error);
+ g_assert (connection != NULL);
+
+ /* Check dhcp-hostname and dhcp-send-hostname */
+ s_ip4 = nm_connection_get_setting_ip4_config (connection);
+ s_ip6 = nm_connection_get_setting_ip6_config (connection);
+ g_assert (s_ip4);
+ g_assert (s_ip6);
+ g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == TRUE);
+ g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec");
+ g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec");
+
+ /* Set dhcp-send-hostname=false dhcp-hostname="kamil-patka" and write the connection. */
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &written,
+ &error);
+ g_assert (success);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (written, NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ unlink (written);
+ g_free (written);
+
+ g_assert_no_error (error);
+ g_assert (reread != NULL);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT);
+ g_assert (success);
+
+ /* Check dhcp-hostname and dhcp-send-hostname from the re-read connection. */
+ s_ip4 = nm_connection_get_setting_ip4_config (reread);
+ s_ip6 = nm_connection_get_setting_ip6_config (reread);
+ g_assert (s_ip4);
+ g_assert (s_ip6);
+ g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname);
+ g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname);
+
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
+static void
test_write_wired_static_ip6_only (void)
{
NMConnection *connection;
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4;
@@ -13211,14 +13280,15 @@ int main (int argc, char **argv)
g_test_add_data_func (TPATH "static-ip6-only-gw/::", "::", test_write_wired_static_ip6_only_gw);
g_test_add_data_func (TPATH "static-ip6-only-gw/2001:db8:8:4::2", "2001:db8:8:4::2", test_write_wired_static_ip6_only_gw);
g_test_add_data_func (TPATH "static-ip6-only-gw/ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255", "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255", test_write_wired_static_ip6_only_gw);
test_read_wired_static (TEST_IFCFG_WIRED_STATIC, "System test-wired-static", TRUE);
test_read_wired_static (TEST_IFCFG_WIRED_STATIC_BOOTPROTO, "System test-wired-static-bootproto", FALSE);
test_read_wired_dhcp ();
+ g_test_add_func (TPATH "dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname);
test_read_wired_global_gateway ();
test_read_wired_never_default ();
test_read_wired_defroute_no ();
test_read_wired_defroute_no_gatewaydev_yes ();
test_read_wired_static_routes ();
test_read_wired_static_routes_legacy ();
test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_1, "System test-wired-ipv4-manual-1");
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 6f302b4..604d492 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -11,15 +11,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2009 - 2013 Red Hat, Inc.
*/
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -1967,14 +1967,21 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
nm_setting_ip4_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
FALSE);
value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4);
if (value)
svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE);
+ /* Missing DHCP_SEND_HOSTNAME means TRUE, and we prefer not write it explicitly
+ * in that case, because it is NM-specific variable
+ */
+ svSetValue (ifcfg, "DHCP_SEND_HOSTNAME",
+ nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
+ FALSE);
+
value = nm_setting_ip4_config_get_dhcp_client_id (s_ip4);
if (value)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
}
svSetValue (ifcfg, "IPV4_FAILURE_FATAL",
nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes",
--
1.9.3
From 0b3fdd073e8665f04f480cda50df7b11955bfd80 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 16:20:48 -0600
Subject: [PATCH] ifcfg-rh: fix handling of DHCP_SEND_HOSTNAME when no hostname
is given
Move DHCP_SEND_HOSTNAME parsing out of the check for DHCP_HOSTNAME so that
users can disable NM sending the system hostname to the DHCP server when
DHCP_HOSTNAME is not defined.
---
src/settings/plugins/ifcfg-rh/reader.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 2c808cf..1650b84 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -1361,21 +1361,22 @@ make_ip4_setting (shvarFile *ifcfg,
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: duplicate IP4 address");
nm_ip4_address_unref (addr);
}
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
- g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value,
- NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
- svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
- NULL);
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
g_free (value);
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
+ svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
+ NULL);
+
value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);
if (value && strlen (value))
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL);
g_free (value);
}
/* DNS servers
--
1.9.3

View File

@ -1,130 +0,0 @@
commit 09bde40f02c2a02f9503ca0ae430753ca81c1792
Author: Dan Williams <dcbw@redhat.com>
Date: Wed Oct 9 13:55:05 2013 -0500
core: fix PropertiesChanged signals for IP-related properties
To present a consistent API to clients, the IP-related properties
are only valid when the device has finished IP configuration. But
they are set before that happens, and their change notifications
were emitted before the IP configuration was considered valid.
Re-emit the change notifications when the device enters the IP_CHECK
state (and thus has IP configuration) and also when the device
deactivates to enusre clients have up-to-date IP-related property
information.
For the changes to has_ip_config(), the priv->ipX_state checks are
not necessary since the device will have valid IP configuration
when it enters the IP_CHECK state. The other checks can be
consolidated into a single statement.
Acked-by: Dan Winship
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 6810afc..4d61c6a 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5282,18 +5282,11 @@ set_property (GObject *object, guint prop_id,
}
static gboolean
-has_ip_config (NMDevice *self)
+ip_config_valid (NMDeviceState state)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
-
- if (priv->ip4_state != IP_DONE && priv->ip6_state != IP_DONE)
- return FALSE;
-
- if (priv->state == NM_DEVICE_STATE_UNMANAGED)
- return TRUE;
-
- return (priv->state >= NM_DEVICE_STATE_IP_CONFIG
- && priv->state <= NM_DEVICE_STATE_DEACTIVATING);
+ return (state == NM_DEVICE_STATE_UNMANAGED) ||
+ (state >= NM_DEVICE_STATE_IP_CHECK &&
+ state <= NM_DEVICE_STATE_DEACTIVATING);
}
static void
@@ -5315,7 +5308,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->iface);
break;
case PROP_IP_IFACE:
- if (has_ip_config (self))
+ if (ip_config_valid (priv->state))
g_value_set_string (value, nm_device_get_ip_iface (self));
else
g_value_set_string (value, NULL);
@@ -5342,25 +5335,25 @@ get_property (GObject *object, guint prop_id,
g_value_set_boolean (value, priv->carrier);
break;
case PROP_IP4_CONFIG:
- if (has_ip_config (self) && priv->ip4_config)
+ if (ip_config_valid (priv->state) && priv->ip4_config)
g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_DHCP4_CONFIG:
- if (has_ip_config (self) && priv->dhcp4_client)
+ if (ip_config_valid (priv->state) && priv->dhcp4_client)
g_value_set_boxed (value, nm_dhcp4_config_get_dbus_path (priv->dhcp4_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_IP6_CONFIG:
- if (has_ip_config (self) && priv->ip6_config)
+ if (ip_config_valid (priv->state) && priv->ip6_config)
g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_DHCP6_CONFIG:
- if (has_ip_config (self) && priv->dhcp6_client)
+ if (ip_config_valid (priv->state) && priv->dhcp6_client)
g_value_set_boxed (value, nm_dhcp6_config_get_dbus_path (priv->dhcp6_config));
else
g_value_set_boxed (value, "/");
@@ -5918,6 +5911,16 @@ state_implies_pending_action (NMDeviceState state)
return "unknown";
}
+static void
+notify_ip_properties (NMDevice *device)
+{
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP_IFACE);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP4_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP6_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG);
+}
+
void
nm_device_state_changed (NMDevice *device,
NMDeviceState state,
@@ -6077,6 +6080,11 @@ nm_device_state_changed (NMDevice *device,
break;
case NM_DEVICE_STATE_IP_CHECK:
nm_device_start_ip_check (device);
+
+ /* IP-related properties are only valid when the device has IP configuration;
+ * now that it does, ensure their change notifications are emitted.
+ */
+ notify_ip_properties (device);
break;
case NM_DEVICE_STATE_SECONDARIES:
ip_check_gw_ping_cleanup (device);
@@ -6093,6 +6101,12 @@ nm_device_state_changed (NMDevice *device,
if (old_state == NM_DEVICE_STATE_ACTIVATED)
nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device, NULL, NULL);
+ /* IP-related properties are only valid when the device has IP configuration.
+ * If it no longer does, ensure their change notifications are emitted.
+ */
+ if (ip_config_valid (old_state) && !ip_config_valid (state))
+ notify_ip_properties (device);
+
/* Dispose of the cached activation request */
if (req)
g_object_unref (req);

View File

@ -1,4 +1,10 @@
# Enable connectivity checking for NetworkManager.
# See `man NetworkManager.conf`.
#
# Note that connectivity checking works badly with rp_filter set to
# strict. Check "/proc/sys/net/ipv4/conf/*/rp_filter".
[connectivity]
enabled=true
uri=http://fedoraproject.org/static/hotspot.txt
response=OK
interval=300

View File

@ -0,0 +1,10 @@
# Enable connectivity checking for NetworkManager.
# See `man NetworkManager.conf`.
#
# Note that connectivity checking works badly with rp_filter set to
# strict. Check "/proc/sys/net/ipv4/conf/*/rp_filter".
[connectivity]
enabled=true
uri=http://static.redhat.com/test/rhel-networkmanager.txt
response=OK
interval=300

15
70-nm-connectivity.conf Normal file
View File

@ -0,0 +1,15 @@
# The Strict mode of RFC3704 Reverse Path filtering breaks some pretty
# common and reasonable use cases.
#
# Notably, it makes it impossible for NetworkManager to do connectivity
# check on a newly arriving default route (it starts with a higher metric
# and is bumped lower if there's connectivity).
#
# Kernel's default is 0 (no filter), systemd configures a Loose filter since
# commit 230450d4e4f1 ('sysctl.d: switch net.ipv4.conf.all.rp_filter from 1
# to 2'). However, RHEL systemd package happens to default to Strict mode
# for historic reasons. Let's override it if we're doing connectivity
# checking.
# Source route verification
net.ipv4.conf.all.rp_filter = 0

View File

@ -1,67 +0,0 @@
From 7481c64ad5068130d92066b1155e6933f8c39655 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Mon, 16 Dec 2013 14:42:40 -0500
Subject: [PATCH] systemd: add "Before=network.service" on Fedora/RHEL (rh
#1034983)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On Fedora/RHEL, NetworkManager.service needs to be started before
network.service, or else network.service may try to bring up NM's
devices itself.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
configure.ac | 6 ++++++
data/Makefile.am | 3 ++-
data/NetworkManager.service.in | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f19b9ad..b525de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,12 @@ AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test "$enable_ifcfg_rh" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_SUSE, test "$enable_ifcfg_suse" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test "$enable_ifupdown" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFNET, test "$enable_ifnet" = "yes")
+
+if test "$enable_ifcfg_rh" = "yes"; then
+ DISTRO_NETWORK_SERVICE=network.service
+fi
+AC_SUBST(DISTRO_NETWORK_SERVICE)
+
# Code coverage
GNOME_CODE_COVERAGE
diff --git a/data/Makefile.am b/data/Makefile.am
index df93f27..29011ef 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -38,7 +38,8 @@ edit = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
- -e 's|@libexecdir[@]|$(libexecdir)|g'
+ -e 's|@libexecdir[@]|$(libexecdir)|g' \
+ -e 's|@DISTRO_NETWORK_SERVICE[@]|$(DISTRO_NETWORK_SERVICE)|g'
EXTRA_DIST = \
NetworkManager.service.in \
diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in
index 8ceefad..84a9c95 100644
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Network Manager
Wants=network.target
-Before=network.target
+Before=network.target @DISTRO_NETWORK_SERVICE@
[Service]
Type=dbus
--
1.7.11.7

View File

@ -1,2 +1,52 @@
# Configuration file for NetworkManager.
#
# See "man 5 NetworkManager.conf" for details.
#
# The directories /usr/lib/NetworkManager/conf.d/ and /run/NetworkManager/conf.d/
# can contain additional .conf snippets installed by packages. These files are
# read before NetworkManager.conf and have thus lowest priority.
# The directory /etc/NetworkManager/conf.d/ can contain additional .conf
# snippets. Those snippets are merged last and overwrite the settings from this main
# file.
#
# The files within one conf.d/ directory are read in asciibetical order.
#
# You can prevent loading a file /usr/lib/NetworkManager/conf.d/NAME.conf
# by having a file NAME.conf in either /run/NetworkManager/conf.d/ or /etc/NetworkManager/conf.d/.
# Likewise, snippets from /run can be prevented from loading by placing
# a file with the same name in /etc/NetworkManager/conf.d/.
#
# If two files define the same key, the one that is read afterwards will overwrite
# the previous one.
[main]
plugins=ifcfg-rh
#plugins=keyfile,ifcfg-rh
[logging]
# When debugging NetworkManager, enabling debug logging is of great help.
#
# Logfiles contain no passwords and little sensitive information. But please
# check before posting the file online. You can also personally hand over the
# logfile to a NM developer to treat it confidential. Meet us on #nm on Libera.Chat.
#
# You can also change the log-level at runtime via
# $ nmcli general logging level TRACE domains ALL
# However, usually it's cleaner to enable debug logging
# in the configuration and restart NetworkManager so that
# debug logging is enabled from the start.
#
# You will find the logfiles in syslog, for example via
# $ journalctl -u NetworkManager
#
# Please post full logfiles for bug reports without pre-filtering or truncation.
# Also, for debugging the entire `journalctl` output can be interesting. Don't
# limit unnecessarily with `journalctl -u`. Exceptions are if you are worried
# about private data. Check before posting logfiles!
#
# Note that debug logging of NetworkManager can be quite verbose. Some messages
# might be rate-limited by the logging daemon (see RateLimitIntervalSec, RateLimitBurst
# in man journald.conf). Please disable rate-limiting before collecting debug logs!
#
#level=TRACE
#domains=ALL

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +0,0 @@
From ff350c04c0546383841126ea43bed93d302482fb Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Tue, 28 Jan 2014 08:39:11 -0500
Subject: [PATCH] core: fix crash when connecting to new Wi-Fi network (bgo
#723163)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the user is AddAndActivating a new network, the connection may not
have an NMSettingConnection yet, but we know that once it does, the
user will be authorized.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-manager-auth.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/nm-manager-auth.c b/src/nm-manager-auth.c
index 7452bc3..7f8b313 100644
--- a/src/nm-manager-auth.c
+++ b/src/nm-manager-auth.c
@@ -535,9 +535,6 @@ nm_auth_uid_in_acl (NMConnection *connection,
if (0 == uid)
return TRUE;
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
-
/* Reject the request if the request comes from no session at all */
if (!nm_session_monitor_uid_has_session (smon, uid, &user, &local)) {
if (out_error_desc) {
@@ -555,6 +552,14 @@ nm_auth_uid_in_acl (NMConnection *connection,
return FALSE;
}
+ s_con = nm_connection_get_setting_connection (connection);
+ if (!s_con) {
+ /* This can only happen when called from AddAndActivate, so we know
+ * the user will be authorized when the connection is completed.
+ */
+ return TRUE;
+ }
+
/* Match the username returned by the session check to a user in the ACL */
if (!nm_setting_connection_permissions_user_allowed (s_con, user)) {
if (out_error_desc)
--
1.7.11.7

View File

@ -1,94 +0,0 @@
From 13f4a00d4d490fb65f93c246d1c93ed56a47213f Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 23 Jan 2014 13:02:16 -0600
Subject: [PATCH] core: only log about IPv6 Commit the first time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since IPv6 configuration gets updated every time a router advertisement
comes in, it can lead NM to continuously logging:
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) scheduled...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) started...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) complete.
that's annoying. So after the initial configuration is done, make
subsequent IPv6 Commit log messages debug instead of info.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 035434e..4684efe 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -335,8 +335,6 @@ static gboolean nm_device_set_ip6_config (NMDevice *dev,
gboolean commit,
NMDeviceStateReason *reason);
-static gboolean nm_device_activate_ip6_config_commit (gpointer user_data);
-
static gboolean check_connection_available (NMDevice *device, NMConnection *connection);
static gboolean spec_match_list (NMDevice *device, const GSList *specs);
@@ -4232,6 +4230,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
NMActRequest *req;
const char *iface;
NMConnection *connection;
@@ -4241,8 +4240,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
activation_source_clear (self, FALSE, AF_INET6);
iface = nm_device_get_iface (self);
- nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...",
- iface);
+ nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...", iface);
req = nm_device_get_act_request (self);
g_assert (req);
@@ -4262,14 +4260,13 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
} else {
- nm_log_info (LOGD_DEVICE | LOGD_IP6,
+ nm_log_warn (LOGD_DEVICE | LOGD_IP6,
"Activation (%s) Stage 5 of 5 (IPv6 Commit) failed",
iface);
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
}
- nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.",
- iface);
+ nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.", iface);
return FALSE;
}
@@ -4277,13 +4274,16 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
void
nm_device_activate_schedule_ip6_config_result (NMDevice *self)
{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
+
g_return_if_fail (NM_IS_DEVICE (self));
activation_source_schedule (self, nm_device_activate_ip6_config_commit, AF_INET6);
- nm_log_info (LOGD_DEVICE | LOGD_IP6,
- "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
- nm_device_get_iface (self));
+ nm_log (LOGD_DEVICE | LOGD_IP6, level,
+ "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
+ nm_device_get_iface (self));
}
gboolean
--
1.7.11.7

View File

@ -1,45 +0,0 @@
From 3391fa810ca323203b036a68af7f3c5802280918 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 10:03:44 +0100
Subject: [PATCH] libnm-glib: export missing get_gateway() and get_searches()
functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
They were added by db9b7e10aca5456ec4960b75617e032209b98bc1 commit.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index cb7b599..bf69db4 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -215,8 +215,10 @@ global:
nm_dhcp6_config_new;
nm_ip4_config_get_addresses;
nm_ip4_config_get_domains;
+ nm_ip4_config_get_gateway;
nm_ip4_config_get_nameservers;
nm_ip4_config_get_routes;
+ nm_ip4_config_get_searches;
nm_ip4_config_get_type;
nm_ip4_config_get_wins_servers;
nm_ip4_config_new;
@@ -224,8 +226,10 @@ global:
nm_ip6_address_object_array_get_type;
nm_ip6_config_get_addresses;
nm_ip6_config_get_domains;
+ nm_ip6_config_get_gateway;
nm_ip6_config_get_nameservers;
nm_ip6_config_get_routes;
+ nm_ip6_config_get_searches;
nm_ip6_config_get_type;
nm_ip6_config_new;
nm_ip6_route_object_array_get_type;
--
1.7.11.7

View File

@ -1,53 +0,0 @@
From 87041545b40fd0c0cfae16a8e605552b7715dc15 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 4 Oct 2013 23:38:31 -0500
Subject: [PATCH] ifcfg-rh: fix ignoring updates that don't change anything
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
connection_from_file() requires the 'error' parameter. Not passing a
valid 'error' parameter causes the function to fail and return NULL,
which mean that commit_changes() would always re-write the connection
instead of ignoring commits where nothing has actually changed.
connection_from_file() no longer requires the unmanaged, keyfile,
or routefile parameters, so remove them.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
index 3788149..d3b93c9 100644
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
@@ -246,7 +246,6 @@ commit_changes (NMSettingsConnection *connection,
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
GError *error = NULL;
NMConnection *reread;
- char *unmanaged = NULL, *keyfile = NULL, *routefile = NULL, *route6file = NULL;
gboolean same = FALSE, success = FALSE;
char *ifcfg_path = NULL;
@@ -256,13 +255,9 @@ commit_changes (NMSettingsConnection *connection,
*/
if (priv->path) {
reread = connection_from_file (priv->path, NULL, NULL, NULL,
- &unmanaged, &keyfile, &routefile, &route6file,
- NULL, NULL);
- g_free (unmanaged);
- g_free (keyfile);
- g_free (routefile);
- g_free (route6file);
-
+ NULL, NULL, NULL, NULL,
+ &error, NULL);
+ g_clear_error (&error);
if (reread) {
same = nm_connection_compare (NM_CONNECTION (connection),
reread,
--
1.7.11.7

View File

@ -1,32 +0,0 @@
From 041f449a910a48716bc88fa56287c4213a2dcb11 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 22 Jan 2014 13:20:18 -0500
Subject: [PATCH] platform: fix linux nm_platform_link_get_physical_port_id()
(rh #804527)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It was reading the wrong property name
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-linux-platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 83cbc49..8e85c59 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1765,7 +1765,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
if (!ifname)
return NULL;
- path = g_strdup_printf ("/sys/class/net/%s/physical_port_id", ifname);
+ path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
if (g_file_test (path, G_FILE_TEST_EXISTS))
id = sysctl_get (platform, path);
else
--
1.7.11.7

View File

@ -1,98 +0,0 @@
From 85272df6eb89682a3d13022281085b97527955e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 15:40:22 +0100
Subject: [PATCH] examples: update get_ips.py python example for DNS
information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
examples/python/gi/get_ips.py | 44 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/examples/python/gi/get_ips.py b/examples/python/gi/get_ips.py
index b1e59e2..6903b6d 100755
--- a/examples/python/gi/get_ips.py
+++ b/examples/python/gi/get_ips.py
@@ -24,8 +24,8 @@ import sys, socket, struct
from gi.repository import GLib, NetworkManager, NMClient
#
-# This example shows how to get get addresses and routes from NMIP4Config and NMIP6Config
-# (got out of NMDevice)
+# This example shows how to get addresses, routes and DNS information
+# from NMIP4Config and NMIP6Config (got out of NMDevice)
#
def show_addresses(self, family):
@@ -59,7 +59,6 @@ def show_addresses(self, family):
socket.inet_ntop(family, gateway_struct))
-
def show_routes(self, family):
if (family == socket.AF_INET):
ip_cfg = self.get_ip4_config()
@@ -70,7 +69,7 @@ def show_routes(self, family):
print("None")
return
- nm_routes = ip_cfg.get_routes()
+ nm_routes = ip_cfg.get_routes()
if len(nm_routes) == 0:
print("None")
return
@@ -93,6 +92,33 @@ def show_routes(self, family):
metric)
+def show_dns(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ if (family == socket.AF_INET):
+ print ("Domains: %s") % (ip_cfg.get_domains())
+ print ("Searches: %s") % (ip_cfg.get_searches())
+ print("Nameservers:")
+ nameservers = ip_cfg.get_nameservers()
+ for dns in nameservers:
+ print socket.inet_ntop(family, struct.pack("=I", dns))
+ else:
+ print ("Domains: %s") % (ip_cfg.get_domains())
+ print ("Searches: %s") % (ip_cfg.get_searches())
+ print("Nameservers:")
+ num = ip_cfg.get_num_nameservers()
+ for i in range(0,num):
+ dns = ip_cfg.get_nameserver(i)
+ print socket.inet_ntop(family, dns)
+
+
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit('Usage: %s <interface>' % sys.argv[0])
@@ -125,3 +151,13 @@ if __name__ == "__main__":
show_routes(dev, socket.AF_INET6)
print
+ print "IPv4 DNS:"
+ print("------------")
+ show_dns(dev, socket.AF_INET)
+ print
+
+ print "IPv6 DNS:"
+ print("------------")
+ show_dns(dev, socket.AF_INET6)
+ print
+
--
1.7.11.7

View File

@ -1,145 +0,0 @@
From 8ee4f58e9ee67df2ef761a691dec55c6008ad4ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 15:31:56 +0100
Subject: [PATCH] libnm-glib: additional functions to get nameservers (rh
#1056146)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit adds two new functions for introspection users to get nameservers:
guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config)
const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
The existing function can't be used due to GObject introspection limitations:
const GSList *nm_ip6_config_get_nameservers (NMIP6Config *config);
https://bugzilla.redhat.com/show_bug.cgi?id=1056146
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 2 ++
libnm-glib/nm-ip6-config.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-
libnm-glib/nm-ip6-config.h | 16 +++++++-------
3 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index bf69db4..9f0db93 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -227,7 +227,9 @@ global:
nm_ip6_config_get_addresses;
nm_ip6_config_get_domains;
nm_ip6_config_get_gateway;
+ nm_ip6_config_get_nameserver;
nm_ip6_config_get_nameservers;
+ nm_ip6_config_get_num_nameservers;
nm_ip6_config_get_routes;
nm_ip6_config_get_searches;
nm_ip6_config_get_type;
diff --git a/libnm-glib/nm-ip6-config.c b/libnm-glib/nm-ip6-config.c
index 01e2cae..7c9cfca 100644
--- a/libnm-glib/nm-ip6-config.c
+++ b/libnm-glib/nm-ip6-config.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2008 - 2011 Red Hat, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*/
#include <string.h>
@@ -192,6 +192,56 @@ nm_ip6_config_get_addresses (NMIP6Config *config)
return NM_IP6_CONFIG_GET_PRIVATE (config)->addresses;
}
+/**
+ * nm_ip6_config_get_num_nameservers:
+ * @config: a #NMIP6Config
+ *
+ * Gets the number of the domain name servers in the configuration.
+ *
+ * Returns: the number of domain name servers
+ *
+ * Since: 0.9.10
+ **/
+guint32
+nm_ip6_config_get_num_nameservers (NMIP6Config *config)
+{
+ g_return_val_if_fail (NM_IS_IP6_CONFIG (config), 0);
+
+ _nm_object_ensure_inited (NM_OBJECT (config));
+ return g_slist_length (NM_IP6_CONFIG_GET_PRIVATE (config)->nameservers);
+}
+
+/**
+ * nm_ip6_config_get_nameserver:
+ * @config: a #NMIP6Config
+ * @idx: index of the nameserver to return
+ *
+ * Gets the domain name server at index @idx in the configuration.
+ *
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of domain name server at index @iidx
+ *
+ * Since: 0.9.10
+ **/
+const struct in6_addr *
+nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
+{
+ NMIP6ConfigPrivate *priv;
+ GSList *item;
+ guint32 i = 0;
+
+ g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (config));
+ priv = NM_IP6_CONFIG_GET_PRIVATE (config);
+
+ for (item = priv->nameservers; item && i < idx; i++)
+ item = item->next;
+
+ g_return_val_if_fail (item, NULL);
+ return item ? (const struct in6_addr *) item->data : NULL;
+}
+
/* FIXME: like in libnm_util, in6_addr is not introspectable, so skipping here */
/**
* nm_ip6_config_get_nameservers: (skip)
diff --git a/libnm-glib/nm-ip6-config.h b/libnm-glib/nm-ip6-config.h
index a71d74b..b6198fa 100644
--- a/libnm-glib/nm-ip6-config.h
+++ b/libnm-glib/nm-ip6-config.h
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*/
#ifndef NM_IP6_CONFIG_H
@@ -65,12 +65,14 @@ GType nm_ip6_config_get_type (void);
GObject *nm_ip6_config_new (DBusGConnection *connection, const char *object_path);
-const char * nm_ip6_config_get_gateway (NMIP6Config *config);
-const GSList * nm_ip6_config_get_addresses (NMIP6Config *config);
-const GSList * nm_ip6_config_get_routes (NMIP6Config *config);
-const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config);
-const GPtrArray *nm_ip6_config_get_domains (NMIP6Config *config);
-const GPtrArray *nm_ip6_config_get_searches (NMIP6Config *config);
+const char * nm_ip6_config_get_gateway (NMIP6Config *config);
+const GSList * nm_ip6_config_get_addresses (NMIP6Config *config);
+const GSList * nm_ip6_config_get_routes (NMIP6Config *config);
+guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config);
+const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx);
+const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config);
+const GPtrArray * nm_ip6_config_get_domains (NMIP6Config *config);
+const GPtrArray * nm_ip6_config_get_searches (NMIP6Config *config);
G_END_DECLS
--
1.7.11.7

View File

@ -1,230 +0,0 @@
From 7ffbbae3a046dbb4c8d5089c41b143eafabed709 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 16 Jan 2014 17:29:08 +0100
Subject: [PATCH 1/2] libnm-glib; fix introspection annotations so that
<ipv6>.get_address() worked
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Without the correct annotation, the functions didn't work correctly in Python
(causing segmentation fault).
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-util/nm-setting-ip6-config.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c
index 7798db3..b02e231 100644
--- a/libnm-util/nm-setting-ip6-config.c
+++ b/libnm-util/nm-setting-ip6-config.c
@@ -1285,7 +1285,8 @@ nm_ip6_address_compare (NMIP6Address *address, NMIP6Address *other)
*
* Gets the IPv6 address property of this address object.
*
- * Returns: (transfer none): the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address
**/
const struct in6_addr *
nm_ip6_address_get_address (NMIP6Address *address)
@@ -1354,7 +1355,9 @@ nm_ip6_address_set_prefix (NMIP6Address *address, guint32 prefix)
*
* Gets the IPv6 default gateway property of this address object.
*
- * Returns: (transfer none): the IPv6 gateway address
+ * Returns: (transfer none):
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 gateway address
**/
const struct in6_addr *
nm_ip6_address_get_gateway (NMIP6Address *address)
@@ -1502,7 +1505,8 @@ nm_ip6_route_compare (NMIP6Route *route, NMIP6Route *other)
*
* Gets the IPv6 destination address property of this route object.
*
- * Returns: the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of destination
**/
const struct in6_addr *
nm_ip6_route_get_dest (NMIP6Route *route)
@@ -1571,7 +1575,8 @@ nm_ip6_route_set_prefix (NMIP6Route *route, guint32 prefix)
*
* Gets the IPv6 address of the next hop of this route.
*
- * Returns: the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of next hop
**/
const struct in6_addr *
nm_ip6_route_get_next_hop (NMIP6Route *route)
--
1.7.11.7
From 68fe50ff3a4774c0abff1d6f8c2f270b73105351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 16 Jan 2014 17:27:05 +0100
Subject: [PATCH 2/2] examples: add an python example (using GI) getting
device IPs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
examples/python/gi/Makefile.am | 3 +-
examples/python/gi/get_ips.py | 127 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 1 deletion(-)
create mode 100755 examples/python/gi/get_ips.py
diff --git a/examples/python/gi/Makefile.am b/examples/python/gi/Makefile.am
index 78569b3..7f122a4 100644
--- a/examples/python/gi/Makefile.am
+++ b/examples/python/gi/Makefile.am
@@ -2,4 +2,5 @@ EXTRA_DIST = \
list-connections.py \
device-state-ip4config.py \
firewall-zone.py \
- show-wifi-networks.py
+ show-wifi-networks.py \
+ get_ips.py
diff --git a/examples/python/gi/get_ips.py b/examples/python/gi/get_ips.py
new file mode 100755
index 0000000..b1e59e2
--- /dev/null
+++ b/examples/python/gi/get_ips.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+#
+# vim: ft=python ts=4 sts=4 sw=4 et ai
+# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+
+import sys, socket, struct
+from gi.repository import GLib, NetworkManager, NMClient
+
+#
+# This example shows how to get get addresses and routes from NMIP4Config and NMIP6Config
+# (got out of NMDevice)
+#
+
+def show_addresses(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ nm_addresses = ip_cfg.get_addresses()
+ if len(nm_addresses) == 0:
+ print("None")
+ return
+
+ for nm_address in nm_addresses:
+ addr = nm_address.get_address()
+ prefix = nm_address.get_prefix()
+ gateway = nm_address.get_gateway()
+
+ if (family == socket.AF_INET):
+ addr_struct = struct.pack("=I", addr)
+ gateway_struct = struct.pack("=I", gateway)
+ else:
+ addr_struct = addr
+ gateway_struct = gateway
+ print("%s/%d %s") % (socket.inet_ntop(family, addr_struct),
+ prefix,
+ socket.inet_ntop(family, gateway_struct))
+
+
+
+def show_routes(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ nm_routes = ip_cfg.get_routes()
+ if len(nm_routes) == 0:
+ print("None")
+ return
+
+ for nm_route in nm_routes:
+ dest = nm_route.get_dest()
+ prefix = nm_route.get_prefix()
+ next_hop = nm_route.get_next_hop()
+ metric = nm_route.get_metric()
+
+ if (family == socket.AF_INET):
+ dest_struct = struct.pack("=I", dest)
+ next_hop_struct = struct.pack("=I", next_hop)
+ else:
+ dest_struct = dest
+ next_hop_struct = next_hop
+ print("%s/%d %s %d") % (socket.inet_ntop(family, dest_struct),
+ prefix,
+ socket.inet_ntop(family, next_hop_struct),
+ metric)
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ sys.exit('Usage: %s <interface>' % sys.argv[0])
+ dev_iface = sys.argv[1]
+
+ c = NMClient.Client.new()
+ dev = c.get_device_by_iface(dev_iface)
+ if dev is None:
+ sys.exit('Device \'%s\' not found' % dev_iface)
+ print "Device: %s - %s" % (dev_iface, dev.get_device_type().value_name)
+ print "---------------------------------------"
+
+ print("IPv4 addresses:")
+ print("---------------")
+ show_addresses(dev, socket.AF_INET)
+ print
+
+ print("IPv4 routes:")
+ print("------------")
+ show_routes(dev, socket.AF_INET)
+ print
+
+ print "IPv6 addresses:"
+ print("---------------")
+ show_addresses(dev, socket.AF_INET6)
+ print
+
+ print "IPv6 routes:"
+ print("------------")
+ show_routes(dev, socket.AF_INET6)
+ print
+
--
1.7.11.7

View File

@ -1,34 +0,0 @@
From de36db0af15fccf273fa05413219df23e3a07f25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 18 Nov 2013 09:06:23 +0100
Subject: [PATCH] libnm-glib: fix return value in
nm_remote_settings_load_connections()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
when g_return_val_if_fail() fails.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-remote-settings.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index 0226e99..1110295 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -664,8 +664,8 @@ nm_remote_settings_load_connections (NMRemoteSettings *settings,
char **my_failures = NULL;
gboolean ret = FALSE;
- g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
- g_return_val_if_fail (filenames != NULL, NULL);
+ g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (filenames != NULL, FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
--
1.7.11.7

View File

@ -1,709 +0,0 @@
*.[0-9][0-9][0-9][0-9][.-]*.orig
aclocal.m4
autom4te.cache/output.0
autom4te.cache/output.1
autom4te.cache/requests
autom4te.cache/traces.0
autom4te.cache/traces.1
build-aux/config.sub
callouts/.libs/
callouts/libtest-dispatcher-envp.la
callouts/libtest_dispatcher_envp_la-nm-dispatcher-utils.lo
callouts/Makefile
callouts/Makefile.in
callouts/nm-avahi-autoipd.action
callouts/nm-avahi-autoipd-action.o
callouts/nm-dispatcher.action
callouts/nm-dispatcher-action.o
callouts/nm-dispatcher-glue.h
callouts/nm-dispatcher-utils.o
callouts/org.freedesktop.nm_dispatcher.service
callouts/tests/.libs/
callouts/tests/Makefile
callouts/tests/Makefile.in
callouts/tests/test-dispatcher-envp
callouts/tests/test-dispatcher-envp.o
cli/completion/Makefile
cli/completion/Makefile.in
cli/Makefile
cli/Makefile.in
cli/src/common.o
cli/src/connections.o
cli/src/devices.o
cli/src/.libs/
cli/src/Makefile
cli/src/Makefile.in
cli/src/network-manager.o
cli/src/nmcli
cli/src/nmcli.o
cli/src/settings.o
cli/src/utils.o
config.guess
config.h
config.log
config.status
config.sub
configure
data/Makefile
data/Makefile.in
data/NetworkManager-dispatcher.service
data/NetworkManager.service
data/NetworkManager-wait-online.service
data/org.freedesktop.NetworkManager.service
data/server.conf
debugfiles.list
debuglinks.list
debugsources.list
docs/api/Makefile
docs/api/Makefile.in
docs/libnm-glib/Makefile
docs/libnm-glib/Makefile.in
docs/libnm-util/Makefile
docs/libnm-util/Makefile.in
docs/Makefile
docs/Makefile.in
elfbins.list
examples/C/glib/add-connection-dbus-glib
examples/C/glib/add-connection-dbus-glib.o
examples/C/glib/add-connection-libnm-glib
examples/C/glib/add-connection-libnm-glib.o
examples/C/glib/get-active-connections-dbus-glib
examples/C/glib/get-active-connections-dbus-glib.o
examples/C/glib/get-ap-info-libnm-glib
examples/C/glib/get-ap-info-libnm-glib.o
examples/C/glib/.libs/
examples/C/glib/list-connections-dbus-glib
examples/C/glib/list-connections-dbus-glib.o
examples/C/glib/list-connections-libnm-glib
examples/C/glib/list-connections-libnm-glib.o
examples/C/glib/Makefile
examples/C/glib/Makefile.in
examples/C/glib/monitor-nm-running-dbus-glib
examples/C/glib/monitor-nm-running-dbus-glib.o
examples/C/glib/monitor-nm-running-GDBus
examples/C/glib/monitor-nm-running-GDBus.o
examples/C/glib/monitor-nm-state-GDBus
examples/C/glib/monitor-nm-state-GDBus.o
examples/C/Makefile
examples/C/Makefile.in
examples/C/qt/add-connection-wired
examples/C/qt/add-connection-wired.o
examples/C/qt/change-ipv4-addresses
examples/C/qt/change-ipv4-addresses.o
examples/C/qt/list-connections
examples/C/qt/list-connections.o
examples/C/qt/Makefile
examples/C/qt/Makefile.in
examples/C/qt/monitor-nm-running
examples/C/qt/monitor-nm-running.moc
examples/C/qt/monitor-nm-running.o
examples/dispatcher/Makefile
examples/dispatcher/Makefile.in
examples/Makefile
examples/Makefile.in
examples/python/dbus/Makefile
examples/python/dbus/Makefile.in
examples/python/gi/Makefile
examples/python/gi/Makefile.in
examples/python/Makefile
examples/python/Makefile.in
examples/ruby/Makefile
examples/ruby/Makefile.in
examples/shell/Makefile
examples/shell/Makefile.in
include/Makefile
include/Makefile.in
initscript/Arch/networkmanager
initscript/Debian/NetworkManager
initscript/linexa/networkmanager
initscript/Mandriva/networkmanager
initscript/RedHat/NetworkManager
initscript/Slackware/rc.networkmanager
initscript/SUSE/networkmanager
introspection/all.xml
introspection/Makefile
introspection/Makefile.in
libgsystem.la
libgsystem_la-gsystem-console.lo
libgsystem_la-gsystem-file-utils.lo
libgsystem_la-gsystem-local-alloc.lo
libgsystem_la-gsystem-log.lo
libgsystem_la-gsystem-shutil.lo
libgsystem_la-gsystem-subprocess-context.lo
libgsystem_la-gsystem-subprocess.lo
libndp/build-aux/config.sub
libndp/config.guess
libndp/config.log
libndp/config.status
libndp/config.sub
libndp/include/Makefile
libndp/libndp/libndp.pc
libndp/libndp/Makefile
libndp/libtool
libndp/Makefile
libndp/man/Makefile
libndp/utils/Makefile
libnm-glib/libdeprecated-nm-glib.la
libnm-glib/libdeprecated_nm_glib_la-libnm_glib.lo
libnm-glib/libnm-glib.la
libnm-glib/libnm_glib_la-nm-access-point.lo
libnm-glib/libnm_glib_la-nm-active-connection.lo
libnm-glib/libnm_glib_la-nm-client.lo
libnm-glib/libnm_glib_la-nm-dbus-helpers.lo
libnm-glib/libnm_glib_la-nm-device-adsl.lo
libnm-glib/libnm_glib_la-nm-device-bond.lo
libnm-glib/libnm_glib_la-nm-device-bridge.lo
libnm-glib/libnm_glib_la-nm-device-bt.lo
libnm-glib/libnm_glib_la-nm-device-ethernet.lo
libnm-glib/libnm_glib_la-nm-device-generic.lo
libnm-glib/libnm_glib_la-nm-device-infiniband.lo
libnm-glib/libnm_glib_la-nm-device.lo
libnm-glib/libnm_glib_la-nm-device-modem.lo
libnm-glib/libnm_glib_la-nm-device-olpc-mesh.lo
libnm-glib/libnm_glib_la-nm-device-team.lo
libnm-glib/libnm_glib_la-nm-device-vlan.lo
libnm-glib/libnm_glib_la-nm-device-wifi.lo
libnm-glib/libnm_glib_la-nm-device-wimax.lo
libnm-glib/libnm_glib_la-nm-dhcp4-config.lo
libnm-glib/libnm_glib_la-nm-dhcp6-config.lo
libnm-glib/libnm_glib_la-nm-glib-enum-types.lo
libnm-glib/libnm_glib_la-nm-ip4-config.lo
libnm-glib/libnm_glib_la-nm-ip6-config.lo
libnm-glib/libnm_glib_la-nm-object-cache.lo
libnm-glib/libnm_glib_la-nm-object.lo
libnm-glib/libnm_glib_la-nm-remote-connection.lo
libnm-glib/libnm_glib_la-nm-remote-settings.lo
libnm-glib/libnm_glib_la-nm-secret-agent.lo
libnm-glib/libnm_glib_la-nm-types.lo
libnm-glib/libnm_glib_la-nm-vpn-connection.lo
libnm-glib/libnm_glib_la-nm-wimax-nsp.lo
libnm-glib/libnm-glib.pc
libnm-glib/libnm-glib-test
libnm-glib/libnm-glib-test.la
libnm-glib/libnm_glib_test_la-nm-access-point.lo
libnm-glib/libnm_glib_test_la-nm-active-connection.lo
libnm-glib/libnm_glib_test_la-nm-client.lo
libnm-glib/libnm_glib_test_la-nm-dbus-helpers.lo
libnm-glib/libnm_glib_test_la-nm-device-adsl.lo
libnm-glib/libnm_glib_test_la-nm-device-bond.lo
libnm-glib/libnm_glib_test_la-nm-device-bridge.lo
libnm-glib/libnm_glib_test_la-nm-device-bt.lo
libnm-glib/libnm_glib_test_la-nm-device-ethernet.lo
libnm-glib/libnm_glib_test_la-nm-device-generic.lo
libnm-glib/libnm_glib_test_la-nm-device-infiniband.lo
libnm-glib/libnm_glib_test_la-nm-device.lo
libnm-glib/libnm_glib_test_la-nm-device-modem.lo
libnm-glib/libnm_glib_test_la-nm-device-olpc-mesh.lo
libnm-glib/libnm_glib_test_la-nm-device-team.lo
libnm-glib/libnm_glib_test_la-nm-device-vlan.lo
libnm-glib/libnm_glib_test_la-nm-device-wifi.lo
libnm-glib/libnm_glib_test_la-nm-device-wimax.lo
libnm-glib/libnm_glib_test_la-nm-dhcp4-config.lo
libnm-glib/libnm_glib_test_la-nm-dhcp6-config.lo
libnm-glib/libnm_glib_test_la-nm-glib-enum-types.lo
libnm-glib/libnm_glib_test_la-nm-ip4-config.lo
libnm-glib/libnm_glib_test_la-nm-ip6-config.lo
libnm-glib/libnm_glib_test_la-nm-object-cache.lo
libnm-glib/libnm_glib_test_la-nm-object.lo
libnm-glib/libnm_glib_test_la-nm-remote-connection.lo
libnm-glib/libnm_glib_test_la-nm-remote-settings.lo
libnm-glib/libnm_glib_test_la-nm-secret-agent.lo
libnm-glib/libnm_glib_test_la-nm-types.lo
libnm-glib/libnm_glib_test_la-nm-vpn-connection.lo
libnm-glib/libnm_glib_test_la-nm-wimax-nsp.lo
libnm-glib/libnm_glib_test-libnm-glib-test.o
libnm-glib/libnm-glib-vpn.la
libnm-glib/libnm_glib_vpn_la-nm-vpn-enum-types.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin-ui-interface.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin-utils.lo
libnm-glib/libnm-glib-vpn.pc
libnm-glib/.libs/
libnm-glib/Makefile
libnm-glib/Makefile.in
libnm-glib/NMClient-1.0.gir
libnm-glib/NMClient-1.0.typelib
libnm-glib/nm-glib-enum-types.c.stamp
libnm-glib/nm-glib-enum-types.h.stamp
libnm-glib/nm-secret-agent-glue.h
libnm-glib/nm-vpn-enum-types.c.stamp
libnm-glib/nm-vpn-enum-types.h.stamp
libnm-glib/nm-vpn-plugin-glue.h
libnm-glib/tests/.libs/
libnm-glib/tests/Makefile
libnm-glib/tests/Makefile.in
libnm-glib/tests/test-nm-client
libnm-glib/tests/test-nm-client.o
libnm-glib/tests/test-remote-settings-client
libnm-glib/tests/test-remote-settings-client.o
libnm-util/crypto.lo
libnm-util/crypto_nss.lo
libnm-util/libnm-util.la
libnm-util/libnm-util.pc
libnm-util/.libs/
libnm-util/libtest-crypto.la
libnm-util/Makefile
libnm-util/Makefile.in
libnm-util/NetworkManager-1.0.gir
libnm-util/NetworkManager-1.0.typelib
libnm-util/nm-connection.lo
libnm-util/nm-param-spec-specialized.lo
libnm-util/nm-setting-8021x.lo
libnm-util/nm-setting-adsl.lo
libnm-util/nm-setting-bluetooth.lo
libnm-util/nm-setting-bond.lo
libnm-util/nm-setting-bridge.lo
libnm-util/nm-setting-bridge-port.lo
libnm-util/nm-setting-cdma.lo
libnm-util/nm-setting-connection.lo
libnm-util/nm-setting-generic.lo
libnm-util/nm-setting-gsm.lo
libnm-util/nm-setting-infiniband.lo
libnm-util/nm-setting-ip4-config.lo
libnm-util/nm-setting-ip6-config.lo
libnm-util/nm-setting.lo
libnm-util/nm-setting-olpc-mesh.lo
libnm-util/nm-setting-ppp.lo
libnm-util/nm-setting-pppoe.lo
libnm-util/nm-setting-serial.lo
libnm-util/nm-setting-team.lo
libnm-util/nm-setting-team-port.lo
libnm-util/nm-setting-vlan.lo
libnm-util/nm-setting-vpn.lo
libnm-util/nm-setting-wimax.lo
libnm-util/nm-setting-wired.lo
libnm-util/nm-setting-wireless.lo
libnm-util/nm-setting-wireless-security.lo
libnm-util/nm-utils-enum-types.c.stamp
libnm-util/nm-utils-enum-types.h.stamp
libnm-util/nm-utils-enum-types.lo
libnm-util/nm-utils.lo
libnm-util/nm-value-transforms.lo
libnm-util/tests/certs/Makefile
libnm-util/tests/certs/Makefile.in
libnm-util/tests/.libs/
libnm-util/tests/Makefile
libnm-util/tests/Makefile.in
libnm-util/tests/test-crypto
libnm-util/tests/test-crypto.o
libnm-util/tests/test-general
libnm-util/tests/test-general.o
libnm-util/tests/test-secrets
libnm-util/tests/test-secrets.o
libnm-util/tests/test-setting-8021x
libnm-util/tests/test-setting-8021x.o
libnm-util/tests/test-settings-defaults
libnm-util/tests/test-settings-defaults.o
.libs/libgsystem.a
.libs/libgsystem.la
.libs/libgsystem_la-gsystem-console.o
.libs/libgsystem_la-gsystem-file-utils.o
.libs/libgsystem_la-gsystem-local-alloc.o
.libs/libgsystem_la-gsystem-log.o
.libs/libgsystem_la-gsystem-shutil.o
.libs/libgsystem_la-gsystem-subprocess-context.o
.libs/libgsystem_la-gsystem-subprocess.o
libtool
Makefile
Makefile.in
man/Makefile
man/Makefile.in
man/nmcli.1
man/nm-online.1
man/nm-system-settings.conf.5
NetworkManager.lang
NetworkManager.pc
po/ar.gmo
po/as.gmo
po/be@latin.gmo
po/bg.gmo
po/bn_IN.gmo
po/bs.gmo
po/ca.gmo
po/cs.gmo
po/da.gmo
po/de.gmo
po/dz.gmo
po/el.gmo
po/en_CA.gmo
po/en_GB.gmo
po/eo.gmo
po/es.gmo
po/et.gmo
po/eu.gmo
po/fi.gmo
po/fr.gmo
po/gl.gmo
po/gu.gmo
po/he.gmo
po/hi.gmo
po/hr.gmo
po/hu.gmo
po/id.gmo
po/.intltool-merge-cache
po/it.gmo
po/ja.gmo
po/ka.gmo
po/kn.gmo
po/ko.gmo
po/ku.gmo
policy/Makefile
policy/Makefile.in
policy/org.freedesktop.NetworkManager.policy
policy/org.freedesktop.NetworkManager.policy.in
po/lt.gmo
po/lv.gmo
po/Makefile
po/Makefile.in
po/mk.gmo
po/ml.gmo
po/mr.gmo
po/nb.gmo
po/ne.gmo
po/NetworkManager.pot
po/nl.gmo
po/oc.gmo
po/or.gmo
po/pa.gmo
po/pl.gmo
po/POTFILES
po/pt_BR.gmo
po/pt.gmo
po/ru.gmo
po/rw.gmo
po/sk.gmo
po/sl.gmo
po/sq.gmo
po/sr.gmo
po/sr@latin.gmo
po/stamp-it
po/sv.gmo
po/ta.gmo
po/te.gmo
po/th.gmo
po/tr.gmo
po/uk.gmo
po/vi.gmo
po/wa.gmo
po/zh_CN.gmo
po/zh_HK.gmo
po/zh_TW.gmo
src/config/tests/.libs/
src/config/tests/Makefile
src/config/tests/Makefile.in
src/config/tests/nm-test-device.o
src/config/tests/test-config
src/config/tests/test-config.o
src/devices/wimax/Makefile
src/devices/wimax/Makefile.in
src/dhcp-manager/Makefile
src/dhcp-manager/Makefile.in
src/dhcp-manager/nm-dhcp-helper
src/dhcp-manager/nm_dhcp_helper-nm-dhcp-helper.o
src/dhcp-manager/tests/.libs/
src/dhcp-manager/tests/Makefile
src/dhcp-manager/tests/Makefile.in
src/dhcp-manager/tests/test-dhcp-dhclient
src/dhcp-manager/tests/test-dhcp-dhclient.o
src/errors.lo
src/libNetworkManager.la
src/.libs/
src/main.o
src/Makefile
src/Makefile.in
src/NetworkManager
src/NetworkManagerUtils.lo
src/nm-activation-request.lo
src/nm-active-connection-glue.h
src/nm-active-connection.lo
src/nm-agent-manager.lo
src/nm-atm-manager.lo
src/nm-bluez-device.lo
src/nm-bluez-manager.lo
src/nm-call-store.lo
src/nm-config-device.lo
src/nm-config.lo
src/nm-connection-provider.lo
src/nm-connectivity.lo
src/nm-dbus-manager.lo
src/nm-default-wired-connection.lo
src/nm-device-adsl.lo
src/nm-device-bond.lo
src/nm-device-bridge.lo
src/nm-device-bt.lo
src/nm-device-ethernet.lo
src/nm-device-generic.lo
src/nm-device-glue.h
src/nm-device-gre.lo
src/nm-device-infiniband.lo
src/nm-device.lo
src/nm-device-macvlan.lo
src/nm-device-modem.lo
src/nm-device-olpc-mesh.lo
src/nm-device-team.lo
src/nm-device-tun.lo
src/nm-device-veth.lo
src/nm-device-vlan.lo
src/nm-device-wifi-glue.h
src/nm-device-wifi.lo
src/nm-dhcp4-config.lo
src/nm-dhcp6-config.lo
src/nm-dhcp-client.lo
src/nm-dhcp-dhclient.lo
src/nm-dhcp-dhclient-utils.lo
src/nm-dhcp-dhcpcd.lo
src/nm-dhcp-manager.lo
src/nm-dispatcher.lo
src/nm-dns-dnsmasq.lo
src/nm-dns-manager.lo
src/nm-dnsmasq-manager.lo
src/nm-dns-plugin.lo
src/nm-dns-utils.lo
src/nm-enum-types.c
src/nm-enum-types.c.stamp
src/nm-enum-types.h
src/nm-enum-types.h.stamp
src/nm-enum-types.lo
src/nm-fake-platform.lo
src/nm-fake-rdisc.lo
src/nm-firewall-manager.lo
src/nm-hostname-provider.lo
src/nm-inotify-helper.lo
src/nm-ip4-config.lo
src/nm-ip6-config.lo
src/nm-keyfile-connection.lo
src/nm-linux-platform.lo
src/nm-lndp-rdisc.lo
src/nm-logging.lo
src/nm-manager-auth.lo
src/nm-manager-glue.h
src/nm-manager.lo
src/nm-modem-broadband.lo
src/nm-modem.lo
src/nm-modem-manager.lo
src/nm-modem-old.lo
src/nm-netlink-monitor.lo
src/nm-platform.lo
src/nm-policy-hosts.lo
src/nm-policy.lo
src/nm-posix-signals.lo
src/nm-ppp-manager.lo
src/nm-properties-changed-signal.lo
src/nm-rdisc.lo
src/nm-rfkill-manager.lo
src/nm-secret-agent.lo
src/nm-session-monitor-systemd.lo
src/nm-session-utils.lo
src/nm-settings-connection.lo
src/nm-settings-error.lo
src/nm-settings-glue.h
src/nm-settings.lo
src/nm-settings-utils.lo
src/nm-sleep-monitor-systemd.lo
src/nm-supplicant-config.lo
src/nm-supplicant-interface.lo
src/nm-supplicant-manager.lo
src/nm-supplicant-settings-verify.lo
src/nm-system-config-interface.lo
src/nm-vpn-connection.lo
src/nm-vpn-manager.lo
src/nm-vpn-service.lo
src/nm-wifi-ap.lo
src/nm-wifi-ap-utils.lo
src/platform/Makefile
src/platform/Makefile.in
src/platform/tests/dump
src/platform/tests/dump.o
src/platform/tests/.libs/
src/platform/tests/Makefile
src/platform/tests/Makefile.in
src/platform/tests/monitor
src/platform/tests/monitor.o
src/platform/tests/nm-fake-platform.o
src/platform/tests/nm-linux-platform.o
src/platform/tests/nm-platform.o
src/platform/tests/platform
src/platform/tests/platform.o
src/platform/tests/test-address-fake
src/platform/tests/test_address_fake-nm-fake-platform.o
src/platform/tests/test_address_fake-nm-linux-platform.o
src/platform/tests/test_address_fake-nm-platform.o
src/platform/tests/test_address_fake-test-address.o
src/platform/tests/test_address_fake-test-common.o
src/platform/tests/test-address-linux
src/platform/tests/test_address_linux-nm-fake-platform.o
src/platform/tests/test_address_linux-nm-linux-platform.o
src/platform/tests/test_address_linux-nm-platform.o
src/platform/tests/test_address_linux-test-address.o
src/platform/tests/test_address_linux-test-common.o
src/platform/tests/test-cleanup-fake
src/platform/tests/test_cleanup_fake-nm-fake-platform.o
src/platform/tests/test_cleanup_fake-nm-linux-platform.o
src/platform/tests/test_cleanup_fake-nm-platform.o
src/platform/tests/test_cleanup_fake-test-cleanup.o
src/platform/tests/test_cleanup_fake-test-common.o
src/platform/tests/test-cleanup-linux
src/platform/tests/test_cleanup_linux-nm-fake-platform.o
src/platform/tests/test_cleanup_linux-nm-linux-platform.o
src/platform/tests/test_cleanup_linux-nm-platform.o
src/platform/tests/test_cleanup_linux-test-cleanup.o
src/platform/tests/test_cleanup_linux-test-common.o
src/platform/tests/test-link-fake
src/platform/tests/test_link_fake-nm-fake-platform.o
src/platform/tests/test_link_fake-nm-linux-platform.o
src/platform/tests/test_link_fake-nm-platform.o
src/platform/tests/test_link_fake-test-common.o
src/platform/tests/test_link_fake-test-link.o
src/platform/tests/test-link-linux
src/platform/tests/test_link_linux-nm-fake-platform.o
src/platform/tests/test_link_linux-nm-linux-platform.o
src/platform/tests/test_link_linux-nm-platform.o
src/platform/tests/test_link_linux-test-common.o
src/platform/tests/test_link_linux-test-link.o
src/platform/tests/test-route-fake
src/platform/tests/test_route_fake-nm-fake-platform.o
src/platform/tests/test_route_fake-nm-linux-platform.o
src/platform/tests/test_route_fake-nm-platform.o
src/platform/tests/test_route_fake-test-common.o
src/platform/tests/test_route_fake-test-route.o
src/platform/tests/test-route-linux
src/platform/tests/test_route_linux-nm-fake-platform.o
src/platform/tests/test_route_linux-nm-linux-platform.o
src/platform/tests/test_route_linux-nm-platform.o
src/platform/tests/test_route_linux-test-common.o
src/platform/tests/test_route_linux-test-route.o
src/plugin.lo
src/ppp-manager/.libs/
src/ppp-manager/Makefile
src/ppp-manager/Makefile.in
src/ppp-manager/nm-pppd-plugin.la
src/ppp-manager/nm-pppd-plugin.lo
src/rdisc/Makefile
src/rdisc/Makefile.in
src/rdisc/tests/.libs
src/rdisc/tests/Makefile
src/rdisc/tests/Makefile.in
src/rdisc/tests/nm-fake-rdisc.o
src/rdisc/tests/nm-lndp-rdisc.o
src/rdisc/tests/nm-logging.o
src/rdisc/tests/nm-rdisc.o
src/rdisc/tests/rdisc
src/rdisc/tests/rdisc.o
src/reader.lo
src/settings/plugins/example/errors.lo
src/settings/plugins/example/libnm-settings-plugin-example.la
src/settings/plugins/example/.libs/
src/settings/plugins/example/Makefile
src/settings/plugins/example/Makefile.in
src/settings/plugins/example/nm-example-connection.lo
src/settings/plugins/example/plugin.lo
src/settings/plugins/example/reader.lo
src/settings/plugins/example/writer.lo
src/settings/plugins/ifcfg-rh/errors.lo
src/settings/plugins/ifcfg-rh/libifcfg-rh-io.la
src/settings/plugins/ifcfg-rh/libnm-settings-plugin-ifcfg-rh.la
src/settings/plugins/ifcfg-rh/.libs/
src/settings/plugins/ifcfg-rh/Makefile
src/settings/plugins/ifcfg-rh/Makefile.in
src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.lo
src/settings/plugins/ifcfg-rh/nm-ifcfg-rh-glue.h
src/settings/plugins/ifcfg-rh/plugin.lo
src/settings/plugins/ifcfg-rh/reader.lo
src/settings/plugins/ifcfg-rh/shvar.lo
src/settings/plugins/ifcfg-rh/tests/errors.o
src/settings/plugins/ifcfg-rh/tests/.libs/
src/settings/plugins/ifcfg-rh/tests/Makefile
src/settings/plugins/ifcfg-rh/tests/Makefile.in
src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile
src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
src/settings/plugins/ifcfg-rh/tests/reader.o
src/settings/plugins/ifcfg-rh/tests/shvar.o
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.o
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.o
src/settings/plugins/ifcfg-rh/tests/utils.o
src/settings/plugins/ifcfg-rh/tests/writer.o
src/settings/plugins/ifcfg-rh/utils.lo
src/settings/plugins/ifcfg-rh/writer.lo
src/settings/plugins/ifcfg-suse/Makefile
src/settings/plugins/ifcfg-suse/Makefile.in
src/settings/plugins/ifnet/Makefile
src/settings/plugins/ifnet/Makefile.in
src/settings/plugins/ifnet/tests/Makefile
src/settings/plugins/ifnet/tests/Makefile.in
src/settings/plugins/ifupdown/Makefile
src/settings/plugins/ifupdown/Makefile.in
src/settings/plugins/ifupdown/tests/Makefile
src/settings/plugins/ifupdown/tests/Makefile.in
src/settings/plugins/keyfile/errors.lo
src/settings/plugins/keyfile/libkeyfile-io.la
src/settings/plugins/keyfile/libnm-settings-plugin-keyfile.la
src/settings/plugins/keyfile/.libs/
src/settings/plugins/keyfile/Makefile
src/settings/plugins/keyfile/Makefile.in
src/settings/plugins/keyfile/nm-keyfile-connection.lo
src/settings/plugins/keyfile/plugin.lo
src/settings/plugins/keyfile/reader.lo
src/settings/plugins/keyfile/tests/errors.o
src/settings/plugins/keyfile/tests/keyfiles/Makefile
src/settings/plugins/keyfile/tests/keyfiles/Makefile.in
src/settings/plugins/keyfile/tests/.libs/
src/settings/plugins/keyfile/tests/Makefile
src/settings/plugins/keyfile/tests/Makefile.in
src/settings/plugins/keyfile/tests/reader.o
src/settings/plugins/keyfile/tests/test-keyfile
src/settings/plugins/keyfile/tests/test-keyfile.o
src/settings/plugins/keyfile/tests/utils.o
src/settings/plugins/keyfile/tests/writer.o
src/settings/plugins/keyfile/utils.lo
src/settings/plugins/keyfile/writer.lo
src/settings/plugins/Makefile
src/settings/plugins/Makefile.in
src/settings/tests/.libs/
src/settings/tests/Makefile
src/settings/tests/Makefile.in
src/settings/tests/test-wired-defname
src/settings/tests/test-wired-defname.o
src/supplicant-manager/tests/.libs/
src/supplicant-manager/tests/Makefile
src/supplicant-manager/tests/Makefile.in
src/supplicant-manager/tests/test-supplicant-config
src/supplicant-manager/tests/test-supplicant-config.o
src/tests/.libs/
src/tests/Makefile
src/tests/Makefile.in
src/tests/test-dhcp-options
src/tests/test_dhcp_options-test-dhcp-options.o
src/tests/test-general
src/tests/test-general.o
src/tests/test-ip4-config
src/tests/test-ip4-config.o
src/tests/test-ip6-config
src/tests/test-ip6-config.o
src/tests/test-policy-hosts
src/tests/test-policy-hosts.o
src/tests/test-wifi-ap-utils
src/tests/test-wifi-ap-utils.o
src/utils.lo
src/wifi-utils.lo
src/wifi-utils-nl80211.lo
src/wifi-utils-wext.lo
src/writer.lo
stamp-h1
test/libnm-glib-test
test/libnm_glib_test-libnm-glib-test.o
test/.libs/
test/Makefile
test/Makefile.in
test/nm-online
test/nm-online.o
tools/generate-settings-spec
tools/generate-settings-spec.o
tools/.libs/
tools/Makefile
tools/Makefile.in
vapi/libnm-glib.vapi
vapi/libnm-util.vapi
vapi/Makefile
vapi/Makefile.in

View File

@ -1,492 +0,0 @@
diff -up NetworkManager-0.9.9.0/cli/completion/nmcli.nmcli-con-load NetworkManager-0.9.9.0/cli/completion/nmcli
--- NetworkManager-0.9.9.0/cli/completion/nmcli.nmcli-con-load 2013-10-03 14:14:44.000000000 -0400
+++ NetworkManager-0.9.9.0/cli/completion/nmcli 2013-11-18 11:02:56.187304537 -0500
@@ -833,6 +833,12 @@ _nmcli()
_nmcli_complete_COMMAND_CONNECTION
fi
;;
+ l|lo|loa|load)
+ if [[ ${#words[@]} -gt 2 ]]; then
+ compopt -o default
+ COMPREPLY=()
+ fi
+ ;;
esac
fi
;;
diff -up NetworkManager-0.9.9.0/cli/src/connections.c.nmcli-con-load NetworkManager-0.9.9.0/cli/src/connections.c
--- NetworkManager-0.9.9.0/cli/src/connections.c.nmcli-con-load 2013-10-03 15:00:47.000000000 -0400
+++ NetworkManager-0.9.9.0/cli/src/connections.c 2013-11-18 11:02:56.188304537 -0500
@@ -222,7 +222,8 @@ usage (void)
" modify [ id | uuid | path ] <ID> <setting>.<property> <value>\n\n"
" edit [ id | uuid | path ] <ID> | [type <new_con_type>] [con-name <new_con_name>]\n\n"
" delete [ id | uuid | path ] <ID>\n\n"
- " reload\n\n\n"
+ " reload\n\n"
+ " load <filename> [ <filename>... ]\n\n\n"
));
}
@@ -308,6 +309,7 @@ static const char *real_con_commands[] =
"edit",
"delete",
"reload",
+ "load",
NULL
};
@@ -7006,6 +7008,50 @@ do_connection_reload (NmCli *nmc, int ar
return nmc->return_value;
}
+static NMCResultCode
+do_connection_load (NmCli *nmc, int argc, char **argv)
+{
+ GError *error = NULL;
+ char **filenames, **failures = NULL;
+ int i;
+
+ nmc->return_value = NMC_RESULT_SUCCESS;
+ nmc->should_wait = FALSE;
+
+ if (!nm_client_get_manager_running (nmc->client)) {
+ g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
+ nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
+ return nmc->return_value;
+ }
+
+ if (argc == 0) {
+ g_string_printf (nmc->return_text, _("Error: No connection specified."));
+ nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
+ return nmc->return_value;
+ }
+
+ filenames = g_new (char *, argc + 1);
+ for (i = 0; i < argc; i++)
+ filenames[i] = argv[i];
+ filenames[i] = NULL;
+
+ nm_remote_settings_load_connections (nmc->system_settings, filenames, &failures, &error);
+ g_free (filenames);
+ if (error) {
+ g_string_printf (nmc->return_text, _("Error: %s."), error->message);
+ nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
+ g_error_free (error);
+ }
+
+ if (failures) {
+ for (i = 0; failures[i]; i++)
+ fprintf (stderr, _("Could not load file '%s'\n"), failures[i]);
+ g_strfreev (failures);
+ }
+
+ return nmc->return_value;
+}
+
typedef struct {
NmCli *nmc;
@@ -7087,6 +7133,9 @@ parse_cmd (NmCli *nmc, int argc, char **
else if (matches(*argv, "reload") == 0) {
nmc->return_value = do_connection_reload (nmc, argc-1, argv+1);
}
+ else if (matches(*argv, "load") == 0) {
+ nmc->return_value = do_connection_load (nmc, argc-1, argv+1);
+ }
else if (matches (*argv, "modify") == 0) {
nmc->return_value = do_connection_modify (nmc, argc-1, argv+1);
}
diff -up NetworkManager-0.9.9.0/introspection/nm-settings.xml.nmcli-con-load NetworkManager-0.9.9.0/introspection/nm-settings.xml
--- NetworkManager-0.9.9.0/introspection/nm-settings.xml.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400
+++ NetworkManager-0.9.9.0/introspection/nm-settings.xml 2013-11-18 11:02:56.188304537 -0500
@@ -82,6 +82,40 @@
</arg>
</method>
+ <method name="LoadConnections">
+ <tp:docstring>
+ Loads or reloads the indicated connections from disk. You
+ should call this after making changes directly to an on-disk
+ connection file to make sure that NetworkManager sees the
+ changes. (If "monitor-connection-files" in NetworkManager.conf
+ is "true", then this will have no real effect, but is
+ harmless.) As with AddConnection(), this operation does not
+ necessarily start the network connection.
+ </tp:docstring>
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_load_connections"/>
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="filenames" type="as" direction="in">
+ <tp:docstring>
+ Array of paths to on-disk connection profiles in directories
+ monitored by NetworkManager.
+ </tp:docstring>
+ </arg>
+ <arg name="status" type="b" direction="out">
+ <tp:docstring>
+ Success or failure of the operation as a whole. True if
+ NetworkManager at least tried to load the indicated
+ connections, even if it did not succeed. False if an error
+ occurred before trying to load the connections (eg,
+ permission denied).
+ </tp:docstring>
+ </arg>
+ <arg name="failures" type="as" direction="out">
+ <tp:docstring>
+ Paths of connection files that could not be loaded.
+ </tp:docstring>
+ </arg>
+ </method>
+
<method name="ReloadConnections">
<tp:docstring>
Tells NetworkManager to reload all connection files from disk,
diff -up NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver
--- NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver.nmcli-con-load 2013-10-01 14:43:57.000000000 -0400
+++ NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver 2013-11-18 11:02:56.188304537 -0500
@@ -243,6 +243,7 @@ global:
nm_remote_settings_get_connection_by_uuid;
nm_remote_settings_get_type;
nm_remote_settings_list_connections;
+ nm_remote_settings_load_connections;
nm_remote_settings_new;
nm_remote_settings_new_async;
nm_remote_settings_new_finish;
diff -up NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c
--- NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400
+++ NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c 2013-11-18 11:02:56.188304537 -0500
@@ -630,6 +630,72 @@ nm_remote_settings_add_connection_unsave
}
/**
+ * nm_remote_settings_load_connections:
+ * @settings: the %NMRemoteSettings
+ * @filenames: %NULL-terminated array of filenames to load
+ * @failures: (out) (transfer full): on return, a %NULL-terminated array of
+ * filenames that failed to load
+ * @error: return location for #GError
+ *
+ * Requests that the remote settings service load or reload the given files,
+ * adding or updating the connections described within.
+ *
+ * The changes to the indicated files will not yet be reflected in
+ * @settings's connections array when the function returns.
+ *
+ * If all of the indicated files were successfully loaded, the
+ * function will return %TRUE, and @failures will be set to %NULL. If
+ * NetworkManager tried to load the files, but some (or all) failed,
+ * then @failures will be set to a %NULL-terminated array of the
+ * filenames that failed to load.
+
+ * Returns: %TRUE if NetworkManager at least tried to load @filenames,
+ * %FALSE if an error occurred (eg, permission denied).
+ *
+ * Since: 0.9.10
+ **/
+gboolean
+nm_remote_settings_load_connections (NMRemoteSettings *settings,
+ char **filenames,
+ char ***failures,
+ GError **error)
+{
+ NMRemoteSettingsPrivate *priv;
+ char **my_failures = NULL;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
+ g_return_val_if_fail (filenames != NULL, NULL);
+
+ priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
+
+ _nm_remote_settings_ensure_inited (settings);
+
+ if (!priv->service_running) {
+ g_set_error_literal (error, NM_REMOTE_SETTINGS_ERROR,
+ NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE,
+ "NetworkManager is not running.");
+ return FALSE;
+ }
+
+ dbus_g_proxy_call (priv->proxy, "LoadConnections", error,
+ G_TYPE_STRV, filenames,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &ret,
+ G_TYPE_STRV, &my_failures,
+ G_TYPE_INVALID);
+
+ if (failures) {
+ if (my_failures && !*my_failures)
+ g_clear_pointer (&my_failures, g_free);
+ *failures = my_failures;
+ } else
+ g_strfreev (my_failures);
+
+ return ret;
+}
+
+/**
* nm_remote_settings_reload_connections:
* @settings: the #NMRemoteSettings
* @error: return location for #GError
diff -up NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h
--- NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400
+++ NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h 2013-11-18 11:02:56.188304537 -0500
@@ -79,6 +79,11 @@ typedef void (*NMRemoteSettingsAddConnec
GError *error,
gpointer user_data);
+typedef void (*NMRemoteSettingsLoadConnectionsFunc) (NMRemoteSettings *settings,
+ char **failures,
+ GError *error,
+ gpointer user_data);
+
typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings,
GError *error,
gpointer user_data);
@@ -135,6 +140,11 @@ gboolean nm_remote_settings_add_connecti
NMRemoteSettingsAddConnectionFunc callback,
gpointer user_data);
+gboolean nm_remote_settings_load_connections (NMRemoteSettings *settings,
+ char **filenames,
+ char ***failures,
+ GError **error);
+
gboolean nm_remote_settings_reload_connections (NMRemoteSettings *settings,
GError **error);
diff -up NetworkManager-0.9.9.0/src/settings/nm-settings.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-settings.c
--- NetworkManager-0.9.9.0/src/settings/nm-settings.c.nmcli-con-load 2013-10-01 14:43:57.000000000 -0400
+++ NetworkManager-0.9.9.0/src/settings/nm-settings.c 2013-11-18 11:10:31.800329234 -0500
@@ -104,6 +104,10 @@ static void impl_settings_add_connection
GHashTable *settings,
DBusGMethodInvocation *context);
+static void impl_settings_load_connections (NMSettings *self,
+ char **filenames,
+ DBusGMethodInvocation *context);
+
static void impl_settings_reload_connections (NMSettings *self,
DBusGMethodInvocation *context);
@@ -1226,33 +1230,78 @@ impl_settings_add_connection_unsaved (NM
impl_settings_add_connection_helper (self, settings, FALSE, context);
}
-static void
-impl_settings_reload_connections (NMSettings *self,
- DBusGMethodInvocation *context)
+static gboolean
+ensure_root (NMDBusManager *dbus_mgr,
+ DBusGMethodInvocation *context)
{
- NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
- GSList *iter;
gulong caller_uid;
GError *error = NULL;
- if (!nm_dbus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid)) {
+ if (!nm_dbus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid)) {
error = g_error_new_literal (NM_SETTINGS_ERROR,
- NM_SETTINGS_ERROR_PERMISSION_DENIED,
- "Unable to determine request UID.");
+ NM_SETTINGS_ERROR_PERMISSION_DENIED,
+ "Unable to determine request UID.");
dbus_g_method_return_error (context, error);
g_error_free (error);
- return;
+ return FALSE;
}
if (caller_uid != 0) {
- nm_log_warn (LOGD_SETTINGS, "ReloadConnections: permission denied to %lu", caller_uid);
error = g_error_new_literal (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_PERMISSION_DENIED,
"Permission denied");
dbus_g_method_return_error (context, error);
g_error_free (error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+impl_settings_load_connections (NMSettings *self,
+ char **filenames,
+ DBusGMethodInvocation *context)
+{
+ NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
+ GPtrArray *failures;
+ GSList *iter;
+ int i;
+
+ if (!ensure_root (priv->dbus_mgr, context))
return;
+
+ failures = g_ptr_array_new ();
+
+ for (i = 0; filenames[i]; i++) {
+ for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
+ NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
+
+ if (nm_system_config_interface_load_connection (plugin, filenames[i]))
+ break;
+ }
+
+ if (!iter) {
+ if (!g_path_is_absolute (filenames[i]))
+ nm_log_warn (LOGD_SETTINGS, "Connection filename '%s' is not an absolute path", filenames[i]);
+ g_ptr_array_add (failures, (char *) filenames[i]);
+ }
}
+ g_ptr_array_add (failures, NULL);
+ dbus_g_method_return (context, failures->len == 1, failures->pdata);
+ g_ptr_array_unref (failures);
+}
+
+static void
+impl_settings_reload_connections (NMSettings *self,
+ DBusGMethodInvocation *context)
+{
+ NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
+ GSList *iter;
+
+ if (!ensure_root (priv->dbus_mgr, context))
+ return;
+
if (!priv->connections_loaded) {
load_connections (self);
} else {
diff -up NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c
--- NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400
+++ NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c 2013-11-18 11:02:56.189304537 -0500
@@ -137,6 +137,17 @@ nm_system_config_interface_get_connectio
return NULL;
}
+gboolean
+nm_system_config_interface_load_connection (NMSystemConfigInterface *config,
+ const char *filename)
+{
+ g_return_val_if_fail (config != NULL, NULL);
+
+ if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection)
+ return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection (config, filename);
+ return FALSE;
+}
+
void
nm_system_config_interface_reload_connections (NMSystemConfigInterface *config)
{
diff -up NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h
--- NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400
+++ NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h 2013-11-18 11:02:56.189304537 -0500
@@ -89,6 +89,12 @@ struct _NMSystemConfigInterface {
*/
GSList * (*get_connections) (NMSystemConfigInterface *config);
+ /* Requests that the plugin load/reload a single connection, if it
+ * recognizes the filename. Returns success or failure.
+ */
+ gboolean (*load_connection) (NMSystemConfigInterface *config,
+ const char *filename);
+
/* Requests that the plugin reload all connection files from disk,
* and emit signals reflecting new, changed, and removed connections.
*/
@@ -142,6 +148,8 @@ void nm_system_config_interface_init (NM
GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *config);
+gboolean nm_system_config_interface_load_connection (NMSystemConfigInterface *config,
+ const char *filename);
void nm_system_config_interface_reload_connections (NMSystemConfigInterface *config);
GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config);
diff -up NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c
--- NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c.nmcli-con-load 2013-11-18 11:02:56.177304536 -0500
+++ NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c 2013-11-18 11:05:18.187312234 -0500
@@ -500,6 +500,30 @@ get_connections (NMSystemConfigInterface
return list;
}
+static gboolean
+load_connection (NMSystemConfigInterface *config,
+ const char *filename)
+{
+ SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config);
+ NMIfcfgConnection *connection;
+ int dir_len = strlen (IFCFG_DIR);
+
+ if ( strncmp (filename, IFCFG_DIR, dir_len) != 0
+ || filename[dir_len] != '/'
+ || strchr (filename + dir_len + 1, '/') != NULL)
+ return FALSE;
+
+ if (utils_should_ignore_file (filename + dir_len + 1, TRUE))
+ return FALSE;
+
+ connection = find_by_path (plugin, filename);
+ connection_new_or_changed (plugin, filename, connection, NULL);
+ if (!connection)
+ connection = find_by_path (plugin, filename);
+
+ return (connection != NULL);
+}
+
static void
reload_connections (NMSystemConfigInterface *config)
{
@@ -939,6 +963,7 @@ system_config_interface_init (NMSystemCo
/* interface implementation */
system_config_interface_class->get_connections = get_connections;
system_config_interface_class->add_connection = add_connection;
+ system_config_interface_class->load_connection = load_connection;
system_config_interface_class->reload_connections = reload_connections;
system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs;
system_config_interface_class->init = init;
diff -up NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c
--- NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c.nmcli-con-load 2013-10-01 14:43:58.000000000 -0400
+++ NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c 2013-11-18 11:02:56.189304537 -0500
@@ -403,6 +403,33 @@ get_connections (NMSystemConfigInterface
return list;
}
+static gboolean
+load_connection (NMSystemConfigInterface *config,
+ const char *filename)
+{
+ SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config);
+ NMKeyfileConnection *connection;
+ int dir_len = strlen (KEYFILE_DIR);
+
+ if ( strncmp (filename, KEYFILE_DIR, dir_len) != 0
+ || filename[dir_len] != '/'
+ || strchr (filename + dir_len + 1, '/') != NULL)
+ return FALSE;
+
+ if (nm_keyfile_plugin_utils_should_ignore_file (filename + dir_len + 1))
+ return FALSE;
+
+ connection = find_by_path (self, filename);
+ if (connection)
+ update_connection (self, connection, filename);
+ else {
+ new_connection (self, filename, NULL);
+ connection = find_by_path (self, filename);
+ }
+
+ return (connection != NULL);
+}
+
static void
reload_connections (NMSystemConfigInterface *config)
{
@@ -701,6 +728,7 @@ system_config_interface_init (NMSystemCo
{
/* interface implementation */
system_config_interface_class->get_connections = get_connections;
+ system_config_interface_class->load_connection = load_connection;
system_config_interface_class->reload_connections = reload_connections;
system_config_interface_class->add_connection = add_connection;
system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs;

File diff suppressed because it is too large Load Diff

View File

@ -1,520 +0,0 @@
From b7300bbe5a9f298ede02225b6b7e73e05aa78bc8 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Fri, 11 Oct 2013 14:59:26 -0400
Subject: [PATCH 1/2] core: improve handling of NPAR/SR-IOV devices (rh
#804527)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use the new kernel physical_port_id interface property to recognize
when two devices are just virtual devices sharing the same physical
port, and refuse to bond/team multiple slaves on the same port.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-device.xml | 8 +++++
src/devices/nm-device-bond.c | 2 ++
src/devices/nm-device-private.h | 3 ++
src/devices/nm-device-team.c | 2 ++
src/devices/nm-device.c | 70 +++++++++++++++++++++++++++++++++++++++-
src/devices/nm-device.h | 3 ++
src/platform/nm-fake-platform.c | 11 +++++++
src/platform/nm-linux-platform.c | 22 +++++++++++++
src/platform/nm-platform.c | 18 +++++++++++
src/platform/nm-platform.h | 4 +++
10 files changed, 142 insertions(+), 1 deletion(-)
diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml
index 7c63a3d..d9e7702 100644
--- a/introspection/nm-device.xml
+++ b/introspection/nm-device.xml
@@ -125,6 +125,14 @@
An array of object paths of every configured connection that is currently 'available' through this device.
</tp:docstring>
</property>
+ <property name="PhysicalPortId" type="s" access="read">
+ <tp:docstring>
+ If non-empty, an (opaque) indicator of the physical network
+ port associated with the device. This can be used to recognize
+ when two seemingly-separate hardware devices are actually just
+ different virtual interfaces to the same physical port.
+ </tp:docstring>
+ </property>
<method name="Disconnect">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_disconnect"/>
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
index 950bbb8..82e5a9d 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -364,6 +364,8 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
const char *iface = nm_device_get_ip_iface (device);
const char *slave_iface = nm_device_get_ip_iface (slave);
+ nm_device_master_check_slave_physical_port (device, slave, LOGD_BOND);
+
nm_device_take_down (slave, TRUE);
success = nm_platform_link_enslave (nm_device_get_ip_ifindex (device),
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
index dc72886..3da1479 100644
--- a/src/devices/nm-device-private.h
+++ b/src/devices/nm-device-private.h
@@ -92,6 +92,9 @@ gboolean nm_device_get_enslaved (NMDevice *device);
NMDevice *nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex);
+void nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave,
+ guint64 log_domain);
+
void nm_device_set_carrier (NMDevice *device, gboolean carrier);
#endif /* NM_DEVICE_PRIVATE_H */
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 1b3b0c0..31806bc 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -546,6 +546,8 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
const char *slave_iface = nm_device_get_ip_iface (slave);
NMSettingTeamPort *s_team_port;
+ nm_device_master_check_slave_physical_port (device, slave, LOGD_TEAM);
+
nm_device_take_down (slave, TRUE);
s_team_port = nm_connection_get_setting_team_port (connection);
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 4ef5030..a0bf465 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -129,6 +129,7 @@ enum {
PROP_RFKILL_TYPE,
PROP_IFINDEX,
PROP_AVAILABLE_CONNECTIONS,
+ PROP_PHYSICAL_PORT_ID,
PROP_IS_MASTER,
PROP_HW_ADDRESS,
PROP_HAS_PENDING_ACTION,
@@ -202,6 +203,7 @@ typedef struct {
GHashTable * available_connections;
guint8 hw_addr[NM_UTILS_HWADDR_LEN_MAX];
guint hw_addr_len;
+ char * physical_port_id;
gboolean manager_managed; /* whether managed by NMManager or not */
gboolean default_unmanaged; /* whether unmanaged by default */
@@ -589,8 +591,10 @@ constructed (GObject *object)
priv->carrier = TRUE;
}
- if (priv->ifindex > 0)
+ if (priv->ifindex > 0) {
priv->is_software = nm_platform_link_is_software (priv->ifindex);
+ priv->physical_port_id = nm_platform_link_get_physical_port_id (priv->ifindex);
+ }
if (G_OBJECT_CLASS (nm_device_parent_class)->constructed)
G_OBJECT_CLASS (nm_device_parent_class)->constructed (object);
@@ -1338,6 +1342,49 @@ nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex)
}
/**
+ * nm_device_master_check_slave_physical_port:
+ * @dev: the master device
+ * @slave: a slave device
+ * @log_domain: domain to log a warning in
+ *
+ * Checks if @dev already has a slave with the same #NMDevice:physical-port-id
+ * as @slave, and logs a warning if so.
+ */
+void
+nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave,
+ guint64 log_domain)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev);
+ const char *slave_physical_port_id, *existing_physical_port_id;
+ SlaveInfo *info;
+ GSList *iter;
+
+ slave_physical_port_id = nm_device_get_physical_port_id (slave);
+ if (!slave_physical_port_id)
+ return;
+
+ for (iter = priv->slaves; iter; iter = iter->next) {
+ info = iter->data;
+ if (info->slave == slave)
+ continue;
+
+ existing_physical_port_id = nm_device_get_physical_port_id (info->slave);
+ if (!g_strcmp0 (slave_physical_port_id, existing_physical_port_id)) {
+ nm_log_warn (log_domain, "(%s): slave %s shares a physical port with existing slave %s",
+ nm_device_get_ip_iface (dev),
+ nm_device_get_ip_iface (slave),
+ nm_device_get_ip_iface (info->slave));
+ /* Since this function will get called for every slave, we only have
+ * to warn about the first match we find; if there are other matches
+ * later in the list, we will have already warned about them matching
+ * @existing earlier.
+ */
+ return;
+ }
+ }
+}
+
+/**
* nm_device_is_master:
* @dev: the device
*
@@ -5172,6 +5219,8 @@ dispose (GObject *object)
g_hash_table_unref (priv->available_connections);
priv->available_connections = NULL;
+ g_clear_pointer (&priv->physical_port_id, g_free);
+
activation_source_clear (self, TRUE, AF_INET);
activation_source_clear (self, TRUE, AF_INET6);
@@ -5432,6 +5481,9 @@ get_property (GObject *object, guint prop_id,
g_ptr_array_add (array, g_strdup (nm_connection_get_path (connection)));
g_value_take_boxed (value, array);
break;
+ case PROP_PHYSICAL_PORT_ID:
+ g_value_set_string (value, priv->physical_port_id);
+ break;
case PROP_IS_MASTER:
g_value_set_boolean (value, priv->is_master);
break;
@@ -5689,6 +5741,14 @@ nm_device_class_init (NMDeviceClass *klass)
G_PARAM_READABLE));
g_object_class_install_property
+ (object_class, PROP_PHYSICAL_PORT_ID,
+ g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID,
+ "PhysicalPortId",
+ "PhysicalPortId",
+ NULL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property
(object_class, PROP_IS_MASTER,
g_param_spec_boolean (NM_DEVICE_IS_MASTER,
"IsMaster",
@@ -6908,3 +6968,11 @@ nm_device_has_pending_action (NMDevice *device)
return !!priv->pending_actions;
}
+
+const char *
+nm_device_get_physical_port_id (NMDevice *device)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
+
+ return priv->physical_port_id;
+}
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index 38b9bea..b593d0a 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -60,6 +60,7 @@
#define NM_DEVICE_AUTOCONNECT "autoconnect"
#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
+#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
#define NM_DEVICE_TYPE_DESC "type-desc" /* Internal only */
#define NM_DEVICE_RFKILL_TYPE "rfkill-type" /* Internal only */
#define NM_DEVICE_IFINDEX "ifindex" /* Internal only */
@@ -337,6 +338,8 @@ gboolean nm_device_has_pending_action (NMDevice *device);
void nm_device_remove_pending_action (NMDevice *device, const char *action);
gboolean nm_device_has_pending_action (NMDevice *device);
+const char *nm_device_get_physical_port_id (NMDevice *device);
+
G_END_DECLS
/* For testing only */
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 6d7843f..491e23e 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -466,6 +466,15 @@ link_get_mtu (NMPlatform *platform, int ifindex)
return device ? device->link.mtu : 0;
}
+static char *
+link_get_physical_port_id (NMPlatform *platform, int ifindex)
+{
+ /* We call link_get just to cause an error to be set if @ifindex is bad. */
+ link_get (platform, ifindex);
+
+ return NULL;
+}
+
static gboolean
link_supports_carrier_detect (NMPlatform *platform, int ifindex)
{
@@ -1189,6 +1198,8 @@ nm_fake_platform_class_init (NMFakePlatformClass *klass)
platform_class->link_get_mtu = link_get_mtu;
platform_class->link_set_mtu = link_set_mtu;
+ platform_class->link_get_physical_port_id = link_get_physical_port_id;
+
platform_class->link_supports_carrier_detect = link_supports_carrier_detect;
platform_class->link_supports_vlans = link_supports_vlans;
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 821a8cd..23125f8 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1725,6 +1725,26 @@ link_get_mtu (NMPlatform *platform, int ifindex)
return rtnllink ? rtnl_link_get_mtu (rtnllink) : 0;
}
+static char *
+link_get_physical_port_id (NMPlatform *platform, int ifindex)
+{
+ const char *ifname;
+ char *path, *id;
+
+ ifname = nm_platform_link_get_name (ifindex);
+ if (!ifname)
+ return NULL;
+
+ path = g_strdup_printf ("/sys/class/net/%s/physical_port_id", ifname);
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ id = sysctl_get (platform, path);
+ else
+ id = NULL;
+ g_free (path);
+
+ return id;
+}
+
static int
vlan_add (NMPlatform *platform, const char *name, int parent, int vlan_id, guint32 vlan_flags)
{
@@ -2719,6 +2739,8 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
platform_class->link_get_mtu = link_get_mtu;
platform_class->link_set_mtu = link_set_mtu;
+ platform_class->link_get_physical_port_id = link_get_physical_port_id;
+
platform_class->link_supports_carrier_detect = link_supports_carrier_detect;
platform_class->link_supports_vlans = link_supports_vlans;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index f5a4c9b..7460b12 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -734,6 +734,24 @@ nm_platform_link_get_mtu (int ifindex)
}
/**
+ * nm_platform_link_get_mtu:
+ * @ifindex: Interface index
+ *
+ * Returns: physical port ID for the interface, or %NULL on error
+ * or if the interface has no physical port ID.
+ */
+char *
+nm_platform_link_get_physical_port_id (int ifindex)
+{
+ reset_error ();
+
+ g_return_val_if_fail (ifindex >= 0, NULL);
+ g_return_val_if_fail (klass->link_get_physical_port_id, NULL);
+
+ return klass->link_get_physical_port_id (platform, ifindex);
+}
+
+/**
* nm_platform_link_enslave:
* @master: Interface index of the master
* @slave: Interface index of the slave
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index b11bbc3..5494d48 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -251,6 +251,8 @@ typedef struct {
guint32 (*link_get_mtu) (NMPlatform *, int ifindex);
gboolean (*link_set_mtu) (NMPlatform *, int ifindex, guint32 mtu);
+ char * (*link_get_physical_port_id) (NMPlatform *, int ifindex);
+
gboolean (*link_supports_carrier_detect) (NMPlatform *, int ifindex);
gboolean (*link_supports_vlans) (NMPlatform *, int ifindex);
@@ -370,6 +372,8 @@ gboolean nm_platform_link_set_address (int ifindex, const void *address, size_t
guint32 nm_platform_link_get_mtu (int ifindex);
gboolean nm_platform_link_set_mtu (int ifindex, guint32 mtu);
+char *nm_platform_link_get_physical_port_id (int ifindex);
+
gboolean nm_platform_link_supports_carrier_detect (int ifindex);
gboolean nm_platform_link_supports_vlans (int ifindex);
--
1.7.11.7
From 47cc8b25f2efe015defde7e76e49e67086603bb3 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Fri, 11 Oct 2013 14:59:26 -0400
Subject: [PATCH 2/2] libnm-glib: add NMDevice:physical-port-id property
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the physical-port-id property to NMDevice so that clients can
recognize NPAR/SR-IOV devices.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 1 +
libnm-glib/nm-device.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++
libnm-glib/nm-device.h | 2 ++
3 files changed, 58 insertions(+)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 4727bc3..416b782 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -130,6 +130,7 @@ global:
nm_device_get_ip6_config;
nm_device_get_ip_iface;
nm_device_get_managed;
+ nm_device_get_physical_port_id;
nm_device_get_product;
nm_device_get_state;
nm_device_get_state_reason;
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 05e59e5..d4f95ac 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -96,6 +96,8 @@ typedef struct {
GUdevClient *client;
char *product;
char *vendor;
+
+ char *physical_port_id;
} NMDevicePrivate;
enum {
@@ -121,6 +123,7 @@ enum {
PROP_DEVICE_TYPE,
PROP_ACTIVE_CONNECTION,
PROP_AVAILABLE_CONNECTIONS,
+ PROP_PHYSICAL_PORT_ID,
LAST_PROP
};
@@ -199,6 +202,7 @@ register_properties (NMDevice *device)
{ NM_DEVICE_STATE_REASON, &priv->state, demarshal_state_reason },
{ NM_DEVICE_ACTIVE_CONNECTION, &priv->active_connection, NULL, NM_TYPE_ACTIVE_CONNECTION },
{ NM_DEVICE_AVAILABLE_CONNECTIONS, &priv->available_connections, NULL, NM_TYPE_REMOTE_CONNECTION },
+ { NM_DEVICE_PHYSICAL_PORT_ID, &priv->physical_port_id },
/* Properties that exist in D-Bus but that we don't track */
{ "ip4-address", NULL },
@@ -389,6 +393,7 @@ finalize (GObject *object)
g_free (priv->product);
g_free (priv->vendor);
g_free (priv->type_description);
+ g_free (priv->physical_port_id);
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
}
@@ -473,6 +478,9 @@ get_property (GObject *object,
case PROP_VENDOR:
g_value_set_string (value, nm_device_get_vendor (device));
break;
+ case PROP_PHYSICAL_PORT_ID:
+ g_value_set_string (value, nm_device_get_physical_port_id (device));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -804,6 +812,22 @@ nm_device_class_init (NMDeviceClass *device_class)
NULL,
G_PARAM_READABLE));
+ /**
+ * NMDevice:physical-port-id:
+ *
+ * The physical port ID of the device. (See
+ * nm_device_get_physical_port_id().)
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_PHYSICAL_PORT_ID,
+ g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID,
+ "Physical Port ID",
+ "Physical port ID",
+ NULL,
+ G_PARAM_READABLE));
+
/* signals */
/**
@@ -1517,6 +1541,37 @@ nm_device_get_vendor (NMDevice *device)
return priv->vendor;
}
+/**
+ * nm_device_get_physical_port_id:
+ * @device: a #NMDevice
+ *
+ * Gets the physical port ID of the #NMDevice. If non-%NULL, this is
+ * an opaque string that can be used to recognize when
+ * seemingly-unrelated #NMDevices are actually just different virtual
+ * ports on a single physical port. (Eg, NPAR / SR-IOV.)
+ *
+ * Returns: the physical port ID of the device, or %NULL if the port
+ * ID is unknown. This is the internal string used by the device and
+ * must not be modified.
+ *
+ * Since: 0.9.10
+ **/
+const char *
+nm_device_get_physical_port_id (NMDevice *device)
+{
+ NMDevicePrivate *priv;
+
+ g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
+
+ priv = NM_DEVICE_GET_PRIVATE (device);
+
+ _nm_object_ensure_inited (NM_OBJECT (device));
+ if (priv->physical_port_id && *priv->physical_port_id)
+ return priv->physical_port_id;
+ else
+ return NULL;
+}
+
typedef struct {
NMDevice *device;
NMDeviceDeactivateFn fn;
diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h
index ed274ca..bd746b3 100644
--- a/libnm-glib/nm-device.h
+++ b/libnm-glib/nm-device.h
@@ -80,6 +80,7 @@ GQuark nm_device_error_quark (void);
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
#define NM_DEVICE_VENDOR "vendor"
#define NM_DEVICE_PRODUCT "product"
+#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
typedef struct {
NMObject parent;
@@ -135,6 +136,7 @@ NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
const GPtrArray * nm_device_get_available_connections(NMDevice *device);
const char * nm_device_get_product (NMDevice *device);
const char * nm_device_get_vendor (NMDevice *device);
+const char * nm_device_get_physical_port_id (NMDevice *device);
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
--
1.7.11.7

View File

@ -1,34 +0,0 @@
From 90782cf023c2fc2c223203a97ca2ea56a0c61c55 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 17:21:11 -0600
Subject: [PATCH] platform: ignore errors adding IPv6 point-to-point address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
For now, ignore them, as libnl does not support IPv6 PtP addresses
and returns an error. In the future perhaps we'll want to add a host
route for the peer instead of using the point-to-point address.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-linux-platform.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index a633b82..a834333 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2274,7 +2274,8 @@ build_rtnl_addr (int family,
auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen);
nle = rtnl_addr_set_peer (rtnladdr, nlpeer);
- g_assert (!nle);
+ /* IPv6 doesn't support peer addresses yet */
+ g_assert (!nle || (nle == -NLE_AF_NOSUPPORT));
}
rtnl_addr_set_prefixlen (rtnladdr, plen);
--
1.7.11.7

31
readme-ifcfg-rh.txt Normal file
View File

@ -0,0 +1,31 @@
NetworkManager stores new network profiles in keyfile format in the
/etc/NetworkManager/system-connections/ directory.
Previously, NetworkManager stored network profiles in ifcfg format
in this directory (/etc/sysconfig/network-scripts/). However, the ifcfg
format is deprecated. By default, NetworkManager no longer creates
new profiles in this format.
Connection profiles in keyfile format have many benefits. For example,
this format is INI file-based and can easily be parsed and generated.
Each section in NetworkManager keyfiles corresponds to a NetworkManager
setting name as described in the nm-settings(5) and nm-settings-keyfile(5)
man pages. Each key-value-pair in a section is one of the properties
listed in the settings specification of the man page.
If you still use network profiles in ifcfg format, consider migrating
them to keyfile format. To migrate all profiles at once, enter:
# nmcli connection migrate
This command migrates all profiles from ifcfg format to keyfile
format and stores them in /etc/NetworkManager/system-connections/.
Alternatively, to migrate only a specific profile, enter:
# nmcli connection migrate <profile_name|UUID|D-Bus_path>
For further details, see:
* nm-settings-keyfile(5)
* nmcli(1)

View File

@ -1,31 +0,0 @@
From df4c9347fc85ec2aa7ddc67e0ff39bc1d56f669a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 27 Jan 2014 17:36:30 +0100
Subject: [PATCH] libnm-glib: chain up the parent constructed() of
NMRemoteConnection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-remote-connection.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 73a2cc8..27baebd 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -508,6 +508,8 @@ constructed (GObject *object)
{
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
+ G_OBJECT_CLASS (nm_remote_connection_parent_class)->constructed (object);
+
g_assert (priv->bus);
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
--
1.7.11.7

View File

@ -1,27 +0,0 @@
commit 9543e45afe0746ac1c9c10e4f78f43264fd288b4
Author: Dan Williams <dcbw@redhat.com>
Date: Mon Oct 7 11:40:16 2013 -0500
core: allow IPv4 to proceed if IPv6 is globally disabled but set to "auto" (rh #1012151)
If the user disabled IPv6 support in the kernel with "ipv6.disable=1" on the
kernel boot line, then any attempts to open IPv6 sockets (which libndp does)
will fail. This failed the entire connection, even if IPv6's "may-fail"
property was TRUE. Instead, just fail IPv6 and allow IPv4 to proceed. If
IPv4 fails or is disabled, then other logic will fail the entire connection.
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index d99b3d7..6810afc 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3329,8 +3329,8 @@ act_stage3_ip6_config_start (NMDevice *self,
if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0
|| strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0) {
if (!addrconf6_start (self)) {
- *reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
- ret = NM_ACT_STAGE_RETURN_FAILURE;
+ /* IPv6 might be disabled; allow IPv4 to proceed */
+ ret = NM_ACT_STAGE_RETURN_STOP;
} else
ret = NM_ACT_STAGE_RETURN_POSTPONE;
} else if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0) {

View File

@ -1,74 +0,0 @@
From 473018d8b2628ce946cc35db432ac2bc68f6f912 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Wed, 16 Oct 2013 12:29:13 -0500
Subject: [PATCH] platform: detect non-mac80211 WiFi devices as WiFi (rh
#1015598)
Before NMPlatform landed, the old NMManager code looked at either
DEVTYPE=wlan or asked the internal wifi utilities whether the
device was WiFi or not. This got lost when moving to NMPlatform.
It turns out that only mac80211-based drivers set the DEVTYPE=wlan
flag in sysfs, while older WEXT, out-of-tree, and staging drivers
often do not (though they should).
To avoid breaking recognition of these crappy drivers that used
to work, re-add the wifi utils checks.
---
src/platform/nm-linux-platform.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 0bea01b..82286ec 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -41,14 +41,15 @@
#include <netlink/route/link/vlan.h>
#include <netlink/route/addr.h>
#include <netlink/route/route.h>
#include <gudev/gudev.h>
#include "nm-linux-platform.h"
#include "nm-logging.h"
+#include "wifi/wifi-utils.h"
/* This is only included for the translation of VLAN flags */
#include "nm-setting-vlan.h"
#define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__)
#define warning(...) nm_log_warn (LOGD_PLATFORM, __VA_ARGS__)
#define error(...) nm_log_err (LOGD_PLATFORM, __VA_ARGS__)
@@ -473,26 +474,28 @@ type_to_string (NMLinkType type)
} G_STMT_END
static NMLinkType
link_type_from_udev (NMPlatform *platform, int ifindex, int arptype, const char **out_name)
{
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
GUdevDevice *udev_device;
- const char *prop;
+ const char *prop, *name, *sysfs_path;
udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (ifindex));
if (!udev_device)
return_type (NM_LINK_TYPE_UNKNOWN, "unknown");
prop = g_udev_device_get_property (udev_device, "ID_NM_OLPC_MESH");
if (prop)
return_type (NM_LINK_TYPE_OLPC_MESH, "olpc-mesh");
prop = g_udev_device_get_property (udev_device, "DEVTYPE");
- if (g_strcmp0 (prop, "wlan") == 0)
+ name = g_udev_device_get_name (udev_device);
+ sysfs_path = g_udev_device_get_sysfs_path (udev_device);
+ if (g_strcmp0 (prop, "wlan") == 0 || wifi_utils_is_wifi (name, sysfs_path))
return_type (NM_LINK_TYPE_WIFI, "wifi");
else if (g_strcmp0 (prop, "wwan") == 0)
return_type (NM_LINK_TYPE_WWAN_ETHERNET, "wwan");
if (arptype == ARPHRD_ETHER)
return_type (NM_LINK_TYPE_ETHERNET, "ethernet");
--
1.8.3.1

View File

@ -1,88 +0,0 @@
From 073cc01f52f8b2b6d5b20c63814dc1ed00699028 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 18 Nov 2013 23:37:58 +0100
Subject: [PATCH] dispatcher: fix crash while logging from signal handler
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug rh#1017884 describes a crash, where dbus_init() failed, which causes
a g_warning(). While writing the warning, a SIGTERM hit, and the
signal_handler() tries to call again g_message().
The logging functions of glib are not reentrant and call abort() when
invoked recursivly. The solution, is to use g_unix_signal_add, which
will dispatch the handler on the mainloop asynchronously.
This bug is not that serious, because the dispatcher was about to
terminate anyway. However, it gets registered as a crash by the system
(ABRT).
https://bugzilla.redhat.com/show_bug.cgi?id=1017884
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
callouts/nm-dispatcher-action.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c
index 397f2ba..f48ff0a 100644
--- a/callouts/nm-dispatcher-action.c
+++ b/callouts/nm-dispatcher-action.c
@@ -31,6 +31,7 @@
#include <arpa/inet.h>
#include <glib.h>
+#include <glib-unix.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
@@ -597,27 +598,15 @@ logging_shutdown (void)
closelog ();
}
-static void
-signal_handler (int signo)
+static gboolean
+signal_handler (gpointer user_data)
{
- if (signo == SIGINT || signo == SIGTERM) {
- g_message ("Caught signal %d, shutting down...", signo);
- g_main_loop_quit (loop);
- }
-}
+ int signo = GPOINTER_TO_INT (user_data);
-static void
-setup_signals (void)
-{
- struct sigaction action;
- sigset_t mask;
-
- sigemptyset (&mask);
- action.sa_handler = signal_handler;
- action.sa_mask = mask;
- action.sa_flags = 0;
- sigaction (SIGTERM, &action, NULL);
- sigaction (SIGINT, &action, NULL);
+ g_message ("Caught signal %d, shutting down...", signo);
+ g_main_loop_quit (loop);
+
+ return G_SOURCE_REMOVE;
}
int
@@ -648,7 +637,8 @@ main (int argc, char **argv)
g_option_context_free (opt_ctx);
g_type_init ();
- setup_signals ();
+ g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
+ g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
if (!debug)
logging_setup ();
--
1.7.11.7

View File

@ -1,857 +0,0 @@
From fec50bd5fad633e57bfd6f9ee480e6192504ca5f Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Mon, 2 Dec 2013 10:20:26 -0500
Subject: [PATCH] platform/core: add back support for PtP/peer addresses (rh
#1018317)
In the migration to NMPlatform, support for ptp/peer addresses was
accidentally dropped. This broke OpenVPN configurations using 'p2p'
topology, which send a different peer address than the local address
for tunX, plus the server may also push routes that use the peer
address as the next hop. NetworkManager was unable to add these
routes, because the kernel had no idea how to talk to the peer,
because the peer's address was not assigned to any interface or
reachable over any routes.
Partly based on a patch from Dan Williams.
---
src/nm-ip4-config.c | 44 +---------------------------
src/nm-ip4-config.h | 4 ---
src/nm-ip6-config.c | 49 -------------------------------
src/nm-ip6-config.h | 4 ---
src/platform/nm-fake-platform.c | 10 +++++--
src/platform/nm-linux-platform.c | 58 ++++++++++++++++++++++++++++++++-----
src/platform/nm-platform.c | 26 +++++++++++++----
src/platform/nm-platform.h | 14 ++++++---
src/platform/tests/platform.c | 4 +--
src/platform/tests/test-address.c | 12 ++++----
src/platform/tests/test-cleanup.c | 4 +--
src/ppp-manager/nm-ppp-manager.c | 2 +-
src/tests/test-dhcp-options.c | 5 ++--
src/tests/test-ip4-config.c | 12 ++++----
src/tests/test-ip6-config.c | 13 ++++-----
src/vpn-manager/nm-vpn-connection.c | 10 +++----
16 files changed, 118 insertions(+), 153 deletions(-)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 7aff888..640a1e1 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -47,7 +47,6 @@ typedef struct {
GPtrArray *domains;
GPtrArray *searches;
guint32 mss;
- guint32 ptp_address;
GArray *nis;
char *nis_domain;
GArray *wins;
@@ -454,10 +453,6 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src)
for (i = 0; i < nm_ip4_config_get_num_addresses (src); i++)
nm_ip4_config_add_address (dst, nm_ip4_config_get_address (src, i));
- /* ptp address; only replace if src doesn't have one */
- if (!nm_ip4_config_get_ptp_address (dst))
- nm_ip4_config_set_ptp_address (dst, nm_ip4_config_get_ptp_address (src));
-
/* nameservers */
for (i = 0; i < nm_ip4_config_get_num_nameservers (src); i++)
nm_ip4_config_add_nameserver (dst, nm_ip4_config_get_nameserver (src, i));
@@ -527,10 +522,6 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src)
}
}
- /* ptp address */
- if (nm_ip4_config_get_ptp_address (src) == nm_ip4_config_get_ptp_address (dst))
- nm_ip4_config_set_ptp_address (dst, 0);
-
/* nameservers */
for (i = 0; i < nm_ip4_config_get_num_nameservers (src); i++) {
guint32 src_ns = nm_ip4_config_get_nameserver (src, i);
@@ -788,12 +779,6 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
has_minor_changes = TRUE;
}
- /* ptp address */
- if (src_priv->ptp_address != dst_priv->ptp_address) {
- dst_priv->ptp_address = src_priv->ptp_address;
- has_relevant_changes = TRUE;
- }
-
/* nis */
num = nm_ip4_config_get_num_nis_servers (src);
are_equal = num == nm_ip4_config_get_num_nis_servers (dst);
@@ -873,11 +858,6 @@ nm_ip4_config_dump (const NMIP4Config *config, const char *detail)
}
}
- /* ptp address */
- tmp = nm_ip4_config_get_ptp_address (config);
- if (inet_ntop (AF_INET, (void *) &tmp, buf, sizeof (buf)))
- g_message (" ptp: %s", buf);
-
/* default gateway */
tmp = nm_ip4_config_get_gateway (config);
if (inet_ntop (AF_INET, (void *) &tmp, buf, sizeof (buf)))
@@ -1314,24 +1294,6 @@ nm_ip4_config_get_mss (const NMIP4Config *config)
/******************************************************************/
void
-nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr)
-{
- NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
-
- priv->ptp_address = ptp_addr;
-}
-
-guint32
-nm_ip4_config_get_ptp_address (const NMIP4Config *config)
-{
- NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
-
- return priv->ptp_address;
-}
-
-/******************************************************************/
-
-void
nm_ip4_config_reset_nis_servers (NMIP4Config *config)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
@@ -1480,7 +1442,7 @@ hash_u32 (GChecksum *sum, guint32 n)
void
nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only)
{
- guint32 i, n;
+ guint32 i;
const char *s;
g_return_if_fail (config);
@@ -1504,10 +1466,6 @@ nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only
hash_u32 (sum, route->metric);
}
- n = nm_ip4_config_get_ptp_address (config);
- if (n)
- hash_u32 (sum, n);
-
for (i = 0; i < nm_ip4_config_get_num_nis_servers (config); i++)
hash_u32 (sum, nm_ip4_config_get_nis_server (config, i));
diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h
index 5b76fb4..d57cd52 100644
--- a/src/nm-ip4-config.h
+++ b/src/nm-ip4-config.h
@@ -117,10 +117,6 @@ const char * nm_ip4_config_get_search (const NMIP4Config *config, guint i);
void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss);
guint32 nm_ip4_config_get_mss (const NMIP4Config *config);
-/* PTP */
-void nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr);
-guint32 nm_ip4_config_get_ptp_address (const NMIP4Config *config);
-
/* NIS */
void nm_ip4_config_reset_nis_servers (NMIP4Config *config);
void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis);
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 65cbd0b..8eb79f2 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -47,7 +47,6 @@ typedef struct {
GPtrArray *domains;
GPtrArray *searches;
guint32 mss;
- struct in6_addr ptp_address;
} NMIP6ConfigPrivate;
@@ -457,10 +456,6 @@ nm_ip6_config_merge (NMIP6Config *dst, const NMIP6Config *src)
for (i = 0; i < nm_ip6_config_get_num_addresses (src); i++)
nm_ip6_config_add_address (dst, nm_ip6_config_get_address (src, i));
- /* ptp address; only replace if src doesn't have one */
- if (!nm_ip6_config_get_ptp_address (dst))
- nm_ip6_config_set_ptp_address (dst, nm_ip6_config_get_ptp_address (src));
-
/* nameservers */
for (i = 0; i < nm_ip6_config_get_num_nameservers (src); i++)
nm_ip6_config_add_nameserver (dst, nm_ip6_config_get_nameserver (src, i));
@@ -535,12 +530,6 @@ nm_ip6_config_subtract (NMIP6Config *dst, const NMIP6Config *src)
}
}
- /* ptp address */
- src_tmp = nm_ip6_config_get_ptp_address (src);
- dst_tmp = nm_ip6_config_get_ptp_address (dst);
- if (src_tmp && dst_tmp && IN6_ARE_ADDR_EQUAL (src_tmp, dst_tmp))
- nm_ip6_config_set_ptp_address (dst, NULL);
-
/* nameservers */
for (i = 0; i < nm_ip6_config_get_num_nameservers (src); i++) {
const struct in6_addr *src_ns = nm_ip6_config_get_nameserver (src, i);
@@ -769,12 +758,6 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev
has_minor_changes = TRUE;
}
- /* ptp address */
- if (!IN6_ARE_ADDR_EQUAL (&src_priv->ptp_address, &dst_priv->ptp_address)) {
- nm_ip6_config_set_ptp_address (dst, &src_priv->ptp_address);
- has_relevant_changes = TRUE;
- }
-
/* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes
* regardless of config_equal. But config_equal must correspond to has_relevant_changes. */
g_assert (config_equal == !has_relevant_changes);
@@ -1219,28 +1197,6 @@ nm_ip6_config_get_mss (const NMIP6Config *config)
/******************************************************************/
-void
-nm_ip6_config_set_ptp_address (NMIP6Config *config, const struct in6_addr *ptp_address)
-{
- NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
-
- if (ptp_address)
- priv->ptp_address = *ptp_address;
- else
- memset (&priv->ptp_address, 0, sizeof (priv->ptp_address));
-
-}
-
-const struct in6_addr *
-nm_ip6_config_get_ptp_address (const NMIP6Config *config)
-{
- NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
-
- return IN6_IS_ADDR_UNSPECIFIED (&priv->ptp_address) ? NULL : &priv->ptp_address;
-}
-
-/******************************************************************/
-
static inline void
hash_u32 (GChecksum *sum, guint32 n)
{
@@ -1260,7 +1216,6 @@ void
nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only)
{
guint32 i;
- const struct in6_addr *in6a;
const char *s;
g_return_if_fail (config);
@@ -1284,10 +1239,6 @@ nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only
hash_in6addr (sum, &route->gateway);
hash_u32 (sum, route->metric);
}
-
- in6a = nm_ip6_config_get_ptp_address (config);
- if (in6a)
- hash_in6addr (sum, in6a);
}
for (i = 0; i < nm_ip6_config_get_num_nameservers (config); i++)
diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h
index aecdab2..eb93d07 100644
--- a/src/nm-ip6-config.h
+++ b/src/nm-ip6-config.h
@@ -116,10 +116,6 @@ const char * nm_ip6_config_get_search (const NMIP6Config *config, guint i);
void nm_ip6_config_set_mss (NMIP6Config *config, guint32 mss);
guint32 nm_ip6_config_get_mss (const NMIP6Config *config);
-/* PTP */
-void nm_ip6_config_set_ptp_address (NMIP6Config *config, const struct in6_addr *ptp_addr);
-const struct in6_addr *nm_ip6_config_get_ptp_address (const NMIP6Config *config);
-
void nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only);
gboolean nm_ip6_config_equal (const NMIP6Config *a, const NMIP6Config *b);
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index df5d5b8..dcbf932 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -739,7 +739,9 @@ get_time (void)
}
static gboolean
-ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred)
+ip4_address_add (NMPlatform *platform, int ifindex,
+ in_addr_t addr, in_addr_t peer_addr,
+ int plen, guint32 lifetime, guint32 preferred)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
NMPlatformIP4Address address;
@@ -748,6 +750,7 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu
memset (&address, 0, sizeof (address));
address.ifindex = ifindex;
address.address = addr;
+ address.peer_address = peer_addr;
address.plen = plen;
address.timestamp = get_time ();
address.lifetime = lifetime;
@@ -775,7 +778,9 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu
}
static gboolean
-ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
+ip6_address_add (NMPlatform *platform, int ifindex,
+ struct in6_addr addr, struct in6_addr peer_addr,
+ int plen, guint32 lifetime, guint32 preferred, guint flags)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
NMPlatformIP6Address address;
@@ -784,6 +789,7 @@ ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int pl
memset (&address, 0, sizeof (address));
address.ifindex = ifindex;
address.address = addr;
+ address.peer_address = peer_addr;
address.plen = plen;
address.timestamp = get_time ();
address.lifetime = lifetime;
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index d13abbe..50b027a 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -764,6 +764,7 @@ static void
init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
{
struct nl_addr *nladdr = rtnl_addr_get_local (rtnladdr);
+ struct nl_addr *nlpeer = rtnl_addr_get_peer (rtnladdr);
g_assert (nladdr);
@@ -776,12 +777,17 @@ init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
g_assert (nl_addr_get_len (nladdr) == sizeof (address->address));
memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address));
+ if (nlpeer) {
+ g_assert (nl_addr_get_len (nlpeer) == sizeof (address->peer_address));
+ memcpy (&address->peer_address, nl_addr_get_binary_addr (nlpeer), sizeof (address->peer_address));
+ }
}
static void
init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
{
struct nl_addr *nladdr = rtnl_addr_get_local (rtnladdr);
+ struct nl_addr *nlpeer = rtnl_addr_get_peer (rtnladdr);
memset (address, 0, sizeof (*address));
@@ -793,6 +799,10 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
address->flags = rtnl_addr_get_flags (rtnladdr);
g_assert (nl_addr_get_len (nladdr) == sizeof (address->address));
memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address));
+ if (nlpeer) {
+ g_assert (nl_addr_get_len (nlpeer) == sizeof (address->peer_address));
+ memcpy (&address->peer_address, nl_addr_get_binary_addr (nlpeer), sizeof (address->peer_address));
+ }
}
static gboolean
@@ -2208,7 +2218,14 @@ ip6_address_get_all (NMPlatform *platform, int ifindex)
}
static struct nl_object *
-build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
+build_rtnl_addr (int family,
+ int ifindex,
+ gconstpointer addr,
+ gconstpointer peer_addr,
+ int plen,
+ guint32 lifetime,
+ guint32 preferred,
+ guint flags)
{
struct rtnl_addr *rtnladdr = rtnl_addr_alloc ();
int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr);
@@ -2220,6 +2237,14 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32
rtnl_addr_set_ifindex (rtnladdr, ifindex);
nle = rtnl_addr_set_local (rtnladdr, nladdr);
g_assert (!nle);
+
+ if (peer_addr) {
+ auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen);
+
+ nle = rtnl_addr_set_peer (rtnladdr, nlpeer);
+ g_assert (!nle);
+ }
+
rtnl_addr_set_prefixlen (rtnladdr, plen);
if (lifetime) {
rtnl_addr_set_valid_lifetime (rtnladdr, lifetime);
@@ -2232,33 +2257,50 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32
}
static gboolean
-ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred)
+ip4_address_add (NMPlatform *platform,
+ int ifindex,
+ in_addr_t addr,
+ in_addr_t peer_addr,
+ int plen,
+ guint32 lifetime,
+ guint32 preferred)
{
- return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred, 0));
+ return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr,
+ peer_addr ? &peer_addr : NULL,
+ plen, lifetime, preferred, 0));
}
static gboolean
-ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
+ip6_address_add (NMPlatform *platform,
+ int ifindex,
+ struct in6_addr addr,
+ struct in6_addr peer_addr,
+ int plen,
+ guint32 lifetime,
+ guint32 preferred,
+ guint flags)
{
- return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred, flags));
+ return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr,
+ memcmp (&peer_addr, &in6addr_any, sizeof (struct in6_addr)) == 0 ? NULL : &peer_addr,
+ plen, lifetime, preferred, flags));
}
static gboolean
ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen)
{
- return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0, 0));
+ return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, NULL, plen, 0, 0, 0));
}
static gboolean
ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen)
{
- return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0, 0));
+ return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, NULL, plen, 0, 0, 0));
}
static gboolean
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, plen, 0, 0, 0);
+ auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, NULL, plen, 0, 0, 0);
auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object);
return !!cached_object;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 3f7f054..4e9c8fc 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1165,7 +1165,12 @@ nm_platform_ip6_address_get_all (int ifindex)
}
gboolean
-nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 lifetime, guint32 preferred)
+nm_platform_ip4_address_add (int ifindex,
+ in_addr_t address,
+ in_addr_t peer_address,
+ int plen,
+ guint32 lifetime,
+ guint32 preferred)
{
reset_error ();
@@ -1175,11 +1180,17 @@ nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 l
g_return_val_if_fail (klass->ip4_address_add, FALSE);
debug ("address: adding or updating IPv4 address");
- return klass->ip4_address_add (platform, ifindex, address, plen, lifetime, preferred);
+ return klass->ip4_address_add (platform, ifindex, address, peer_address, plen, lifetime, preferred);
}
gboolean
-nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred, guint flags)
+nm_platform_ip6_address_add (int ifindex,
+ struct in6_addr address,
+ struct in6_addr peer_address,
+ int plen,
+ guint32 lifetime,
+ guint32 preferred,
+ guint flags)
{
reset_error ();
@@ -1189,7 +1200,7 @@ nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, gui
g_return_val_if_fail (klass->ip6_address_add, FALSE);
debug ("address: adding or updating IPv6 address");
- return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred, flags);
+ return klass->ip6_address_add (platform, ifindex, address, peer_address, plen, lifetime, preferred, flags);
}
gboolean
@@ -1350,7 +1361,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
- if (!nm_platform_ip4_address_add (ifindex, known_address->address, known_address->plen, lifetime, preferred))
+ if (!nm_platform_ip4_address_add (ifindex, known_address->address, known_address->peer_address, known_address->plen, lifetime, preferred))
return FALSE;
}
@@ -1407,7 +1418,8 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses)
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
- if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen,
+ if (!nm_platform_ip6_address_add (ifindex, known_address->address,
+ known_address->peer_address, known_address->plen,
lifetime, preferred, known_address->flags))
return FALSE;
}
@@ -1843,6 +1855,7 @@ nm_platform_ip4_address_cmp (const NMPlatformIP4Address *a, const NMPlatformIP4A
{
_CMP_POINTER (a, b);
_CMP_FIELD_MEMCMP (a, b, address);
+ _CMP_FIELD_MEMCMP (a, b, peer_address);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD (a, b, plen);
_CMP_FIELD (a, b, timestamp);
@@ -1857,6 +1870,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
_CMP_POINTER (a, b);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD_MEMCMP (a, b, address);
+ _CMP_FIELD_MEMCMP (a, b, peer_address);
_CMP_FIELD (a, b, plen);
_CMP_FIELD (a, b, timestamp);
_CMP_FIELD (a, b, lifetime);
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index ff338fc..b742c39 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -122,6 +122,7 @@ typedef struct {
typedef struct {
int ifindex;
in_addr_t address;
+ in_addr_t peer_address; /* PTP peer address */
int plen;
guint32 timestamp;
guint32 lifetime;
@@ -131,6 +132,7 @@ typedef struct {
typedef struct {
int ifindex;
struct in6_addr address;
+ struct in6_addr peer_address;
int plen;
guint32 timestamp;
guint32 lifetime;
@@ -280,9 +282,11 @@ typedef struct {
GArray * (*ip4_address_get_all) (NMPlatform *, int ifindex);
GArray * (*ip6_address_get_all) (NMPlatform *, int ifindex);
- gboolean (*ip4_address_add) (NMPlatform *, int ifindex, in_addr_t address, int plen,
- guint32 lifetime, guint32 preferred_lft);
- gboolean (*ip6_address_add) (NMPlatform *, int ifindex, struct in6_addr address, int plen,
+ gboolean (*ip4_address_add) (NMPlatform *, int ifindex,
+ in_addr_t address, in_addr_t peer_address, int plen,
+ guint32 lifetime, guint32 preferred_lft);
+ gboolean (*ip6_address_add) (NMPlatform *, int ifindex,
+ struct in6_addr address, struct in6_addr peer_address, int plen,
guint32 lifetime, guint32 preferred_lft, guint flags);
gboolean (*ip4_address_delete) (NMPlatform *, int ifindex, in_addr_t address, int plen);
gboolean (*ip6_address_delete) (NMPlatform *, int ifindex, struct in6_addr address, int plen);
@@ -402,9 +406,11 @@ gboolean nm_platform_gre_get_properties (int ifindex, NMPlatformGreProperties *p
GArray *nm_platform_ip4_address_get_all (int ifindex);
GArray *nm_platform_ip6_address_get_all (int ifindex);
-gboolean nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen,
- guint32 lifetime, guint32 preferred_lft);
-gboolean nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen,
+gboolean nm_platform_ip4_address_add (int ifindex,
+ in_addr_t address, in_addr_t peer_address, int plen,
+ guint32 lifetime, guint32 preferred_lft);
+gboolean nm_platform_ip6_address_add (int ifindex,
+ struct in6_addr address, struct in6_addr peer_address, int plen,
guint32 lifetime, guint32 preferred_lft, guint flags);
gboolean nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen);
gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index c0b2c02..7ca2cb5 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -523,7 +523,7 @@ do_ip4_address_add (char **argv)
guint32 lifetime = strtol (*argv++, NULL, 10);
guint32 preferred = strtol (*argv++, NULL, 10);
- gboolean value = nm_platform_ip4_address_add (ifindex, address, plen, lifetime, preferred);
+ gboolean value = nm_platform_ip4_address_add (ifindex, address, 0, plen, lifetime, preferred);
return value;
} else
return FALSE;
@@ -541,7 +541,7 @@ do_ip6_address_add (char **argv)
guint32 preferred = strtol (*argv++, NULL, 10);
guint flags = (*argv) ? rtnl_addr_str2flags (*argv++) : 0;
- gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred, flags);
+ gboolean value = nm_platform_ip6_address_add (ifindex, address, in6addr_any, plen, lifetime, preferred, flags);
return value;
} else
return FALSE;
diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c
index 52952c3..0f0ccc8 100644
--- a/src/platform/tests/test-address.c
+++ b/src/platform/tests/test-address.c
@@ -60,14 +60,14 @@ test_ip4_address (void)
/* Add address */
g_assert (!nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN));
no_error ();
- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred));
no_error ();
g_assert (nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN));
no_error ();
accept_signal (address_added);
/* Add address again (aka update) */
- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred));
no_error ();
accept_signal (address_changed);
@@ -116,14 +116,14 @@ test_ip6_address (void)
/* Add address */
g_assert (!nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
no_error ();
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags));
no_error ();
g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
no_error ();
accept_signal (address_added);
/* Add address again (aka update) */
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags));
no_error ();
accept_signal (address_changed);
@@ -183,7 +183,7 @@ test_ip4_address_external (void)
/* Add/delete conflict */
run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d",
IP4_ADDRESS, IP4_PLEN, DEVICE_NAME, lifetime, preferred);
- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred));
no_error ();
g_assert (nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN));
accept_signal (address_added);
@@ -222,7 +222,7 @@ test_ip6_address_external (void)
/* Add/delete conflict */
run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d",
IP6_ADDRESS, IP6_PLEN, DEVICE_NAME, lifetime, preferred);
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags));
no_error ();
g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
accept_signal (address_added);
diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c
index f102870..d94b359 100644
--- a/src/platform/tests/test-cleanup.c
+++ b/src/platform/tests/test-cleanup.c
@@ -41,8 +41,8 @@ test_cleanup_internal ()
g_assert (ifindex > 0);
/* Add routes and addresses */
- g_assert (nm_platform_ip4_address_add (ifindex, addr4, plen4, lifetime, preferred));
- g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred, flags));
+ g_assert (nm_platform_ip4_address_add (ifindex, addr4, 0, plen4, lifetime, preferred));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr6, in6addr_any, plen6, lifetime, preferred, flags));
g_assert (nm_platform_ip4_route_add (ifindex, gateway4, 32, INADDR_ANY, metric, mss));
g_assert (nm_platform_ip4_route_add (ifindex, network4, plen4, gateway4, metric, mss));
g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway4, metric, mss));
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index ffb1e74..b2f2326 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -538,7 +538,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_GATEWAY);
if (val) {
nm_ip4_config_set_gateway (config, g_value_get_uint (val));
- nm_ip4_config_set_ptp_address (config, g_value_get_uint (val));
+ address.peer_address = g_value_get_uint (val);
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_ADDRESS);
diff --git a/src/tests/test-dhcp-options.c b/src/tests/test-dhcp-options.c
index effe658..6ef599e 100644
--- a/src/tests/test-dhcp-options.c
+++ b/src/tests/test-dhcp-options.c
@@ -129,6 +129,8 @@ test_generic_options (const char *client)
"dhcp-generic", "couldn't convert expected IP address");
ASSERT (address->address == tmp,
"dhcp-generic", "unexpected IP address");
+ ASSERT (address->peer_address == 0,
+ "dhcp-generic", "unexpected PTP address");
ASSERT (address->plen == 24,
"dhcp-generic", "unexpected IP address prefix length");
@@ -139,9 +141,6 @@ test_generic_options (const char *client)
ASSERT (nm_ip4_config_get_gateway (ip4_config) == tmp,
"dhcp-generic", "unexpected IP gateway");
- ASSERT (nm_ip4_config_get_ptp_address (ip4_config) == 0,
- "dhcp-generic", "unexpected PTP address");
-
ASSERT (nm_ip4_config_get_num_wins (ip4_config) == 0,
"dhcp-generic", "unexpected number of WINS servers");
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index 331897c..fde4a40 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -25,10 +25,12 @@
#include "nm-ip4-config.h"
static void
-addr_init (NMPlatformIP4Address *a, const char *addr, guint plen)
+addr_init (NMPlatformIP4Address *a, const char *addr, const char *peer, guint plen)
{
memset (a, 0, sizeof (*a));
g_assert (inet_pton (AF_INET, addr, (void *) &a->address) == 1);
+ if (peer)
+ g_assert (inet_pton (AF_INET, peer, (void *) &a->peer_address) == 1);
a->plen = plen;
}
@@ -68,7 +70,7 @@ build_test_config (void)
/* Build up the config to subtract */
config = nm_ip4_config_new ();
- addr_init (&addr, "192.168.1.10", 24);
+ addr_init (&addr, "192.168.1.10", "1.2.3.4", 24);
nm_ip4_config_add_address (config, &addr);
route_new (&route, "10.0.0.0", 8, "192.168.1.1");
@@ -86,8 +88,6 @@ build_test_config (void)
nm_ip4_config_add_search (config, "blahblah.com");
nm_ip4_config_add_search (config, "beatbox.com");
- nm_ip4_config_set_ptp_address (config, addr_to_num ("1.2.3.4"));
-
nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.9"));
nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.10"));
@@ -121,7 +121,7 @@ test_subtract (void)
/* add a couple more things to the test config */
dst = build_test_config ();
- addr_init (&addr, expected_addr, expected_addr_plen);
+ addr_init (&addr, expected_addr, NULL, expected_addr_plen);
nm_ip4_config_add_address (dst, &addr);
route_new (&route, expected_route_dest, expected_route_plen, expected_route_next_hop);
@@ -142,9 +142,9 @@ test_subtract (void)
test_addr = nm_ip4_config_get_address (dst, 0);
g_assert (test_addr != NULL);
g_assert_cmpuint (test_addr->address, ==, addr_to_num (expected_addr));
+ g_assert_cmpuint (test_addr->peer_address, ==, 0);
g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen);
- g_assert_cmpuint (nm_ip4_config_get_ptp_address (dst), ==, 0);
g_assert_cmpuint (nm_ip4_config_get_gateway (dst), ==, 0);
g_assert_cmpuint (nm_ip4_config_get_num_routes (dst), ==, 1);
diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c
index 10ce3bf..b8b9c7b 100644
--- a/src/tests/test-ip6-config.c
+++ b/src/tests/test-ip6-config.c
@@ -25,10 +25,12 @@
#include "nm-ip6-config.h"
static void
-addr_init (NMPlatformIP6Address *a, const char *addr, guint plen)
+addr_init (NMPlatformIP6Address *a, const char *addr, const char *peer, guint plen)
{
memset (a, 0, sizeof (*a));
g_assert (inet_pton (AF_INET6, addr, (void *) &a->address) == 1);
+ if (peer)
+ g_assert (inet_pton (AF_INET6, peer, (void *) &a->peer_address) == 1);
a->plen = plen;
}
@@ -61,7 +63,7 @@ build_test_config (void)
/* Build up the config to subtract */
config = nm_ip6_config_new ();
- addr_init (&addr, "abcd:1234:4321::cdde", 64);
+ addr_init (&addr, "abcd:1234:4321::cdde", "1:2:3:4::5", 64);
nm_ip6_config_add_address (config, &addr);
route_new (&route, "abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2");
@@ -82,9 +84,6 @@ build_test_config (void)
nm_ip6_config_add_search (config, "blahblah.com");
nm_ip6_config_add_search (config, "beatbox.com");
- addr_to_num ("1:2:3:4::5", &tmp);
- nm_ip6_config_set_ptp_address (config, &tmp);
-
return config;
}
@@ -111,7 +110,7 @@ test_subtract (void)
/* add a couple more things to the test config */
dst = build_test_config ();
- addr_init (&addr, expected_addr, expected_addr_plen);
+ addr_init (&addr, expected_addr, NULL, expected_addr_plen);
nm_ip6_config_add_address (dst, &addr);
route_new (&route, expected_route_dest, expected_route_plen, expected_route_next_hop);
@@ -133,9 +132,9 @@ test_subtract (void)
g_assert (test_addr != NULL);
addr_to_num (expected_addr, &tmp);
g_assert (memcmp (&test_addr->address, &tmp, sizeof (tmp)) == 0);
+ g_assert (memcmp (&test_addr->peer_address, &in6addr_any, sizeof (tmp)) == 0);
g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen);
- g_assert (nm_ip6_config_get_ptp_address (dst) == NULL);
g_assert (nm_ip6_config_get_gateway (dst) == NULL);
g_assert_cmpuint (nm_ip6_config_get_num_routes (dst), ==, 1);
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index a3b09f2..2d53449 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -569,8 +569,7 @@ print_vpn_config (NMVPNConnection *connection)
nm_log_info (LOGD_VPN, " Internal Gateway: %s", ip_address_to_string (priv->ip4_internal_gw));
nm_log_info (LOGD_VPN, " Internal Address: %s", ip_address_to_string (address4->address));
nm_log_info (LOGD_VPN, " Internal Prefix: %d", address4->plen);
- nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s",
- ip_address_to_string (nm_ip4_config_get_ptp_address (priv->ip4_config)));
+ nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", ip_address_to_string (address4->peer_address));
nm_log_info (LOGD_VPN, " Maximum Segment Size (MSS): %d", nm_ip4_config_get_mss (priv->ip4_config));
num = nm_ip4_config_get_num_routes (priv->ip4_config);
@@ -610,8 +609,7 @@ print_vpn_config (NMVPNConnection *connection)
nm_log_info (LOGD_VPN, " Internal Gateway: %s", ip6_address_to_string (priv->ip6_internal_gw));
nm_log_info (LOGD_VPN, " Internal Address: %s", ip6_address_to_string (&address6->address));
nm_log_info (LOGD_VPN, " Internal Prefix: %d", address6->plen);
- nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s",
- ip6_address_to_string (nm_ip6_config_get_ptp_address (priv->ip6_config)));
+ nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", ip6_address_to_string (&address6->peer_address));
nm_log_info (LOGD_VPN, " Maximum Segment Size (MSS): %d", nm_ip6_config_get_mss (priv->ip6_config));
num = nm_ip6_config_get_num_routes (priv->ip6_config);
@@ -876,7 +874,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_PTP);
if (val)
- nm_ip4_config_set_ptp_address (config, g_value_get_uint (val));
+ address.peer_address = g_value_get_uint (val);
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX);
if (val)
@@ -1024,7 +1022,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
GByteArray *ba = g_value_get_boxed (val);
if (ba->len == sizeof (struct in6_addr))
- nm_ip6_config_set_ptp_address (config, (struct in6_addr *)ba->data);
+ address.peer_address = *(struct in6_addr *) ba->data;
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP6_CONFIG_PREFIX);
--
1.8.4.2

View File

@ -1,321 +0,0 @@
From ac94d83f04d87971c8bea4e164d7a5e260720e5c Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 15 Oct 2013 20:44:59 +0200
Subject: [PATCH] core: add ifa_flags to NMPlatformIP6Address structure
Add a field 'flags' to NMPlatformIP6Address that holds the
IFA_F_* flags as reported over netlink.
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-fake-platform.c | 3 ++-
src/platform/nm-linux-platform.c | 17 ++++++++++-------
src/platform/nm-platform.c | 20 +++++++++++++++-----
src/platform/nm-platform.h | 6 ++++--
src/platform/tests/platform.c | 6 ++++--
src/platform/tests/test-address.c | 8 +++++---
src/platform/tests/test-cleanup.c | 3 ++-
7 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 491e23e..df5d5b8 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -775,7 +775,7 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu
}
static gboolean
-ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred)
+ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
NMPlatformIP6Address address;
@@ -788,6 +788,7 @@ ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int pl
address.timestamp = get_time ();
address.lifetime = lifetime;
address.preferred = preferred;
+ address.flags = flags;
for (i = 0; i < priv->ip6_addresses->len; i++) {
NMPlatformIP6Address *item = &g_array_index (priv->ip6_addresses, NMPlatformIP6Address, i);
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 0f67180..e3d6357 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -790,6 +790,7 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
address->timestamp = rtnl_addr_get_create_time (rtnladdr);
address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr);
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
+ address->flags = rtnl_addr_get_flags (rtnladdr);
g_assert (nl_addr_get_len (nladdr) == sizeof (address->address));
memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address));
}
@@ -2198,7 +2199,7 @@ ip6_address_get_all (NMPlatform *platform, int ifindex)
}
static struct nl_object *
-build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred)
+build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
{
struct rtnl_addr *rtnladdr = rtnl_addr_alloc ();
int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr);
@@ -2215,6 +2216,8 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32
rtnl_addr_set_valid_lifetime (rtnladdr, lifetime);
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
}
+ if (flags)
+ rtnl_addr_set_flags (rtnladdr, flags);
return (struct nl_object *) rtnladdr;
}
@@ -2222,31 +2225,31 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32
static gboolean
ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred)
{
- return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred));
+ return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred, 0));
}
static gboolean
-ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred)
+ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags)
{
- return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred));
+ return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred, flags));
}
static gboolean
ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen)
{
- return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0));
+ return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0, 0));
}
static gboolean
ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen)
{
- return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0));
+ return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0, 0));
}
static gboolean
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, plen, 0, 0);
+ auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, plen, 0, 0, 0);
auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object);
return !!cached_object;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 5a5e464..3f645ed 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -24,6 +24,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
+#include <netlink/route/addr.h>
#include "nm-platform.h"
#include "nm-logging.h"
@@ -1100,7 +1101,7 @@ nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 l
}
gboolean
-nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred)
+nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred, guint flags)
{
reset_error ();
@@ -1111,7 +1112,7 @@ nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, gui
g_return_val_if_fail (klass->ip6_address_add, FALSE);
debug ("address: adding or updating IPv6 address");
- return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred);
+ return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred, flags);
}
gboolean
@@ -1329,7 +1330,8 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses)
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
- if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen, lifetime, preferred))
+ if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen,
+ lifetime, preferred, known_address->flags))
return FALSE;
}
@@ -1637,8 +1639,10 @@ const char *
nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
{
static char buffer[256];
+ char s_flags[256];
char s_address[INET6_ADDRSTRLEN];
const char *s_dev;
+ char *str_flags;
g_return_val_if_fail (address, "(unknown)");
@@ -1648,7 +1652,12 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s",
+ rtnl_addr_flags2str(address->flags, s_flags, sizeof(s_flags));
+ str_flags = s_flags[0] ? g_strconcat (" flags ", s_flags, NULL) : NULL;
+
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
- (guint)address->timestamp, s_dev ? s_dev : "-");
+ (guint)address->timestamp, s_dev ? s_dev : "-",
+ str_flags ? str_flags : "");
+ g_free (str_flags);
return buffer;
}
@@ -1775,6 +1784,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
_CMP_FIELD (a, b, timestamp);
_CMP_FIELD (a, b, lifetime);
_CMP_FIELD (a, b, preferred);
+ _CMP_FIELD (a, b, flags);
return 0;
}
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index eae5465..7de0280 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -24,6 +24,7 @@
#include <glib-object.h>
#include <netinet/in.h>
#include <linux/if.h>
+#include <linux/if_addr.h>
#define NM_TYPE_PLATFORM (nm_platform_get_type ())
#define NM_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PLATFORM, NMPlatform))
@@ -134,6 +135,7 @@ typedef struct {
guint32 timestamp;
guint32 lifetime;
guint32 preferred;
+ guint flags; /* ifa_flags from <linux/if_addr.h>, field type "unsigned int" is as used in rtnl_addr_get_flags. */
} NMPlatformIP6Address;
typedef struct {
@@ -281,7 +283,7 @@ typedef struct {
gboolean (*ip4_address_add) (NMPlatform *, int ifindex, in_addr_t address, int plen,
guint32 lifetime, guint32 preferred_lft);
gboolean (*ip6_address_add) (NMPlatform *, int ifindex, struct in6_addr address, int plen,
- guint32 lifetime, guint32 preferred_lft);
+ guint32 lifetime, guint32 preferred_lft, guint flags);
gboolean (*ip4_address_delete) (NMPlatform *, int ifindex, in_addr_t address, int plen);
gboolean (*ip6_address_delete) (NMPlatform *, int ifindex, struct in6_addr address, int plen);
gboolean (*ip4_address_exists) (NMPlatform *, int ifindex, in_addr_t address, int plen);
@@ -402,7 +404,7 @@ GArray *nm_platform_ip6_address_get_all (int ifindex);
gboolean nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen,
guint32 lifetime, guint32 preferred_lft);
gboolean nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen,
- guint32 lifetime, guint32 preferred_lft);
+ guint32 lifetime, guint32 preferred_lft, guint flags);
gboolean nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen);
gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen);
gboolean nm_platform_ip4_address_exists (int ifindex, in_addr_t address, int plen);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index cd274cd..c0b2c02 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
+#include <netlink/route/addr.h>
#include "nm-platform.h"
#include "nm-linux-platform.h"
@@ -538,8 +539,9 @@ do_ip6_address_add (char **argv)
if (ifindex && parse_ip6_address (*argv++, &address, &plen)) {
guint32 lifetime = strtol (*argv++, NULL, 10);
guint32 preferred = strtol (*argv++, NULL, 10);
+ guint flags = (*argv) ? rtnl_addr_str2flags (*argv++) : 0;
- gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred);
+ gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred, flags);
return value;
} else
return FALSE;
@@ -765,7 +767,7 @@ static const command_t commands[] = {
{ "ip4-address-get-all", "print all IPv4 addresses", do_ip4_address_get_all, 1, "<ifname/ifindex>" },
{ "ip6-address-get-all", "print all IPv6 addresses", do_ip6_address_get_all, 1, "<ifname/ifindex>" },
{ "ip4-address-add", "add IPv4 address", do_ip4_address_add, 4, "<ifname/ifindex> <address>/<plen> <lifetime> <>" },
- { "ip6-address-add", "add IPv6 address", do_ip6_address_add, 4, "<ifname/ifindex> <address>/<plen> <lifetime> <>" },
+ { "ip6-address-add", "add IPv6 address", do_ip6_address_add, 4, "<ifname/ifindex> <address>/<plen> <lifetime> [<flags>] <>" },
{ "ip4-address-delete", "delete IPv4 address", do_ip4_address_delete, 2,
"<ifname/ifindex> <address>/<plen>" },
{ "ip6-address-delete", "delete IPv6 address", do_ip6_address_delete, 2,
diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c
index ff11384..52952c3 100644
--- a/src/platform/tests/test-address.c
+++ b/src/platform/tests/test-address.c
@@ -109,20 +109,21 @@ test_ip6_address (void)
struct in6_addr addr;
guint32 lifetime = 2000;
guint32 preferred = 1000;
+ guint flags = 0;
inet_pton (AF_INET6, IP6_ADDRESS, &addr);
/* Add address */
g_assert (!nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
no_error ();
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
no_error ();
g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
no_error ();
accept_signal (address_added);
/* Add address again (aka update) */
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
no_error ();
accept_signal (address_changed);
@@ -205,6 +206,7 @@ test_ip6_address_external (void)
struct in6_addr addr;
guint32 lifetime = 2000;
guint32 preferred = 1000;
+ guint flags = 0;
inet_pton (AF_INET6, IP6_ADDRESS, &addr);
@@ -220,7 +222,7 @@ test_ip6_address_external (void)
/* Add/delete conflict */
run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d",
IP6_ADDRESS, IP6_PLEN, DEVICE_NAME, lifetime, preferred);
- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags));
no_error ();
g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN));
accept_signal (address_added);
diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c
index cbfebe7..f102870 100644
--- a/src/platform/tests/test-cleanup.c
+++ b/src/platform/tests/test-cleanup.c
@@ -23,6 +23,7 @@ test_cleanup_internal ()
int preferred = NM_PLATFORM_LIFETIME_PERMANENT;
int metric = 20;
int mss = 1000;
+ guint flags = 0;
inet_pton (AF_INET, "192.0.2.1", &addr4);
inet_pton (AF_INET, "192.0.3.0", &network4);
@@ -41,7 +42,7 @@ test_cleanup_internal ()
/* Add routes and addresses */
g_assert (nm_platform_ip4_address_add (ifindex, addr4, plen4, lifetime, preferred));
- g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred));
+ g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred, flags));
g_assert (nm_platform_ip4_route_add (ifindex, gateway4, 32, INADDR_ANY, metric, mss));
g_assert (nm_platform_ip4_route_add (ifindex, network4, plen4, gateway4, metric, mss));
g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway4, metric, mss));
--
1.8.4.2

View File

@ -1,51 +0,0 @@
From ec1cabde2872337a98b1f5fb8e1e9b8219548010 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 30 Oct 2013 22:39:32 +0100
Subject: [PATCH] core: fix error in print_vpn_config to print the route
correctly
ip_address_to_string returns a static buffer, need to make a copy
in this case.
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index a3074aa..7d3582a 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -576,11 +576,13 @@ print_vpn_config (NMVPNConnection *connection)
num = nm_ip4_config_get_num_routes (priv->ip4_config);
for (i = 0; i < num; i++) {
const NMPlatformIP4Route *route = nm_ip4_config_get_route (priv->ip4_config, i);
+ char *s = g_strdup (ip_address_to_string (route->gateway));
nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s",
ip_address_to_string (route->network),
route->plen,
- ip_address_to_string (route->gateway));
+ s);
+ g_free (s);
}
nm_log_info (LOGD_VPN, " Forbid Default Route: %s",
@@ -615,11 +617,13 @@ print_vpn_config (NMVPNConnection *connection)
num = nm_ip6_config_get_num_routes (priv->ip6_config);
for (i = 0; i < num; i++) {
const NMPlatformIP6Route *route = nm_ip6_config_get_route (priv->ip6_config, i);
+ char *s = g_strdup (ip6_address_to_string (&route->gateway));
nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s",
ip6_address_to_string (&route->network),
route->plen,
- ip6_address_to_string (&route->gateway));
+ s);
+ g_free (s);
}
nm_log_info (LOGD_VPN, " Forbid Default Route: %s",
--
1.8.4.2

View File

@ -1,62 +0,0 @@
commit 19b040236ec59fe8f9730d9da6d9262921d28936
Author: Thomas Haller <thaller@redhat.com>
Date: Wed Oct 30 20:18:58 2013 +0100
core: fix segfault in nm-policy when setting default route for vpn
nm_vpn_connection_get_ip6_internal_gateway might return NULL. In this
case, we add a device route (to gateway '::') over the vpn.
Before, in such a case, NM crashed with SEGFAULT.
https://bugzilla.redhat.com/show_bug.cgi?id=1019021
Signed-off-by: Thomas Haller <thaller@redhat.com>
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 6d15e01..49c005c 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -860,12 +860,15 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
int parent_ifindex = nm_device_get_ip_ifindex (parent);
NMIP6Config *parent_ip6 = nm_device_get_ip6_config (parent);
guint32 parent_mss = parent_ip6 ? nm_ip6_config_get_mss (parent_ip6) : 0;
- struct in6_addr int_gw = *nm_vpn_connection_get_ip6_internal_gateway (vpn);
+ const struct in6_addr *int_gw = nm_vpn_connection_get_ip6_internal_gateway (vpn);
int mss = nm_ip6_config_get_mss (ip6_config);
- if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, int_gw, 0, mss)) {
+ if (!int_gw)
+ int_gw = &in6addr_any;
+
+ if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
nm_platform_ip6_route_add (parent_ifindex, *gw_addr, 128, in6addr_any, 0, parent_mss);
- if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, int_gw, 0, mss)) {
+ if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route.");
}
}
commit 886ca75ac33de252158a63074cc7cf9d0215c962
Author: Thomas Haller <thaller@redhat.com>
Date: Fri Nov 1 10:57:18 2013 +0100
core: fix crash when reading routes from VPN Ip6Config (bgo #706332)
https://bugzilla.gnome.org/show_bug.cgi?id=706332
Reported-by: Nicolas Iooss <nicolas.iooss.2010_nm@m4x.org>
Signed-off-by: Thomas Haller <thaller@redhat.com>
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 6962e30..263f253 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -1084,7 +1084,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
* the VPN server, we want to use the NM created route instead of
* whatever the server provides.
*/
- if (IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128)
+ if (priv->ip6_external_gw && IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128)
continue;
/* Otherwise accept the VPN-provided route */

View File

@ -1,19 +0,0 @@
commit 0a557ac01d28340e43247eef52007a8b18bb24d8
Author: Dan Winship <danw@gnome.org>
Date: Thu Oct 24 15:15:02 2013 -0400
core: fix crash when activating a never-default IPv4 connection
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 81c003e..ed1728d 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -583,7 +583,7 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
/* never_default */
if (src_priv->never_default != dst_priv->never_default) {
dst_priv->never_default = src_priv->never_default;
- has_relevant_changes = TRUE;
+ has_minor_changes = TRUE;
}
/* default gateway */

View File

@ -1,55 +0,0 @@
commit 912152cf85d29db45f706522c8e3ce13eaf13197
Author: Jiří Klimeš <jklimes@redhat.com>
Date: Tue Oct 29 15:02:30 2013 +0100
ifcfg-rh: fix crash when doing managed->unmanaged transition
Testcase:
* add 'NM_CONTROLLED=no' to /etc/sysconfig/network-scripts/ifcfg-ABC
* sudo nmcli con reload
* ... NM asserts ...
We need to ref() 'existing' connection before nm_settings_connection_signal_remove(),
because the function unref()s ithe connection via connection_removed_cb().
Backtrace:
...
#4 0x00007fbcf0ea0cba in g_assertion_message_expr (domain=domain@entry=0x0,
file=file@entry=0x7fbcf4e5805d "nm-dbus-manager.c", line=line@entry=848,
func=func@entry=0x7fbcf4e585e0 <__FUNCTION__.15088> "nm_dbus_manager_unregister_object", expr=expr@entry=0x7fbcf4e5820b "G_IS_OBJECT (object)")
at gtestutils.c:2293
#5 0x00007fbcf4de69d9 in nm_dbus_manager_unregister_object (
self=0x7fbcf6fdc9c0, object=0x7fbcf70235c0) at nm-dbus-manager.c:848
#6 0x00007fbcf4dd6a23 in nm_settings_connection_signal_remove (
self=<optimized out>) at settings/nm-settings-connection.c:1541
#7 0x00007fbce6fee884 in connection_new_or_changed (
self=self@entry=0x7fbcf7006f80,
path=path@entry=0x7fbcf70c3f80 "/etc/sysconfig/network-scripts/ifcfg-ABC",
existing=existing@entry=0x7fbcf70235c0,
out_old_path=out_old_path@entry=0x7fff2b7b8988) at plugin.c:327
#8 0x00007fbce6feeca2 in read_connections (plugin=0x7fbcf7006f80)
at plugin.c:453
#9 0x00007fbcf4dd8e98 in impl_settings_reload_connections (
self=0x7fbcf6fd98c0, context=0x7fbcf70bcb30) at settings/nm-settings.c:1262
...
diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c
index dbfc496..5cd24b0 100644
--- a/src/settings/plugins/ifcfg-rh/plugin.c
+++ b/src/settings/plugins/ifcfg-rh/plugin.c
@@ -320,6 +320,7 @@ connection_new_or_changed (SCPluginIfcfg *self,
if (new_unmanaged) {
if (!old_unmanaged) {
+ g_object_ref (existing);
/* Unexport the connection by telling the settings service it's
* been removed, and notify the settings service by signalling that
* unmanaged specs have changed.
@@ -331,6 +332,7 @@ connection_new_or_changed (SCPluginIfcfg *self,
g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL);
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
+ g_object_unref (existing);
}
} else {
if (old_unmanaged) { /* now managed */

View File

@ -1,35 +0,0 @@
commit 25428882839ff17c531887bfc58f6669c9708fc8
Author: Thomas Haller <thaller@redhat.com>
Date: Thu Oct 31 12:42:01 2013 +0100
ifcfg-rh: fix crash when reading connection (assert in connection_new_or_changed)
rh #1025007 reports a crash on g_assert_no_error() in
connection_new_or_changed() of src/settings/plugins/ifcfg-rh/plugin.c.
From the back trace I am not 100% sure, what the problem was, but I
think that nm_settings_connection_replace_settings failed because of
nm_connection_update_secrets. Apparently such a situation can
happen and it should simply be accepted as valid.
What might have happened, is that the connection used to have
secrets (maybe it had 802.1x configured?) and then it got changed,
so update_secrets() fails because the connection no longer has a
setting to which the secrets would apply.
https://bugzilla.redhat.com/show_bug.cgi?id=1025007
Signed-off-by: Thomas Haller <thaller@redhat.com>
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 59b29ad..7dce397 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -462,7 +462,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
if (priv->agent_secrets) {
hash = nm_connection_to_hash (priv->agent_secrets, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
if (hash) {
- success = nm_connection_update_secrets (NM_CONNECTION (self), NULL, hash, error);
+ nm_connection_update_secrets (NM_CONNECTION (self), NULL, hash, NULL);
g_hash_table_destroy (hash);
}
}

View File

@ -1,92 +0,0 @@
From 788eed99de51cd35adeb6585379b5e920c79b3f3 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 1 Nov 2013 10:32:27 +0100
Subject: [PATCH] core: workaround crash when connecting to wifi (rh #1025371)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
rh #1025371 reports a crash in handle_ip_config_timeout() because
nm_device_wifi_get_activation_ap() did not return any access point.
The handling of the AP in nm-device-wifi.c should be reworked and soon
will be fixed. For now, play it safe, and try to cope with any cases
where nm_device_wifi_get_activation_ap() might return NULL.
Later, this patch should be reverted and handling of the AP properly
cleaned up.
https://bugzilla.redhat.com/show_bug.cgi?id=1025371
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-wifi.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c
index 855c1e7..6c19d62 100644
--- a/src/devices/nm-device-wifi.c
+++ b/src/devices/nm-device-wifi.c
@@ -2313,7 +2313,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
*/
if (devstate == NM_DEVICE_STATE_CONFIG) {
NMAccessPoint *ap = nm_device_wifi_get_activation_ap (self);
- const GByteArray *ssid = nm_ap_get_ssid (ap);
+ const GByteArray *ssid = ap ? nm_ap_get_ssid (ap) : NULL;
nm_log_info (LOGD_DEVICE | LOGD_WIFI,
"Activation (%s/wireless) Stage 2 of 5 (Device Configure) "
@@ -2593,9 +2593,8 @@ supplicant_connection_timeout_cb (gpointer user_data)
g_assert (priv->mode == NM_802_11_MODE_INFRA);
ap = nm_device_wifi_get_activation_ap (self);
- g_assert (ap);
- if (priv->ssid_found && is_encrypted (ap, connection)) {
+ if (priv->ssid_found && ap && is_encrypted (ap, connection)) {
guint64 timestamp = 0;
gboolean new_secrets = TRUE;
@@ -2944,7 +2943,11 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
g_assert (req);
ap = nm_device_wifi_get_activation_ap (self);
- g_assert (ap);
+ if (!ap) {
+ nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "act_stage2_config failed due to unexpected missing activation_ap. Abort");
+ *reason = NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT;
+ goto out;
+ }
connection = nm_act_request_get_connection (req);
g_assert (connection);
@@ -3102,7 +3105,6 @@ handle_ip_config_timeout (NMDeviceWifi *self,
}
ap = nm_device_wifi_get_activation_ap (self);
- g_assert (ap);
/* If IP configuration times out and it's a static WEP connection, that
* usually means the WEP key is wrong. WEP's Open System auth mode has
@@ -3111,7 +3113,7 @@ handle_ip_config_timeout (NMDeviceWifi *self,
* types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
* connection would have failed before IP configuration.
*/
- if (is_static_wep (ap, connection) && (may_fail == FALSE)) {
+ if (ap && is_static_wep (ap, connection) && (may_fail == FALSE)) {
/* Activation failed, we must have bad encryption key */
nm_log_warn (LOGD_DEVICE | LOGD_WIFI,
"Activation (%s/wireless): could not get IP configuration for "
@@ -3203,7 +3205,7 @@ activation_success_handler (NMDevice *dev)
/* If the AP isn't fake, it was found in the scan list and all its
* details are known.
*/
- if (!nm_ap_get_fake (ap))
+ if (!ap || !nm_ap_get_fake (ap))
goto done;
/* If the activate AP was fake, it probably won't have a BSSID at all.
--
1.7.11.7

View File

@ -1,73 +0,0 @@
From 696f655d7c7b605d0344aeb6ba4ff643cd46a5b4 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 11 Nov 2013 15:43:13 -0600
Subject: [PATCH] ethernet: don't crash if device doesn't have a MAC address
(rh #1029053)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Like IBM s390 CTC devices, which aren't really ethernet but for
historical reasons we treat them as such.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Updated to apply for Fedora 20 snapshot.
---
src/devices/nm-device-ethernet.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index 7b1c248..c0b7861 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -310,6 +310,7 @@ update_permanent_hw_address (NMDevice *dev)
struct ifreq req;
struct ethtool_perm_addr *epaddr = NULL;
int fd, ret;
+ const guint8 *mac;
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
@@ -332,7 +333,11 @@ update_permanent_hw_address (NMDevice *dev)
nm_log_dbg (LOGD_HW | LOGD_ETHER, "(%s): unable to read permanent MAC address (error %d)",
nm_device_get_iface (dev), errno);
/* Fall back to current address */
- memcpy (epaddr->data, nm_device_get_hw_address (dev, NULL), ETH_ALEN);
+ mac = nm_device_get_hw_address (dev, NULL);
+ if (mac)
+ memcpy (epaddr->data, mac, ETH_ALEN);
+ else
+ memset (epaddr->data, 0, ETH_ALEN);
}
if (memcmp (&priv->perm_hw_addr, epaddr->data, ETH_ALEN)) {
@@ -350,11 +355,14 @@ update_initial_hw_address (NMDevice *dev)
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
char *mac_str;
+ const guint8 *mac;
/* This sets initial MAC address from current MAC address. It should only
* be called from NMDevice constructor() to really get the initial address.
*/
- memcpy (priv->initial_hw_addr, nm_device_get_hw_address (dev, NULL), ETH_ALEN);
+ mac = nm_device_get_hw_address (dev, NULL);
+ if (mac)
+ memcpy (priv->initial_hw_addr, mac, ETH_ALEN);
mac_str = nm_utils_hwaddr_ntoa (priv->initial_hw_addr, ARPHRD_ETHER);
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): read initial MAC address %s",
@@ -1219,7 +1219,7 @@ update_connection (NMDevice *device, NMConnection *connection)
{
NMSettingWired *s_wired = nm_connection_get_setting_wired (connection);
guint maclen;
- gconstpointer mac = nm_device_get_hw_address (device, &maclen);
+ const guint8 *mac = nm_device_get_hw_address (device, &maclen);
if (!s_wired) {
s_wired = (NMSettingWired *) nm_setting_wired_new ();
--
1.7.11.7

View File

@ -1,50 +0,0 @@
From 2086cab1273b26630840e3a0c092e8b1617e803b Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Wed, 13 Nov 2013 20:06:39 -0600
Subject: [PATCH] platform: dump objects that fail to be added (rh #1029213)
Attempt to figure out why the objects fail.
---
src/platform/nm-linux-platform.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index a35b0cc..d13abbe 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1100,27 +1100,32 @@ refresh_object (NMPlatform *platform, struct nl_object *object, gboolean removed
/* Decreases the reference count if @obj for convenience */
static gboolean
add_object (NMPlatform *platform, struct nl_object *obj)
{
auto_nl_object struct nl_object *object = obj;
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
int nle;
+ struct nl_dump_params dp = {
+ .dp_type = NL_DUMP_DETAILS,
+ .dp_fd = stderr,
+ };
nle = add_kernel_object (priv->nlh, object);
/* NLE_EXIST is considered equivalent to success to avoid race conditions. You
* never know when something sends an identical object just before
* NetworkManager.
*/
switch (nle) {
case -NLE_SUCCESS:
case -NLE_EXIST:
break;
default:
error ("Netlink error: %s", nl_geterror (nle));
+ nl_object_dump (object, &dp);
return FALSE;
}
return refresh_object (platform, object, FALSE, NM_PLATFORM_REASON_INTERNAL);
}
/* Decreases the reference count if @obj for convenience */
--
1.8.3.1

View File

@ -1,98 +0,0 @@
From 8586353b09460ec0a619058421743dd7d424a75d Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Wed, 20 Nov 2013 13:40:07 -0600
Subject: [PATCH] core: ignore RA-provided default routes (rh #1029213)
The router has no idea what the local configuration or user preferences are,
so sending routes with a prefix length of 0 is at best misinformed and at
worst breaks things. The kernel also ignores plen=0 routes in its in-kernel
RA processing code in net/ipv6/ndisc.c.
https://bugzilla.redhat.com/show_bug.cgi?id=1029213
---
src/devices/nm-device.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f03ecbb..d92a94b 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3283,20 +3283,26 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
/* Rebuild route list from router discovery cache. */
nm_ip6_config_reset_routes (priv->ac_ip6_config);
for (i = 0; i < rdisc->routes->len; i++) {
NMRDiscRoute *discovered_route = &g_array_index (rdisc->routes, NMRDiscRoute, i);
NMPlatformIP6Route route;
- memset (&route, 0, sizeof (route));
- route.network = discovered_route->network;
- route.plen = discovered_route->plen;
- route.gateway = discovered_route->gateway;
+ /* Only accept non-default routes. The router has no idea what the
+ * local configuration or user preferences are, so sending routes
+ * with a prefix length of 0 is quite rude and thus ignored.
+ */
+ if (discovered_route->plen > 0) {
+ memset (&route, 0, sizeof (route));
+ route.network = discovered_route->network;
+ route.plen = discovered_route->plen;
+ route.gateway = discovered_route->gateway;
- nm_ip6_config_add_route (priv->ac_ip6_config, &route);
+ nm_ip6_config_add_route (priv->ac_ip6_config, &route);
+ }
}
}
if (changed & NM_RDISC_CONFIG_DNS_SERVERS) {
/* Rebuild DNS server list from router discovery cache. */
nm_ip6_config_reset_nameservers (priv->ac_ip6_config);
--
1.8.3.1
From 6e73f01b6e69f44f8d9da4872fb796b9d80acac1 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 3 Dec 2013 14:12:55 -0600
Subject: [PATCH] platform: fix possible out-of-bounds access with RA route
masking
If the prefix length was 128, that could cause an access beyond the
end of the array. Found by Thomas Haller.
---
src/rdisc/nm-lndp-rdisc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index abcc3c2..3299b32 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -411,17 +411,21 @@ set_address_masked (struct in6_addr *dst, struct in6_addr *src, guint8 plen)
guint nbytes = plen / 8;
guint nbits = plen % 8;
g_return_if_fail (plen <= 128);
g_assert (src);
g_assert (dst);
- memset (dst, 0, sizeof (*dst));
- memcpy (dst, src, nbytes);
- dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits)));
+ if (plen >= 128)
+ *dst = *src;
+ else {
+ memset (dst, 0, sizeof (*dst));
+ memcpy (dst, src, nbytes);
+ dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits)));
+ }
}
static int
receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
{
NMRDisc *rdisc = (NMRDisc *) user_data;
NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
--
1.8.3.1

View File

@ -1,293 +0,0 @@
From d7c369712b9e6298d62303899e372ab7d27a92d9 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 23 Dec 2013 12:21:09 -0600
Subject: [PATCH] vpn: handle missing tunnel interface for IP-based VPNs (bgo
#721724) (rh #1030068)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
IPSec-based VPNs that use the kernel IPSec stack don't have tunnel
interfaces, and the IP details (address, routes) get added directly
to the parent network device. NetworkManager previously required
a tunnel interface and failed the VPN if one was not provided.
When no tunnel interface is passed, construct the VPN IP configuration
using available details and pass that to the NMDevice as the VPN IP
config. The device will merge that config with its own and apply
any configuration that the kernel/VPN has not already applied.
https://bugzilla.gnome.org/show_bug.cgi?id=721724
https://bugzilla.redhat.com/show_bug.cgi?id=1030068
https://bugzilla.redhat.com/show_bug.cgi?id=865883
https://bugzilla.redhat.com/show_bug.cgi?id=845599
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 15 +++--
src/vpn-manager/nm-vpn-connection.c | 112 ++++++++++++++++++++++--------------
2 files changed, 79 insertions(+), 48 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 92ec1ab..090cd04 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -655,17 +655,21 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
in_addr_t int_gw = nm_vpn_connection_get_ip4_internal_gateway (vpn);
int mss = nm_ip4_config_get_mss (ip4_config);
+ /* If no VPN interface, use the parent interface */
+ if (ip_ifindex <= 0)
+ ip_ifindex = parent_ifindex;
+
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss)) {
nm_platform_ip4_route_add (parent_ifindex, gw_addr, 32, 0, 0, parent_mss);
- if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss)) {
+ if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss))
nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route.");
- }
}
default_device = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip4_config_get_mss (ip4_config);
+ g_assert (ip_iface);
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, gw_addr, 0, mss)) {
nm_platform_ip4_route_add (ip_ifindex, gw_addr, 32, 0, 0, mss);
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, gw_addr, 0, mss)) {
@@ -845,6 +849,10 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
if (!int_gw)
int_gw = &in6addr_any;
+ /* If no VPN interface, use the parent interface */
+ if (ip_ifindex <= 0)
+ ip_ifindex = parent_ifindex;
+
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
nm_platform_ip6_route_add (parent_ifindex, *gw_addr, 128, in6addr_any, 0, parent_mss);
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
@@ -858,9 +866,8 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss)) {
nm_platform_ip6_route_add (ip_ifindex, *gw_addr, 128, in6addr_any, 0, mss);
- if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss)) {
+ if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss))
nm_log_err (LOGD_IP6, "Failed to set default route.");
- }
}
default_device6 = best;
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 8541f10..f1d7d46 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -301,13 +301,13 @@ device_state_changed (NMActiveConnection *active,
}
static void
-add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
+add_ip4_vpn_gateway_route (NMIP4Config *config, NMDevice *parent_device, guint32 vpn_gw)
{
NMIP4Config *parent_config;
guint32 parent_gw;
NMPlatformIP4Route route;
- NMIP4Config *vpn4_config;
+ g_return_if_fail (NM_IS_IP4_CONFIG (config));
g_return_if_fail (NM_IS_DEVICE (parent_device));
g_return_if_fail (vpn_gw != 0);
@@ -321,8 +321,6 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
if (!parent_gw)
return;
- vpn4_config = nm_ip4_config_new ();
-
memset (&route, 0, sizeof (route));
route.network = vpn_gw;
route.plen = 32;
@@ -335,7 +333,7 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
if (nm_ip4_config_destination_is_direct (parent_config, vpn_gw, 32))
route.gateway = 0;
- nm_ip4_config_add_route (vpn4_config, &route);
+ nm_ip4_config_add_route (config, &route);
/* Ensure there's a route to the parent device's gateway through the
* parent device, since if the VPN claims the default route and the VPN
@@ -346,21 +344,19 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
route.network = parent_gw;
route.plen = 32;
- nm_ip4_config_add_route (vpn4_config, &route);
-
- nm_device_set_vpn4_config (parent_device, vpn4_config);
- g_object_unref (vpn4_config);
+ nm_ip4_config_add_route (config, &route);
}
static void
-add_ip6_vpn_gateway_route (NMDevice *parent_device,
+add_ip6_vpn_gateway_route (NMIP6Config *config,
+ NMDevice *parent_device,
const struct in6_addr *vpn_gw)
{
NMIP6Config *parent_config;
const struct in6_addr *parent_gw;
NMPlatformIP6Route route;
- NMIP6Config *vpn6_config;
+ g_return_if_fail (NM_IS_IP6_CONFIG (config));
g_return_if_fail (NM_IS_DEVICE (parent_device));
g_return_if_fail (vpn_gw != NULL);
@@ -370,8 +366,6 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
if (!parent_gw)
return;
- vpn6_config = nm_ip6_config_new ();
-
memset (&route, 0, sizeof (route));
route.network = *vpn_gw;
route.plen = 128;
@@ -384,7 +378,7 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
if (nm_ip6_config_destination_is_direct (parent_config, vpn_gw, 128))
route.gateway = in6addr_any;
- nm_ip6_config_add_route (vpn6_config, &route);
+ nm_ip6_config_add_route (config, &route);
/* Ensure there's a route to the parent device's gateway through the
* parent device, since if the VPN claims the default route and the VPN
@@ -395,10 +389,7 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
route.network = *parent_gw;
route.plen = 128;
- nm_ip6_config_add_route (vpn6_config, &route);
-
- nm_device_set_vpn6_config (parent_device, vpn6_config);
- g_object_unref (vpn6_config);
+ nm_ip6_config_add_route (config, &route);
}
NMVPNConnection *
@@ -601,7 +592,7 @@ print_vpn_config (NMVPNConnection *connection)
ip6_address_to_string (priv->ip6_external_gw));
}
- nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface);
+ nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface ? priv->ip_iface : "(none)");
if (priv->ip4_config) {
nm_log_info (LOGD_VPN, "IPv4 configuration:");
@@ -692,25 +683,54 @@ nm_vpn_connection_apply_config (NMVPNConnection *connection)
nm_vpn_connection_apply_config (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
+ NMIP4Config *vpn4_parent_config = NULL;
+ NMIP6Config *vpn6_parent_config = NULL;
- nm_platform_link_set_up (priv->ip_ifindex);
+ if (priv->ip_ifindex > 0) {
+ nm_platform_link_set_up (priv->ip_ifindex);
- if (priv->ip4_config) {
- if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex, 0))
- return FALSE;
+ if (priv->ip4_config) {
+ if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex, 0))
+ return FALSE;
+ }
+
+ if (priv->ip6_config) {
+ if (!nm_ip6_config_commit (priv->ip6_config, priv->ip_ifindex, 0))
+ return FALSE;
+ }
+
+ if (priv->ip4_config)
+ vpn4_parent_config = nm_ip4_config_new ();
+ if (priv->ip6_config)
+ vpn6_parent_config = nm_ip6_config_new ();
+ } else {
+ /* If the VPN didn't return a network interface, it is a route-based
+ * VPN (like kernel IPSec) and all IP addressing and routing should
+ * be done on the parent interface instead.
+ */
+
+ if (priv->ip4_config)
+ vpn4_parent_config = g_object_ref (priv->ip4_config);
+ if (priv->ip6_config)
+ vpn6_parent_config = g_object_ref (priv->ip6_config);
}
- if (priv->ip6_config) {
- if (!nm_ip6_config_commit (priv->ip6_config, priv->ip_ifindex, 0))
- /* FIXME: remove ip4 config */
- return FALSE;
+ if (vpn4_parent_config) {
+ /* Add any explicit route to the VPN gateway through the parent device */
+ if (priv->ip4_external_gw)
+ add_ip4_vpn_gateway_route (vpn4_parent_config, priv->parent_dev, priv->ip4_external_gw);
+
+ nm_device_set_vpn4_config (priv->parent_dev, vpn4_parent_config);
+ g_object_unref (vpn4_parent_config);
}
+ if (vpn6_parent_config) {
+ /* Add any explicit route to the VPN gateway through the parent device */
+ if (priv->ip6_external_gw)
+ add_ip6_vpn_gateway_route (vpn6_parent_config, priv->parent_dev, priv->ip6_external_gw);
- /* Add any explicit route to the VPN gateway through the parent device */
- if (priv->ip4_external_gw)
- add_ip4_vpn_gateway_route (priv->parent_dev, priv->ip4_external_gw);
- if (priv->ip6_external_gw)
- add_ip6_vpn_gateway_route (priv->parent_dev, priv->ip6_external_gw);
+ nm_device_set_vpn6_config (priv->parent_dev, vpn6_parent_config);
+ g_object_unref (vpn6_parent_config);
+ }
nm_log_info (LOGD_VPN, "VPN connection '%s' (IP Config Get) complete.",
nm_connection_get_id (priv->connection));
@@ -768,21 +788,25 @@ process_generic_config (NMVPNConnection *connection,
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
GValue *val;
+ g_clear_pointer (&priv->ip_iface, g_free);
+
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_TUNDEV);
- if (val)
- priv->ip_iface = g_strdup (g_value_get_string (val));
- else {
- nm_log_err (LOGD_VPN, "invalid or missing tunnel device received!");
- nm_vpn_connection_config_maybe_complete (connection, FALSE);
- return FALSE;
+ if (val) {
+ const char *tmp = g_value_get_string (val);
+
+ /* Backwards compat with NM-openswan */
+ if (g_strcmp0 (tmp, "_none_") != 0)
+ priv->ip_iface = g_strdup (tmp);
}
- /* Grab the interface index for address/routing operations */
- priv->ip_ifindex = nm_platform_link_get_ifindex (priv->ip_iface);
- if (!priv->ip_ifindex) {
- nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
- nm_vpn_connection_config_maybe_complete (connection, FALSE);
- return FALSE;
+ if (priv->ip_iface) {
+ /* Grab the interface index for address/routing operations */
+ priv->ip_ifindex = nm_platform_link_get_ifindex (priv->ip_iface);
+ if (!priv->ip_ifindex) {
+ nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
+ nm_vpn_connection_config_maybe_complete (connection, FALSE);
+ return FALSE;
+ }
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_BANNER);
--
1.7.11.7

View File

@ -1,45 +0,0 @@
From fbcabeb7f72b710a790ca8617f7406a1ba7cf5be Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 18 Nov 2013 22:20:05 +0100
Subject: [PATCH] libnm-glib: fix crash by taking additional ref in
nm-remote-connection/result_cb
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
result_cb invokes a function pointer provided by the user. Nothing prevents
the user from destroying the NMRemoteConnection in the callback, which leads
to a crash. Take an additional ref of NMRemoteConnection to keep it
alive.
This probably caused a crash for nm-applet:
https://bugzilla.redhat.com/show_bug.cgi?id=1030403
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-remote-connection.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index a03a44b..73a2cc8 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -137,12 +137,14 @@ result_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
RemoteCall *call = user_data;
NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc) call->callback;
GError *error = NULL;
+ NMRemoteConnection *self = g_object_ref (call->self);
dbus_g_proxy_end_call (proxy, proxy_call, &error, G_TYPE_INVALID);
if (func)
(*func) (call->self, error, call->user_data);
g_clear_error (&error);
remote_call_complete (call->self, call);
+ g_object_unref (self);
}
/**
--
1.7.11.7

View File

@ -1,99 +0,0 @@
From 8a046bedbbf8218737d7471f949a541b35579539 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 11 Oct 2013 18:25:20 +0200
Subject: [PATCH] core: fix crash for bridge-slave with missing
NMSettingBridgePort setting
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/devices/nm-device-bridge.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c
index 69e976c..2018e93 100644
--- a/src/devices/nm-device-bridge.c
+++ b/src/devices/nm-device-bridge.c
@@ -203,7 +203,7 @@ static const Option slave_options[] = {
};
static void
-commit_option (NMDevice *device, GObject *setting, const Option *option, gboolean slave)
+commit_option (NMDevice *device, NMSetting *setting, const Option *option, gboolean slave)
{
int ifindex = nm_device_get_ifindex (device);
GParamSpec *pspec;
@@ -211,12 +211,14 @@ commit_option (NMDevice *device, GObject *setting, const Option *option, gboolea
guint32 uval = 0;
gs_free char *value = NULL;
+ g_assert (setting);
+
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), option->name);
g_assert (pspec);
/* Get the property's value */
g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
- g_object_get_property (setting, option->name, &val);
+ g_object_get_property ((GObject *) setting, option->name, &val);
if (G_VALUE_HOLDS_BOOLEAN (&val))
uval = g_value_get_boolean (&val) ? 1 : 0;
else if (G_VALUE_HOLDS_UINT (&val)) {
@@ -251,25 +253,30 @@ commit_option (NMDevice *device, GObject *setting, const Option *option, gboolea
}
static void
-commit_master_options (NMDevice *device, GObject *setting)
+commit_master_options (NMDevice *device, NMSettingBridge *setting)
{
const Option *option;
-
- g_assert (setting);
+ NMSetting *s = NM_SETTING (setting);
for (option = master_options; option->name; option++)
- commit_option (device, setting, option, FALSE);
+ commit_option (device, s, option, FALSE);
}
static void
-commit_slave_options (NMDevice *device, GObject *setting)
+commit_slave_options (NMDevice *device, NMSettingBridgePort *setting)
{
const Option *option;
+ NMSetting *s, *s_clear = NULL;
- g_assert (setting);
+ if (setting)
+ s = NM_SETTING (setting);
+ else
+ s = s_clear = nm_setting_bridge_port_new ();
for (option = slave_options; option->name; option++)
- commit_option (device, setting, option, TRUE);
+ commit_option (device, s, option, TRUE);
+
+ g_clear_object (&s_clear);
}
static NMActStageReturn
@@ -284,7 +291,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
return ret;
- commit_master_options (device, (GObject *) nm_connection_get_setting_bridge (connection));
+ commit_master_options (device, nm_connection_get_setting_bridge (connection));
return NM_ACT_STAGE_RETURN_SUCCESS;
}
@@ -295,7 +302,7 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
if (!nm_platform_link_enslave (nm_device_get_ip_ifindex (device), nm_device_get_ip_ifindex (slave)))
return FALSE;
- commit_slave_options (slave, (GObject *) nm_connection_get_setting_bridge_port (connection));
+ commit_slave_options (slave, nm_connection_get_setting_bridge_port (connection));
nm_log_info (LOGD_BRIDGE, "(%s): attached bridge port %s",
nm_device_get_ip_iface (device),
--
1.8.4.2

View File

@ -1,96 +0,0 @@
From 00b29b6c61c0b7bff874a1a440f59c782ea7f83d Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Sun, 20 Oct 2013 16:27:46 -0400
Subject: [PATCH] core: fix NMManager:primary-connection when a VPN has the
default route
If a VPN had the default route, :primary-connection would become NULL,
which is exactly what it's not supposed to do. Fix it to have the
value it's supposed to.
https://bugzilla.gnome.org/show_bug.cgi?id=710207
---
src/nm-policy.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index d5176ae..22f7c11 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -638,7 +638,7 @@ static void
update_ip4_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL;
+ NMDevice *best = NULL, *default_device;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -682,6 +682,8 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route.");
}
}
+
+ default_device = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip4_config_get_mss (ip4_config);
@@ -691,14 +693,16 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP4, "Failed to set default route.");
}
}
+
+ default_device = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default);
- if (best == priv->default_device4)
+ if (default_device == priv->default_device4)
return;
- priv->default_device4 = best;
+ priv->default_device4 = default_device;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv4 routing and DNS.",
nm_connection_get_id (connection), ip_iface);
@@ -816,7 +820,7 @@ static void
update_ip6_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL;
+ NMDevice *best = NULL, *default_device6;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -870,6 +874,8 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route.");
}
}
+
+ default_device6 = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip6_config_get_mss (ip6_config);
@@ -879,14 +885,16 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP6, "Failed to set default route.");
}
}
+
+ default_device6 = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default6);
- if (best == priv->default_device6)
+ if (default_device6 == priv->default_device6)
return;
- priv->default_device6 = best;
+ priv->default_device6 = default_device6;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv6 routing and DNS.",
nm_connection_get_id (connection), ip_iface);
--
1.8.4.2

View File

@ -1,86 +0,0 @@
From 7eb12a5b21f87d7592ec2c5235d1ed90c4fac132 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 3 Dec 2013 11:42:28 -0600
Subject: [PATCH] platform: set IPv4 broadcast address too (rh #1032819)
When moving over the platform, setting of the IPv4 broadcast address
got lost. Bring it back.
https://bugzilla.redhat.com/show_bug.cgi?id=1032819
---
src/platform/nm-linux-platform.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 8f0e077..3f57925 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2213,14 +2213,33 @@ ip6_address_get_all (NMPlatform *platform, int ifindex)
nl_object_unmark (object);
}
}
return addresses;
}
+static void
+addr4_to_broadcast (struct in_addr *dst, const struct in_addr *src, guint8 plen)
+{
+ guint nbytes = plen / 8;
+ guint nbits = plen % 8;
+
+ g_return_if_fail (plen <= 32);
+ g_assert (src);
+ g_assert (dst);
+
+ if (plen >= 32)
+ *dst = *src;
+ else {
+ dst->s_addr = 0xFFFFFFFF;
+ memcpy (dst, src, nbytes);
+ ((guint8 *) dst)[nbytes] = (((const guint8 *) src)[nbytes] | (0xFF >> nbits));
+ }
+}
+
static struct nl_object *
build_rtnl_addr (int family,
int ifindex,
gconstpointer addr,
gconstpointer peer_addr,
int plen,
guint32 lifetime,
@@ -2230,18 +2249,31 @@ build_rtnl_addr (int family,
struct rtnl_addr *rtnladdr = rtnl_addr_alloc ();
int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr);
auto_nl_addr struct nl_addr *nladdr = nl_addr_build (family, addr, addrlen);
int nle;
g_assert (rtnladdr && nladdr);
+ /* IP address */
rtnl_addr_set_ifindex (rtnladdr, ifindex);
nle = rtnl_addr_set_local (rtnladdr, nladdr);
g_assert (!nle);
+ /* IPv4 Broadcast address */
+ if (family == AF_INET) {
+ struct in_addr bcast;
+ auto_nl_addr struct nl_addr *bcaddr = NULL;
+
+ addr4_to_broadcast (&bcast, addr, plen);
+ bcaddr = nl_addr_build (family, &bcast, addrlen);
+ g_assert (bcaddr);
+ rtnl_addr_set_broadcast (rtnladdr, bcaddr);
+ }
+
+ /* Peer/point-to-point address */
if (peer_addr) {
auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen);
nle = rtnl_addr_set_peer (rtnladdr, nlpeer);
g_assert (!nle);
}
--
1.8.3.1

View File

@ -1,833 +0,0 @@
From 07281f21a71fa333288821ad863accfeedfff567 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 9 Dec 2013 12:55:04 -0600
Subject: [PATCH] core: delay startup complete until carrier is found or
timeout (rh #1034921) (rh #1030583)
---
src/devices/nm-device.c | 177 ++++++++++++++++++++++++++++++++++-----------
src/nm-active-connection.c | 8 ++
2 files changed, 142 insertions(+), 43 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 578ccb0..96a5d44 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -184,15 +184,15 @@ typedef struct {
gboolean initialized;
gboolean in_state_changed;
NMDeviceState state;
NMDeviceStateReason state_reason;
QueuedState queued_state;
guint queued_ip_config_id;
- guint pending_actions;
+ GArray *pending_actions;
char * udi;
char * path;
char * iface; /* may change, could be renamed by user */
int ifindex;
gboolean is_software;
char * ip_iface;
@@ -224,14 +224,15 @@ typedef struct {
gpointer act_source6_func;
/* Link stuff */
guint link_connected_id;
guint link_disconnected_id;
guint carrier_defer_id;
gboolean carrier;
+ guint carrier_wait_id;
gboolean ignore_carrier;
/* Generic DHCP stuff */
NMDHCPManager * dhcp_manager;
guint32 dhcp_timeout;
GByteArray * dhcp_anycast_address;
@@ -390,14 +391,15 @@ nm_device_init (NMDevice *self)
priv->capabilities = NM_DEVICE_CAP_NM_SUPPORTED;
priv->state = NM_DEVICE_STATE_UNMANAGED;
priv->state_reason = NM_DEVICE_STATE_REASON_NONE;
priv->dhcp_timeout = 0;
priv->rfkill_type = RFKILL_TYPE_UNKNOWN;
priv->autoconnect = DEFAULT_AUTOCONNECT;
priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
+ priv->pending_actions = g_array_sized_new (FALSE, TRUE, sizeof (GQuark), 5);
}
static void
update_accept_ra_save (NMDevice *self)
{
NMDevicePrivate *priv;
const char *ip_iface;
@@ -1154,14 +1156,20 @@ nm_device_set_carrier (NMDevice *device, gboolean carrier)
if (priv->carrier) {
nm_log_info (LOGD_DEVICE, "(%s): link connected", iface);
if (priv->carrier_defer_id) {
g_source_remove (priv->carrier_defer_id);
priv->carrier_defer_id = 0;
}
klass->carrier_changed (device, TRUE);
+
+ if (priv->carrier_wait_id) {
+ g_source_remove (priv->carrier_wait_id);
+ priv->carrier_wait_id = 0;
+ nm_device_remove_pending_action (device, "carrier wait");
+ }
} else if (state <= NM_DEVICE_STATE_DISCONNECTED) {
nm_log_info (LOGD_DEVICE, "(%s): link disconnected", iface);
klass->carrier_changed (device, FALSE);
} else {
nm_log_info (LOGD_DEVICE, "(%s): link disconnected (deferring action for %d seconds)",
iface, LINK_DISCONNECT_DELAY);
priv->carrier_defer_id = g_timeout_add_seconds (LINK_DISCONNECT_DELAY,
@@ -5110,17 +5118,28 @@ nm_device_start_ip_check (NMDevice *self)
/* If no ping was started, just advance to SECONDARIES */
if (!priv->gw_ping.pid)
nm_device_queue_state (self, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE);
}
/****************************************************************/
+static gboolean
+carrier_wait_timeout (gpointer user_data)
+{
+ NMDevice *self = NM_DEVICE (user_data);
+
+ NM_DEVICE_GET_PRIVATE (self)->carrier_wait_id = 0;
+ nm_device_remove_pending_action (self, "carrier wait");
+ return G_SOURCE_REMOVE;
+}
+
gboolean
nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
gboolean success;
guint32 tries = 0;
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
if (nm_device_is_up (self))
goto out;
@@ -5138,14 +5157,28 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
g_usleep (200);
if (!nm_device_is_up (self)) {
nm_log_warn (LOGD_HW, "(%s): device not up after timeout!", nm_device_get_iface (self));
return FALSE;
}
+ /* Devices that support carrier detect must be IFF_UP to report carrier
+ * changes; so after setting the device IFF_UP we must suppress startup
+ * complete (via a pending action) until either the carrier turns on, or
+ * a timeout is reached.
+ */
+ if (device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
+ if (priv->carrier_wait_id) {
+ g_source_remove (priv->carrier_wait_id);
+ nm_device_remove_pending_action (self, "carrier wait");
+ }
+ priv->carrier_wait_id = g_timeout_add_seconds (5, carrier_wait_timeout, self);
+ nm_device_add_pending_action (self, "carrier wait");
+ }
+
out:
/* Can only get HW address of some devices when they are up */
nm_device_update_hw_address (self);
_update_ip4_address (self);
return TRUE;
}
@@ -5301,14 +5334,19 @@ dispose (GObject *object)
}
if (priv->cp_updated_id) {
g_signal_handler_disconnect (priv->con_provider, priv->cp_updated_id);
priv->cp_updated_id = 0;
}
+ if (priv->carrier_wait_id) {
+ g_source_remove (priv->carrier_wait_id);
+ priv->carrier_wait_id = 0;
+ }
+
g_hash_table_unref (priv->available_connections);
priv->available_connections = NULL;
activation_source_clear (self, TRUE, AF_INET);
activation_source_clear (self, TRUE, AF_INET6);
clear_act_request (self);
@@ -5331,14 +5369,17 @@ finalize (GObject *object)
if (priv->dhcp_manager)
g_object_unref (priv->dhcp_manager);
if (priv->fw_manager)
g_object_unref (priv->fw_manager);
+ g_array_free (priv->pending_actions, TRUE);
+ priv->pending_actions = NULL;
+
g_free (priv->udi);
g_free (priv->path);
g_free (priv->iface);
g_free (priv->ip_iface);
g_free (priv->driver);
g_free (priv->driver_version);
g_free (priv->firmware_version);
@@ -5931,46 +5972,54 @@ nm_device_set_firmware_missing (NMDevice *self, gboolean new_missing)
gboolean
nm_device_get_firmware_missing (NMDevice *self)
{
return NM_DEVICE_GET_PRIVATE (self)->firmware_missing;
}
+#define QUEUED_PREFIX "queued state change to "
+
static const char *
-state_to_string (NMDeviceState state)
+queued_state_to_string (NMDeviceState state)
{
switch (state) {
case NM_DEVICE_STATE_UNMANAGED:
- return "unmanaged";
+ return QUEUED_PREFIX "unmanaged";
case NM_DEVICE_STATE_UNAVAILABLE:
- return "unavailable";
+ return QUEUED_PREFIX "unavailable";
case NM_DEVICE_STATE_DISCONNECTED:
- return "disconnected";
+ return QUEUED_PREFIX "disconnected";
case NM_DEVICE_STATE_PREPARE:
- return "prepare";
+ return QUEUED_PREFIX "prepare";
case NM_DEVICE_STATE_CONFIG:
- return "config";
+ return QUEUED_PREFIX "config";
case NM_DEVICE_STATE_NEED_AUTH:
- return "need-auth";
+ return QUEUED_PREFIX "need-auth";
case NM_DEVICE_STATE_IP_CONFIG:
- return "ip-config";
+ return QUEUED_PREFIX "ip-config";
case NM_DEVICE_STATE_IP_CHECK:
- return "ip-check";
+ return QUEUED_PREFIX "ip-check";
case NM_DEVICE_STATE_SECONDARIES:
- return "secondaries";
+ return QUEUED_PREFIX "secondaries";
case NM_DEVICE_STATE_ACTIVATED:
- return "activated";
+ return QUEUED_PREFIX "activated";
case NM_DEVICE_STATE_DEACTIVATING:
- return "deactivating";
+ return QUEUED_PREFIX "deactivating";
case NM_DEVICE_STATE_FAILED:
- return "failed";
+ return QUEUED_PREFIX "failed";
default:
break;
}
- return "unknown";
+ return QUEUED_PREFIX "unknown";
+}
+
+static const char *
+state_to_string (NMDeviceState state)
+{
+ return queued_state_to_string (state) + strlen (QUEUED_PREFIX);
}
static const char *
reason_to_string (NMDeviceStateReason reason)
{
switch (reason) {
case NM_DEVICE_STATE_REASON_NONE:
@@ -6083,21 +6132,14 @@ reason_to_string (NMDeviceStateReason reason)
return "secondary-connection-failed";
default:
break;
}
return "unknown";
}
-static inline gboolean
-state_implies_pending_action (NMDeviceState state)
-{
- return ( state >= NM_DEVICE_STATE_PREPARE
- && state < NM_DEVICE_STATE_ACTIVATED);
-}
-
void
nm_device_state_changed (NMDevice *device,
NMDeviceState state,
NMDeviceStateReason reason)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
NMDeviceState old_state;
@@ -6131,18 +6173,14 @@ nm_device_state_changed (NMDevice *device,
return;
}
old_state = priv->state;
priv->state = state;
priv->state_reason = reason;
- if ( state_implies_pending_action (state)
- && !state_implies_pending_action (old_state))
- nm_device_add_pending_action (device, "activation");
-
nm_log_info (LOGD_DEVICE, "(%s): device state change: %s -> %s (reason '%s') [%d %d %d]",
nm_device_get_iface (device),
state_to_string (old_state),
state_to_string (state),
reason_to_string (reason),
old_state,
state,
@@ -6300,18 +6338,14 @@ nm_device_state_changed (NMDevice *device,
if (old_state == NM_DEVICE_STATE_ACTIVATED)
nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device, NULL, NULL);
/* Dispose of the cached activation request */
if (req)
g_object_unref (req);
- if ( state_implies_pending_action (old_state)
- && !state_implies_pending_action (state))
- nm_device_remove_pending_action (device, "activation");
-
priv->in_state_changed = FALSE;
}
static gboolean
queued_set_state (gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
@@ -6330,15 +6364,15 @@ queued_set_state (gpointer user_data)
*/
priv->queued_state.id = 0;
new_state = priv->queued_state.state;
new_reason = priv->queued_state.reason;
nm_device_queued_state_clear (self);
nm_device_state_changed (self, new_state, new_reason);
- nm_device_remove_pending_action (self, "queued state change");
+ nm_device_remove_pending_action (self, queued_state_to_string (new_state));
} else {
g_warn_if_fail (priv->queued_state.state == NM_DEVICE_STATE_UNKNOWN);
g_warn_if_fail (priv->queued_state.reason == NM_DEVICE_STATE_REASON_NONE);
}
return FALSE;
}
@@ -6349,29 +6383,37 @@ nm_device_queue_state (NMDevice *self,
{
NMDevicePrivate *priv;
g_return_if_fail (NM_IS_DEVICE (self));
priv = NM_DEVICE_GET_PRIVATE (self);
+ /* "lock" the pending actions so that if there was a previously
+ * queued action that's about to be cleared, that doesn't drop
+ * the pending actions to 0 before we add the new pending action.
+ */
+ nm_device_add_pending_action (self, "queued state lock");
+
/* We should only ever have one delayed state transition at a time */
if (priv->queued_state.id) {
if (priv->queued_state.state == state)
return;
nm_log_warn (LOGD_DEVICE, "(%s): overwriting previously queued state change to %s (%s)",
nm_device_get_iface (self),
state_to_string (priv->queued_state.state),
reason_to_string (priv->queued_state.reason));
nm_device_queued_state_clear (self);
}
priv->queued_state.state = state;
priv->queued_state.reason = reason;
priv->queued_state.id = g_idle_add (queued_set_state, self);
- nm_device_add_pending_action (self, "queued state change");
+ nm_device_add_pending_action (self, queued_state_to_string (state));
+
+ nm_device_remove_pending_action (self, "queued state lock");
nm_log_dbg (LOGD_DEVICE, "(%s): queued state change to %s due to %s (id %d)",
nm_device_get_iface (self), state_to_string (state), reason_to_string (reason),
priv->queued_state.id);
}
NMDeviceState
@@ -6391,15 +6433,15 @@ nm_device_queued_state_clear (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->queued_state.id) {
nm_log_dbg (LOGD_DEVICE, "(%s): clearing queued state transition (id %d)",
nm_device_get_iface (self), priv->queued_state.id);
g_source_remove (priv->queued_state.id);
- nm_device_remove_pending_action (self, "queued state change");
+ nm_device_remove_pending_action (self, queued_state_to_string (priv->queued_state.state));
}
memset (&priv->queued_state, 0, sizeof (priv->queued_state));
}
NMDeviceState
nm_device_get_state (NMDevice *device)
{
@@ -7102,40 +7144,89 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr,
}
nm_device_bring_up (device, TRUE, NULL);
g_free (mac_str);
return success;
}
+/**
+ * nm_device_add_pending_action():
+ * @device: the #NMDevice to add the pending action to
+ * @action: a static string that identifies the action
+ *
+ * Adds a pending action to the device.
+ */
void
nm_device_add_pending_action (NMDevice *device, const char *action)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
+ GQuark qaction;
+ guint i;
- priv->pending_actions++;
- nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): %s",
- nm_device_get_iface (device), priv->pending_actions, action);
+ qaction = g_quark_from_static_string (action);
- if (priv->pending_actions == 1)
+ /* Shouldn't ever add the same pending action twice */
+ for (i = 0; i < priv->pending_actions->len; i++) {
+ if (qaction == g_array_index (priv->pending_actions, GQuark, i)) {
+ nm_log_warn (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already added",
+ nm_device_get_iface (device),
+ priv->pending_actions->len,
+ action);
+ g_warn_if_reached ();
+ return;
+ }
+ }
+
+ g_array_prepend_val (priv->pending_actions, qaction);
+ nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s'",
+ nm_device_get_iface (device),
+ priv->pending_actions->len,
+ action);
+
+ if (priv->pending_actions->len == 1)
g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION);
}
+/**
+ * nm_device_remove_pending_action():
+ * @device: the #NMDevice to remove the pending action from
+ * @action: a static string that identifies the action
+ *
+ * Removes a pending action previously added by nm_device_add_pending_action().
+ */
void
nm_device_remove_pending_action (NMDevice *device, const char *action)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
+ GQuark qaction;
+ guint i;
- priv->pending_actions--;
- nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): %s",
- nm_device_get_iface (device), priv->pending_actions, action);
+ qaction = g_quark_from_static_string (action);
- if (priv->pending_actions == 0)
- g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION);
+ /* Shouldn't ever add the same pending action twice */
+ for (i = 0; i < priv->pending_actions->len; i++) {
+ if (qaction == g_array_index (priv->pending_actions, GQuark, i)) {
+ g_array_remove_index_fast (priv->pending_actions, i);
+ nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s'",
+ nm_device_get_iface (device),
+ priv->pending_actions->len,
+ action);
+
+ if (priv->pending_actions->len == 0)
+ g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION);
+ return;
+ }
+ }
+
+ nm_log_warn (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' never added",
+ nm_device_get_iface (device),
+ priv->pending_actions->len,
+ action);
}
gboolean
nm_device_has_pending_action (NMDevice *device)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
- return priv->pending_actions > 0;
+ return priv->pending_actions->len > 0;
}
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 6a825bc..34f438c 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -135,14 +135,20 @@ nm_active_connection_set_state (NMActiveConnection *self,
if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|| old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (priv->connection),
(guint64) time (NULL), TRUE);
}
+ if (priv->device) {
+ if ( old_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
+ nm_device_remove_pending_action (priv->device, "activation");
+ }
+
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
/* Device is no longer relevant when deactivated */
g_clear_object (&priv->device);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES);
}
}
@@ -262,8 +268,10 @@ set_property (GObject *object, guint pro
case PROP_INT_DEVICE:
g_warn_if_fail (priv->device == NULL);
priv->device = g_value_dup_object (value);
- if (priv->device)
+ if (priv->device) {
g_warn_if_fail (priv->device != priv->master);
+ nm_device_add_pending_action (priv->device, "activation");
+ }
break;
case PROP_INT_USER_REQUESTED:
priv->user_requested = g_value_get_boolean (value);
--
1.8.3.1
From 813ea5995bb5a35c115c46f30eefe18db2886afb Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 16 Dec 2013 16:52:36 +0100
Subject: [PATCH 1/2] core: allow dynamic strings for pending action names
Use a GSList of the string values, instead of an array of GQuarks.
Using GQuarks does not allow to add arbitrary strings, because they
would leak the internalized strings. The next patch will begin
using unique, non-const action strings.
Given the rather small number of expected pending states, a singly
linked list seems appropriate.
Signed-off-by: Thomas Haller <thaller@redhat.com>
(some fixes and simplifications by dcbw based on patch reviews)
---
src/devices/nm-device.c | 49 +++++++++++++++++++++++++------------------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index c1c7c69..e4644bf 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -184,15 +184,15 @@ typedef struct {
gboolean initialized;
gboolean in_state_changed;
NMDeviceState state;
NMDeviceStateReason state_reason;
QueuedState queued_state;
guint queued_ip_config_id;
- GArray *pending_actions;
+ GSList *pending_actions;
char * udi;
char * path;
char * iface; /* may change, could be renamed by user */
int ifindex;
gboolean is_software;
char * ip_iface;
@@ -391,15 +391,14 @@ nm_device_init (NMDevice *self)
priv->capabilities = NM_DEVICE_CAP_NM_SUPPORTED;
priv->state = NM_DEVICE_STATE_UNMANAGED;
priv->state_reason = NM_DEVICE_STATE_REASON_NONE;
priv->dhcp_timeout = 0;
priv->rfkill_type = RFKILL_TYPE_UNKNOWN;
priv->autoconnect = DEFAULT_AUTOCONNECT;
priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
- priv->pending_actions = g_array_sized_new (FALSE, TRUE, sizeof (GQuark), 5);
}
static void
update_accept_ra_save (NMDevice *self)
{
NMDevicePrivate *priv;
const char *ip_iface;
@@ -5368,16 +5367,15 @@ finalize (GObject *object)
if (priv->dhcp_manager)
g_object_unref (priv->dhcp_manager);
if (priv->fw_manager)
g_object_unref (priv->fw_manager);
- g_array_free (priv->pending_actions, TRUE);
- priv->pending_actions = NULL;
+ g_slist_free_full (priv->pending_actions, g_free);
g_free (priv->udi);
g_free (priv->path);
g_free (priv->iface);
g_free (priv->ip_iface);
g_free (priv->driver);
g_free (priv->driver_version);
@@ -7153,78 +7152,80 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr,
*
* Adds a pending action to the device.
*/
void
nm_device_add_pending_action (NMDevice *device, const char *action)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
- GQuark qaction;
- guint i;
+ GSList *iter;
+ guint count;
- qaction = g_quark_from_static_string (action);
+ g_return_if_fail (action);
/* Shouldn't ever add the same pending action twice */
- for (i = 0; i < priv->pending_actions->len; i++) {
- if (qaction == g_array_index (priv->pending_actions, GQuark, i)) {
+ for (iter = priv->pending_actions; iter; iter = iter->next) {
+ if (!strcmp (action, iter->data)) {
nm_log_warn (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already added",
nm_device_get_iface (device),
- priv->pending_actions->len,
+ g_slist_length (priv->pending_actions),
action);
- g_warn_if_reached ();
- return;
+ g_return_val_if_reached (FALSE);
}
}
- g_array_prepend_val (priv->pending_actions, qaction);
+ priv->pending_actions = g_slist_append (priv->pending_actions, g_strdup (action));
+ count = g_slist_length (priv->pending_actions);
+
nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s'",
nm_device_get_iface (device),
- priv->pending_actions->len,
+ count,
action);
- if (priv->pending_actions->len == 1)
+ if (count == 1)
g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION);
}
/**
* nm_device_remove_pending_action():
* @device: the #NMDevice to remove the pending action from
* @action: a static string that identifies the action
*
* Removes a pending action previously added by nm_device_add_pending_action().
*/
void
nm_device_remove_pending_action (NMDevice *device, const char *action)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
- GQuark qaction;
- guint i;
+ GSList *iter;
- qaction = g_quark_from_static_string (action);
+ g_return_if_fail (action);
/* Shouldn't ever add the same pending action twice */
- for (i = 0; i < priv->pending_actions->len; i++) {
- if (qaction == g_array_index (priv->pending_actions, GQuark, i)) {
- g_array_remove_index_fast (priv->pending_actions, i);
+ for (iter = priv->pending_actions; iter; iter = iter->next) {
+ if (!strcmp (action, iter->data)) {
+ g_free (iter->data);
+ priv->pending_actions = g_slist_delete_link (priv->pending_actions, iter);
nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s'",
nm_device_get_iface (device),
- priv->pending_actions->len,
+ g_slist_length (priv->pending_actions),
action);
- if (priv->pending_actions->len == 0)
+ if (priv->pending_actions == NULL)
g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION);
return;
}
}
nm_log_warn (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' never added",
nm_device_get_iface (device),
- priv->pending_actions->len,
+ g_slist_length (priv->pending_actions),
action);
+ g_return_if_reached ();
}
gboolean
nm_device_has_pending_action (NMDevice *device)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
- return priv->pending_actions->len > 0;
+ return !!priv->pending_actions;
}
--
1.8.3.1
From b6ef165cfefba44a496cc336e1f91bb93b28f3ff Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 16 Dec 2013 15:02:38 +0100
Subject: [PATCH 2/2] core: fix NMActiveConnection to properly add/remove
pending action "activation"
When a new activation request is received, NetworkManager creates a new
NMActiveConnection to track that request. The device may already be activated,
in which case NetworkManager stops the old activation and starts the new one,
but both exist in parallel for a short period of time. If the old
NMActiveConnection is activating and already has a pending 'activation'
action, when the new NMActiveConnection adds its own 'activating' action,
they will clash. This is fixed by making each NMActiveConnection's activation
pending action uniquely named.
This fixes a g_warning with the following back trace:
#0 0x000000328224edfd in g_logv () from /lib64/libglib-2.0.so.0
#1 0x000000328224efe2 in g_log () from /lib64/libglib-2.0.so.0
#2 0x000000328224f2e6 in g_warn_message () from /lib64/libglib-2.0.so.0
#3 0x0000000000440aee in nm_device_add_pending_action (device=0x14002e0, action=0x50704a "activation") at devices/nm-device.c:7172
#4 0x000000000047525c in nm_active_connection_set_device (self=0x141b3c0, device=0x14002e0) at nm-active-connection.c:364
#5 0x0000000000475ec1 in set_property (object=0x141b3c0, prop_id=11, value=0x7fff7ff36c20, pspec=0x1405f70) at nm-active-connection.c:647
#6 0x0000003282615d3e in g_object_newv () from /lib64/libgobject-2.0.so.0
#7 0x00000032826162e6 in g_object_new_valist () from /lib64/libgobject-2.0.so.0
#8 0x0000003282616654 in g_object_new () from /lib64/libgobject-2.0.so.0
#9 0x0000000000474193 in nm_act_request_new (connection=0x13bb0e0, specific_object=0x0, subject=0x1447740, device=0x14002e0) at nm-activation-request.c:376
#10 0x000000000048e477 in _new_active_connection (self=0x13e8060, connection=0x13bb0e0, specific_object=0x0, device=0x14002e0, subject=0x1447740, error=0x7fff7ff36f90) at nm-manager.c:2947
#11 0x000000000048ed77 in impl_manager_activate_connection (self=0x13e8060, connection_path=0x134d590 "/org/freedesktop/NetworkManager/Settings/9", device_path=0x134d550 "/org/freedesktop/NetworkManager/Devices/1",
specific_object_path=0x0, context=0x143a9b0) at nm-manager.c:3206
#12 0x00000000004876c8 in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7fff7ff37220, return_value=0x0, n_param_values=5, param_values=0x1448830, invocation_hint=0x0,
marshal_data=0x48e9dd <impl_manager_activate_connection>) at nm-manager-glue.h:189
#13 0x0000003284a0d6a9 in object_registration_message () from /lib64/libdbus-glib-1.so.2
#14 0x000000348ea1ce66 in _dbus_object_tree_dispatch_and_unlock () from /lib64/libdbus-1.so.3
#15 0x000000348ea0fa31 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
#16 0x0000003284a0acc5 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
#17 0x0000003282247df6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#18 0x0000003282248148 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0
#19 0x000000328224854a in g_main_loop_run () from /lib64/libglib-2.0.so.0
#20 0x000000000042c6c0 in main (argc=1, argv=0x7fff7ff379b8) at main.c:629
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/nm-active-connection.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index cb42417..a8a422c 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -42,14 +42,16 @@ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT)
NMDevice *device;
gboolean is_default;
gboolean is_default6;
NMActiveConnectionState state;
gboolean vpn;
+ char *pending_activation_id;
+
gboolean user_requested;
gulong user_uid;
NMDevice *master;
} NMActiveConnectionPrivate;
enum {
PROP_0,
@@ -138,16 +140,20 @@ nm_active_connection_set_state (NMActiveConnection *self,
|| old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (priv->connection),
(guint64) time (NULL), TRUE);
}
if (priv->device) {
if ( old_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATED
- && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
- nm_device_remove_pending_action (priv->device, "activation");
+ && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
+ priv->pending_activation_id)
+ {
+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
+ g_clear_pointer (&priv->pending_activation_id, g_free);
+ }
}
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
/* Device is no longer relevant when deactivated */
g_clear_object (&priv->device);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES);
}
@@ -357,15 +363,16 @@ set_property (GObject *object, guint prop_id,
priv->connection = g_value_dup_object (value);
break;
case PROP_INT_DEVICE:
g_warn_if_fail (priv->device == NULL);
priv->device = g_value_dup_object (value);
if (priv->device) {
g_warn_if_fail (priv->device != priv->master);
- nm_device_add_pending_action (priv->device, "activation");
+ priv->pending_activation_id = g_strdup_printf ("activation::%p", (void *)object);
+ nm_device_add_pending_action (priv->device, priv->pending_activation_id);
}
break;
case PROP_INT_USER_REQUESTED:
priv->user_requested = g_value_get_boolean (value);
break;
case PROP_INT_USER_UID:
priv->user_uid = g_value_get_ulong (value);
@@ -732,14 +739,18 @@ static void
g_free (priv->path);
priv->path = NULL;
g_free (priv->specific_object);
priv->specific_object = NULL;
g_clear_object (&priv->connection);
+ if (priv->pending_activation_id) {
+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
+ g_clear_pointer (&priv->pending_activation_id, g_free);
+ }
g_clear_object (&priv->device);
g_clear_object (&priv->master);
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
}
static void
--
1.8.3.1

View File

@ -1,943 +0,0 @@
From fe2fb7137c2fec59222db890d516a81a16cc0a60 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 19 Dec 2013 09:11:20 -0500
Subject: [PATCH 1/4] introspection: wrap long lines in
nm-active-connection.xml
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-active-connection.xml | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index b6a3c48..d77f0d0 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -11,7 +11,9 @@
</tp:docstring>
<property name="Connection" type="o" access="read">
- <tp:docstring>The path of the connection.</tp:docstring>
+ <tp:docstring>
+ The path of the connection.
+ </tp:docstring>
</property>
<property name="SpecificObject" type="o" access="read">
<tp:docstring>
@@ -27,22 +29,37 @@
</tp:docstring>
</property>
<property name="Devices" type="ao" access="read">
- <tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring>
+ <tp:docstring>
+ Array of object paths representing devices which are part of this active
+ connection.
+ </tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_ACTIVE_CONNECTION_STATE">
- <tp:docstring>The state of this active connection.</tp:docstring>
+ <tp:docstring>
+ The state of this active connection.
+ </tp:docstring>
</property>
<property name="Default" type="b" access="read">
- <tp:docstring>Whether this active connection is the default IPv4 connection, i.e. whether it currently owns the default IPv4 route.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is the default IPv4 connection, i.e.
+ whether it currently owns the default IPv4 route.
+ </tp:docstring>
</property>
<property name="Default6" type="b" access="read">
- <tp:docstring>Whether this active connection is the default IPv6 connection, i.e. whether it currently owns the default IPv6 route.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is the default IPv6 connection, i.e.
+ whether it currently owns the default IPv6 route.
+ </tp:docstring>
</property>
<property name="Vpn" type="b" access="read">
- <tp:docstring>Whether this active connection is also a VPN connection.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is also a VPN connection.
+ </tp:docstring>
</property>
<property name="Master" type="o" access="read">
- <tp:docstring>The path to the master device if the connection is a slave.</tp:docstring>
+ <tp:docstring>
+ The path to the master device if the connection is a slave.
+ </tp:docstring>
</property>
<signal name="PropertiesChanged">
--
1.7.11.7
From f642e88afd2bf585036ca8af54c81976cd2f259b Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 08:46:43 -0500
Subject: [PATCH 2/4] core: add IP/DHCP config properties to
o.fd.NM.Connection.Active
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add IP and DHCP config properties to the D-Bus ActiveConnection
objects.
For device connections, this is redundant with the properties already
on the Device object, but for VPN connections, this information was
not previously available.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-active-connection.xml | 30 ++++++++++++++
src/nm-activation-request.c | 71 ++++++++++++++++++++++++++++++++++
src/nm-active-connection.c | 53 +++++++++++++++++++++++++
src/nm-active-connection.h | 4 ++
src/vpn-manager/nm-vpn-connection.c | 23 +++++++++++
5 files changed, 181 insertions(+)
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index d77f0d0..56a1013 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -45,12 +45,42 @@
whether it currently owns the default IPv4 route.
</tp:docstring>
</property>
+ <property name="Ip4Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Ip4Config object describing the configuration of the
+ connection. Only valid when the connection is in the
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ </tp:docstring>
+ </property>
+ <property name="Dhcp4Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Dhcp4Config object describing the DHCP options
+ returned by the DHCP server (assuming the connection used DHCP). Only
+ valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ state.
+ </tp:docstring>
+ </property>
<property name="Default6" type="b" access="read">
<tp:docstring>
Whether this active connection is the default IPv6 connection, i.e.
whether it currently owns the default IPv6 route.
</tp:docstring>
</property>
+ <property name="Ip6Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Ip6Config object describing the configuration of the
+ connection. Only valid when the connection is in the
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ </tp:docstring>
+ </property>
+ <property name="Dhcp6Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Dhcp6Config object describing the DHCP options
+ returned by the DHCP server (assuming the connection used DHCP). Only
+ valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ state.
+ </tp:docstring>
+ </property>
<property name="Vpn" type="b" access="read">
<tp:docstring>
Whether this active connection is also a VPN connection.
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c
index 0f3c91e..5fa0fc3 100644
--- a/src/nm-activation-request.c
+++ b/src/nm-activation-request.c
@@ -56,6 +56,16 @@ typedef struct {
GSList *share_rules;
} NMActRequestPrivate;
+enum {
+ PROP_0,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
+
+ LAST_PROP
+};
+
/*******************************************************************/
NMConnection *
@@ -282,6 +292,14 @@ nm_act_request_add_share_rule (NMActRequest *req,
/********************************************************************/
static void
+device_notify (GObject *object,
+ GParamSpec *pspec,
+ gpointer self)
+{
+ g_object_notify (self, pspec->name);
+}
+
+static void
device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self)
{
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
@@ -301,6 +319,15 @@ device_state_changed (NMActiveConnection *active,
break;
case NM_DEVICE_STATE_ACTIVATED:
ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
+
+ g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
break;
case NM_DEVICE_STATE_DEACTIVATING:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING;
@@ -310,6 +337,8 @@ device_state_changed (NMActiveConnection *active,
case NM_DEVICE_STATE_UNAVAILABLE:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
+ g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+
/* No longer need to pay attention to device state */
if (priv->device && priv->device_state_id) {
g_signal_handler_disconnect (priv->device, priv->device_state_id);
@@ -414,6 +443,37 @@ dispose (GObject *object)
}
static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMDevice *device;
+
+ device = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
+ if (!device) {
+ g_value_set_boxed (value, "/");
+ return;
+ }
+
+ switch (prop_id) {
+ case PROP_IP4_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_IP4_CONFIG, value);
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG, value);
+ break;
+ case PROP_IP6_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_IP6_CONFIG, value);
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG, value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
nm_act_request_class_init (NMActRequestClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
@@ -423,5 +483,16 @@ nm_act_request_class_init (NMActRequestClass *req_class)
/* virtual methods */
object_class->constructed = constructed;
object_class->dispose = dispose;
+ object_class->get_property = get_property;
+
+ /* properties */
+ g_object_class_override_property (object_class, PROP_IP4_CONFIG,
+ NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_DHCP4_CONFIG,
+ NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_IP6_CONFIG,
+ NM_ACTIVE_CONNECTION_IP6_CONFIG);
+ g_object_class_override_property (object_class, PROP_DHCP6_CONFIG,
+ NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
}
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index a8a422c..3631470 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -74,7 +74,11 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
PROP_VPN,
PROP_MASTER,
@@ -152,6 +156,14 @@ nm_active_connection_set_state (NMActiveConnection *self,
}
}
+ if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
+ }
+
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
/* Device is no longer relevant when deactivated */
g_clear_object (&priv->device);
@@ -712,9 +724,22 @@ get_property (GObject *object, guint prop_id,
case PROP_DEFAULT:
g_value_set_boolean (value, priv->is_default);
break;
+ case PROP_IP4_CONFIG:
+ /* The IP and DHCP config properties may be overridden by a subclass */
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
case PROP_DEFAULT6:
g_value_set_boolean (value, priv->is_default6);
break;
+ case PROP_IP6_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
case PROP_VPN:
g_value_set_boolean (value, priv->vpn);
break;
@@ -838,6 +863,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_IP4_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP4_CONFIG,
+ "IP4 Config",
+ "IP4 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_DHCP4_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
+ "DHCP4 Config",
+ "DHCP4 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
g_object_class_install_property (object_class, PROP_DEFAULT6,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
"Default6",
@@ -845,6 +884,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_IP6_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP6_CONFIG,
+ "IP6 Config",
+ "IP6 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_DHCP6_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
+ "DHCP6 Config",
+ "DHCP6 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
g_object_class_install_property (object_class, PROP_VPN,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
"VPN",
diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h
index 43b76bd..2a4df97 100644
--- a/src/nm-active-connection.h
+++ b/src/nm-active-connection.h
@@ -40,7 +40,11 @@
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_VPN "vpn"
#define NM_ACTIVE_CONNECTION_MASTER "master"
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 500c72b..a4bc431 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -105,6 +105,8 @@ enum {
PROP_0,
PROP_VPN_STATE,
PROP_BANNER,
+ PROP_IP4_CONFIG,
+ PROP_IP6_CONFIG,
PROP_MASTER = 2000,
LAST_PROP
@@ -1011,6 +1013,8 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
nm_ip4_config_merge_setting (config, nm_connection_get_setting_ip4_config (priv->connection));
priv->ip4_config = config;
+ nm_ip4_config_export (config);
+ g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP4_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@@ -1152,6 +1156,8 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
nm_ip6_config_merge_setting (config, nm_connection_get_setting_ip6_config (priv->connection));
priv->ip6_config = config;
+ nm_ip6_config_export (config);
+ g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP6_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@@ -1787,6 +1793,18 @@ get_property (GObject *object, guint prop_id,
case PROP_BANNER:
g_value_set_string (value, priv->banner ? priv->banner : "");
break;
+ case PROP_IP4_CONFIG:
+ if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip4_config)
+ g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
+ else
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_IP6_CONFIG:
+ if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip6_config)
+ g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
+ else
+ g_value_set_boxed (value, "/");
+ break;
case PROP_MASTER:
g_value_set_boxed (value, nm_device_get_path (priv->parent_dev));
break;
@@ -1832,6 +1850,11 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
NULL,
G_PARAM_READABLE));
+ g_object_class_override_property (object_class, PROP_IP4_CONFIG,
+ NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_IP6_CONFIG,
+ NM_ACTIVE_CONNECTION_IP6_CONFIG);
+
/* signals */
signals[VPN_STATE_CHANGED] =
g_signal_new ("vpn-state-changed",
--
1.7.11.7
From 4783f43c530ba7b8d045a1d66001af4ac6463dd4 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 10:56:09 -0500
Subject: [PATCH 3/4] libnm-glib: expose new NMActiveConnection IP/DHCP config
properties
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 4 +
libnm-glib/nm-active-connection.c | 184 ++++++++++++++++++++++++++++++++++++--
libnm-glib/nm-active-connection.h | 16 +++-
libnm-glib/nm-device.c | 16 ++++
4 files changed, 209 insertions(+), 11 deletions(-)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index ac784cc..5247ce9 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -23,6 +23,10 @@ global:
nm_active_connection_get_default6;
nm_active_connection_get_default;
nm_active_connection_get_devices;
+ nm_active_connection_get_dhcp4_config;
+ nm_active_connection_get_dhcp6_config;
+ nm_active_connection_get_ip4_config;
+ nm_active_connection_get_ip6_config;
nm_active_connection_get_master;
nm_active_connection_get_specific_object;
nm_active_connection_get_state;
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index c474483..11f37cf 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -58,7 +58,11 @@ typedef struct {
GPtrArray *devices;
NMActiveConnectionState state;
gboolean is_default;
+ NMIP4Config *ip4_config;
+ NMDHCP4Config *dhcp4_config;
gboolean is_default6;
+ NMIP6Config *ip6_config;
+ NMDHCP6Config *dhcp6_config;
char *master;
} NMActiveConnectionPrivate;
@@ -70,21 +74,16 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
PROP_MASTER,
LAST_PROP
};
-#define DBUS_PROP_CONNECTION "Connection"
-#define DBUS_PROP_UUID "Uuid"
-#define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
-#define DBUS_PROP_DEVICES "Devices"
-#define DBUS_PROP_STATE "State"
-#define DBUS_PROP_DEFAULT "Default"
-#define DBUS_PROP_DEFAULT6 "Default6"
-#define DBUS_PROP_MASTER "Master"
-
/**
* nm_active_connection_new:
* @connection: the #DBusGConnection
@@ -308,6 +307,49 @@ nm_active_connection_get_default (NMActiveConnection *connection)
}
/**
+ * nm_active_connection_get_ip4_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMIP4Config associated with the #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMIP4Config, or %NULL if the
+ * connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ * state.
+ *
+ * Since: 0.9.10
+ **/
+NMIP4Config *
+nm_active_connection_get_ip4_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip4_config;
+}
+
+/**
+ * nm_active_connection_get_dhcp4_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMDHCP4Config (if any) associated with the
+ * #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMDHCP4Config, or %NULL if the
+ * connection does not use DHCP, or is not in the
+ * %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ *
+ * Since: 0.9.10
+ **/
+NMDHCP4Config *
+nm_active_connection_get_dhcp4_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp4_config;
+}
+
+/**
* nm_active_connection_get_default6:
* @connection: a #NMActiveConnection
*
@@ -326,6 +368,49 @@ nm_active_connection_get_default6 (NMActiveConnection *connection)
}
/**
+ * nm_active_connection_get_ip6_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMIP6Config associated with the #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMIP6Config, or %NULL if the
+ * connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ * state.
+ *
+ * Since: 0.9.10
+ **/
+NMIP6Config *
+nm_active_connection_get_ip6_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip6_config;
+}
+
+/**
+ * nm_active_connection_get_dhcp6_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMDHCP6Config (if any) associated with the
+ * #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMDHCP6Config, or %NULL if the
+ * connection does not use DHCPv6, or is not in the
+ * %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ *
+ * Since: 0.9.10
+ **/
+NMDHCP6Config *
+nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
+}
+
+/**
* nm_active_connection_get_master:
* @connection: a #NMActiveConnection
*
@@ -359,6 +444,11 @@ dispose (GObject *object)
priv->devices = NULL;
}
+ g_clear_object (&priv->ip4_config);
+ g_clear_object (&priv->dhcp4_config);
+ g_clear_object (&priv->ip6_config);
+ g_clear_object (&priv->dhcp6_config);
+
g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
@@ -406,9 +496,21 @@ get_property (GObject *object,
case PROP_DEFAULT:
g_value_set_boolean (value, nm_active_connection_get_default (self));
break;
+ case PROP_IP4_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_ip4_config (self));
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_dhcp4_config (self));
+ break;
case PROP_DEFAULT6:
g_value_set_boolean (value, nm_active_connection_get_default6 (self));
break;
+ case PROP_IP6_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_ip6_config (self));
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
+ break;
case PROP_MASTER:
g_value_set_string (value, nm_active_connection_get_master (self));
break;
@@ -429,7 +531,11 @@ register_properties (NMActiveConnection *connection)
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
+ { NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
+ { NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
+ { NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
+ { NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
/* not tracked after construction time */
@@ -551,6 +657,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
G_PARAM_READABLE));
/**
+ * NMActiveConnection:ip4-config:
+ *
+ * The #NMIP4Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IP4_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG,
+ "IP4 Config",
+ "IP4 Config",
+ NM_TYPE_IP4_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
+ * NMActiveConnection:dhcp4-config:
+ *
+ * The #NMDHCP4Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP4_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
+ "DHCP4 Config",
+ "DHCP4 Config",
+ NM_TYPE_DHCP4_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
* NMActiveConnection:default6:
*
* Whether the active connection is the default IPv6 one.
@@ -564,6 +700,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
G_PARAM_READABLE));
/**
+ * NMActiveConnection:ip6-config:
+ *
+ * The #NMIP6Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IP6_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG,
+ "IP6 Config",
+ "IP6 Config",
+ NM_TYPE_IP6_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
+ * NMActiveConnection:dhcp6-config:
+ *
+ * The #NMDHCP6Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP6_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
+ "DHCP6 Config",
+ "DHCP6 Config",
+ NM_TYPE_DHCP6_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
* NMActiveConnection:master:
*
* The path of the master device if one exists.
diff --git a/libnm-glib/nm-active-connection.h b/libnm-glib/nm-active-connection.h
index c6777f8..49f040d 100644
--- a/libnm-glib/nm-active-connection.h
+++ b/libnm-glib/nm-active-connection.h
@@ -29,6 +29,10 @@
#include "nm-object.h"
#include <nm-connection.h>
#include <NetworkManager.h>
+#include "nm-ip4-config.h"
+#include "nm-dhcp4-config.h"
+#include "nm-ip6-config.h"
+#include "nm-dhcp6-config.h"
G_BEGIN_DECLS
@@ -45,7 +49,11 @@ G_BEGIN_DECLS
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_MASTER "master"
typedef struct {
@@ -73,9 +81,13 @@ const char * nm_active_connection_get_uuid (NMActiveConnection *c
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
-gboolean nm_active_connection_get_default (NMActiveConnection *connection);
-gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
const char * nm_active_connection_get_master (NMActiveConnection *connection);
+gboolean nm_active_connection_get_default (NMActiveConnection *connection);
+NMIP4Config * nm_active_connection_get_ip4_config (NMActiveConnection *connection);
+NMDHCP4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
+gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
+NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
+NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
G_END_DECLS
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index d4f95ac..6d8e9f1 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -1253,6 +1253,10 @@ nm_device_get_firmware_missing (NMDevice *device)
*
* Gets the current #NMIP4Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_ip4_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMIP4Config or %NULL if the device is not activated.
**/
NMIP4Config *
@@ -1270,6 +1274,10 @@ nm_device_get_ip4_config (NMDevice *device)
*
* Gets the current #NMDHCP4Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_dhcp4_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMDHCP4Config or %NULL if the device is not activated or not
* using DHCP.
**/
@@ -1288,6 +1296,10 @@ nm_device_get_dhcp4_config (NMDevice *device)
*
* Gets the current #NMIP6Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_ip6_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMIP6Config or %NULL if the device is not activated.
**/
NMIP6Config *
@@ -1305,6 +1317,10 @@ nm_device_get_ip6_config (NMDevice *device)
*
* Gets the current #NMDHCP6Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_dhcp6_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMDHCP6Config or %NULL if the device is not activated or not
* using DHCP.
**/
--
1.7.11.7
From f1f4f32c02e724f59fcc958d08ab8d543a01311d Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 11:49:39 -0500
Subject: [PATCH 4/4] cli: get IP/DHCP config directly from the
NMActiveConnection (rh #1036132)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
cli/src/connections.c | 60 ++++++++++++++-------------------------------------
1 file changed, 16 insertions(+), 44 deletions(-)
diff --git a/cli/src/connections.c b/cli/src/connections.c
index 26be72f..7376405 100644
--- a/cli/src/connections.c
+++ b/cli/src/connections.c
@@ -941,66 +941,38 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
/* IP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[1].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMIP4Config *cfg4 = nm_active_connection_get_ip4_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
-
- b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
+ was_output = was_output || b1;
}
/* DHCP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMDHCP4Config *dhcp4 = nm_active_connection_get_dhcp4_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device);
-
- b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
+ was_output = was_output || b1;
}
/* IP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[3].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMIP6Config *cfg6 = nm_active_connection_get_ip6_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
-
- b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
+ was_output = was_output || b1;
}
/* DHCP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[4].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMDHCP6Config *dhcp6 = nm_active_connection_get_dhcp6_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device);
-
- b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
+ was_output = was_output || b1;
}
/* VPN */
--
1.7.11.7

View File

@ -1,431 +0,0 @@
From 8d3618a07baccc8abd9cfe7cf5b000b5d8c3340b Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 23 Oct 2013 18:37:02 +0200
Subject: [PATCH] rdisc: emit config_change signal for update of address
lifetime
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/rdisc/nm-lndp-rdisc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index 3299b32..f94d82a 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -101,16 +101,19 @@ add_address (NMRDisc *rdisc, const NMRDiscAddress *new)
{
int i;
for (i = 0; i < rdisc->addresses->len; i++) {
NMRDiscAddress *item = &g_array_index (rdisc->addresses, NMRDiscAddress, i);
if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address)) {
- memcpy (item, new, sizeof (*new));
- return FALSE;
+ gboolean changed = item->timestamp + item->lifetime != new->timestamp + new->lifetime ||
+ item->timestamp + item->preferred != new->timestamp + new->preferred;
+
+ *item = *new;
+ return changed;
}
}
g_array_insert_val (rdisc->addresses, i, *new);
return TRUE;
}
--
1.8.3.1
From 4f3f789fa5dad459a2aecabd77ef4a595dec5013 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 19 Dec 2013 10:58:46 -0600
Subject: [PATCH] rdisc: ensure RDNSS and DNSSL lifetimes are updated (rh
#1044757) (bgo #720760)
The DNS server and domain timestamps and lifetimes weren't updated
when a new RA was received. When half the lifetime for either of
them had passed, clean_dns_servers() and clean_domains() request a
Router Solicitation to ensure the DNS information does not expire.
This obviously results in a new Router Advertisement, but since the
timestamps don't get updated, clean_dns_servers() and clean_domains()
simply request another solicitation because 'now' is still greater
than half the old lifetime. This casues another solicit request,
which causes another RA, which... etc.
https://bugzilla.redhat.com/show_bug.cgi?id=1044757
https://bugzilla.gnome.org/show_bug.cgi?id=720760
---
src/devices/nm-device.c | 9 +++--
src/rdisc/nm-lndp-rdisc.c | 97 +++++++++++++++++++++++++++++------------------
2 files changed, 67 insertions(+), 39 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 74d443d..6f2383b 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3315,14 +3315,17 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
NMRDiscDNSServer *discovered_server = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i);
nm_ip6_config_add_nameserver (priv->ac_ip6_config, &discovered_server->address);
}
}
if (changed & NM_RDISC_CONFIG_DNS_DOMAINS) {
+ /* Rebuild domain list from router discovery cache. */
+ nm_ip6_config_reset_domains (priv->ac_ip6_config);
+
for (i = 0; i < rdisc->dns_domains->len; i++) {
NMRDiscDNSDomain *discovered_domain = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i);
nm_ip6_config_add_domain (priv->ac_ip6_config, discovered_domain->domain);
}
}
@@ -3357,28 +3360,29 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
static gboolean
addrconf6_start (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection;
+ const char *ip_iface = nm_device_get_ip_iface (self);
connection = nm_device_get_connection (self);
g_assert (connection);
g_warn_if_fail (priv->ac_ip6_config == NULL);
if (priv->ac_ip6_config) {
g_object_unref (priv->ac_ip6_config);
priv->ac_ip6_config = NULL;
}
- priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), nm_device_get_ip_iface (self));
+ priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), ip_iface);
nm_platform_sysctl_set (priv->ip6_accept_ra_path, "0");
if (!priv->rdisc) {
- nm_log_err (LOGD_IP6, "Failed to start router discovery.");
+ nm_log_err (LOGD_IP6, "(%s): failed to start router discovery.", ip_iface);
return FALSE;
}
priv->rdisc_config_changed_sigid = g_signal_connect (
priv->rdisc, NM_RDISC_CONFIG_CHANGED, G_CALLBACK (rdisc_config_changed), self);
/* FIXME: what if interface has no lladdr, like PPP? */
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index f94d82a..2e22fd9 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -140,44 +140,68 @@ add_route (NMRDisc *rdisc, const NMRDiscRoute *new)
}
g_array_insert_val (rdisc->routes, i, *new);
return TRUE;
}
static gboolean
-add_server (NMRDisc *rdisc, const NMRDiscDNSServer *new)
+add_dns_server (NMRDisc *rdisc, const NMRDiscDNSServer *new)
{
int i;
for (i = 0; i < rdisc->dns_servers->len; i++) {
NMRDiscDNSServer *item = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i);
- if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address))
- return FALSE;
+ if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address)) {
+ gboolean changed = item->timestamp != new->timestamp ||
+ item->lifetime != new->lifetime;
+ if (changed) {
+ item->timestamp = new->timestamp;
+ item->lifetime = new->lifetime;
+ }
+ return changed;
+ }
}
+ /* DNS server should no longer be used */
+ if (new->lifetime == 0)
+ return FALSE;
+
g_array_insert_val (rdisc->dns_servers, i, *new);
-
return TRUE;
}
+/* Always copies new->domain */
static gboolean
add_domain (NMRDisc *rdisc, const NMRDiscDNSDomain *new)
{
+ NMRDiscDNSDomain *item;
int i;
for (i = 0; i < rdisc->dns_domains->len; i++) {
- NMRDiscDNSDomain *item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i);
+ item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i);
- if (!g_strcmp0 (item->domain, new->domain))
- return FALSE;
+ if (!g_strcmp0 (item->domain, new->domain)) {
+ gboolean changed = item->timestamp != new->timestamp ||
+ item->lifetime != new->lifetime;
+ if (changed) {
+ item->timestamp = new->timestamp;
+ item->lifetime = new->lifetime;
+ }
+ return changed;
+ }
}
+ /* Domain should no longer be used */
+ if (new->lifetime == 0)
+ return FALSE;
+
g_array_insert_val (rdisc->dns_domains, i, *new);
-
+ item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i);
+ item->domain = g_strdup (new->domain);
return TRUE;
}
#define RETRY 10
static gboolean
send_rs (NMRDisc *rdisc)
@@ -186,15 +210,15 @@ send_rs (NMRDisc *rdisc)
struct ndp_msg *msg;
int error;
error = ndp_msg_new (&msg, NDP_MSG_RS);
g_assert (!error);
ndp_msg_ifindex_set (msg, rdisc->ifindex);
- debug ("(%s): sending router solicitation: %d", rdisc->ifname, rdisc->ifindex);
+ debug ("(%s): sending router solicitation", rdisc->ifname);
error = ndp_msg_send (priv->ndp, msg);
if (error)
error ("(%s): cannot send router solicitation: %d.", rdisc->ifname, error);
ndp_msg_destroy (msg);
@@ -218,139 +242,140 @@ solicit (NMRDisc *rdisc)
static void
clean_gateways (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
{
int i;
for (i = 0; i < rdisc->gateways->len; i++) {
NMRDiscGateway *item = &g_array_index (rdisc->gateways, NMRDiscGateway, i);
- guint32 expiry = item->timestamp + item->lifetime;
+ guint64 expiry = item->timestamp + item->lifetime;
- if (item->lifetime == UINT_MAX)
+ if (item->lifetime == G_MAXUINT32)
continue;
if (now >= expiry) {
g_array_remove_index (rdisc->gateways, i--);
*changed |= NM_RDISC_CONFIG_GATEWAYS;
} else if (*nextevent > expiry)
- *nextevent = expiry;
+ *nextevent = (guint32) expiry;
}
}
static void
clean_addresses (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
{
int i;
for (i = 0; i < rdisc->addresses->len; i++) {
NMRDiscAddress *item = &g_array_index (rdisc->addresses, NMRDiscAddress, i);
- guint32 expiry = item->timestamp + item->lifetime;
+ guint64 expiry = item->timestamp + item->lifetime;
- if (item->lifetime == UINT_MAX)
+ if (item->lifetime == G_MAXUINT32)
continue;
if (now >= expiry) {
g_array_remove_index (rdisc->addresses, i--);
*changed |= NM_RDISC_CONFIG_ADDRESSES;
} else if (*nextevent > expiry)
- *nextevent = expiry;
+ *nextevent = (guint32) expiry;
}
}
static void
clean_routes (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
{
int i;
for (i = 0; i < rdisc->routes->len; i++) {
NMRDiscRoute *item = &g_array_index (rdisc->routes, NMRDiscRoute, i);
- guint32 expiry = item->timestamp + item->lifetime;
+ guint64 expiry = item->timestamp + item->lifetime;
- if (item->lifetime == UINT_MAX)
+ if (item->lifetime == G_MAXUINT32)
continue;
if (now >= expiry) {
g_array_remove_index (rdisc->routes, i--);
*changed |= NM_RDISC_CONFIG_ROUTES;
} else if (*nextevent > expiry)
- *nextevent = expiry;
+ *nextevent = (guint32) expiry;
}
}
static void
-clean_servers (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
+clean_dns_servers (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
{
int i;
for (i = 0; i < rdisc->dns_servers->len; i++) {
NMRDiscDNSServer *item = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i);
- guint32 expiry = item->timestamp + item->lifetime;
- guint32 refresh = item->timestamp + item->lifetime / 2;
+ guint64 expiry = item->timestamp + item->lifetime;
+ guint64 refresh = item->timestamp + item->lifetime / 2;
- if (item->lifetime == UINT_MAX)
+ if (item->lifetime == G_MAXUINT32)
continue;
if (now >= expiry) {
g_array_remove_index (rdisc->dns_servers, i--);
- *changed |= NM_RDISC_CONFIG_ROUTES;
+ *changed |= NM_RDISC_CONFIG_DNS_SERVERS;
} else if (now >= refresh)
solicit (rdisc);
else if (*nextevent > refresh)
- *nextevent = refresh;
+ *nextevent = (guint32) refresh;
}
}
static void
clean_domains (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent)
{
int i;
for (i = 0; i < rdisc->dns_domains->len; i++) {
NMRDiscDNSDomain *item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i);
- guint32 expiry = item->timestamp + item->lifetime;
- guint32 refresh = item->timestamp + item->lifetime / 2;
+ guint64 expiry = item->timestamp + item->lifetime;
+ guint64 refresh = item->timestamp + item->lifetime / 2;
- if (item->lifetime == UINT_MAX)
+ if (item->lifetime == G_MAXUINT32)
continue;
if (now >= expiry) {
+ g_free (item->domain);
g_array_remove_index (rdisc->dns_domains, i--);
- *changed |= NM_RDISC_CONFIG_ROUTES;
+ *changed |= NM_RDISC_CONFIG_DNS_DOMAINS;
} else if (now >= refresh)
solicit (rdisc);
else if (*nextevent >=refresh)
- *nextevent = refresh;
+ *nextevent = (guint32) refresh;
}
}
static gboolean timeout_cb (gpointer user_data);
static void
check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed)
{
NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
- /* Use a magic date in distant enough future as there's no guint32 max macro. */
- guint32 never = G_MAXINT32;
+ /* Use a magic date in the distant future (~68 years) */
+ guint32 never = G_MAXINT32;
guint32 nextevent = never;
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
clean_gateways (rdisc, now, &changed, &nextevent);
clean_addresses (rdisc, now, &changed, &nextevent);
clean_routes (rdisc, now, &changed, &nextevent);
- clean_servers (rdisc, now, &changed, &nextevent);
+ clean_dns_servers (rdisc, now, &changed, &nextevent);
clean_domains (rdisc, now, &changed, &nextevent);
if (changed)
g_signal_emit_by_name (rdisc, NM_RDISC_CONFIG_CHANGED, changed);
if (nextevent != never) {
- debug ("Scheduling next now/lifetime check: %d seconds", (int) nextevent);
+ debug ("(%s): scheduling next now/lifetime check: %u seconds", rdisc->ifname, nextevent);
priv->timeout_id = g_timeout_add_seconds (nextevent, timeout_cb, rdisc);
}
}
static guint32
get_time (void)
{
@@ -450,15 +475,15 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
*
* The biggest difference from good old DHCP is that all configuration
* items have their own lifetimes and they are merged from various
* sources. Router discovery is *not* contract-based, so there is *no*
* single time when the configuration is finished and updates can
* come at any time.
*/
- debug ("Recieved router advertisement: %d at %d", rdisc->ifindex, (int) now);
+ debug ("(%s): received router advertisement at %u", rdisc->ifname, now);
if (priv->send_rs_id) {
g_source_remove (priv->send_rs_id);
priv->send_rs_id = 0;
}
/* DHCP level:
@@ -559,27 +584,27 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
/* Pad the lifetime somewhat to give a bit of slack in cases
* where one RA gets lost or something (which can happen on unreliable
* links like WiFi where certain types of frames are not retransmitted).
* Note that 0 has special meaning and is therefore not adjusted.
*/
if (dns_server.lifetime && dns_server.lifetime < 7200)
dns_server.lifetime = 7200;
- if (add_server (rdisc, &dns_server))
+ if (add_dns_server (rdisc, &dns_server))
changed |= NM_RDISC_CONFIG_DNS_SERVERS;
}
}
ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_DNSSL) {
char *domain;
int domain_index;
ndp_msg_opt_dnssl_for_each_domain (domain, domain_index, msg, offset) {
NMRDiscDNSDomain dns_domain;
memset (&dns_domain, 0, sizeof (dns_domain));
- dns_domain.domain = g_strdup (domain);
+ dns_domain.domain = domain;
dns_domain.timestamp = now;
dns_domain.lifetime = ndp_msg_opt_rdnss_lifetime (msg, offset);
/* Pad the lifetime somewhat to give a bit of slack in cases
* where one RA gets lost or something (which can happen on unreliable
* links like WiFi where certain types of frames are not retransmitted).
* Note that 0 has special meaning and is therefore not adjusted.
*/
--
1.8.3.1

View File

@ -1,61 +0,0 @@
From a9f1d121783a7f3c65c9f47d3419b5a8a255fe47 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 23 Jan 2014 12:16:02 -0600
Subject: [PATCH] dhcp: don't add an IPv6 address if one wasn't given (rh
#1048046)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In information-only mode (where RA is providing addresses), DHCPv6
may not give an address. NetworkManager was adding a blank one
anyway, which is invalid. Don't do that.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/dhcp-manager/nm-dhcp-client.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 75cd818..57298c8 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -1404,6 +1404,12 @@ ip6_options_to_config (NMDHCPClient *self)
ip6_config = nm_ip6_config_new ();
+ str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
+ if (str) {
+ address.lifetime = address.preferred = strtoul (str, NULL, 10);
+ nm_log_info (LOGD_DHCP6, " lease time %d", address.lifetime);
+ }
+
str = g_hash_table_lookup (priv->options, "new_ip6_address");
if (str) {
if (!inet_pton (AF_INET6, str, &tmp_addr)) {
@@ -1413,21 +1419,13 @@ ip6_options_to_config (NMDHCPClient *self)
}
address.address = tmp_addr;
+ nm_ip6_config_add_address (ip6_config, &address);
nm_log_info (LOGD_DHCP6, " address %s", str);
-
} else if (priv->info_only == FALSE) {
/* No address in Managed mode is a hard error */
goto error;
}
- str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
- if (str) {
- address.lifetime = address.preferred = strtoul (str, NULL, 10);
- nm_log_info (LOGD_DHCP6, " lease time %d", address.lifetime);
- }
-
- nm_ip6_config_add_address (ip6_config, &address);
-
str = g_hash_table_lookup (priv->options, "new_host_name");
if (str)
nm_log_info (LOGD_DHCP6, " hostname '%s'", str);
--
1.7.11.7

View File

@ -1,21 +0,0 @@
diff -up NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c.bluez-crash NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c
--- NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c.bluez-crash 2013-10-03 15:00:51.000000000 -0400
+++ NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c 2014-01-06 12:09:14.449583005 -0500
@@ -686,7 +686,7 @@ static void
on_adapter_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
{
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
- GError *error;
+ GError *error = NULL;
GVariant *v;
priv->adapter = g_dbus_proxy_new_for_bus_finish (res, &error);
@@ -923,7 +923,7 @@ static void
on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
{
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
- GError *error;
+ GError *error = NULL;
priv->proxy5 = g_dbus_proxy_new_for_bus_finish (res, &error);

View File

@ -1,203 +0,0 @@
From e62b212be3b51b0dc31fd12ea70d78358164063e Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 24 Jan 2014 12:49:57 -0600
Subject: [PATCH] core: exit cleanly if D-Bus cannot be initialized (rh
#1057738)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Instead of crashing, let's exit cleanly.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-manager.c | 90 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 49 insertions(+), 41 deletions(-)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index e6ff8d5..1545e72 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -217,6 +217,7 @@ typedef struct {
NMDBusManager *dbus_mgr;
guint dbus_connection_changed_id;
+ gboolean prop_filter_added;
NMAtmManager *atm_mgr;
NMRfkillManager *rfkill_mgr;
NMBluezManager *bluez_mgr;
@@ -250,7 +251,6 @@ typedef struct {
GHashTable *nm_bridges;
gboolean startup;
- gboolean disposed;
} NMManagerPrivate;
#define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate))
@@ -4503,6 +4503,16 @@ nm_manager_new (NMSettings *settings,
priv = NM_MANAGER_GET_PRIVATE (singleton);
+ bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
+ if (!bus) {
+ nm_log_err (LOGD_CORE, "Failed to initialize D-Bus connection");
+ g_object_unref (singleton);
+ return NULL;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection (bus);
+ g_assert (dbus_connection);
+
priv->policy = nm_policy_new (singleton, settings);
g_signal_connect (priv->policy, "notify::" NM_POLICY_DEFAULT_IP4_DEVICE,
G_CALLBACK (policy_default_device_changed), singleton);
@@ -4517,16 +4527,12 @@ nm_manager_new (NMSettings *settings,
g_signal_connect (priv->connectivity, "notify::" NM_CONNECTIVITY_STATE,
G_CALLBACK (connectivity_changed), singleton);
- bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
- g_assert (bus);
- dbus_connection = dbus_g_connection_get_connection (bus);
- g_assert (dbus_connection);
-
if (!dbus_connection_add_filter (dbus_connection, prop_filter, singleton, NULL)) {
nm_log_err (LOGD_CORE, "failed to register DBus connection filter");
g_object_unref (singleton);
return NULL;
- }
+ }
+ priv->prop_filter_added = TRUE;
priv->settings = g_object_ref (settings);
@@ -4614,14 +4620,9 @@ dispose (GObject *object)
DBusConnection *dbus_connection;
GSList *iter;
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
- return;
- }
- priv->disposed = TRUE;
-
g_slist_foreach (priv->auth_chains, (GFunc) nm_auth_chain_unref, NULL);
g_slist_free (priv->auth_chains);
+ priv->auth_chains = NULL;
nm_auth_changed_func_unregister (authority_changed_cb, manager);
@@ -4635,8 +4636,7 @@ dispose (GObject *object)
for (iter = priv->active_connections; iter; iter = g_slist_next (iter))
active_connection_removed (manager, NM_ACTIVE_CONNECTION (iter->data));
- g_slist_free (priv->active_connections);
- priv->active_connections = NULL;
+ g_clear_pointer (&priv->active_connections, g_slist_free);
g_clear_object (&priv->primary_connection);
g_clear_object (&priv->activating_connection);
@@ -4644,12 +4644,14 @@ dispose (GObject *object)
g_free (priv->hostname);
- g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_default_device_changed), singleton);
- g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_activating_device_changed), singleton);
- g_object_unref (priv->policy);
+ if (priv->policy) {
+ g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_default_device_changed), singleton);
+ g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_activating_device_changed), singleton);
+ g_clear_object (&priv->policy);
+ }
- g_object_unref (priv->settings);
- g_object_unref (priv->vpn_manager);
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->vpn_manager);
if (priv->modem_added_id) {
g_source_remove (priv->modem_added_id);
@@ -4659,39 +4661,42 @@ dispose (GObject *object)
g_source_remove (priv->modem_removed_id);
priv->modem_removed_id = 0;
}
- g_object_unref (priv->modem_manager);
+ g_clear_object (&priv->modem_manager);
/* Unregister property filter */
- bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
- if (bus) {
- dbus_connection = dbus_g_connection_get_connection (bus);
- g_assert (dbus_connection);
- dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
+ if (priv->dbus_mgr) {
+ bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
+ if (bus) {
+ dbus_connection = dbus_g_connection_get_connection (bus);
+ if (dbus_connection && priv->prop_filter_added) {
+ dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
+ priv->prop_filter_added = FALSE;
+ }
+ }
+ g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
+ priv->dbus_mgr = NULL;
}
- g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
- priv->dbus_mgr = NULL;
-
- if (priv->bluez_mgr)
- g_object_unref (priv->bluez_mgr);
-
- if (priv->aipd_proxy)
- g_object_unref (priv->aipd_proxy);
- if (priv->sleep_monitor)
- g_object_unref (priv->sleep_monitor);
+ g_clear_object (&priv->bluez_mgr);
+ g_clear_object (&priv->aipd_proxy);
+ g_clear_object (&priv->sleep_monitor);
if (priv->fw_monitor) {
- if (priv->fw_monitor_id)
+ if (priv->fw_monitor_id) {
g_signal_handler_disconnect (priv->fw_monitor, priv->fw_monitor_id);
+ priv->fw_monitor_id = 0;
+ }
- if (priv->fw_changed_id)
+ if (priv->fw_changed_id) {
g_source_remove (priv->fw_changed_id);
+ priv->fw_changed_id = 0;
+ }
g_file_monitor_cancel (priv->fw_monitor);
- g_object_unref (priv->fw_monitor);
+ g_clear_object (&priv->fw_monitor);
}
- g_slist_free (priv->factories);
+ g_clear_pointer (&priv->factories, g_slist_free);
if (priv->timestamp_update_id) {
g_source_remove (priv->timestamp_update_id);
@@ -4945,14 +4950,17 @@ dbus_connection_changed_cb (NMDBusManager *dbus_mgr,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
+ gboolean success = FALSE;
if (dbus_connection) {
/* Register property filter on new connection; there's no reason this
* should fail except out-of-memory or program error; if it does fail
* then there's no Manager property access control, which is bad.
*/
- g_assert (dbus_connection_add_filter (dbus_connection, prop_filter, self, NULL));
+ success = dbus_connection_add_filter (dbus_connection, prop_filter, self, NULL);
+ g_assert (success);
}
+ NM_MANAGER_GET_PRIVATE (self)->prop_filter_added = success;
}
static void
--
1.7.11.7

View File

@ -1,83 +0,0 @@
From 31fe84e467732463eabc8f70c2a419008e7a227c Mon Sep 17 00:00:00 2001
From: Scott Shambarger <devel@shambarger.net>
Date: Thu, 9 Jan 2014 14:26:53 -0800
Subject: [PATCH] core: Add host route for DHCP4 server if outside assigned
subnet (bgo #721767)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some ISP's provide leases from central servers that are on different
subnets that the address offered. If the host does not configure the
interface as the default route, the dhcp server may not be reachable
via unicast, and a host specific route is needed.
https://bugzilla.gnome.org/show_bug.cgi?id=721767
https://bugzilla.redhat.com/show_bug.cgi?id=983325
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/dhcp-manager/nm-dhcp-client.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index edea8f8..75cd818 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -1200,8 +1200,8 @@ ip4_options_to_config (NMDHCPClient *self)
for (s = routers; *s; s++) {
/* FIXME: how to handle multiple routers? */
- if (inet_pton (AF_INET, *s, &tmp_addr) > 0) {
- nm_ip4_config_set_gateway (ip4_config, tmp_addr);
+ if (inet_pton (AF_INET, *s, &gwaddr) > 0) {
+ nm_ip4_config_set_gateway (ip4_config, gwaddr);
nm_log_info (LOGD_DHCP4, " gateway %s", *s);
break;
} else
@@ -1211,6 +1211,41 @@ ip4_options_to_config (NMDHCPClient *self)
}
}
+ /*
+ * RFC 2132, section 9.7
+ * DHCP clients use the contents of the 'server identifier' field
+ * as the destination address for any DHCP messages unicast to
+ * the DHCP server.
+ *
+ * Some ISP's provide leases from central servers that are on
+ * different subnets that the address offered. If the host
+ * does not configure the interface as the default route, the
+ * dhcp server may not be reachable via unicast, and a host
+ * specific route is needed.
+ **/
+ str = g_hash_table_lookup (priv->options, "new_dhcp_server_identifier");
+ if (str) {
+ if (inet_pton (AF_INET, str, &tmp_addr) > 0) {
+ NMPlatformIP4Route route;
+ guint32 mask = nm_utils_ip4_prefix_to_netmask (address.plen);
+
+ nm_log_info (LOGD_DHCP4, " server identifier %s", str);
+ if ((tmp_addr & mask) != (address.address & mask)) {
+ /* DHCP server not on assigned subnet, route needed */
+ memset (&route, 0, sizeof (route));
+ route.network = tmp_addr;
+ route.plen = 32;
+ /* this will be a device route if gwaddr is 0 */
+ route.gateway = gwaddr;
+ nm_ip4_config_add_route (ip4_config, &route);
+ nm_log_dbg (LOGD_IP, "adding route for server identifier: %s",
+ nm_platform_ip4_route_to_string (&route));
+ }
+ }
+ else
+ nm_log_warn (LOGD_DHCP4, "ignoring invalid server identifier '%s'", str);
+ }
+
str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
if (str) {
address.lifetime = address.preferred = strtoul (str, NULL, 10);
--
1.7.11.7

View File

@ -1 +1 @@
7251704430cb206f2c29bfebc45bd0fb NetworkManager-0.9.9.0.git20131003.tar.bz2
SHA512 (NetworkManager-1.43.6.tar.xz) = e1d898d3e6154018defcf189bc017a962ed93b9f5d7bafd90642cd70f9bbd4885874b24f716d524e52cf9e44c7ba338e3c416e78bd7b6ec6eaa1cb5066244504

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
# Tests for NetworkManager
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://github.com/NetworkManager/NetworkManager-ci"
dest: "NetworkManager-ci"
tests:
- sanity-tests:
dir: NetworkManager-ci
run: run/osci/run-tests fedora28

View File

@ -1,178 +0,0 @@
From c72d2eb02fa05b29dbff372a3ab02a11f3a0557b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 12:49:31 +0100
Subject: [PATCH 1/2] vpn: print VPN plugin failures and VPN connection reason
changes as strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 58 ++++++++++++++++++++++++++++++++++---
1 file changed, 54 insertions(+), 4 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index e7c3e07..d0c82e4 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -438,14 +438,31 @@ nm_vpn_connection_get_service (NMVPNConnection *connection)
return nm_setting_vpn_get_service_type (s_vpn);
}
+static const char *
+vpn_plugin_failure_to_string (NMVPNPluginFailure failure)
+{
+ switch (failure) {
+ case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED:
+ return "connect-failed";
+ case NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG:
+ return "bad-ip-config";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_failed (DBusGProxy *proxy,
- NMVPNPluginFailure plugin_failure,
- gpointer user_data)
+ NMVPNPluginFailure plugin_failure,
+ gpointer user_data)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (user_data);
- nm_log_warn (LOGD_VPN, "VPN plugin failed: %d", plugin_failure);
+ nm_log_warn (LOGD_VPN, "VPN plugin failed: %s (%d)",
+ vpn_plugin_failure_to_string (plugin_failure), plugin_failure);
switch (plugin_failure) {
case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
@@ -481,6 +498,38 @@ vpn_state_to_string (NMVPNServiceState state)
return "unknown";
}
+static const char *
+vpn_reason_to_string (NMVPNConnectionStateReason reason)
+{
+ switch (reason) {
+ case NM_VPN_CONNECTION_STATE_REASON_NONE:
+ return "none";
+ case NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED:
+ return "user-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED:
+ return "device-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED:
+ return "service-stopped";
+ case NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID:
+ return "ip-config-invalid";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT:
+ return "connect-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT:
+ return "service-start-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED:
+ return "service-start-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS:
+ return "no-secrets";
+ case NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED:
+ return "connection-removed";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_state_changed (DBusGProxy *proxy,
NMVPNServiceState state,
@@ -504,7 +553,8 @@ plugin_state_changed (DBusGProxy *proxy,
case NM_VPN_CONNECTION_STATE_CONNECT:
case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
case NM_VPN_CONNECTION_STATE_ACTIVATED:
- nm_log_info (LOGD_VPN, "VPN plugin state change reason: %d", priv->failure_reason);
+ nm_log_info (LOGD_VPN, "VPN plugin state change reason: %s (%d)",
+ vpn_reason_to_string (priv->failure_reason), priv->failure_reason);
nm_vpn_connection_set_vpn_state (connection,
NM_VPN_CONNECTION_STATE_FAILED,
priv->failure_reason);
--
1.7.11.7
From 3cebf963da32c610b5607dd5c9ca77054e4fa9c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 13:17:44 +0100
Subject: [PATCH 2/2] vpn: add code2string translation for
NMVPNConnectionState and fix its logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index d0c82e4..500c72b 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -477,7 +477,7 @@ plugin_failed (DBusGProxy *proxy,
}
static const char *
-vpn_state_to_string (NMVPNServiceState state)
+vpn_service_state_to_string (NMVPNServiceState state)
{
switch (state) {
case NM_VPN_SERVICE_STATE_INIT:
@@ -499,6 +499,30 @@ vpn_state_to_string (NMVPNServiceState state)
}
static const char *
+vpn_state_to_string (NMVPNConnectionState state)
+{
+ switch (state) {
+ case NM_VPN_CONNECTION_STATE_PREPARE:
+ return "prepare";
+ case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+ return "need-auth";
+ case NM_VPN_CONNECTION_STATE_CONNECT:
+ return "connect";
+ case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+ return "ip-config-get";
+ case NM_VPN_CONNECTION_STATE_ACTIVATED:
+ return "activated";
+ case NM_VPN_CONNECTION_STATE_FAILED:
+ return "failed";
+ case NM_VPN_CONNECTION_STATE_DISCONNECTED:
+ return "disconnected";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
+static const char *
vpn_reason_to_string (NMVPNConnectionStateReason reason)
{
switch (reason) {
@@ -539,7 +563,7 @@ plugin_state_changed (DBusGProxy *proxy,
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
nm_log_info (LOGD_VPN, "VPN plugin state changed: %s (%d)",
- vpn_state_to_string (state), state);
+ vpn_service_state_to_string (state), state);
if (state == NM_VPN_SERVICE_STATE_STOPPED) {
/* Clear connection secrets to ensure secrets get requested each time the
--
1.7.11.7