Nuke undocumented long-deprecated and/or unsupported lease
authorkrw <krw@openbsd.org>
Thu, 29 Jun 2017 21:37:43 +0000 (21:37 +0000)
committerkrw <krw@openbsd.org>
Thu, 29 Jun 2017 21:37:43 +0000 (21:37 +0000)
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.

sbin/dhclient/clparse.c
sbin/dhclient/conflex.c
sbin/dhclient/dhcpd.h
sbin/dhclient/dhctoken.h
sbin/dhclient/parse.c

index b061b6c..e8ba540 100644 (file)
@@ -1,4 +1,4 @@
-/*     $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. */
 
@@ -166,8 +166,6 @@ read_client_leases(struct interface_info *ifi)
  *     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 |
@@ -179,7 +177,6 @@ read_client_leases(struct interface_info *ifi)
  *     TOK_INITIAL_INTERVAL number |
  *     interface-declaration |
  *     TOK_LEASE client-lease-statement |
- *     TOK_ALIAS client-lease-statement |
  *     TOK_REJECT reject-statement
  */
 void
@@ -215,9 +212,6 @@ parse_client_statement(FILE *cfile, struct interface_info *ifi)
                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) {
@@ -269,11 +263,6 @@ parse_client_statement(FILE *cfile, struct interface_info *ifi)
        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;
@@ -585,9 +574,6 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease,
                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;
index 184bd16..cc63633 100644 (file)
@@ -1,4 +1,4 @@
-/*     $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. */
 
@@ -321,24 +321,19 @@ static const struct keywords {
        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 },
index 64744fc..08b4c24 100644 (file)
@@ -1,4 +1,4 @@
-/*     $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>
@@ -188,7 +188,6 @@ int parse_semi(FILE *);
 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 *);
index c10d152..140425d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $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
@@ -66,9 +64,6 @@
 #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
index 85f9243..d4e5da4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $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. */
 
@@ -226,43 +226,6 @@ parse_ip_addr(FILE *cfile, struct in_addr *addr)
        }
 }
 
-/*
- * 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
  */