From 8caf9e7d7aff376cd9794546398ceb35f500922a Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Mon, 25 Jul 2011 03:39:17 -0400 Subject: [PATCH] Remove support for RFC868 Time Server options. Totally obsolete, and ifchd just had empty hooks that never received work messages anyway. Shorten the names of ifchd commands. This breaks wire protocol, but thankfully I haven't released yet! --- ifchd/ifch_proto.h | 19 +++++++++++++++++++ ifchd/ifchd.c | 13 ------------- ifchd/ifproto.h | 20 -------------------- ndhc/options.c | 3 +-- ndhc/options.h | 1 - 5 files changed, 20 insertions(+), 36 deletions(-) create mode 100644 ifchd/ifch_proto.h delete mode 100644 ifchd/ifproto.h diff --git a/ifchd/ifch_proto.h b/ifchd/ifch_proto.h new file mode 100644 index 0000000..5bb110d --- /dev/null +++ b/ifchd/ifch_proto.h @@ -0,0 +1,19 @@ +#ifndef NJK_IFCH_PROTO_H__ +#define NJK_IFCH_PROTO_H__ 1 + +#define CMD_INTERFACE "iface" +#define CMD_IP "ip" +#define CMD_SUBNET "snet" +#define CMD_TIMEZONE "tzone" +#define CMD_ROUTER "routr" +#define CMD_DNS "dns" +#define CMD_LPRSVR "lpr" +#define CMD_HOSTNAME "host" +#define CMD_DOMAIN "dom" +#define CMD_IPTTL "ipttl" +#define CMD_MTU "mtu" +#define CMD_BROADCAST "bcast" +#define CMD_NTPSVR "ntp" +#define CMD_WINS "wins" + +#endif diff --git a/ifchd/ifchd.c b/ifchd/ifchd.c index b350d96..4cc34d0 100644 --- a/ifchd/ifchd.c +++ b/ifchd/ifchd.c @@ -68,7 +68,6 @@ enum states { STATE_SUBNET, STATE_TIMEZONE, STATE_ROUTER, - STATE_TIMESVR, STATE_DNS, STATE_LPRSVR, STATE_HOSTNAME, @@ -246,10 +245,6 @@ static void parse_list(int idx, char *str, strlist_t **toplist, static void perform_timezone(int idx, char *str) {} -/* Does anyone use this command? */ -static void perform_timesvr(int idx, char *str) -{} - /* Add a dns server to the /etc/resolv.conf -- we already have a fd. */ static void perform_dns(int idx, char *str) { @@ -403,8 +398,6 @@ static void execute_list(int i) state[i] = STATE_TIMEZONE; if (strncmp(p, CMD_ROUTER, sizeof(CMD_ROUTER)) == 0) state[i] = STATE_ROUTER; - if (strncmp(p, CMD_TIMESVR, sizeof(CMD_TIMESVR)) == 0) - state[i] = STATE_TIMESVR; if (strncmp(p, CMD_DNS, sizeof(CMD_DNS)) == 0) state[i] = STATE_DNS; if (strncmp(p, CMD_LPRSVR, sizeof(CMD_LPRSVR)) == 0) @@ -456,12 +449,6 @@ static void execute_list(int i) state[i] = STATE_NOTHING; break; - case STATE_TIMESVR: - perform_timesvr(i, p); - free_stritem(&(curl[i])); - state[i] = STATE_NOTHING; - break; - case STATE_DNS: perform_dns(i, p); free_stritem(&(curl[i])); diff --git a/ifchd/ifproto.h b/ifchd/ifproto.h deleted file mode 100644 index 46954bf..0000000 --- a/ifchd/ifproto.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef NJK_IFPROTO_H__ -#define NJK_IFPROTO_H__ 1 - -#define CMD_INTERFACE "interface" -#define CMD_IP "ip" -#define CMD_SUBNET "subnet" -#define CMD_TIMEZONE "timezone" -#define CMD_ROUTER "router" -#define CMD_TIMESVR "timesvr" -#define CMD_DNS "dns" -#define CMD_LPRSVR "lprsvr" -#define CMD_HOSTNAME "hostname" -#define CMD_DOMAIN "domain" -#define CMD_IPTTL "ipttl" -#define CMD_MTU "mtu" -#define CMD_BROADCAST "broadcast" -#define CMD_NTPSRV "ntpsrv" -#define CMD_WINS "wins" - -#endif diff --git a/ndhc/options.c b/ndhc/options.c index 7f2dc1b..12323ad 100644 --- a/ndhc/options.c +++ b/ndhc/options.c @@ -37,7 +37,7 @@ struct dhcp_option { uint8_t code; uint8_t type; - char name[10]; + char name[6]; }; #define DCODE_PADDING 0x00 @@ -57,7 +57,6 @@ static const struct dhcp_option options[] = { {DCODE_SUBNET , OPTION_IP | OPTION_LIST | OPTION_REQ, CMD_SUBNET }, {DCODE_TIMEZONE , OPTION_S32, CMD_TIMEZONE }, {DCODE_ROUTER , OPTION_IP | OPTION_REQ, CMD_ROUTER }, - {DCODE_TIMESVR , OPTION_IP | OPTION_LIST, CMD_TIMESVR }, {DCODE_DNS , OPTION_IP | OPTION_LIST | OPTION_REQ, CMD_DNS }, {DCODE_LPRSVR , OPTION_IP | OPTION_LIST, CMD_LPRSVR }, {DCODE_HOSTNAME , OPTION_STRING | OPTION_REQ, CMD_HOSTNAME }, diff --git a/ndhc/options.h b/ndhc/options.h index ea1f86b..4a6a30e 100644 --- a/ndhc/options.h +++ b/ndhc/options.h @@ -33,7 +33,6 @@ #define DCODE_SUBNET 0x01 #define DCODE_TIMEZONE 0x02 #define DCODE_ROUTER 0x03 -#define DCODE_TIMESVR 0x04 #define DCODE_DNS 0x06 #define DCODE_LPRSVR 0x09 #define DCODE_HOSTNAME 0x0c