summaryrefslogtreecommitdiff
path: root/sbin/ipsec
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-08-01 06:17:16 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-08-01 06:17:16 +0000
commit4c98bb9a9fe04e29632ba2a981f10b791586f9ee (patch)
tree3def8f3db0ef22b30c58f3bd080b06ea10dcafdd /sbin/ipsec
parent47633be64bd7c31618d702a0cc76ee01330a502f (diff)
Forgot this already-documented addition: -proto/-proto2 can also take
"esp", "ah", and "ip4" as arguments (in addition to protocol numbers).
Diffstat (limited to 'sbin/ipsec')
-rw-r--r--sbin/ipsec/ipsecadm/ipsecadm.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/sbin/ipsec/ipsecadm/ipsecadm.c b/sbin/ipsec/ipsecadm/ipsecadm.c
index 29a980b694e..41ac468ab43 100644
--- a/sbin/ipsec/ipsecadm/ipsecadm.c
+++ b/sbin/ipsec/ipsecadm/ipsecadm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecadm.c,v 1.18 1998/08/01 06:12:20 angelos Exp $ */
+/* $OpenBSD: ipsecadm.c,v 1.19 1998/08/01 06:17:15 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -348,11 +348,35 @@ main(argc, argv)
dst2.s_addr = inet_addr(argv[i+1]);
i++;
} else if (!strcmp(argv[i]+1, "proto") && i+1 < argc) {
- proto = atoi(argv[i+1]);
+ if (isalpha(argv[i+1][0])) {
+ if (!strcasecmp(argv[i+1], "esp"))
+ proto = IPPROTO_ESP;
+ else if (!strcasecmp(argv[i+1], "ah"))
+ proto = IPPROTO_AH;
+ else if (!strcasecmp(argv[i+1], "ip4"))
+ proto = IPPROTO_IPIP;
+ else {
+ fprintf(stderr, "%s: unknown security protocol type %s\n", argv[0], argv[i+1]);
+ exit(1);
+ }
+ } else
+ proto = atoi(argv[i+1]);
i++;
} else if (!strcmp(argv[i]+1, "proto2") &&
iscmd(mode, GRP_SPI) && i+1 < argc) {
- proto2 = atoi(argv[i+1]);
+ if (isalpha(argv[i+1][0])) {
+ if (!strcasecmp(argv[i+1], "esp"))
+ proto2 = IPPROTO_ESP;
+ else if (!strcasecmp(argv[i+1], "ah"))
+ proto2 = IPPROTO_AH;
+ else if (!strcasecmp(argv[i+1], "ip4"))
+ proto2 = IPPROTO_IPIP;
+ else {
+ fprintf(stderr, "%s: unknown security protocol2 type %s\n", argv[0], argv[i+1]);
+ exit(1);
+ }
+ } else
+ proto2 = atoi(argv[i+1]);
i++;
} else if (!strcmp(argv[i]+1, "chain") && chain == 0 &&
iscmd(mode, DEL_SPI)) {