Bugzilla – Attachment 65118 Details for
Bug 144324
No hostname in dhc/DNS setup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
hostname via dns patch
hostname_via_dns.diff (text/plain), 1.28 KB, created by
Stefan Scheler
on 2006-01-26 09:30:08 UTC
(
hide
)
Description:
hostname via dns patch
Filename:
MIME Type:
Creator:
Stefan Scheler
Created:
2006-01-26 09:30:08 UTC
Size:
1.28 KB
patch
obsolete
>Index: src/backends/NetworkManagerSuSE.c >=================================================================== >RCS file: /cvs/gnome/NetworkManager/src/backends/NetworkManagerSuSE.c,v >retrieving revision 1.28 >diff -u -r1.28 NetworkManagerSuSE.c >--- src/backends/NetworkManagerSuSE.c 23 Jan 2006 21:17:59 -0000 1.28 >+++ src/backends/NetworkManagerSuSE.c 26 Jan 2006 09:27:20 -0000 >@@ -1023,6 +1023,8 @@ > { > shvarFile *file; > gchar *name, *buf, *hostname = NULL; >+ struct in_addr temp_addr; >+ struct hostent *host; > > g_return_if_fail (config != NULL); > >@@ -1037,8 +1039,20 @@ > > if (!strcmp (buf, "yes")) { > hostname = nm_ip4_config_get_hostname (config); >- if (hostname) { >- nm_info ("Setting hostname to %s\n", hostname); >+ if (!hostname) { >+ /* try to get hostname via dns */ >+ temp_addr.s_addr = nm_ip4_config_get_address(config); >+ if ( (host = gethostbyaddr((char *)&temp_addr, sizeof(temp_addr), AF_INET)) == NULL ) { >+ nm_warning( "nm_system_set_hostname: gethostbyaddr failed, h_errno = %d", h_errno); >+ } >+ else { >+ hostname = g_strdup(host->h_name); >+ hostname = strtok(hostname, "."); >+ } >+ } >+ if (hostname) >+ { >+ nm_info ("Setting hostname to '%s'", hostname); > if (sethostname (hostname, strlen (hostname)) < 0) > nm_warning ("Could not set hostname."); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 144324
: 65118 |
65380