Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-14 Thread Miguel Figueiredo
A Domingo 12 Dezembro 2010 00:12:19 Floris Bos vocĂȘ escreveu:
 On Saturday, December 11, 2010 07:31:48 am Christian PERRIER wrote:
  Correct. Apparently, though, that behaviour didn't bother anybody
  enough to look at current netcfg code and propose the needed patch
 
 Fair enough.
 
 Attached a patch that introduces a new netcfg/hostname option that -if set-
 takes precedence over the RDNS/DHCP hostname magic.
 
 
 This patch has a dependency on my other bug/patch:
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606515 (Preseed
 installation does not wait for network to be ready)
 Because if netcfg/hostname is set, the reverse DNS check is skipped, and
 the chance is higher that the installer attempts to fetch the kickstart
 file before the network link is up  running.

I suggest if this is not going to be included for Squeeze i suggest to be 
added to Wheezy Goals wiki page [1]. 

1 - http://wiki.debian.org/DebianInstaller/WheezyGoals

-- 
Melhores cumprimentos/Best regards,

Miguel Figueiredo
http://www.DebianPT.org




--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201012142321.44704.el...@debianpt.org



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-11 Thread Floris Bos
On Saturday, December 11, 2010 07:31:48 am Christian PERRIER wrote:
 Correct. Apparently, though, that behaviour didn't bother anybody
 enough to look at current netcfg code and propose the needed patch

Fair enough.

Attached a patch that introduces a new netcfg/hostname option that -if set- 
takes precedence over the RDNS/DHCP hostname 
magic.


This patch has a dependency on my other bug/patch: 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606515 (Preseed 
installation does not wait for network to be ready)
Because if netcfg/hostname is set, the reverse DNS check is skipped, and the 
chance is higher that the installer attempts to fetch 
the kickstart file before the network link is up  running.


-- 
Yours sincerely,

Floris Bos
diff -ur netcfg.orig1/debian/netcfg-common.templates netcfg/debian/netcfg-common.templates
--- netcfg.orig1/debian/netcfg-common.templates	2009-09-12 16:13:23.0 +0200
+++ netcfg/debian/netcfg-common.templates	2010-12-11 17:20:01.361351304 +0100
@@ -105,6 +105,12 @@
  administrator. If you are setting up your own home network, you can make
  something up here.
 
+Template: netcfg/hostname
+Type: string
+Description: Hostname that can be preseeded.
+ .
+ If specified this disables the automatic detection of the hostname by netcfg.
+
 Template: netcfg/invalid_hostname
 Type: error
 # :sl2:
diff -ur netcfg.orig1/dhcp.c netcfg/dhcp.c
--- netcfg.orig1/dhcp.c	2010-08-06 23:49:44.0 +0200
+++ netcfg/dhcp.c	2010-12-11 23:18:25.841977721 +0100
@@ -473,12 +473,19 @@
 }
 
 /*
- * Default to the hostname returned via DHCP, if any,
+ * If the netcfg/hostname preseed value is set use that
+ * Otherwise default to the hostname returned via DHCP, if any,
  * otherwise to the requested DHCP hostname
  * otherwise to the hostname found in DNS for the IP address
  * of the interface
  */
