Bug 11933 - -h hostname forgotten on renewal
Summary: -h hostname forgotten on renewal
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: pump
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Erik Troan
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-06-06 23:12 UTC by gkm
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-07-25 17:28:19 UTC
Embargoed:


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

Description gkm 2000-06-06 23:12:54 UTC
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 23:13:48 UTC
Created attachment 319 [details]
possible fix (aka quick hack)

Comment 2 gkm 2000-06-06 23:48:02 UTC
Created attachment 320 [details]
blah.  this one should work better; wrong version of diff last time.

Comment 3 Tomasz Kepczynski 2000-07-25 17:28:19 UTC
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 16:23:32 UTC
Fixed in the rawhide/pinstrip pump

Comment 5 Tomasz Kepczynski 2000-09-16 13:45:22 UTC
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 16:20:23 UTC
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 09:53:31 UTC
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.