fields 'hardware', 'alias', 'media', 'medium', 'ethernet'.
Also remove now-unused parse_ethernet().
Making these parsing failures will smoke out anybody with
leases or conf files from the last century.
-/* $OpenBSD: clparse.c,v 1.113 2017/06/16 14:12:12 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.114 2017/06/29 21:37:43 krw Exp $ */
/* Parser for dhclient config and lease files. */
* TOK_SUPERSEDE option-decl |
* TOK_APPEND option-decl |
* TOK_PREPEND option-decl |
- * TOK_MEDIA string-list |
- * hardware-declaration |
* TOK_REQUEST option-list |
* TOK_REQUIRE option-list |
* TOK_IGNORE option-list |
* TOK_INITIAL_INTERVAL number |
* interface-declaration |
* TOK_LEASE client-lease-statement |
- * TOK_ALIAS client-lease-statement |
* TOK_REJECT reject-statement
*/
void
if (code != -1)
config->default_actions[code] = ACTION_PREPEND;
break;
- case TOK_HARDWARE:
- parse_ethernet(cfile, &ifi->hw_address);
- break;
case TOK_REQUEST:
count = parse_option_list(cfile, optlist, sizeof(optlist));
if (count != -1) {
case TOK_LEASE:
parse_client_lease_statement(cfile, 1, ifi);
break;
- case TOK_ALIAS:
- case TOK_MEDIA:
- /* Deprecated and ignored. */
- skip_to_semi(cfile);
- break;
case TOK_REJECT:
parse_reject_statement(cfile);
break;
if (!parse_ip_addr(cfile, &lease->next_server))
return;
break;
- case TOK_MEDIUM:
- skip_to_semi(cfile);
- return;
case TOK_FILENAME:
lease->filename = parse_string(cfile, NULL);
break;
-/* $OpenBSD: conflex.c,v 1.39 2017/06/10 17:56:29 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.40 2017/06/29 21:37:43 krw Exp $ */
/* Lexical scanner for dhclient config file. */
const char *k_name;
int k_val;
} keywords[] = {
- { "alias", TOK_ALIAS },
{ "append", TOK_APPEND },
{ "backoff-cutoff", TOK_BACKOFF_CUTOFF },
{ "bootp", TOK_BOOTP },
{ "default", TOK_DEFAULT },
{ "deny", TOK_DENY },
- { "ethernet", TOK_ETHERNET },
{ "expire", TOK_EXPIRE },
{ "filename", TOK_FILENAME },
{ "fixed-address", TOK_FIXED_ADDR },
- { "hardware", TOK_HARDWARE },
{ "ignore", TOK_IGNORE },
{ "initial-interval", TOK_INITIAL_INTERVAL },
{ "interface", TOK_INTERFACE },
{ "lease", TOK_LEASE },
{ "link-timeout", TOK_LINK_TIMEOUT },
- { "media", TOK_MEDIA },
- { "medium", TOK_MEDIUM },
{ "next-server", TOK_NEXT_SERVER },
{ "option", TOK_OPTION },
{ "prepend", TOK_PREPEND },
-/* $OpenBSD: dhcpd.h,v 1.199 2017/06/29 13:55:53 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.200 2017/06/29 21:37:43 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
char *parse_string(FILE *, unsigned int *);
int parse_ip_addr(FILE *, struct in_addr *);
int parse_cidr(FILE *, unsigned char *);
-void parse_ethernet(FILE *, struct ether_addr *);
void parse_lease_time(FILE *, time_t *);
int parse_decimal(FILE *, unsigned char *, char);
int parse_hex(FILE *, unsigned char *);
-/* $OpenBSD: dhctoken.h,v 1.10 2016/08/16 21:57:51 krw Exp $ */
+/* $OpenBSD: dhctoken.h,v 1.11 2017/06/29 21:37:43 krw Exp $ */
/* Tokens for config file lexer and parser. */
* Enterprises, see ``http://www.vix.com''.
*/
-#define TOK_FIRST_TOKEN TOK_HARDWARE
-#define TOK_HARDWARE 257
-#define TOK_FILENAME 258
+#define TOK_FIRST_TOKEN TOK_FILENAME
+#define TOK_FILENAME 257
#define TOK_FIXED_ADDR 259
#define TOK_OPTION 260
-#define TOK_ETHERNET 261
#define TOK_STRING 262
#define TOK_NUMBER 263
#define TOK_NUMBER_OR_NAME 264
#define TOK_BOOTP 280
#define TOK_DENY 281
#define TOK_DEFAULT 282
-#define TOK_MEDIA 283
-#define TOK_MEDIUM 284
-#define TOK_ALIAS 285
#define TOK_REBOOT 286
#define TOK_BACKOFF_CUTOFF 287
#define TOK_INITIAL_INTERVAL 288
-/* $OpenBSD: parse.c,v 1.53 2017/06/22 15:08:53 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.54 2017/06/29 21:37:43 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
}
}
-/*
- * ETHERNET :== 'ethernet' NUMBER:NUMBER:NUMBER:NUMBER:NUMBER:NUMBER
- */
-void
-parse_ethernet(FILE *cfile, struct ether_addr *hardware)
-{
- struct ether_addr buf;
- int len, token;
-
- token = next_token(NULL, cfile);
- if (token != TOK_ETHERNET) {
- parse_warn("expecting 'ethernet'.");
- if (token != ';')
- skip_to_semi(cfile);
- return;
- }
-
- len = 0;
- for (token = ':'; token == ':'; token = next_token(NULL, cfile)) {
- if (!parse_hex(cfile, &buf.ether_addr_octet[len]))
- break;
- if (++len == sizeof(buf.ether_addr_octet))
- break;
- }
-
- if (len == 6) {
- if (parse_semi(cfile))
- memcpy(hardware, &buf, sizeof(*hardware));
- } else if (token != ':') {
- parse_warn("expecting ':'.");
- skip_to_semi(cfile);
- } else {
- parse_warn("expecting hex value.");
- skip_to_semi(cfile);
- }
-}
-
/*
* lease-time :== NUMBER SEMI
*/