summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/eth/eth.c4
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index 9bbadf91..90143d2f 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -1106,6 +1106,10 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf)
memcpy(ifr.ifr_name, conf->dev, strlen(conf->dev));
#ifdef BUILD_ETH_DIX
+ if (conf->ethertype < 0x0600 || conf->ethertype == 0xFFFF) {
+ log_err("Invalid Ethertype.");
+ return -1;
+ }
eth_data.ethertype = htons(conf->ethertype);
#endif
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index 9a0a30ec..4eeedbd3 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -182,11 +182,17 @@ int do_bootstrap_ipcp(int argc,
} else if (matches(*argv, "device") == 0) {
dev = *(argv + 1);
} else if (matches(*argv, "ethertype") == 0) {
- /* NOTE: We might do some checks on this. */
+ /* NOTE: We might do some more checks on strtol. */
if (matches(*(argv + 1), "0x") == 0)
ethertype = strtol(*(argv + 1), NULL, 0);
else
ethertype = strtol(*(argv + 1), NULL, 16);
+ if (ethertype < 0x0600 || ethertype == 0xFFFF) {
+ printf("Invalid Ethertype: \"%s\".\n"
+ "Recommended range: 0xA000-0xEFFF.\n",
+ *(argv + 1));
+ return -1;
+ }
} else if (matches(*argv, "addr") == 0) {
addr_size = atoi(*(argv + 1));
} else if (matches(*argv, "eid") == 0) {