From 7c2f6343cedc0aa760d7b15a59a45f26bf5228ce Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 24 Jul 2017 18:13:20 +0000 Subject: Throw DHO_STATIC_ROUTES to the floor! Roughly! Ensure they don't appear in effective leases at all. --- sbin/dhclient/dhclient.c | 20 +++++++++----------- sbin/dhclient/dhcpd.h | 5 ++--- sbin/dhclient/kroute.c | 7 ++----- 3 files changed, 13 insertions(+), 19 deletions(-) (limited to 'sbin/dhclient') diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 20ee6ca097e..2060a8f86a8 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.482 2017/07/24 17:15:41 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.483 2017/07/24 18:13:19 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -1038,7 +1038,6 @@ bind_lease(struct interface_info *ifi) &options[DHO_CLASSLESS_STATIC_ROUTES], &options[DHO_CLASSLESS_MS_STATIC_ROUTES], &options[DHO_ROUTERS], - &options[DHO_STATIC_ROUTES], &options[DHO_SUBNET_MASK]); newlease: @@ -2319,23 +2318,22 @@ apply_defaults(struct client_lease *lease) } } + if (newlease->options[DHO_STATIC_ROUTES].len != 0) { + log_warnx("DHO_STATIC_ROUTES (option 33) not supported"); + free(newlease->options[DHO_STATIC_ROUTES].data); + newlease->options[DHO_STATIC_ROUTES].data = NULL; + newlease->options[DHO_STATIC_ROUTES].len = 0; + } /* - * RFC 3442 says client *MUST* ignore both DHO_ROUTERS and - * DHO_STATIC_ROUTES when DHO_CLASSLESS_[MS_]_ROUTES present. - * - * Remove them from 'newlease' so that -L will not show them - * as part of the effective lease. + * RFC 3442 says client *MUST* ignore DHO_ROUTERS + * when DHO_CLASSLESS_[MS_]_ROUTES present. */ if ((newlease->options[DHO_CLASSLESS_MS_STATIC_ROUTES].len != 0) || (newlease->options[DHO_CLASSLESS_STATIC_ROUTES].len != 0)) { free(newlease->options[DHO_ROUTERS].data); newlease->options[DHO_ROUTERS].data = NULL; newlease->options[DHO_ROUTERS].len = 0; - - free(newlease->options[DHO_STATIC_ROUTES].data); - newlease->options[DHO_STATIC_ROUTES].data = NULL; - newlease->options[DHO_STATIC_ROUTES].len = 0; } return newlease; diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 151eae9d0e1..e76b5d6c894 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.217 2017/07/24 17:15:41 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.218 2017/07/24 18:13:19 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -239,5 +239,4 @@ void flush_unpriv_ibuf(const char *); void set_mtu(struct option_data *); void set_address(char *, struct in_addr, struct option_data *); void set_routes(struct in_addr, struct option_data *, - struct option_data *, struct option_data *, struct option_data *, - struct option_data *); + struct option_data *, struct option_data *, struct option_data *); diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index d75df496ea6..b7b700cea8d 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.117 2017/07/24 17:15:41 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.118 2017/07/24 18:13:19 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback @@ -373,7 +373,7 @@ create_route_label(struct sockaddr_rtlabel *label) void set_routes(struct in_addr addr, struct option_data *classless, struct option_data *msclassless, struct option_data *routers, - struct option_data *classfull, struct option_data *subnet) + struct option_data *subnet) { struct in_addr gateway, mask; @@ -406,9 +406,6 @@ set_routes(struct in_addr addr, struct option_data *classless, add_default_route(gateway, addr); } - - if (classfull->len != 0) - log_warnx("DHO_STATIC_ROUTES (option 33) not supported"); } /* -- cgit v1.2.3