diff options
author | Thomas Haller <thaller@redhat.com> | 2021-07-08 17:24:36 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-07-08 17:24:36 +0200 |
commit | e16c50f507703f15a550b4ef80448dcbd3a85131 (patch) | |
tree | 569067f7fc0662cfe7ca4b078c4253cfc0980e15 | |
parent | f929bc9945e334ff89cee6598ecffcd749f52c93 (diff) | |
parent | 94a5ae58aeafb84100fee654307c69db53e0944d (diff) | |
download | NetworkManager-e16c50f507703f15a550b4ef80448dcbd3a85131.tar.gz |
all: merge branch 'th/device-connect-dummy'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/915
-rw-r--r-- | po/ar.po | 2 | ||||
-rw-r--r-- | po/as.po | 2 | ||||
-rw-r--r-- | po/be@latin.po | 2 | ||||
-rw-r--r-- | po/bg.po | 2 | ||||
-rw-r--r-- | po/bn_IN.po | 2 | ||||
-rw-r--r-- | po/bs.po | 2 | ||||
-rw-r--r-- | po/ca.po | 2 | ||||
-rw-r--r-- | po/cs.po | 2 | ||||
-rw-r--r-- | po/da.po | 2 | ||||
-rw-r--r-- | po/de.po | 2 | ||||
-rw-r--r-- | po/dz.po | 2 | ||||
-rw-r--r-- | po/el.po | 2 | ||||
-rw-r--r-- | po/en_CA.po | 2 | ||||
-rw-r--r-- | po/en_GB.po | 2 | ||||
-rw-r--r-- | po/eo.po | 2 | ||||
-rw-r--r-- | po/es.po | 2 | ||||
-rw-r--r-- | po/et.po | 2 | ||||
-rw-r--r-- | po/eu.po | 2 | ||||
-rw-r--r-- | po/fi.po | 2 | ||||
-rw-r--r-- | po/fr.po | 2 | ||||
-rw-r--r-- | po/gd.po | 2 | ||||
-rw-r--r-- | po/gl.po | 2 | ||||
-rw-r--r-- | po/gu.po | 2 | ||||
-rw-r--r-- | po/he.po | 2 | ||||
-rw-r--r-- | po/hi.po | 2 | ||||
-rw-r--r-- | po/hr.po | 2 | ||||
-rw-r--r-- | po/hu.po | 2 | ||||
-rw-r--r-- | po/id.po | 2 | ||||
-rw-r--r-- | po/it.po | 2 | ||||
-rw-r--r-- | po/ja.po | 2 | ||||
-rw-r--r-- | po/ka.po | 2 | ||||
-rw-r--r-- | po/kn.po | 2 | ||||
-rw-r--r-- | po/ko.po | 2 | ||||
-rw-r--r-- | po/ku.po | 2 | ||||
-rw-r--r-- | po/lt.po | 2 | ||||
-rw-r--r-- | po/lv.po | 2 | ||||
-rw-r--r-- | po/mk.po | 2 | ||||
-rw-r--r-- | po/ml.po | 2 | ||||
-rw-r--r-- | po/mr.po | 2 | ||||
-rw-r--r-- | po/nb.po | 2 | ||||
-rw-r--r-- | po/ne.po | 2 | ||||
-rw-r--r-- | po/nl.po | 2 | ||||
-rw-r--r-- | po/oc.po | 2 | ||||
-rw-r--r-- | po/or.po | 2 | ||||
-rw-r--r-- | po/pa.po | 2 | ||||
-rw-r--r-- | po/pl.po | 2 | ||||
-rw-r--r-- | po/pt.po | 2 | ||||
-rw-r--r-- | po/pt_BR.po | 2 | ||||
-rw-r--r-- | po/ru.po | 2 | ||||
-rw-r--r-- | po/rw.po | 2 | ||||
-rw-r--r-- | po/sk.po | 2 | ||||
-rw-r--r-- | po/sl.po | 2 | ||||
-rw-r--r-- | po/sq.po | 2 | ||||
-rw-r--r-- | po/sr.po | 2 | ||||
-rw-r--r-- | po/sr@latin.po | 2 | ||||
-rw-r--r-- | po/sv.po | 2 | ||||
-rw-r--r-- | po/ta.po | 2 | ||||
-rw-r--r-- | po/te.po | 2 | ||||
-rw-r--r-- | po/th.po | 2 | ||||
-rw-r--r-- | po/tr.po | 2 | ||||
-rw-r--r-- | po/uk.po | 2 | ||||
-rw-r--r-- | po/vi.po | 2 | ||||
-rw-r--r-- | po/wa.po | 2 | ||||
-rw-r--r-- | po/zh_CN.po | 2 | ||||
-rw-r--r-- | po/zh_HK.po | 2 | ||||
-rw-r--r-- | po/zh_TW.po | 2 | ||||
-rw-r--r-- | src/core/NetworkManagerUtils.c | 49 | ||||
-rw-r--r-- | src/core/NetworkManagerUtils.h | 63 | ||||
-rw-r--r-- | src/core/devices/nm-device-dummy.c | 24 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device.c | 2 | ||||
-rw-r--r-- | src/libnm-core-impl/nm-connection.c | 30 | ||||
-rw-r--r-- | src/libnm-core-impl/tests/test-setting.c | 40 | ||||
-rw-r--r-- | src/libnm-core-public/nm-connection.h | 15 | ||||
-rw-r--r-- | src/nmcli/connections.c | 115 |
74 files changed, 299 insertions, 171 deletions
@@ -1131,7 +1131,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1185,7 +1185,7 @@ msgstr "ত্ৰুটি: সংযোগ বৈধ নহয়: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/be@latin.po b/po/be@latin.po index 258022829d..65a234efcf 100644 --- a/po/be@latin.po +++ b/po/be@latin.po @@ -1092,7 +1092,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1179,7 +1179,7 @@ msgstr "връзката е премахната" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/bn_IN.po b/po/bn_IN.po index 14c4dce1bf..d1006a04e7 100644 --- a/po/bn_IN.po +++ b/po/bn_IN.po @@ -1204,7 +1204,7 @@ msgstr "ত্রুটি: সংযোগ বৈধ নয়: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1125,7 +1125,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1189,7 +1189,7 @@ msgstr "La connexió no era vàlida: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "No han concordat els noms d'interfície del dispositiu i la connexió." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1149,7 +1149,7 @@ msgstr "Připojení nebylo platné: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1163,7 +1163,7 @@ msgstr "forbindelsen blev fjernet" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1208,7 +1208,7 @@ msgstr "Die Verbindung war ungültig: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" "Die Schnittstellennamen des Geräts und der Verbindung stimmen nicht überein." @@ -1126,7 +1126,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1228,7 +1228,7 @@ msgstr "Σφάλμα: η σύνδεση δεν είναι έγκυρη: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/en_CA.po b/po/en_CA.po index e4a5ff0fe0..6d5f570e9f 100644 --- a/po/en_CA.po +++ b/po/en_CA.po @@ -1151,7 +1151,7 @@ msgstr "VPN connection '%s' said:" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/en_GB.po b/po/en_GB.po index a7e96adcd9..87fb3a2a14 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -1178,7 +1178,7 @@ msgstr "the connection was removed" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1134,7 +1134,7 @@ msgstr "la konekto estis forigita" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1188,7 +1188,7 @@ msgstr "La conexión no era válida: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" "Los nombres de interfaz del dispositivo y de la conexión no coincidieron." @@ -1111,7 +1111,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1160,7 +1160,7 @@ msgstr "konexioa kendu egin da" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1160,7 +1160,7 @@ msgstr "yhteys poistettu" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1189,7 +1189,7 @@ msgstr "La connexion n'était pas valide : %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" "Les noms d'interface du périphérique et de la connexion ne correspondaient " "pas." @@ -1138,7 +1138,7 @@ msgstr "Chan eil rèiteachadh an IP dligheach tuilleadh" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1193,7 +1193,7 @@ msgstr "eliminouse a conexión" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1193,7 +1193,7 @@ msgstr "ભૂલ: જોડાણ યોગ્ય નથી: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1092,7 +1092,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1175,7 +1175,7 @@ msgstr "त्रुटि: कनेक्शन वैध नहीं है: #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1152,7 +1152,7 @@ msgstr "veza je uklonjena" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1204,7 +1204,7 @@ msgstr "a kapcsolat eltávolításra került" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1131,7 +1131,7 @@ msgstr "Koneksi tidak valid: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Nama-nama antar muka perangkat dan koneksi tidak cocok." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1174,7 +1174,7 @@ msgstr "La connessione non era valida: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" "Il nome dell'interfaccia del dispositivo e la connessione non corrispondono." @@ -1129,7 +1129,7 @@ msgstr "接続は有効ではありませんでした: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "デバイスと接続のインターフェース名が一致しませんでした。" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1151,7 +1151,7 @@ msgstr "VPN-შეერთება '%s' არასწორად იყო #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1183,7 +1183,7 @@ msgstr "ದೋಷ: ಸಂಪರ್ಕವು ಮಾನ್ಯವಾದುದಾಗ #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1133,7 +1133,7 @@ msgstr "연결이 유효하지 않았음: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "장치와 연결의 인터페이스 이름이 일치하지 않습니다." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1132,7 +1132,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1183,7 +1183,7 @@ msgstr "ryšys buvo pašalintas" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1153,7 +1153,7 @@ msgstr "VPN savienojums '%s' nebija korekti konfigurēts." #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1098,7 +1098,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1194,7 +1194,7 @@ msgstr "പിശക്: കണക്ഷന് ശരിയല്ല: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1169,7 +1169,7 @@ msgstr "त्रुटी: जोडणी वैध नाही: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1099,7 +1099,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1129,7 +1129,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1106,7 +1106,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1170,7 +1170,7 @@ msgstr "La connexion es invalida : %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1182,7 +1182,7 @@ msgstr "ତୃଟି: ସଂଯୋଗଟି ବୈଧ ନୁହଁ: %s\n" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1130,7 +1130,7 @@ msgstr "ਕਨੈਕਸ਼ਨ ਢੁੱਕਵਾਂ ਨਹੀ ਸੀ: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1147,7 +1147,7 @@ msgstr "Połączenie jest nieprawidłowe: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Nazwy interfejsu urządzenia i połączenia się nie zgadzają." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1125,7 +1125,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/pt_BR.po b/po/pt_BR.po index 86f604ae85..db5c7f9b8a 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -1162,7 +1162,7 @@ msgstr "A conexão não era válida: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Os nomes de interface do dispositivo e a conexão não correspondem." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1164,7 +1164,7 @@ msgstr "Это подключение не было действительным #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Имена интерфейсов устройства и подключения не совпадают." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1147,7 +1147,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1146,7 +1146,7 @@ msgstr "VPN spojenie '%s' nebolo správne nakonfigurované." #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1189,7 +1189,7 @@ msgstr "povezava je odstranjena" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1123,7 +1123,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1162,7 +1162,7 @@ msgstr "веза је уклоњена" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/sr@latin.po b/po/sr@latin.po index 595668a98a..2c33b60275 100644 --- a/po/sr@latin.po +++ b/po/sr@latin.po @@ -1165,7 +1165,7 @@ msgstr "veza je uklonjena" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1160,7 +1160,7 @@ msgstr "Anslutningen var inte giltig: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Gränssnittsnamnen på enheten och anslutningen matchar inte." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1167,7 +1167,7 @@ msgstr "இணைப்பு செல்லுபடியாகாதது: #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "சாதனம் மற்றும் இணைப்பின் இடைமுகப் பெயர்கள் பொருந்தவில்லை." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1170,7 +1170,7 @@ msgstr "దోషం: అనుసంధానం చెల్లునది #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1152,7 +1152,7 @@ msgstr "การเชื่อมต่อ VPN '%s' ตั้งค่าไ #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1186,7 +1186,7 @@ msgstr "Bağlantı geçerli değildi: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Aygıtın arayüz isimleri ve bağlantı eşleşmiyor." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1167,7 +1167,7 @@ msgstr "З'єднання не є коректним: %s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "Назви інтерфейсу пристрою і з'єднання не збігаються." #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1101,7 +1101,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 @@ -1122,7 +1122,7 @@ msgstr "" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/zh_CN.po b/po/zh_CN.po index 6df2d6a545..3c0266d8f1 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -1108,7 +1108,7 @@ msgstr "连接无效:%s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "这个设备的接口名和连接不匹配。" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/zh_HK.po b/po/zh_HK.po index 510d20dbbc..99f4629d82 100644 --- a/po/zh_HK.po +++ b/po/zh_HK.po @@ -1154,7 +1154,7 @@ msgstr "VPN 連線‘%s’沒有設定正確。" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/po/zh_TW.po b/po/zh_TW.po index 5e6cd99701..55a8b14069 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -1118,7 +1118,7 @@ msgstr "連線無效:%s" #: ../src/libnm-client-impl/nm-device.c:2773 #, c-format -msgid "The interface names of the device and the connection didn't match." +msgid "The interface names of the device and the connection didn't match" msgstr "設備的接口名稱和連接不匹配。" #: ../src/libnm-client-impl/nm-secret-agent-old.c:1384 diff --git a/src/core/NetworkManagerUtils.c b/src/core/NetworkManagerUtils.c index 34ddf9fb1a..32d6db6375 100644 --- a/src/core/NetworkManagerUtils.c +++ b/src/core/NetworkManagerUtils.c @@ -227,19 +227,23 @@ out: /*****************************************************************************/ void -nm_utils_complete_generic(NMPlatform * platform, - NMConnection * connection, - const char * ctype, - NMConnection *const *existing_connections, - const char * preferred_id, - const char * fallback_id_prefix, - const char * ifname_prefix, - const char * ifname, - gboolean default_enable_ipv6) +_nm_utils_complete_generic_with_params(NMPlatform * platform, + NMConnection * connection, + const char * ctype, + NMConnection *const *existing_connections, + const char * preferred_id, + const char * fallback_id_prefix, + const char * ifname_prefix, + const char * ifname, + ...) { NMSettingConnection *s_con; - char * id, *generated_ifname; - GHashTable * parameters; + char * id; + char * generated_ifname; + gs_unref_hashtable GHashTable *parameters = NULL; + va_list ap; + const char * p_val; + const char * p_key; g_assert(fallback_id_prefix); g_return_if_fail(ifname_prefix == NULL || ifname == NULL); @@ -268,7 +272,9 @@ nm_utils_complete_generic(NMPlatform * platform, } /* Add an interface name, if requested */ - if (ifname) { + if (nm_setting_connection_get_interface_name(s_con)) { + /* pass */ + } else if (ifname) { g_object_set(G_OBJECT(s_con), NM_SETTING_CONNECTION_INTERFACE_NAME, ifname, NULL); } else if (ifname_prefix && !nm_setting_connection_get_interface_name(s_con)) { generated_ifname = get_new_connection_ifname(platform, existing_connections, ifname_prefix); @@ -277,13 +283,20 @@ nm_utils_complete_generic(NMPlatform * platform, } /* Normalize */ - parameters = g_hash_table_new(nm_str_hash, g_str_equal); - g_hash_table_insert(parameters, - NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD, - default_enable_ipv6 ? NM_SETTING_IP6_CONFIG_METHOD_AUTO - : NM_SETTING_IP6_CONFIG_METHOD_IGNORE); + va_start(ap, ifname); + while ((p_key = va_arg(ap, const char *))) { + p_val = va_arg(ap, const char *); + if (!p_val) { + if (parameters) + g_hash_table_remove(parameters, p_key); + continue; + } + if (!parameters) + parameters = g_hash_table_new(nm_str_hash, g_str_equal); + g_hash_table_insert(parameters, (char *) p_key, (char *) p_val); + } + va_end(ap); nm_connection_normalize(connection, parameters, NULL, NULL); - g_hash_table_destroy(parameters); } /*****************************************************************************/ diff --git a/src/core/NetworkManagerUtils.h b/src/core/NetworkManagerUtils.h index 1c86387c06..af5b5a5ef2 100644 --- a/src/core/NetworkManagerUtils.h +++ b/src/core/NetworkManagerUtils.h @@ -19,15 +19,60 @@ const char *nm_utils_get_ip_config_method(NMConnection *connection, int addr_fam const char *nm_utils_get_shared_wifi_permission(NMConnection *connection); -void nm_utils_complete_generic(NMPlatform * platform, - NMConnection * connection, - const char * ctype, - NMConnection *const *existing_connections, - const char * preferred_id, - const char * fallback_id_prefix, - const char * ifname_prefix, - const char * ifname, - gboolean default_enable_ipv6); +void _nm_utils_complete_generic_with_params(NMPlatform * platform, + NMConnection * connection, + const char * ctype, + NMConnection *const *existing_connections, + const char * preferred_id, + const char * fallback_id_prefix, + const char * ifname_prefix, + const char * ifname, + ...) G_GNUC_NULL_TERMINATED; + +#define nm_utils_complete_generic_with_params(platform, \ + connection, \ + ctype, \ + existing_connections, \ + preferred_id, \ + fallback_id_prefix, \ + ifname_prefix, \ + ifname, \ + ...) \ + _nm_utils_complete_generic_with_params(platform, \ + connection, \ + ctype, \ + existing_connections, \ + preferred_id, \ + fallback_id_prefix, \ + ifname_prefix, \ + ifname, \ + ##__VA_ARGS__, \ + NULL) + +static inline void +nm_utils_complete_generic(NMPlatform * platform, + NMConnection * connection, + const char * ctype, + NMConnection *const *existing_connections, + const char * preferred_id, + const char * fallback_id_prefix, + const char * ifname_prefix, + const char * ifname, + gboolean default_enable_ipv6) +{ + nm_utils_complete_generic_with_params(platform, + connection, + ctype, + existing_connections, + preferred_id, + fallback_id_prefix, + ifname_prefix, + ifname, + NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD, + default_enable_ipv6 + ? NM_SETTING_IP6_CONFIG_METHOD_AUTO + : NM_SETTING_IP6_CONFIG_METHOD_IGNORE); +} typedef gboolean(NMUtilsMatchFilterFunc)(NMConnection *connection, gpointer user_data); diff --git a/src/core/devices/nm-device-dummy.c b/src/core/devices/nm-device-dummy.c index 488f0ba003..c2b9dbab68 100644 --- a/src/core/devices/nm-device-dummy.c +++ b/src/core/devices/nm-device-dummy.c @@ -50,23 +50,19 @@ complete_connection(NMDevice * device, { NMSettingDummy *s_dummy; - nm_utils_complete_generic(nm_device_get_platform(device), - connection, - NM_SETTING_DUMMY_SETTING_NAME, - existing_connections, - NULL, - _("Dummy connection"), - NULL, - NULL, - TRUE); + nm_utils_complete_generic_with_params(nm_device_get_platform(device), + connection, + NM_SETTING_DUMMY_SETTING_NAME, + existing_connections, + NULL, + _("Dummy connection"), + NULL, + nm_device_get_ip_iface(device)); s_dummy = nm_connection_get_setting_dummy(connection); if (!s_dummy) { - g_set_error_literal(error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_INVALID_CONNECTION, - "A 'dummy' setting is required."); - return FALSE; + s_dummy = NM_SETTING_DUMMY(nm_setting_dummy_new()); + nm_connection_add_setting(connection, NM_SETTING(s_dummy)); } return TRUE; diff --git a/src/libnm-client-impl/nm-device.c b/src/libnm-client-impl/nm-device.c index 4d097935cb..601850d984 100644 --- a/src/libnm-client-impl/nm-device.c +++ b/src/libnm-client-impl/nm-device.c @@ -2770,7 +2770,7 @@ connection_compatible(NMDevice *device, NMConnection *connection, GError **error g_set_error(error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, - _("The interface names of the device and the connection didn't match.")); + _("The interface names of the device and the connection didn't match")); return FALSE; } diff --git a/src/libnm-core-impl/nm-connection.c b/src/libnm-core-impl/nm-connection.c index 4ac7b322fe..a8563cffac 100644 --- a/src/libnm-core-impl/nm-connection.c +++ b/src/libnm-core-impl/nm-connection.c @@ -1208,10 +1208,23 @@ _normalize_ip_config(NMConnection *self, GHashTable *parameters) if (_supports_addr_family(self, AF_INET)) { if (!s_ip4) { - const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; + const char *default_ip4_method = NULL; - if (nm_connection_is_type(self, NM_SETTING_WIREGUARD_SETTING_NAME)) - default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; + if (parameters) { + default_ip4_method = + g_hash_table_lookup(parameters, + NM_CONNECTION_NORMALIZE_PARAM_IP4_CONFIG_METHOD); + } + if (!default_ip4_method) { + const char *type = nm_connection_get_connection_type(self); + + if (NM_IN_STRSET(type, + NM_SETTING_WIREGUARD_SETTING_NAME, + NM_SETTING_DUMMY_SETTING_NAME)) + default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; + else + default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; + } /* But if no IP4 setting was specified, assume the caller was just * being lazy and use the default method. @@ -1255,13 +1268,18 @@ _normalize_ip_config(NMConnection *self, GHashTable *parameters) if (!s_ip6) { const char *default_ip6_method = NULL; - if (parameters) + if (parameters) { default_ip6_method = g_hash_table_lookup(parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD); + } if (!default_ip6_method) { - if (nm_connection_is_type(self, NM_SETTING_WIREGUARD_SETTING_NAME)) - default_ip6_method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; + const char *type = nm_connection_get_connection_type(self); + + if (NM_IN_STRSET(type, + NM_SETTING_WIREGUARD_SETTING_NAME, + NM_SETTING_DUMMY_SETTING_NAME)) + default_ip6_method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED; else default_ip6_method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; } diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 6b65e98d26..58e5e1a4a7 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -874,6 +874,34 @@ test_bond_normalize(void) /*****************************************************************************/ +static void +test_dummy_normalize(void) +{ + gs_unref_object NMConnection *connection = NULL; + NMSettingConnection * s_con; + + connection = nm_simple_connection_new(); + s_con = NM_SETTING_CONNECTION(nm_setting_connection_new()); + nm_connection_add_setting(connection, NM_SETTING(s_con)); + + g_object_set(s_con, + NM_SETTING_CONNECTION_ID, + "dummy-test", + NM_SETTING_CONNECTION_UUID, + nm_uuid_generate_random_str_a(), + NM_SETTING_CONNECTION_TYPE, + NM_SETTING_DUMMY_SETTING_NAME, + NULL); + + nmtst_assert_connection_unnormalizable(connection, 0, 0); + + g_object_set(s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, "dummy1", NULL); + + nmtst_connection_normalize(connection); +} + +/*****************************************************************************/ + #define DCB_FLAGS_ALL \ (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE | NM_SETTING_DCB_FLAG_WILLING) @@ -3619,6 +3647,12 @@ test_roundtrip_conversion(gconstpointer test_data) s_wg = NM_SETTING_WIREGUARD(nm_connection_get_setting(con, NM_TYPE_SETTING_WIREGUARD)); + s_ip.s_4 = NM_SETTING_IP_CONFIG(nm_connection_get_setting(con, NM_TYPE_SETTING_IP4_CONFIG)); + g_assert_cmpstr(nm_setting_ip_config_get_method(s_ip.s_4), ==, "disabled"); + + s_ip.s_6 = NM_SETTING_IP_CONFIG(nm_connection_get_setting(con, NM_TYPE_SETTING_IP6_CONFIG)); + g_assert_cmpstr(nm_setting_ip_config_get_method(s_ip.s_6), ==, "disabled"); + g_ptr_array_add(kf_data_arr, g_strdup_printf("[connection]\n" "id=%s\n" @@ -3636,7 +3670,7 @@ test_roundtrip_conversion(gconstpointer test_data) "[ipv6]\n" "addr-gen-mode=stable-privacy\n" "dns-search=\n" - "method=ignore\n" + "method=disabled\n" "\n" "[proxy]\n" "", @@ -3693,7 +3727,7 @@ test_roundtrip_conversion(gconstpointer test_data) "[ipv6]\n" "addr-gen-mode=stable-privacy\n" "dns-search=\n" - "method=ignore\n" + "method=disabled\n" "\n" "[proxy]\n" "", @@ -4741,6 +4775,8 @@ main(int argc, char **argv) g_test_add_func("/libnm/settings/bond/compare", test_bond_compare); g_test_add_func("/libnm/settings/bond/normalize", test_bond_normalize); + g_test_add_func("/libnm/settings/dummy/normalize", test_dummy_normalize); + g_test_add_func("/libnm/settings/dcb/flags-valid", test_dcb_flags_valid); g_test_add_func("/libnm/settings/dcb/flags-invalid", test_dcb_flags_invalid); g_test_add_func("/libnm/settings/dcb/app-priorities", test_dcb_app_priorities); diff --git a/src/libnm-core-public/nm-connection.h b/src/libnm-core-public/nm-connection.h index 44d1568d7a..fd985141a1 100644 --- a/src/libnm-core-public/nm-connection.h +++ b/src/libnm-core-public/nm-connection.h @@ -29,9 +29,20 @@ G_BEGIN_DECLS #define NM_CONNECTION_CHANGED "changed" /* + * NM_CONNECTION_NORMALIZE_PARAM_IP4_CONFIG_METHOD: overwrite the ip4 method + * when normalizing ip4 configuration. This only takes effect, if the profile + * has no IPv4 settings and new settings are to be added. If omitted, this + * defaults depends on the profile type but usually it is "auto". + * + * Since: 1.34 + */ +#define NM_CONNECTION_NORMALIZE_PARAM_IP4_CONFIG_METHOD "ip4-config-method" + +/* * NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD: overwrite the ip6 method - * when normalizing ip6 configuration. If omitted, this defaults to - * @NM_SETTING_IP6_CONFIG_METHOD_AUTO. + * when normalizing ip6 configuration. This only takes effect, if the profile + * has no IPv6 settings and new settings are to be added. If omitted, this + * defaults depends on the profile type but usually it is "auto". */ #define NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD "ip6-config-method" diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 9f700caed0..87cd2a8b94 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -201,24 +201,24 @@ nmc_active_connection_cmp(NMActiveConnection *ac_a, NMActiveConnection *ac_b) conn = nm_active_connection_get_connection(ac_a); s_ip = conn ? nm_connection_get_setting_ip6_config(NM_CONNECTION(conn)) : NULL; if (s_ip - && strcmp(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP6_CONFIG_METHOD_SHARED) == 0) + && nm_streq(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP6_CONFIG_METHOD_SHARED)) cmp++; conn = nm_active_connection_get_connection(ac_b); s_ip = conn ? nm_connection_get_setting_ip6_config(NM_CONNECTION(conn)) : NULL; if (s_ip - && strcmp(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP6_CONFIG_METHOD_SHARED) == 0) + && nm_streq(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP6_CONFIG_METHOD_SHARED)) cmp--; NM_CMP_RETURN(cmp); conn = nm_active_connection_get_connection(ac_a); s_ip = conn ? nm_connection_get_setting_ip4_config(NM_CONNECTION(conn)) : NULL; if (s_ip - && strcmp(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) + && nm_streq(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP4_CONFIG_METHOD_SHARED)) cmp++; conn = nm_active_connection_get_connection(ac_b); s_ip = conn ? nm_connection_get_setting_ip4_config(NM_CONNECTION(conn)) : NULL; if (s_ip - && strcmp(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) + && nm_streq(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP4_CONFIG_METHOD_SHARED)) cmp--; NM_CMP_RETURN(cmp); @@ -2463,7 +2463,7 @@ find_device_for_connection(NmCli * nmc, g_assert(s_con); con_type = nm_setting_connection_get_connection_type(s_con); - if (strcmp(con_type, NM_SETTING_VPN_SETTING_NAME) == 0) { + if (nm_streq(con_type, NM_SETTING_VPN_SETTING_NAME)) { /* VPN connections */ NMActiveConnection *active = NULL; if (iface) { @@ -2488,8 +2488,9 @@ find_device_for_connection(NmCli * nmc, } } else { /* Other connections */ - NMDevice * found_device = NULL; - const GPtrArray *devices = nm_client_get_devices(nmc->client); + NMDevice * found_device = NULL; + const GPtrArray *devices = nm_client_get_devices(nmc->client); + gboolean found_device_with_name = FALSE; for (i = 0; i < devices->len && !found_device; i++) { NMDevice *dev = g_ptr_array_index(devices, i); @@ -2499,6 +2500,7 @@ find_device_for_connection(NmCli * nmc, if (!nm_streq0(dev_iface, iface)) continue; + found_device_with_name = TRUE; if (!nm_device_connection_compatible(dev, connection, error)) { g_prefix_error(error, _("device '%s' not compatible with connection '%s': "), @@ -2535,12 +2537,21 @@ find_device_for_connection(NmCli * nmc, if (!found_device) { if (iface) { - g_set_error(error, - NMCLI_ERROR, - 0, - _("device '%s' not compatible with connection '%s'"), - iface, - nm_setting_connection_get_id(s_con)); + if (found_device_with_name) { + g_set_error(error, + NMCLI_ERROR, + 0, + _("device '%s' not compatible with connection '%s'"), + iface, + nm_setting_connection_get_id(s_con)); + } else { + g_set_error(error, + NMCLI_ERROR, + 0, + _("device '%s' not found for connection '%s'"), + iface, + nm_setting_connection_get_id(s_con)); + } } else { g_set_error(error, NMCLI_ERROR, @@ -2833,8 +2844,7 @@ nmc_activate_connection(NmCli * nmc, &spec_object, &local); - /* Virtual connection may not have their interfaces created yet */ - if (!device_found && !nm_connection_is_virtual(connection)) { + if (!device_found) { g_set_error(error, NMCLI_ERROR, NMC_RESULT_ERROR_CON_ACTIVATION, "%s", local->message); return FALSE; } @@ -2947,7 +2957,7 @@ do_connection_up(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const argc_ptr = &arg_num; } - if (argc > 0 && strcmp(*argv, "ifname") != 0) { + if (argc > 0 && !nm_streq(*argv, "ifname")) { connection = get_connection(nmc, argc_ptr, argv_ptr, NULL, NULL, NULL, &error); if (!connection) { g_string_printf(nmc->return_text, _("Error: %s."), error->message); @@ -2960,7 +2970,7 @@ do_connection_up(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const if (argc == 1 && nmc->complete) nmc_complete_strings(*argv, "ifname", "ap", "passwd-file"); - if (strcmp(*argv, "ifname") == 0) { + if (nm_streq(*argv, "ifname")) { argc--; argv++; if (!argc) { @@ -2972,7 +2982,7 @@ do_connection_up(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const ifname = *argv; if (argc == 1 && nmc->complete) nmc_complete_device(nmc->client, ifname, ap != NULL); - } else if (strcmp(*argv, "ap") == 0) { + } else if (nm_streq(*argv, "ap")) { argc--; argv++; if (!argc) { @@ -2984,7 +2994,7 @@ do_connection_up(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const ap = *argv; if (argc == 1 && nmc->complete) nmc_complete_bssid(nmc->client, ifname, ap); - } else if (strcmp(*argv, "passwd-file") == 0) { + } else if (nm_streq(*argv, "passwd-file")) { argc--; argv++; if (!argc) { @@ -3652,7 +3662,7 @@ is_setting_mandatory(NMConnection *connection, NMSetting *setting) else item = nm_meta_setting_info_valid_parts_for_slave_type(s_type, NULL); for (; item && *item; item++) { - if (!strcmp(name, (*item)->setting_info->general->setting_name)) + if (nm_streq(name, (*item)->setting_info->general->setting_name)) return (*item)->mandatory; } } @@ -3721,11 +3731,11 @@ normalized_master_for_slave(const GPtrArray *connections, s_con = nm_connection_get_setting_connection(connection); g_assert(s_con); con_type = nm_setting_connection_get_connection_type(s_con); - if (type && g_strcmp0(con_type, type) != 0) + if (type && !nm_streq0(con_type, type)) continue; if (func) { /* There was a prefix; only compare to that type. */ - if (g_strcmp0(master, func(connection)) == 0) { + if (nm_streq0(master, func(connection))) { if (out_type) *out_type = con_type; if (func == nm_connection_get_id) @@ -3738,13 +3748,13 @@ normalized_master_for_slave(const GPtrArray *connections, id = nm_connection_get_id(connection); uuid = nm_connection_get_uuid(connection); ifname = nm_connection_get_interface_name(connection); - if (g_strcmp0(master, uuid) == 0 || g_strcmp0(master, ifname) == 0) { + if (NM_IN_STRSET(master, uuid, ifname)) { out_master = master; if (out_type) *out_type = con_type; break; } - if (!found_by_id && g_strcmp0(master, id) == 0) { + if (!found_by_id && nm_streq0(master, id)) { out_type_by_id = con_type; found_by_id = uuid; } @@ -4352,10 +4362,11 @@ set_connection_type(NmCli * nmc, } /* ifname is mandatory for all connection types except virtual ones (bond, team, bridge, vlan) */ - if ((strcmp(value, NM_SETTING_BOND_SETTING_NAME) == 0) - || (strcmp(value, NM_SETTING_TEAM_SETTING_NAME) == 0) - || (strcmp(value, NM_SETTING_BRIDGE_SETTING_NAME) == 0) - || (strcmp(value, NM_SETTING_VLAN_SETTING_NAME) == 0)) { + if (NM_IN_STRSET(value, + NM_SETTING_BOND_SETTING_NAME, + NM_SETTING_TEAM_SETTING_NAME, + NM_SETTING_BRIDGE_SETTING_NAME, + NM_SETTING_VLAN_SETTING_NAME)) { disable_options(NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); } @@ -4386,7 +4397,7 @@ set_connection_iface(NmCli * nmc, { if (value) { /* Special value of '*' means no specific interface name */ - if (strcmp(value, "*") == 0) + if (nm_streq(value, "*")) value = NULL; } @@ -4541,19 +4552,17 @@ set_bluetooth_type(NmCli * nmc, return TRUE; /* 'dun' type requires adding 'gsm' or 'cdma' setting */ - if (!strcmp(value, NM_SETTING_BLUETOOTH_TYPE_DUN) - || !strcmp(value, NM_SETTING_BLUETOOTH_TYPE_DUN "-gsm")) { + if (NM_IN_STRSET(value, NM_SETTING_BLUETOOTH_TYPE_DUN, NM_SETTING_BLUETOOTH_TYPE_DUN "-gsm")) { value = NM_SETTING_BLUETOOTH_TYPE_DUN; setting = nm_meta_setting_info_editor_new_setting( &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_GSM], NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI); nm_connection_add_setting(con, setting); - } else if (!strcmp(value, NM_SETTING_BLUETOOTH_TYPE_DUN "-cdma")) { + } else if (NM_IN_STRSET(value, NM_SETTING_BLUETOOTH_TYPE_DUN "-cdma")) { value = NM_SETTING_BLUETOOTH_TYPE_DUN; setting = nm_setting_cdma_new(); nm_connection_add_setting(con, setting); - } else if (!strcmp(value, NM_SETTING_BLUETOOTH_TYPE_PANU) - || !strcmp(value, NM_SETTING_BLUETOOTH_TYPE_NAP)) { + } else if (NM_IN_STRSET(value, NM_SETTING_BLUETOOTH_TYPE_PANU, NM_SETTING_BLUETOOTH_TYPE_NAP)) { /* no op */ } else { g_set_error(error, @@ -5605,13 +5614,13 @@ read_properties: g_clear_error(&error); /* Get the arguments from the command line if any */ if (argc && !nmc_process_connection_properties(nmc, connection, &argc, &argv, FALSE, &error)) { - if (g_strcmp0(*argv, "--") == 0 && !seen_dash_dash) { + if (nm_streq0(*argv, "--") && !seen_dash_dash) { /* This is for compatibility with older nmcli that required * options and properties to be separated with "--" */ seen_dash_dash = TRUE; next_arg(nmc, &argc, &argv, NULL); goto read_properties; - } else if (g_strcmp0(*argv, "save") == 0) { + } else if (nm_streq0(*argv, "save")) { /* It would be better if "save" was a separate argument and not * mixed with properties, but there's not much we can do about it now. */ argc--; @@ -6071,7 +6080,7 @@ _create_vpn_array(const GPtrArray *connections, gboolean uuid) NMConnection *connection = NM_CONNECTION(connections->pdata[c]); const char * type = nm_connection_get_connection_type(connection); - if (g_strcmp0(type, NM_SETTING_VPN_SETTING_NAME) == 0) + if (nm_streq0(type, NM_SETTING_VPN_SETTING_NAME)) array[idx++] = uuid ? nm_connection_get_uuid(connection) : nm_connection_get_id(connection); } @@ -6479,11 +6488,11 @@ nmcli_editor_tab_completion(const char *text, int start, int end) n1 = strspn(line, " \t"); /* Choose the right generator function */ - if (strcmp(prompt_tmp, EDITOR_PROMPT_CON_TYPE) == 0) + if (nm_streq(prompt_tmp, EDITOR_PROMPT_CON_TYPE)) generator_func = gen_connection_types(text); - else if (strcmp(prompt_tmp, EDITOR_PROMPT_SETTING) == 0) + else if (nm_streq(prompt_tmp, EDITOR_PROMPT_SETTING)) generator_func = gen_setting_names; - else if (strcmp(prompt_tmp, EDITOR_PROMPT_PROPERTY) == 0) + else if (nm_streq(prompt_tmp, EDITOR_PROMPT_PROPERTY)) generator_func = gen_property_names; else if (g_str_has_suffix(rl_prompt, prompt_yes_no(TRUE, NULL)) || g_str_has_suffix(rl_prompt, prompt_yes_no(FALSE, NULL))) @@ -6759,7 +6768,7 @@ parse_editor_main_cmd(const char *cmd, char **cmd_arg) editor_cmd = NMC_EDITOR_MAIN_CMD_ACTIVATE; else if (matches(cmd_arg0, "back")) editor_cmd = NMC_EDITOR_MAIN_CMD_BACK; - else if (matches(cmd_arg0, "help") || strcmp(cmd_arg0, "?") == 0) + else if (matches(cmd_arg0, "help") || nm_streq(cmd_arg0, "?")) editor_cmd = NMC_EDITOR_MAIN_CMD_HELP; else if (matches(cmd_arg0, "quit")) editor_cmd = NMC_EDITOR_MAIN_CMD_QUIT; @@ -6946,7 +6955,7 @@ parse_editor_sub_cmd(const char *cmd, char **cmd_arg) editor_cmd = NMC_EDITOR_SUB_CMD_PRINT; else if (matches(cmd_arg0, "back")) editor_cmd = NMC_EDITOR_SUB_CMD_BACK; - else if (matches(cmd_arg0, "help") || strcmp(cmd_arg0, "?") == 0) + else if (matches(cmd_arg0, "help") || nm_streq(cmd_arg0, "?")) editor_cmd = NMC_EDITOR_SUB_CMD_HELP; else if (matches(cmd_arg0, "quit")) editor_cmd = NMC_EDITOR_SUB_CMD_QUIT; @@ -8161,12 +8170,12 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty case NMC_EDITOR_MAIN_CMD_VERIFY: /* Verify current setting or the whole connection */ - if (cmd_arg && strcmp(cmd_arg, "all") && strcmp(cmd_arg, "fix")) { + if (cmd_arg && !nm_streq(cmd_arg, "all") && !nm_streq(cmd_arg, "fix")) { g_print(_("Invalid verify option: %s\n"), cmd_arg); break; } - if (menu_ctx.curr_setting && (!cmd_arg || strcmp(cmd_arg, "all") != 0)) { + if (menu_ctx.curr_setting && (!cmd_arg || !nm_streq(cmd_arg, "all"))) { gs_free_error GError *tmp_err = NULL; nm_setting_verify(menu_ctx.curr_setting, NULL, &tmp_err); @@ -8524,7 +8533,7 @@ editor_init_new_connection(NmCli *nmc, NMConnection *connection, const char *sla set_default_interface_name(nmc, s_con); /* Set sensible initial VLAN values */ - if (g_strcmp0(con_type, NM_SETTING_VLAN_SETTING_NAME) == 0) { + if (nm_streq0(con_type, NM_SETTING_VLAN_SETTING_NAME)) { const char *dev_ifname = get_ethernet_device_name(nmc); g_object_set(NM_SETTING_VLAN(base_setting), @@ -9311,7 +9320,7 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co nmc_complete_strings(*argv, type ? NULL : "type", filename ? NULL : "file"); } - if (strcmp(*argv, "type") == 0) { + if (nm_streq(*argv, "type")) { argc--; argv++; if (!argc) { @@ -9333,7 +9342,7 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co else g_printerr(_("Warning: 'type' already specified, ignoring extra one.\n")); - } else if (strcmp(*argv, "file") == 0) { + } else if (nm_streq(*argv, "file")) { argc--; argv++; if (!argc) { @@ -9465,7 +9474,7 @@ do_connection_export(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co } type = nm_connection_get_connection_type(connection); - if (g_strcmp0(type, NM_SETTING_VPN_SETTING_NAME) != 0) { + if (!nm_streq0(type, NM_SETTING_VPN_SETTING_NAME)) { g_string_printf(nmc->return_text, _("Error: the connection is not VPN.")); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; goto finish; @@ -9587,7 +9596,7 @@ nmcli_con_tab_completion(const char *text, int start, int end) /* Disable readline's default filename completion */ rl_attempted_completion_over = 1; - if (g_strcmp0(rl_prompt, PROMPT_CONNECTION) == 0) { + if (nm_streq0(rl_prompt, PROMPT_CONNECTION)) { /* Disable appending space after completion */ rl_completion_append_character = '\0'; @@ -9595,18 +9604,18 @@ nmcli_con_tab_completion(const char *text, int start, int end) return NULL; generator_func = gen_func_connection_names; - } else if (g_strcmp0(rl_prompt, PROMPT_CONNECTIONS) == 0) { + } else if (nm_streq0(rl_prompt, PROMPT_CONNECTIONS)) { generator_func = gen_func_connection_names; - } else if (g_strcmp0(rl_prompt, PROMPT_ACTIVE_CONNECTIONS) == 0) { + } else if (nm_streq0(rl_prompt, PROMPT_ACTIVE_CONNECTIONS)) { generator_func = gen_func_active_connection_names; } else if (rl_prompt && g_str_has_prefix(rl_prompt, NM_META_TEXT_PROMPT_VPN_TYPE)) { info = (const NMMetaAbstractInfo *) nm_meta_property_info_vpn_service_type; nmc_tab_completion.words = _meta_abstract_complete(info, text); generator_func = _meta_abstract_generator; - } else if (g_strcmp0(rl_prompt, PROMPT_IMPORT_FILE) == 0) { + } else if (nm_streq0(rl_prompt, PROMPT_IMPORT_FILE)) { rl_attempted_completion_over = 0; rl_complete_with_tilde_expansion = 1; - } else if (g_strcmp0(rl_prompt, PROMPT_VPN_CONNECTION) == 0) { + } else if (nm_streq0(rl_prompt, PROMPT_VPN_CONNECTION)) { generator_func = gen_vpn_ids; } |