summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_ipcp_bootstrap.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-03-11 10:30:30 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-03-12 10:32:17 +0100
commit6a4151baa8231cdaf746761fd8dc4aacb895c9e5 (patch)
tree5d9bf738c4fcf0463e207940011834bc51aaba56 /src/tools/irm/irm_ipcp_bootstrap.c
parent103e9d80b2970b4e8fc1f45d3bf48d95b8937d6a (diff)
downloadouroboros-6a4151baa8231cdaf746761fd8dc4aacb895c9e5.tar.gz
ouroboros-6a4151baa8231cdaf746761fd8dc4aacb895c9e5.zip
ipcpd: Add validity checks for eth-dix
This will check if the Ethertype value is a valid Ethertype in the irm tool and the eth-dix IPCPd. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/tools/irm/irm_ipcp_bootstrap.c')
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c8
1 files changed, 7 insertions, 1 deletions
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) {