Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jul 2014 21:25:06 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Glen Barber <gjb@FreeBSD.org>
Cc:        freebsd-jail@FreeBSD.org
Subject:   Re: check_dhcp
Message-ID:  <alpine.BSF.2.11.1407242122540.3624@wonkity.com>
In-Reply-To: <20140725032045.GY1065@hub.FreeBSD.org>
References:  <alpine.BSF.2.11.1407242042240.3624@wonkity.com> <20140725032045.GY1065@hub.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 Jul 2014, Glen Barber wrote:

> On Thu, Jul 24, 2014 at 09:14:24PM -0600, Warren Block wrote:
>> net-mgmt/monitoring-plugins has a check_dhcp program used to test the
>> availability of a remote DHCP server.  It has BSD-specific code, but seems
>> fairly dated and only works when all supposedly optional parameters are
>> given.  However, it does work on a normal machine:
>>
>>   OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded, max lease time = 600 sec.
>>
>> But it does not work inside a jail, seeing no offers:
>>
>>   CRITICAL: No DHCPOFFERs were received.
>>
>> Raw sockets and bpf are enabled in the jail.  dhclient in the jail can
>> actually get a lease.  Is there anything else that needs to be configured to
>> allow this to work in a jail?
>>
>>
>>
>> After 'make -C /usr/ports/net-mgmt/monitoring-plugins', the code in question
>> is check_dhcp.c in
>> work/monitoring-plugins-monitoring-plugins-b5611ea/plugins-root.  It gives
>> these type of errors:
>>
>>   % ./check_dhcp -s 192.168.1.1
>>   Error: if_nametoindex error - Device not configured.
>>
>>   % ./check_dhcp -s 192.168.1.1 -i em0
>>   Error: Couldn't get hardware address from em0. sysctl 2 error - No such file or directory.
>>
>> After adding -m <jail card's MAC>, it gives no errors but never sees a
>> response.
>
> The problem, I suspect, is that bpf(4) does not exist in the jail.

It's there:

# ls -lh /dev/b*
crw-------  1 root  wheel   0x12 Jul 24 21:00 /dev/bpf
lrwxr-xr-x  1 root  wheel     3B Jul 24 20:08 /dev/bpf0 -> bpf

dhclient would not work without it, I think.  But something else is 
different between the jail and a real machine.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.11.1407242122540.3624>