summaryrefslogtreecommitdiff
path: root/sbin/ipsecctl/parse.y
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-08-02 15:47:26 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-08-02 15:47:26 +0000
commitd44a12eee424bb76951bb2aa982e858e59d21eac (patch)
treeb60a7997e2d90f7320389fdd5765fc1d5075b9b8 /sbin/ipsecctl/parse.y
parent036e467c67c26048b55e5d32264de43c498c6140 (diff)
Make use of struct ipsec_auth dynamic.
Do not pass IDs to kernel when deleting flows.
Diffstat (limited to 'sbin/ipsecctl/parse.y')
-rw-r--r--sbin/ipsecctl/parse.y28
1 files changed, 17 insertions, 11 deletions
diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y
index eda3e4354ff..a1a1cf245dd 100644
--- a/sbin/ipsecctl/parse.y
+++ b/sbin/ipsecctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.14 2005/07/24 12:11:49 hshoexer Exp $ */
+/* $OpenBSD: parse.y,v 1.15 2005/08/02 15:47:25 hshoexer Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -918,11 +918,14 @@ create_flow(u_int8_t dir, struct ipsec_addr *src, struct ipsec_addr *dst,
r->peer = peer;
r->proto = proto;
- r->auth.srcid = srcid;
- r->auth.dstid = dstid;
- r->auth.idtype = ID_FQDN; /* XXX For now only FQDN. */
+ r->auth = calloc(1, sizeof(struct ipsec_auth));
+ if (r->auth == NULL)
+ err(1, "calloc");
+ r->auth->srcid = srcid;
+ r->auth->dstid = dstid;
+ r->auth->idtype = ID_FQDN; /* XXX For now only FQDN. */
#ifdef notyet
- r->auth.type = authtype;
+ r->auth->type = authtype;
#endif
return r;
@@ -963,14 +966,17 @@ reverse_rule(struct ipsec_rule *rule)
reverse->peer = copyhost(rule->peer);
reverse->proto = (u_int8_t)rule->proto;
- if (rule->auth.dstid && (reverse->auth.dstid =
- strdup(rule->auth.dstid)) == NULL)
+ reverse->auth = calloc(1, sizeof(struct ipsec_auth));
+ if (reverse->auth == NULL)
+ err(1, "calloc");
+ if (rule->auth->dstid && (reverse->auth->dstid =
+ strdup(rule->auth->dstid)) == NULL)
err(1, "strdup");
- if (rule->auth.srcid && (reverse->auth.srcid =
- strdup(rule->auth.srcid)) == NULL)
+ if (rule->auth->srcid && (reverse->auth->srcid =
+ strdup(rule->auth->srcid)) == NULL)
err(1, "strdup");
- reverse->auth.idtype = rule->auth.idtype;
- reverse->auth.type = rule->auth.type;
+ reverse->auth->idtype = rule->auth->idtype;
+ reverse->auth->type = rule->auth->type;
return reverse;
}