On Wed, Apr 07, 2021 at 11:16:44PM +0000, Uwe Werler wrote:
> >Synopsis: no default route added when dhcp option 121 set
> >Category: system
> >Environment:
> System : OpenBSD 6.9
> Details : OpenBSD 6.9 (GENERIC.MP) #12: Tue Apr 6 15:41:46 GMT 2021
>
> uwe@FT-GV164M2:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine : amd64
> >Description:
> When option classless-static-routes is set at the dhcp server no
> routes are added at all, neither the additional routes nor the default route.
> >How-To-Repeat:
>
> define a subnet in dhcpd.conf like that:
>
> subnet 192.168.1.0 netmask 255.255.255.0 {
> option routers 192.168.1.1;
> option classless-static-routes 0/0 192.168.1.1, 192.168.2.0/24
> 192.168.1.2;
> ...
> }
>
>
> >Fix:
> Without option 121 the default route is set.
Two things:
1. dhcpleased(8) requests but then completely ignores dhcp-options(5)
"classless-static-routes".
2. With "classless-static-routes" set in dhcpd.conf, dhcpd(8) omits
"routers" in ACKs iff "classless-static-routes" was requested,
following RFC 3442:
DHCP Server Administrator Responsibilities
Many clients may not implement the Classless Static Routes option.
DHCP server administrators should therefore configure their DHCP
servers to send both a Router option and a Classless Static Routes
option, and should specify the default router(s) both in the Router
option and in the Classless Static Routes option.
When a DHCP client requests the Classless Static Routes option and
also requests either or both of the Router option and the Static
Routes option, and the DHCP server is sending Classless Static Routes
options to that client, the server SHOULD NOT include the Router or
Static Routes options.
With the same dhcpd.conf, not requesting "classless-static-routes" makes
dhcpd respond with both "routers" and "classless-static-routes".
I suggest dhcpleased shouldn't request the option until it actually
supports it so as to ensure a default route is still installed.
This fixes connectivity but not your option 121 use case -- for that
I'd recommend using dhclient(8) until dhcpleased grows support for it.
Feedback? Objections? OK?
Index: frontend.c
===================================================================
RCS file: /cvs/src/sbin/dhcpleased/frontend.c,v
retrieving revision 1.8
diff -u -p -r1.8 frontend.c
--- frontend.c 22 Mar 2021 16:28:25 -0000 1.8
+++ frontend.c 8 Apr 2021 05:30:14 -0000
@@ -776,9 +776,9 @@ build_packet(uint8_t message_type, uint3
static uint8_t dhcp_client_id[] = {DHO_DHCP_CLIENT_IDENTIFIER, 7,
HTYPE_ETHER, 0, 0, 0, 0, 0, 0};
static uint8_t dhcp_req_list[] = {DHO_DHCP_PARAMETER_REQUEST_LIST,
- 8, DHO_SUBNET_MASK, DHO_ROUTERS, DHO_DOMAIN_NAME_SERVERS,
+ 7, DHO_SUBNET_MASK, DHO_ROUTERS, DHO_DOMAIN_NAME_SERVERS,
DHO_HOST_NAME, DHO_DOMAIN_NAME, DHO_BROADCAST_ADDRESS,
- DHO_DOMAIN_SEARCH, DHO_CLASSLESS_STATIC_ROUTES};
+ DHO_DOMAIN_SEARCH};
static uint8_t dhcp_requested_address[] = {DHO_DHCP_REQUESTED_ADDRESS,
4, 0, 0, 0, 0};
static uint8_t dhcp_server_identifier[] = {DHO_DHCP_SERVER_IDENTIFIER,