Bug 17585 - hostname allocation
Summary: hostname allocation
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: pump
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Elliot Lee
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-09-18 11:21 UTC by Won-kyu Park
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2001-07-16 13:41:38 UTC


Attachments (Terms of Use)

Description Won-kyu Park 2000-09-18 11:21:18 UTC
I think, pump with --lookup-hostname is not correctly implemented.

* Pump version: 0.7.11

I want auto configuation at boot time, then I set the network option

as...
/etc/sysconfig/network
-----
NETWORK="yes"
---------
/etc/sysconfig/network-scripts/ifcfg-eth0
-----
ONBOOT="yes"
BOOTPROTO="bootp"
DEVICE="eth0"
-----

All looks good, but hostname,domainname are incorrect.

In /etc/sysconfig/network-scripts/ifup script, hostname maybe retrived with pump using "--lookup-hostname" option.
But, hostname is not setted with below manner..

[...]
    if [ -n "$NEEDHOSTNAME" ]; then
       PUMPARGS="$PUMPARGS --lookup-hostname"
       DHCPCDARGS="$DHCPCDARGS -H"
    fi
[...]

I see, the pump source, and I found, there is no using 'sethostname', or 'setdomainname'

This is my quick hack for correct hostname/domainname retriving.

--------------
--- pump-0.7.11/dhcp.c	Tue Jul  4 14:27:04 2000
+++ pump-0.7.11.new/dhcp.c	Mon Sep 18 17:50:30 2000
@@ -1305,8 +1305,8 @@
     close(s);
 
     parseReply(&bresp, intf);
-    if (flags & PUMP_FLAG_FORCEHNLOOKUP)
-	intf->set &= ~(PUMP_NETINFO_HAS_DOMAIN | PUMP_NETINFO_HAS_HOSTNAME);
+//    if (flags & PUMP_FLAG_FORCEHNLOOKUP) /* XXX */
+//	intf->set &= ~(PUMP_NETINFO_HAS_DOMAIN | PUMP_NETINFO_HAS_HOSTNAME);
 
     return NULL;
 }
diff -ru pump-0.7.11/pump.c pump-0.7.11.new/pump.c
--- pump-0.7.11/pump.c	Fri Feb 18 00:15:48 2000
+++ pump-0.7.11.new/pump.c	Mon Sep 18 18:32:04 2000
@@ -410,6 +410,16 @@
 		} else {
 		    pumpSetupInterface(intf + numInterfaces);
 
+		    if (intf[numInterfaces].set & PUMP_NETINFO_HAS_HOSTNAME) {
+			sethostname(intf[numInterfaces].hostname,
+				strlen(intf[numInterfaces].hostname));
+			syslog(LOG_INFO, "HOST %s (%d)", 
intf[numInterfaces].hostname,strlen(intf[numInterfaces].hostname));
+		    }
+		    if (intf[numInterfaces].set & PUMP_NETINFO_HAS_DOMAIN) {
+			setdomainname(intf[numInterfaces].domain,
+				strlen(intf[numInterfaces].domain));
+			syslog(LOG_INFO, "DOMAIN %s", intf[numInterfaces].domain);
+		    }
 		    syslog(LOG_INFO, "configured interface %s", intf->device);
 
 		    if (intf->set & PUMP_NETINFO_HAS_GATEWAY) {

Comment 1 Elliot Lee 2001-07-19 22:20:32 UTC
The hostname is only retrieved - it is the responsibility of the initscripts or
whatever to actually set them.

FWIW setdomainname() isn't going to do what you think it is.

Apologies for the unresponsiveness of the previous pump maintainer...


Note You need to log in before you can comment on or make changes to this bug.