dhclient.conf - prepend domain-name issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dhclient.conf - prepend domain-name issue

Jiri B-2
Hi,

I try to configure dhclient.conf to always have my own domain
as first in final /etc/resolv.conf 'search' option line.

But with following configuration there is _no_ white space
between my 'domain-name' and one obtained from lease.

kern.version=OpenBSD 6.2-current (GENERIC.MP) #0: Sat Feb 17 14:45:09 CET 2018
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

# grep -Ev '^#' /etc/dhclient.conf
prepend domain-name "example.com";
prepend domain-name-servers 127.0.0.1;

# echo '' > /etc/resolv.conf
# pkill -HUP -U root -f dhclient
# cat /etc/resolv.conf
# Generated by em0 dhclient
search example.combrq.afterboot.cz
nameserver 127.0.0.1
nameserver 192.168.1.1

# grep domain-name /var/db/dhclient.leases.em0
  option domain-name-servers 192.168.1.1;
   option domain-name "brq.afterboot.cz";

Do I have to put explicitly white space in dhclient.conf?
It seems odd.

Jiri

   

Reply | Threaded
Open this post in threaded view
|

Re: dhclient.conf - prepend domain-name issue

Jiri B-2
On Thu, Feb 22, 2018 at 03:09:39PM -0500, Jiri B wrote:

> Hi,
>
> I try to configure dhclient.conf to always have my own domain
> as first in final /etc/resolv.conf 'search' option line.
>
> But with following configuration there is _no_ white space
> between my 'domain-name' and one obtained from lease.
>
> kern.version=OpenBSD 6.2-current (GENERIC.MP) #0: Sat Feb 17 14:45:09 CET 2018
>     [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> # grep -Ev '^#' /etc/dhclient.conf
> prepend domain-name "example.com";
> prepend domain-name-servers 127.0.0.1;
>
> # echo '' > /etc/resolv.conf
> # pkill -HUP -U root -f dhclient
> # cat /etc/resolv.conf
> # Generated by em0 dhclient
> search example.combrq.afterboot.cz
> nameserver 127.0.0.1
> nameserver 192.168.1.1
>
> # grep domain-name /var/db/dhclient.leases.em0
>   option domain-name-servers 192.168.1.1;
>    option domain-name "brq.afterboot.cz";
>
> Do I have to put explicitly white space in dhclient.conf?
> It seems odd.

Same for 'append', the value needs white space in the beginning
not to have both domains joined into one long string.

Jiri

Reply | Threaded
Open this post in threaded view
|

Re: dhclient.conf - prepend domain-name issue

Kenneth R Westerback-2
In reply to this post by Jiri B-2
On Thu, Feb 22, 2018 at 03:09:39PM -0500, Jiri B wrote:

> Hi,
>
> I try to configure dhclient.conf to always have my own domain
> as first in final /etc/resolv.conf 'search' option line.
>
> But with following configuration there is _no_ white space
> between my 'domain-name' and one obtained from lease.
>
> kern.version=OpenBSD 6.2-current (GENERIC.MP) #0: Sat Feb 17 14:45:09 CET 2018
>     [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> # grep -Ev '^#' /etc/dhclient.conf
> prepend domain-name "example.com";
> prepend domain-name-servers 127.0.0.1;
>
> # echo '' > /etc/resolv.conf
> # pkill -HUP -U root -f dhclient
> # cat /etc/resolv.conf
> # Generated by em0 dhclient
> search example.combrq.afterboot.cz
> nameserver 127.0.0.1
> nameserver 192.168.1.1
>
> # grep domain-name /var/db/dhclient.leases.em0
>   option domain-name-servers 192.168.1.1;
>    option domain-name "brq.afterboot.cz";
>
> Do I have to put explicitly white space in dhclient.conf?
> It seems odd.
>
> Jiri

The whitespace is required. The 'prepend' and 'append' logic treats
the existing option data and the additional data as uint8_t arrays and
attaches one to the other.

.... Ken