Bug 11933 - -h hostname forgotten on renewal
-h hostname forgotten on renewal
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: pump (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Erik Troan
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-06-06 19:12 EDT by gkm
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-07-25 13:28:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
possible fix (aka quick hack) (2.54 KB, patch)
2000-06-06 19:13 EDT, gkm
no flags Details | Diff
blah. this one should work better; wrong version of diff last time. (3.71 KB, patch)
2000-06-06 19:48 EDT, gkm
no flags Details | Diff

  None (edit)
Description gkm 2000-06-06 19:12:54 EDT
the command line specified hostname is forgotten about when it comes time
to renew the dhcp lease.  looks like it should be stored in `intf' and used
if the bootp reponses didn't include a hostname... this will make ddns work
in some environments.
Comment 1 gkm 2000-06-06 19:13:48 EDT
Created attachment 319 [details]
possible fix (aka quick hack)
Comment 2 gkm 2000-06-06 19:48:02 EDT
Created attachment 320 [details]
blah.  this one should work better; wrong version of diff last time.
Comment 3 Tomasz Kepczynski 2000-07-25 13:28:19 EDT
This causes problem with ddns. As pump gets hostname at renewal from gethostname
it may
get FQDN. This will be passed to server and it will cause change in dns to add
domain one
more time (it depends on server configuration however).
Pump should always send the same hostname it contacts dhcp server I guess.
Comment 4 Erik Troan 2000-08-03 12:23:32 EDT
Fixed in the rawhide/pinstrip pump
Comment 5 Tomasz Kepczynski 2000-09-16 09:45:22 EDT
This still doesn't work correctly as in pump-0.7.11-2. When lease is obtained
for the first time
hostname specified with -h is used and dhcp properly registers hostname.domain
in DNS.
When lease is renewed fully qualified domain name is send and therefore dhcp
registers
hostname.domain.domain in DNS which is at least inconvenient.
Comment 6 Patrick J. LoPresti 2000-10-26 12:20:23 EDT
I can confirm that this bug is *still present* as recently as pump
0.8.2.

The original bug, which was pump forgetting the -h option, is fixed.
But the new problem, which is that pump uses hostname() instead of the -h option
when renewing a lease, has not been fixed.

Using hostname() is wrong, because it is not the same as the -h option.  In
particular, the hostname() is often fully-qualified, and many schemes for
updating the DNS from DHCP data expect the client hostname to be the short name.

Please re-open this bug.
Comment 7 Tomasz Kepczynski 2000-10-28 05:53:31 EDT
The fault is not resolved in pump-0.8.4-1 as shipped in RawHide. It seems that
the reason it occurs is as follows:
1. pump uses command line provided hostname when obtaining lease for the first
time
2. dhcp responds but does not send hostname in vendor options (option 12)
3. pump stores information about interface in a record but it doesn't store
hostname as it relies on dhcp server only to provide it
4. when pump tries to renew lease it sees that there is no hostname in record
describing device and falls back to gethostname
5. gethostname returns FQDN (as set at system starup) and this is the fault
reproduced
The following patch (against pump-0.8.4) works for me but it may break your
system (it certainly will if pump tries to use sethostname)

--- dhcp.c.orig Thu Aug 17 00:33:43 2000
+++ dhcp.c      Sat Oct 28 11:05:28 2000
@@ -1323,6 +1323,15 @@
     close(s);

     parseReply(&bresp, intf);
+    if(reqHostname) {
+       if (intf->hostname)
+           free(intf->hostname);
+       if ((intf->hostname = malloc(strlen(reqHostname) + 1))) {
+           strcpy(intf->hostname, reqHostname);
+           intf->set |= PUMP_NETINFO_HAS_HOSTNAME;
+           syslog (LOG_DEBUG, "intf: reqHostname: %s", intf->hostname);
+       }
+    }
     if (flags & PUMP_FLAG_FORCEHNLOOKUP)
        intf->set &= ~(PUMP_NETINFO_HAS_DOMAIN | PUMP_NETINFO_HAS_HOSTNAME);

Patch is applied at very end of pumpDhcpRun function.
Please reopen this bug reported and hopefully have it sorted at last...

Regards,
Tomek

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