about summary refs log tree commit diff
path: root/src/libnm-core-impl
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-05-26 22:00:52 +0200
committerMichael Biebl <biebl@debian.org>2022-05-26 22:00:52 +0200
commited3fbd48dfdf52a008aa4e281b3ab3a8c08c4900 (patch)
tree751dbc6a721e96f7af9f689e443a7061ad06f3a8 /src/libnm-core-impl
parent34881d66ffb4eaa113e318a7bc09f7ba3c7e4aec (diff)
parentb3b81846241e51b3e2bfb34c1b5af385cdcdf894 (diff)
Merge branch 'debian/master' into debian/bullseye-backports
Diffstat (limited to 'src/libnm-core-impl')
-rw-r--r--src/libnm-core-impl/nm-setting-infiniband.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/libnm-core-impl/nm-setting-infiniband.c b/src/libnm-core-impl/nm-setting-infiniband.c
index eb6c9536..787b838b 100644
--- a/src/libnm-core-impl/nm-setting-infiniband.c
+++ b/src/libnm-core-impl/nm-setting-infiniband.c
@@ -241,6 +241,14 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
             g_prefix_error(error, "%s: ", NM_SETTING_INFINIBAND_PARENT);
             return FALSE;
         }
+        if (NM_IN_SET(priv->p_key, 0, 0x8000)) {
+            g_set_error_literal(error,
+                                NM_CONNECTION_ERROR,
+                                NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                                _("the values 0 and 0x8000 are not allowed"));
+            g_prefix_error(error, "%s: ", NM_SETTING_INFINIBAND_P_KEY);
+            return FALSE;
+        }
     }
 
     if (connection)
@@ -254,17 +262,27 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
             virtual_iface_name =
                 nm_setting_infiniband_get_virtual_interface_name(NM_SETTING_INFINIBAND(setting));
 
-            if (!nm_streq(interface_name, virtual_iface_name)) {
+            if (!nm_streq0(interface_name, virtual_iface_name)) {
                 /* We don't support renaming software infiniband devices. Later we might, but
                  * for now just reject such connections.
                  **/
-                g_set_error(error,
-                            NM_CONNECTION_ERROR,
-                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
-                            _("interface name of software infiniband device must be '%s' or unset "
-                              "(instead it is '%s')"),
-                            virtual_iface_name,
-                            interface_name);
+                if (virtual_iface_name) {
+                    g_set_error(
+                        error,
+                        NM_CONNECTION_ERROR,
+                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                        _("interface name of software infiniband device must be '%s' or unset "
+                          "(instead it is '%s')"),
+                        virtual_iface_name,
+                        interface_name);
+                } else {
+                    g_set_error(error,
+                                NM_CONNECTION_ERROR,
+                                NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                                _("interface name of software infiniband device with MAC address "
+                                  "must be unset (instead it is '%s')"),
+                                interface_name);
+                }
                 g_prefix_error(error,
                                "%s.%s: ",
                                NM_SETTING_CONNECTION_SETTING_NAME,