dhcp: pass individual options to DHCP instead of NMSettingIPxConfig

This commit is contained in:
Dan Williams
2014-07-11 12:50:17 -05:00
parent d7b3ae8c10
commit 24c1523b51
3 changed files with 18 additions and 23 deletions

View File

@@ -2773,7 +2773,9 @@ dhcp4_start (NMDevice *self,
tmp,
nm_connection_get_uuid (connection),
nm_device_get_priority (self),
s_ip4,
nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4),
nm_setting_ip4_config_get_dhcp_hostname (s_ip4),
nm_setting_ip4_config_get_dhcp_client_id (s_ip4),
priv->dhcp_timeout,
priv->dhcp_anycast_address);
@@ -3209,7 +3211,8 @@ dhcp6_start (NMDevice *self,
g_assert (connection);
}
/* Begin a DHCP transaction on the interface */
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
/* Clear old exported DHCP options */
if (priv->dhcp6_config)
@@ -3233,7 +3236,7 @@ dhcp6_start (NMDevice *self,
tmp,
nm_connection_get_uuid (connection),
nm_device_get_priority (self),
nm_connection_get_setting_ip6_config (connection),
nm_setting_ip6_config_get_dhcp_hostname (s_ip6),
priv->dhcp_timeout,
priv->dhcp_anycast_address,
(dhcp_opt == NM_RDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE);

View File

@@ -447,26 +447,20 @@ nm_dhcp_manager_start_ip4 (NMDHCPManager *self,
const GByteArray *hwaddr,
const char *uuid,
guint priority,
NMSettingIP4Config *s_ip4,
gboolean send_hostname,
const char *dhcp_hostname,
const char *dhcp_client_id,
guint32 timeout,
GByteArray *dhcp_anycast_addr)
{
const char *hostname = NULL, *method;
gboolean send_hostname;
const char *hostname = NULL;
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
method = nm_setting_ip4_config_get_method (s_ip4);
g_return_val_if_fail (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, NULL);
send_hostname = nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4);
if (send_hostname)
hostname = get_send_hostname (self, nm_setting_ip4_config_get_dhcp_hostname (s_ip4));
hostname = get_send_hostname (self, dhcp_hostname);
return client_start (self, iface, ifindex, hwaddr, uuid, priority, FALSE,
nm_setting_ip4_config_get_dhcp_client_id (s_ip4),
timeout, dhcp_anycast_addr, hostname, FALSE);
dhcp_client_id, timeout, dhcp_anycast_addr, hostname, FALSE);
}
/* Caller owns a reference to the NMDHCPClient on return */
@@ -477,7 +471,7 @@ nm_dhcp_manager_start_ip6 (NMDHCPManager *self,
const GByteArray *hwaddr,
const char *uuid,
guint priority,
NMSettingIP6Config *s_ip6,
const char *dhcp_hostname,
guint32 timeout,
GByteArray *dhcp_anycast_addr,
gboolean info_only)
@@ -486,8 +480,7 @@ nm_dhcp_manager_start_ip6 (NMDHCPManager *self,
g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
hostname = get_send_hostname (self, nm_setting_ip6_config_get_dhcp_hostname (s_ip6));
hostname = dhcp_hostname ? get_send_hostname (self, dhcp_hostname) : NULL;
return client_start (self, iface, ifindex, hwaddr, uuid, priority, TRUE,
NULL, timeout, dhcp_anycast_addr, hostname, info_only);
}

View File

@@ -25,9 +25,6 @@
#include <glib.h>
#include <glib-object.h>
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
#include "nm-dhcp-client.h"
#include "nm-ip4-config.h"
#include "nm-dhcp4-config.h"
@@ -70,7 +67,9 @@ NMDHCPClient * nm_dhcp_manager_start_ip4 (NMDHCPManager *manager,
const GByteArray *hwaddr,
const char *uuid,
guint priority,
NMSettingIP4Config *s_ip4,
gboolean send_hostname,
const char *dhcp_hostname,
const char *dhcp_client_id,
guint32 timeout,
GByteArray *dhcp_anycast_addr);
@@ -80,7 +79,7 @@ NMDHCPClient * nm_dhcp_manager_start_ip6 (NMDHCPManager *manager,
const GByteArray *hwaddr,
const char *uuid,
guint priority,
NMSettingIP6Config *s_ip6,
const char *dhcp_hostname,
guint32 timeout,
GByteArray *dhcp_anycast_addr,
gboolean info_only);