summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhshoexer <hshoexer@openbsd.org>2005-07-07 21:00:07 +0000
committerhshoexer <hshoexer@openbsd.org>2005-07-07 21:00:07 +0000
commita5b7e7776e222909922d5c0927957a39476aca5d (patch)
tree82b83e7e77316127653f96a6c26d7adc2ea1db6f
parentMake Fractional T1 work, reported and tested by Greg Mortensen, (diff)
downloadwireguard-openbsd-a5b7e7776e222909922d5c0927957a39476aca5d.tar.xz
wireguard-openbsd-a5b7e7776e222909922d5c0927957a39476aca5d.zip
add type for rules; will need this for tcpmd5
-rw-r--r--sbin/ipsecctl/ipsecctl.c6
-rw-r--r--sbin/ipsecctl/ipsecctl.h5
-rw-r--r--sbin/ipsecctl/parse.y6
3 files changed, 13 insertions, 4 deletions
diff --git a/sbin/ipsecctl/ipsecctl.c b/sbin/ipsecctl/ipsecctl.c
index 7dc05e7f403..5f42601b3a2 100644
--- a/sbin/ipsecctl/ipsecctl.c
+++ b/sbin/ipsecctl/ipsecctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecctl.c,v 1.13 2005/06/30 19:13:57 hshoexer Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.14 2005/07/07 21:00:07 hshoexer Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@@ -187,6 +187,7 @@ ipsecctl_print_addr(struct ipsec_addr *ipa)
void
ipsecctl_print_rule(struct ipsec_rule *r, int opts)
{
+ static const char *rule[] = {"?", "flow", "tcpmd5"};
static const char *direction[] = {"?", "in", "out"};
static const char *type[] = {"?", "use", "acquire", "require", "deny",
"bypass", "dontacq"};
@@ -196,7 +197,8 @@ ipsecctl_print_rule(struct ipsec_rule *r, int opts)
if (opts & IPSECCTL_OPT_VERBOSE2)
printf("@%d ", r->nr);
- printf("flow %s %s", proto[r->proto], direction[r->direction]);
+ printf("%s %s %s", rule[r->type], proto[r->proto],
+ direction[r->direction]);
printf(" from ");
ipsecctl_print_addr(r->src);
printf(" to ");
diff --git a/sbin/ipsecctl/ipsecctl.h b/sbin/ipsecctl/ipsecctl.h
index f9609f7416c..f84075125ad 100644
--- a/sbin/ipsecctl/ipsecctl.h
+++ b/sbin/ipsecctl/ipsecctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecctl.h,v 1.7 2005/06/30 19:05:27 hshoexer Exp $ */
+/* $OpenBSD: ipsecctl.h,v 1.8 2005/07/07 21:00:08 hshoexer Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@@ -29,6 +29,9 @@
#define IPSECCTL_OPT_DELETE 0x0200
enum {
+ RULE_UNKNOWN, RULE_FLOW, RULE_TCPMD5
+};
+enum {
DIRECTION_UNKNOWN, IPSEC_IN, IPSEC_OUT, IPSEC_INOUT
};
enum {
diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y
index 2da33fac2a5..339e46a2f22 100644
--- a/sbin/ipsecctl/parse.y
+++ b/sbin/ipsecctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.4 2005/05/25 16:31:22 hshoexer Exp $ */
+/* $OpenBSD: parse.y,v 1.5 2005/07/07 21:00:08 hshoexer Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -664,6 +664,8 @@ create_rule(u_int8_t dir, struct ipsec_addr *src, struct ipsec_addr *dst,
else
r->direction = dir;
+ r->type = RULE_FLOW;
+
r->src = src;
r->dst = dst;
@@ -715,6 +717,8 @@ reverse_rule(struct ipsec_rule *rule)
reverse = calloc(1, sizeof(struct ipsec_rule));
if (reverse == NULL)
err(1, "calloc");
+
+ reverse->type = RULE_FLOW;
if (rule->direction == (u_int8_t)IPSEC_OUT)
reverse->direction = (u_int8_t)IPSEC_IN;