diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/clparse.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/conflex.c | 3 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.c | 13 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 3 | ||||
-rw-r--r-- | sbin/dhclient/dhctoken.h | 3 |
5 files changed, 23 insertions, 5 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index b3f198fed2a..275dfbf5040 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.60 2013/06/09 16:21:50 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.61 2013/10/22 18:15:58 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -549,6 +549,10 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease) if (!parse_ip_addr(cfile, &lease->address)) return; break; + case TOK_NEXT_SERVER: + if (!parse_ip_addr(cfile, &lease->next_server)) + return; + break; case TOK_MEDIUM: skip_to_semi(cfile); return; diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 02533c4ef83..1cec42ee87e 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.22 2013/06/09 01:51:58 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.23 2013/10/22 18:15:58 krw Exp $ */ /* Lexical scanner for dhclient config file. */ @@ -337,6 +337,7 @@ static const struct keywords { { "link-timeout", TOK_LINK_TIMEOUT }, { "media", TOK_MEDIA }, { "medium", TOK_MEDIUM }, + { "next-server", TOK_NEXT_SERVER }, { "option", TOK_OPTION }, { "prepend", TOK_PREPEND }, { "rebind", TOK_REBIND }, diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 38511404c7e..32076c2fa95 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.262 2013/09/09 20:30:05 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.263 2013/10/22 18:15:58 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1048,6 +1048,10 @@ packet_to_lease(struct in_addr client_addr, struct option_data *options) memcpy(&lease->address.s_addr, &client->packet.yiaddr, sizeof(in_addr_t)); + /* Save the siaddr (a.k.a. next-server) info. */ + memcpy(&lease->next_server.s_addr, &client->packet.siaddr, + sizeof(in_addr_t)); + /* If the server name was filled out, copy it. */ if ((!lease->options[DHO_DHCP_OPTION_OVERLOAD].len || !(lease->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) && @@ -1700,6 +1704,13 @@ lease_as_string(char *type, struct client_lease *lease) p += rslt; sz -= rslt; + rslt = snprintf(p, sz, " next-server %s;\n", + inet_ntoa(lease->next_server)); + if (rslt == -1 || rslt >= sz) + return (NULL); + p += rslt; + sz -= rslt; + if (lease->filename) { rslt = snprintf(p, sz, " filename \"%s\";\n", lease->filename); if (rslt == -1 || rslt >= sz) diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 282bb8795a7..3b7eb556044 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.121 2013/06/09 22:39:51 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.122 2013/10/22 18:15:58 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -102,6 +102,7 @@ struct client_lease { TAILQ_ENTRY(client_lease) next; time_t expiry, renewal, rebind; struct in_addr address; + struct in_addr next_server; char *server_name; char *filename; char *resolv_conf; diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 6359bbbd14e..cfd41f0a3dc 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhctoken.h,v 1.7 2012/10/30 18:39:44 krw Exp $ */ +/* $OpenBSD: dhctoken.h,v 1.8 2013/10/22 18:15:59 krw Exp $ */ /* Tokens for config file lexer and parser. */ @@ -59,6 +59,7 @@ #define TOK_TIMEOUT 272 #define TOK_RETRY 273 #define TOK_SELECT_TIMEOUT 274 +#define TOK_NEXT_SERVER 275 #define TOK_INTERFACE 276 #define TOK_RENEW 277 #define TOK_REBIND 278 |