diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-04-20 10:53:01 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-04-20 20:24:10 +0200 |
commit | c0de1f4f511106b4ed107778900835e1872a2b9b (patch) | |
tree | 37abcdbcf0e3dab852727fa90c88316dee0bf788 | |
parent | 40e29aec791295652bb0cfc3dda0a47499b71384 (diff) | |
download | ouroboros-c0de1f4f511106b4ed107778900835e1872a2b9b.tar.gz ouroboros-c0de1f4f511106b4ed107778900835e1872a2b9b.zip |
tools: Fix type check when bootstrapping ipcps
The type check failed incorrectly if the type was specified because
the specified type was not set.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
-rw-r--r-- | src/tools/irm/irm_ipcp_bootstrap.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c index 8c01569b..e1f75956 100644 --- a/src/tools/irm/irm_ipcp_bootstrap.c +++ b/src/tools/irm/irm_ipcp_bootstrap.c @@ -247,24 +247,26 @@ int do_bootstrap_ipcp(int argc, } } + if (ipcp_type != NULL) { + if (strcmp(ipcp_type, NORMAL) == 0) + type = IPCP_NORMAL; + else if (strcmp(ipcp_type, UDP) == 0) + type = IPCP_UDP; + else if (strcmp(ipcp_type, ETH_LLC) == 0) + type = IPCP_ETH_LLC; + else if (strcmp(ipcp_type, ETH_DIX) == 0) + type = IPCP_ETH_DIX; + else if (strcmp(ipcp_type, LOCAL) == 0) + type = IPCP_LOCAL; + else if (strcmp(ipcp_type, RAPTOR) == 0) + type = IPCP_RAPTOR; + else goto fail_usage; + } + if (pid == -1) { if (ipcp_type == NULL) { printf("No IPCPs matching %s found.\n\n", ipcp); goto fail; - } else { - if (strcmp(ipcp_type, NORMAL) == 0) - type = IPCP_NORMAL; - else if (strcmp(ipcp_type, UDP) == 0) - type = IPCP_UDP; - else if (strcmp(ipcp_type, ETH_LLC) == 0) - type = IPCP_ETH_LLC; - else if (strcmp(ipcp_type, ETH_DIX) == 0) - type = IPCP_ETH_DIX; - else if (strcmp(ipcp_type, LOCAL) == 0) - type = IPCP_LOCAL; - else if (strcmp(ipcp_type, RAPTOR) == 0) - type = IPCP_RAPTOR; - else goto fail_usage; } pid = irm_create_ipcp(ipcp, type); |