[PATCH] Use anycast dhcp option if set



Add an anycast stanza in the dhcp config file if an anycast address is set.
Note this probably causes your dhcp client to fail if it doesn't recognize the
option.

Signed-off-by: Sjoerd Simons <sjoerd simons collabora co uk>
---
 src/dhcp-manager/nm-dhcp-dhclient.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
index 4cb71e6..2edc0b2 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
@@ -127,6 +127,19 @@ merge_dhclient_config (NMDHCPDevice *device,
 	if (s_ip4 && s_ip4->dhcp_hostname)
 		g_string_append_printf (new_contents, DHCP_HOSTNAME_FORMAT "\n", s_ip4->dhcp_hostname);
 
+	if (s_ip4 && s_ip4->anycast_address)
+		g_string_append_printf (new_contents, "interface \"%s\" {\n"
+			"  initial-interval 1; \n"
+			"  anycast-mac ethernet %02x:%02x:%02x:%02x:%02x:%02x;\n"
+			"};\n",
+			device->iface,
+			s_ip4->anycast_address->data[0],
+			s_ip4->anycast_address->data[1],
+			s_ip4->anycast_address->data[2],
+			s_ip4->anycast_address->data[3],
+			s_ip4->anycast_address->data[4],
+			s_ip4->anycast_address->data[5]);
+
 	if (g_file_set_contents (device->conf_file, new_contents->str, -1, error))
 		success = TRUE;
 
-- 
1.5.6.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]