diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-03-04 19:58:44 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-03-04 19:58:44 +0000 |
commit | 49f8dbe67500265ce383da82c48065cb52184676 (patch) | |
tree | 3261c5997ce64793e31a572b787e4af20c753262 /sbin/ipsecadm/ipsecadm.c | |
parent | 1f35dffc8d00683e57728680047bb4e57287250d (diff) |
Fix -proto2 numeric protocol handling.
Diffstat (limited to 'sbin/ipsecadm/ipsecadm.c')
-rw-r--r-- | sbin/ipsecadm/ipsecadm.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sbin/ipsecadm/ipsecadm.c b/sbin/ipsecadm/ipsecadm.c index ddb1314f915..57cdf8453d9 100644 --- a/sbin/ipsecadm/ipsecadm.c +++ b/sbin/ipsecadm/ipsecadm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsecadm.c,v 1.12 1999/02/27 07:29:17 deraadt Exp $ */ +/* $OpenBSD: ipsecadm.c,v 1.13 1999/03/04 19:58:43 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -777,14 +777,26 @@ main(int argc, char **argv) } } else - proto2 = atoi(argv[i + 1]); - - if (proto2 != IPPROTO_ESP && proto2 != IPPROTO_AH && - proto2 != IPPROTO_IPIP) { - fprintf(stderr, - "%s: unknown security protocol2 %d\n", argv[0], proto); - exit(1); + proto2 = atoi(argv[i + 1]); + + if (proto2 != IPPROTO_ESP && proto2 != IPPROTO_AH && + proto2 != IPPROTO_IPIP) + { + fprintf(stderr, + "%s: unknown security protocol2 %d\n", + argv[0], proto2); + exit(1); + } + + if (proto2 == IPPROTO_ESP) + sprotocol.sadb_protocol_proto = SADB_SATYPE_ESP; + else + if (proto2 == IPPROTO_AH) + sprotocol.sadb_protocol_proto = SADB_SATYPE_AH; + else + if (proto2 == IPPROTO_IPIP) + sprotocol.sadb_protocol_proto = SADB_SATYPE_X_IPIP; } sprotocol.sadb_protocol_exttype = SADB_EXT_X_PROTOCOL; |