Re: dhclient.conf - prepend domain-name issue

2018-02-22 Thread Kenneth R Westerback
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
> ji...@build1.brq.afterboot.cz:/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



Re: dhclient.conf - prepend domain-name issue

2018-02-22 Thread Jiri B
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
> ji...@build1.brq.afterboot.cz:/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



dhclient.conf - prepend domain-name issue

2018-02-22 Thread Jiri B
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
ji...@build1.brq.afterboot.cz:/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