summaryrefslogtreecommitdiff
path: root/src/nm-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-device.c')
-rw-r--r--src/nm-device.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/nm-device.c b/src/nm-device.c
index 401d529af6..db71eaea1d 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -89,12 +89,13 @@ typedef struct {
/* IP configuration info */
NMIP4Config * ip4_config; /* Config from DHCP, PPP, or system config files */
NMDHCPManager * dhcp_manager;
guint32 dhcp_timeout;
gulong dhcp_state_sigid;
gulong dhcp_timeout_sigid;
+ GByteArray * dhcp_anycast_address;
NMDHCP4Config * dhcp4_config;
/* dnsmasq stuff for shared connections */
NMDnsMasqManager *dnsmasq_manager;
gulong dnsmasq_state_id;
@@ -891,20 +892,24 @@ real_act_stage3_ip_config_start (NMDevice *self, NMDeviceStateReason *reason)
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
if (!s_ip4 || !method || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
gboolean success;
+ guint8 *anycast = NULL;
+
+ if (priv->dhcp_anycast_address)
+ anycast = priv->dhcp_anycast_address->data;
/* Begin a DHCP transaction on the interface */
nm_device_set_use_dhcp (self, TRUE);
/* DHCP manager will cancel any transaction already in progress and we do not
want to cancel this activation if we get "down" state from that. */
g_signal_handler_block (priv->dhcp_manager, priv->dhcp_state_sigid);
- success = nm_dhcp_manager_begin_transaction (priv->dhcp_manager, ip_iface, uuid, s_ip4, priv->dhcp_timeout);
+ success = nm_dhcp_manager_begin_transaction (priv->dhcp_manager, ip_iface, uuid, s_ip4, priv->dhcp_timeout, anycast);
g_signal_handler_unblock (priv->dhcp_manager, priv->dhcp_state_sigid);
if (success) {
/* DHCP devices will be notified by the DHCP manager when
* stuff happens.
*/
@@ -2215,12 +2220,14 @@ finalize (GObject *object)
g_free (priv->udi);
g_free (priv->iface);
g_free (priv->ip_iface);
g_free (priv->driver);
g_free (priv->type_desc);
+ if (priv->dhcp_anycast_address)
+ g_byte_array_free (priv->dhcp_anycast_address, TRUE);
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
}
static void
@@ -2536,14 +2543,34 @@ nm_device_spec_match_list (NMDeviceInterface *device, const GSList *specs)
return NM_DEVICE_GET_CLASS (self)->spec_match_list (self, specs);
return FALSE;
}
void
-nm_device_set_dhcp_timeout (NMDevice *device,
- guint32 timeout)
+nm_device_set_dhcp_timeout (NMDevice *device, guint32 timeout)
{
g_return_if_fail (NM_IS_DEVICE (device));
NM_DEVICE_GET_PRIVATE (device)->dhcp_timeout = timeout;
}
+void
+nm_device_set_dhcp_anycast_address (NMDevice *device, guint8 *addr)
+{
+ NMDevicePrivate *priv;
+
+ g_return_if_fail (NM_IS_DEVICE (device));
+
+ priv = NM_DEVICE_GET_PRIVATE (device);
+
+ if (priv->dhcp_anycast_address) {
+ g_byte_array_free (priv->dhcp_anycast_address, TRUE);
+ priv->dhcp_anycast_address = NULL;
+ }
+
+ if (addr) {
+ priv->dhcp_anycast_address = g_byte_array_sized_new (ETH_ALEN);
+ g_byte_array_append (priv->dhcp_anycast_address, addr, ETH_ALEN);
+ }
+}
+
+