diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2011-05-09 18:09:27 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2011-05-13 11:44:22 +0200 |
commit | 573757331487ece02d8e13c5c5643762978af0e6 (patch) | |
tree | 7d1b13156b04b5fb8d41f2c25a708887177bd59d | |
parent | cecc0621ce84d9c38d4370ad572389097539de2b (diff) | |
download | NetworkManager-573757331487ece02d8e13c5c5643762978af0e6.tar.gz |
dhclient: only send hostname without domain as host-name option (rh #694758)
-rw-r--r-- | src/dhcp-manager/nm-dhcp-dhclient-utils.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index cc5255ab59..caf90f1162 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -14,7 +14,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2011 Red Hat, Inc. */ #include <config.h> @@ -166,8 +166,19 @@ nm_dhcp_dhclient_create_config (const char *interface, } if (hostname) { - g_string_append_printf (new_contents, HOSTNAME_FORMAT "\n", hostname); + char *plain_hostname, *dot; + + plain_hostname = g_strdup (hostname); + dot = strchr (plain_hostname, '.'); + + /* get rid of the domain */ + if (dot) + *dot = '\0'; + + g_string_append_printf (new_contents, HOSTNAME_FORMAT "\n", plain_hostname); added = TRUE; + + g_free (plain_hostname); } if (added) |