-if (gethostname(buf, sizeof(buf)) == 0
+debconf_get(client, netcfg/hostname);
+if (!empty_str(client-value))
+{
+strncpy(buf, client-value, sizeof(buf));
+debconf_set(client, netcfg/get_hostname, buf);
+}
+else if (gethostname(buf, sizeof(buf)) == 0
  !empty_str(buf)
  strcmp(buf, (none))
  verify_hostname(buf) == 0
diff -ur netcfg.orig1/static.c netcfg/static.c
--- netcfg.orig1/static.c	2010-08-06 06:32:41.0 +0200
+++ netcfg/static.c	2010-12-12 00:12:44.691551386 +0100
@@ -454,9 +464,28 @@
 GET_GATEWAY : CONFIRM;
 break;
 case GET_HOSTNAME:
-seed_hostname_from_dns(client, ipaddress);
-state = (netcfg_get_hostname(client, netcfg/get_hostname, hostname, 1)) ?
-GET_NAMESERVERS : GET_DOMAIN;
+debconf_get(client, netcfg/hostname);
+if (!empty_str(client-value)) {
+/* Copy preseeded netcfg/hostname to hostname variable and netcfg/get_hostname */
+hostname = strdup(client-value);
+debconf_set(client, netcfg/get_hostname, hostname);
+
+/* FQDN? Then set domain */
+char *s = strchr(hostname, '.');
+if (s  s[1] != '\0') {
+domain = strdup(s + 1);
+debconf_set(client, netcfg/get_domain, domain);
+have_domain = 1;
+*s = '\0';
+}
+state = GET_DOMAIN;
+
+} else {
+seed_hostname_from_dns(client, ipaddress);
+state = (netcfg_get_hostname(client, netcfg/get_hostname, hostname, 1)) ?
+GET_NAMESERVERS : GET_DOMAIN;
+}
+
 break;
 case GET_DOMAIN:
 if (!have_domain) {


Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-11 Thread Matthew Palmer
On Sun, Dec 12, 2010 at 01:12:19AM +0100, Floris Bos wrote:
 On Saturday, December 11, 2010 07:31:48 am Christian PERRIER wrote:
  Correct. Apparently, though, that behaviour didn't bother anybody
  enough to look at current netcfg code and propose the needed patch
 
 Fair enough.
 
 Attached a patch that introduces a new netcfg/hostname option that -if
 set- takes precedence over the RDNS/DHCP hostname magic.

Floris, I think I'm going to name my first child after you.

In the meantime, to honour your awesomeness, here's a patch for the manual
to go along with your patch.

- Matt
diff --git a/manual/en/appendix/preseed.xml b/manual/en/appendix/preseed.xml
index 7e9eff1..19a7da7 100644
--- a/manual/en/appendix/preseed.xml
+++ b/manual/en/appendix/preseed.xml
@@ -864,12 +864,18 @@ d-i netcfg/choose_interface select auto
 #d-i netcfg/get_gateway string 192.168.1.1
 #d-i netcfg/confirm_static boolean true
 
-# Any hostname and domain names assigned from dhcp take precedence over
-# values set here. However, setting the values still prevents the questions
-# from being shown, even if values come from dhcp.
+# Setting these values prevents the associated questions from being asked,
+# however if DHCP or reverse DNS lookups succeed, those results will be used
+# in favour of these options.  If you truly want to preseed a hostname, see
+# netcfg/hostname (below)
 d-i netcfg/get_hostname string unassigned-hostname
 d-i netcfg/get_domain string unassigned-domain
 
+# If you want netcfg to definitely use your preseeded hostname, rather than
+# trying to look it up via DHCP or DNS, you want to set this option.  It
+# can either be a bare hostname, or an FQDN.
+d-i netcfg/hostname string unassigned-hostname.unassigned-domain
+
 # Disable that annoying WEP key dialog.
 d-i netcfg/wireless_wep string
 # The wacky dhcp hostname that some ISPs use as a password of sorts.


Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Floris Bos
Package: netcfg
Version: 1.46

The value specified using netcfg/get_hostname seems to be ignored, if a 
reverse DNS entry is present for the IP-address of the server being installed.


Seems to be a bit similar to this bug: http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=544513 (dhcp returned hostname take precedence on 
netcfg/get_hostname)
Except in my case it seems the reverse DNS hostname is used, instead of the 
DHCP hostname.


I think netcfg/get_hostname should take precendence over everything else.


Yours sincerely,

Floris Bos



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201012101513.32125@je-eigen-domein.nl



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Ferenc Wagner
Floris Bos b...@je-eigen-domein.nl writes:

 The value specified using netcfg/get_hostname seems to be ignored, if a 
 reverse DNS entry is present for the IP-address of the server being installed.
 [...]
 I think netcfg/get_hostname should take precendence over everything else.

Half of the current behaviour is documented in
http://d-i.alioth.debian.org/manual/en.i386/apbs04.html#preseed-network
Maybe the idea was to enable skipping the question without specifying a
fixed name.
-- 
Cheers,
Feri.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87sjy5k3g4@tac.ki.iif.hu



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Floris Bos
Hi,

On Friday, December 10, 2010 05:17:15 pm Ferenc Wagner wrote:
 Floris Bos b...@je-eigen-domein.nl writes:
  The value specified using netcfg/get_hostname seems to be ignored, if a
  reverse DNS entry is present for the IP-address of the server being
  installed. [...]
  I think netcfg/get_hostname should take precendence over everything else.
 
 Half of the current behaviour is documented in
 http://d-i.alioth.debian.org/manual/en.i386/apbs04.html#preseed-network
 Maybe the idea was to enable skipping the question without specifying a
 fixed name.

Well, if you think people rely on the current behavior because it's partial 
documented, then treat my bug report as a feature request for a preseed option 
to override this behavior.

Not everyone has the power to change their own reverse DNS entries, or it 
might take time to process (send a request to the upstream provider that is 
responsible for the IP block, wait for them to process it, and reload the 
nameserver zonefile).
And people like to be able to choose their own hostname.


-- 
Yours sincerely,

Floris Bos



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201012102042.37085@je-eigen-domein.nl



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Ferenc Wagner
Floris Bos b...@je-eigen-domein.nl writes:

 On Friday, December 10, 2010 05:17:15 pm Ferenc Wagner wrote:

 Floris Bos b...@je-eigen-domein.nl writes:

 The value specified using netcfg/get_hostname seems to be ignored, if a
 reverse DNS entry is present for the IP-address of the server being
 installed. [...]
 I think netcfg/get_hostname should take precendence over everything else.
 
 Half of the current behaviour is documented in
 http://d-i.alioth.debian.org/manual/en.i386/apbs04.html#preseed-network
 Maybe the idea was to enable skipping the question without specifying a
 fixed name.

 Well, if you think people rely on the current behavior because it's partial 
 documented

I certainly do...  Maybe that's my problem, though. :)

 then treat my bug report as a feature request for a preseed option to
 override this behavior.

Fair enough.  But I doubt its feasibility before squeeze...

 Not everyone has the power to change their own reverse DNS entries, or it 
 might take time to process (send a request to the upstream provider that is 
 responsible for the IP block, wait for them to process it, and reload the 
 nameserver zonefile).
 And people like to be able to choose their own hostname.

Yeah.  Currently they can either
 1. not preseed it but type in during installation, or
 2. set it in the DNS records.
Looks like it worked good enough till now.
-- 
Regards,
Feri.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87bp4tic2x@tac.ki.iif.hu



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Floris Bos
On Friday, December 10, 2010 09:53:42 pm Ferenc Wagner wrote:
  Not everyone has the power to change their own reverse DNS entries, or it
  might take time to process (send a request to the upstream provider that
  is responsible for the IP block, wait for them to process it, and reload
  the nameserver zonefile).
  And people like to be able to choose their own hostname.
 
 Yeah.  Currently they can either
  1. not preseed it but type in during installation, or
  2. set it in the DNS records.
 Looks like it worked good enough till now.

Guess it wasn't good enough 5 years ago either. :-)
Seems my bug is a duplicate of: 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343269


-- 
Yours sincerely,

Floris Bos



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201012102333.04654@je-eigen-domein.nl



Re: Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Matthew Palmer
On Fri, Dec 10, 2010 at 09:53:42PM +0100, Ferenc Wagner wrote:
 Floris Bos b...@je-eigen-domein.nl writes:
  Not everyone has the power to change their own reverse DNS entries, or it 
  might take time to process (send a request to the upstream provider that is 
  responsible for the IP block, wait for them to process it, and reload the 
  nameserver zonefile).
  And people like to be able to choose their own hostname.
 
 Yeah.  Currently they can either
  1. not preseed it but type in during installation, or

Mmmm, manual intervention during automated installation.  WIN!

  2. set it in the DNS records.

Doesn't work if you're just using DHCP to get an address to use during
installation, with an automated configuration system keying off the hostname
for later (permanent) network configuration -- in addition to the not
everyone controls their own rDNS problem.

 Looks like it worked good enough till now.

No, it hasn't worked at all.  I gave up trying to fight this fight years
ago, and just use my own udeb which unfucks netcfg's stupidity with a
preseeded FQDN on the command line (which also, as a bonus, saves one
preseed setting).  Floris, let me know if you'd like a copy of that udeb --
it's ugly, but it works.

To reiterate my position: overriding an explicit setting by the user with a
value obtained by magic over the network is, was, and always will be a
really, really bad idea.

- Matt


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20101210225346.gd4...@hezmatt.org



Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Christian PERRIER
forcemerge 343269 606636
thanks

Quoting Floris Bos (b...@je-eigen-domein.nl):

 Guess it wasn't good enough 5 years ago either. :-)
 Seems my bug is a duplicate of: 
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343269

Correct. Apparently, though, that behaviour didn't bother anybody
enough to look at current netcfg code and propose the needed patch
(hint: netcfg is one of the very few parts of D-I that's written in
C. It partly explains why several feature requests, like this one,
aren't processed).

Patches still welcomed. There is no objection by the D-I team to fix
that, but not for squeeze.




signature.asc
Description: Digital signature


Processed: Re: Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname

2010-12-10 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 forcemerge 343269 606636
Bug#343269: hostname/domain name preseeding is quite broken
Bug#606636: Reverse DNS takes precedence over netcfg/get_hostname
Forcibly Merged 343269 606636.

 thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
606636: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606636
343269: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343269
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.129204913815615.transcr...@bugs.debian.org