diff options
Diffstat (limited to 'programs/starter/confread.c')
-rw-r--r-- | programs/starter/confread.c | 26 |
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); |