diff --git a/ndhc/ifch_proto.h b/ndhc/ifch_proto.h deleted file mode 100644 index 91cb2cc..0000000 --- a/ndhc/ifch_proto.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef NJK_IFCH_PROTO_H__ -#define NJK_IFCH_PROTO_H__ 1 - -#define CMD_IP4SET "ip4" -#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" -#define CMD_NULL "NULL" - -#endif diff --git a/ndhc/ifchange.c b/ndhc/ifchange.c index 00cbb92..09d7feb 100644 --- a/ndhc/ifchange.c +++ b/ndhc/ifchange.c @@ -43,7 +43,6 @@ #include "io.h" #include "strl.h" #include "ifchange.h" -#include "ifch_proto.h" static struct dhcpmsg cfg_packet; // Copy of the current configuration packet. @@ -126,6 +125,18 @@ static int ifchd_cmd_bytes(char *buf, size_t buflen, char *optname, return (buf - obuf) + optlen + 1; } +#define CMD_ROUTER "routr" +#define CMD_IP4SET "ip4" +#define CMD_DNS "dns" +#define CMD_LPRSVR "lpr" +#define CMD_NTPSVR "ntp" +#define CMD_WINS "wins" +#define CMD_HOSTNAME "host" +#define CMD_DOMAIN "dom" +#define CMD_TIMEZONE "tzone" +#define CMD_MTU "mtu" +#define CMD_IPTTL "ipttl" +#define CMD_NULL "NULL" #define IFCHD_SW_CMD(x, y) case DCODE_##x: \ optname = CMD_##x; \ dofn = ifchd_cmd_##y; \ @@ -136,16 +147,16 @@ static int ifchd_cmd(char *buf, size_t buflen, uint8_t *optdata, int (*dofn)(char *, size_t, char *, uint8_t *, ssize_t); char *optname; switch (code) { + IFCHD_SW_CMD(ROUTER, ip); IFCHD_SW_CMD(DNS, iplist); IFCHD_SW_CMD(LPRSVR, iplist); IFCHD_SW_CMD(NTPSVR, iplist); IFCHD_SW_CMD(WINS, iplist); - IFCHD_SW_CMD(ROUTER, ip); - IFCHD_SW_CMD(TIMEZONE, s32); IFCHD_SW_CMD(HOSTNAME, bytes); IFCHD_SW_CMD(DOMAIN, bytes); - IFCHD_SW_CMD(IPTTL, u8); + IFCHD_SW_CMD(TIMEZONE, s32); IFCHD_SW_CMD(MTU, u16); + IFCHD_SW_CMD(IPTTL, u8); default: log_line("Invalid option code (%c) for ifchd cmd.", code); return -1; diff --git a/ndhc/ifchd-parse.rl b/ndhc/ifchd-parse.rl index bc4f8ff..107dee9 100644 --- a/ndhc/ifchd-parse.rl +++ b/ndhc/ifchd-parse.rl @@ -33,7 +33,6 @@ #include "ifchd-parse.h" #include "ifchd.h" #include "log.h" -#include "ifch_proto.h" #include "strl.h" #include "ifset.h" diff --git a/ndhc/ifchd.c b/ndhc/ifchd.c index 5b45cde..014d62c 100644 --- a/ndhc/ifchd.c +++ b/ndhc/ifchd.c @@ -51,7 +51,6 @@ #include "chroot.h" #include "pidfile.h" #include "signals.h" -#include "ifch_proto.h" #include "ifchd-parse.h" #include "strl.h" #include "cap.h" diff --git a/ndhc/ifset.c b/ndhc/ifset.c index 4838205..2cef4be 100644 --- a/ndhc/ifset.c +++ b/ndhc/ifset.c @@ -51,7 +51,6 @@ #include "ifchd.h" #include "ndhc.h" #include "log.h" -#include "ifch_proto.h" #include "strl.h" #include "nl.h" diff --git a/ndhc/options.c b/ndhc/options.c index bc98185..7bfc29f 100644 --- a/ndhc/options.c +++ b/ndhc/options.c @@ -33,9 +33,6 @@ #include "options.h" #include "log.h" -#ifndef NDHS_BUILD -#include "ifch_proto.h" -#endif static int do_overload_value(uint8_t *buf, ssize_t blen, int overload) {