dhcp: ensure the IP4 method is compatible with DHCP
authorDan Williams <dcbw@redhat.com>
Thu, 15 Apr 2010 21:54:42 +0000 (14:54 -0700)
committerDan Williams <dcbw@redhat.com>
Thu, 15 Apr 2010 21:54:42 +0000 (14:54 -0700)
src/dhcp-manager/nm-dhcp-manager.c

index 94109ad..635fe32 100644 (file)
@@ -482,6 +482,13 @@ nm_dhcp_manager_start_ip4 (NMDHCPManager *self,
        priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
 
        if (s_ip4) {
+               const char *method = nm_setting_ip4_config_get_method (s_ip4);
+
+               if (method) {
+                       /* Method must be 'auto' */
+                       g_return_val_if_fail (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, NULL);
+               }
+
                if (   nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4)
                    && (nm_setting_ip4_config_get_dhcp_hostname (s_ip4) == NULL)
                    && priv->hostname_provider != NULL) {