diff options
author | 2016-11-25 14:46:57 +0000 | |
---|---|---|
committer | 2016-11-25 14:46:57 +0000 | |
commit | f2a8abb2ad5ac1ffd48b06843b976b72fd574b06 (patch) | |
tree | f98e05122af72a28c1e7f2f6309dcf928b2b62d0 | |
parent | The NCM encoding allows to aggregate multiple segments in one single (diff) | |
download | wireguard-openbsd-f2a8abb2ad5ac1ffd48b06843b976b72fd574b06.tar.xz wireguard-openbsd-f2a8abb2ad5ac1ffd48b06843b976b72fd574b06.zip |
Nuke the DHO_ROUTERS and DHO_STATIC_ROUTES options from the effective
lease when DHO_CLASSLESS_[MS_]STATIC_ROUTES are present. RFC 3442 says
the client must ignore the former if the latter is present.
The information was already ignored but was still written to the
'effective' section of the pseudo-lease file created by the -L
option. This incorrectly implied that these options were 'effective'.
Problem noted by Ed Fochler. Thanks!
-rw-r--r-- | sbin/dhclient/dhclient.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 40edc43c02e..48f5c21bf27 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.392 2016/10/06 16:29:17 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.393 2016/11/25 14:46:57 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -2503,6 +2503,25 @@ apply_defaults(struct client_lease *lease) } } + + /* + * 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. + */ + 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); cleanup: |