[DRBD-user] Error with numeric hostnames

Trevor Hemsley themsley at voiceflex.com
Thu Nov 12 10:17:43 CET 2015

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On 12/11/15 06:05, Philipp Marek wrote:
> Hi Jeffrey,
>
>> We're using DRBD with heartbeat and we're seeing an error if we configure 
>> a host with an all-numeric hostname.
>>
>> ---------------------------------
>> Starting DRBD resources:
>> //etc/drbd.conf:37: Parse error: 'TK_STRING | '('' expected.
>> 	but got '123456' (TK 281)
>> ---------------------------------
>>
>> Line 37 of the drbd.conf file is the "on <host> {" line.  In this case, the hostname being used is "123456".
> ...
>> This seems like a bug to me, but I haven't found reference to anyone else 
>> having the problem, so I thought I'd see if there's a solution that I'm 
>> missing.  Seems to me that the parse_hosts() function should accept 
>> TK_STING or TK_INTEGER.
> Yeah, right, basically.
>
> The workaround is to enclose the hostname in quotes, as in
>
>     on "123456" {
>         ...
>     }
>
>
>
> To be honest, this is the first time I've ever heard of a full-numeric 
> hostname; I guess that quite some other things might go wrong this way, 
> because IPv4 addresses don't *have* *to* have the dots in them:
>
>     # getent hosts 123456
>     0.1.226.64      123456
>
> This is using the inet_pton() function (inet_aton() works the same),
> so I don't think we want to support purely numeric hostnames.
>
> If we ever allow to use DNS names in the DRBD configuration files' 
> "address" items, should "address 123456:1234" be parsed as IPv4 or via 
> host name lookup? Would you risk that your definition "1234567" suddenly 
> gets mapped to a 123457.com domain, as soon as someone added that one, 
> "just because" your resolv.conf contains "search .com"?
>
>
> I've seen similar problems with programs that wrote IP addresses via
> "%03d.%03d.%03d.%03d" - the leading zeroes make the digits get interpreted 
> as octal numbers...

Also rather complicated by the fact that numbers are directly
translatable to IP addresses - e.g 192.168.1.1 = 0xc0a80101 = 3232235777
and running `ping 3232235777` will ping 192.168.1.1

I thought all numeric hostnames were not allowed...

T



More information about the drbd-user mailing list