summaryrefslogtreecommitdiff
path: root/programs/starter/confread.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2006-06-26 11:32:54 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2006-06-26 11:32:54 +0000
commit6782d06a206e8aa8304d4ec9518361aecd1b9472 (patch)
tree8ea2727105be2e0191d89f7a101f43ba8b59c810 /programs/starter/confread.c
parentaa0f5b38aec14428b4b80e06f90ff781f8bca5f1 (diff)
downloadvyos-strongswan-6782d06a206e8aa8304d4ec9518361aecd1b9472.tar.gz
vyos-strongswan-6782d06a206e8aa8304d4ec9518361aecd1b9472.zip
Load /tmp/tmp.dFxzTv5957/strongswan-2.7.2 into
branches/source-dist/debian/strongswan.
Diffstat (limited to 'programs/starter/confread.c')
-rw-r--r--programs/starter/confread.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/programs/starter/confread.c b/programs/starter/confread.c
index cf12d05ca..af0f00877 100644
--- a/programs/starter/confread.c
+++ b/programs/starter/confread.c
@@ -11,7 +11,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * RCSID $Id: confread.c,v 1.37 2006/04/17 19:35:07 as Exp $
+ * RCSID $Id: confread.c,v 1.38 2006/06/20 21:52:53 as Exp $
*/
#include <stddef.h>
@@ -31,6 +31,9 @@
#include "args.h"
#include "interfaces.h"
+/* strings containing a colon are interpreted as an IPv6 address */
+#define ip_version(string) (strchr(string, ':') != NULL)? AF_INET6 : AF_INET;
+
static const char ike_defaults[] = "3des-sha, 3des-md5";
static const char esp_defaults[] = "3des-sha1, 3des-md5";
@@ -166,8 +169,13 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
goto err;
}
}
- else if (streq(value,"%any"))
- {
+ else if (streq(value, "%any"))
+ {
+ anyaddr(conn->addr_family, &end->addr);
+ }
+ else if (streq(value, "%any6"))
+ {
+ conn->addr_family = AF_INET6;
anyaddr(conn->addr_family, &end->addr);
}
else if (value[0] == '%')
@@ -183,6 +191,7 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
}
else
{
+ conn->addr_family = ip_version(value);
ugh = ttoaddr(value, 0, conn->addr_family, &end->addr);
if (ugh != NULL)
{
@@ -203,10 +212,14 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
}
}
else if (streq(value, "%direct"))
+ {
ugh = anyaddr(conn->addr_family, &end->nexthop);
+ }
else
+ {
+ conn->addr_family = ip_version(value);
ugh = ttoaddr(value, 0, conn->addr_family, &end->nexthop);
-
+ }
if (ugh != NULL)
{
plog("# bad addr: %s=%s [%s]", name, value, ugh);
@@ -222,6 +235,7 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
else
{
end->has_client = TRUE;
+ conn->tunnel_addr_family = ip_version(value);
ugh = ttosubnet(value, 0, conn->tunnel_addr_family, &end->subnet);
if (ugh != NULL)
{
@@ -233,6 +247,7 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
case KW_SUBNETWITHIN:
end->has_client = TRUE;
end->has_client_wildcard = TRUE;
+ conn->tunnel_addr_family = ip_version(value);
ugh = ttosubnet(value, 0, conn->tunnel_addr_family, &end->subnet);
break;
case KW_PROTOPORT:
@@ -246,7 +261,8 @@ kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token
}
else
{
- ugh = ttoaddr(value, 0, conn->addr_family, &end->srcip);
+ conn->tunnel_addr_family = ip_version(value);
+ ugh = ttoaddr(value, 0, conn->tunnel_addr_family, &end->srcip);
if (ugh != NULL)
{
plog("# bad addr: %s=%s [%s]", name, value, ugh);