diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2008-11-14 23:16:38 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2008-11-14 23:16:38 +0000 |
commit | c5aa8399ba613ea117909086961c3fb859ae041e (patch) | |
tree | de27fdaefb85cc14397da94945189471bf57c633 | |
parent | 825ee4f92811c4211aa92a725c40869ad6f885de (diff) |
When parsing v4 addresses mark them as network addresses
(IPV4_ADDR_SUBNET) when they contain a '/'.
This allows to choose between IPV4_ADDR and IPV4_ADDR_SUBNET by adding
"/32", ie. "a.b.c.d" vs. "a.b.c.d/32". This helps to interop with other
IKE implementations.
From Mitja Muzenic <mitja at muzenic dot net>, thanks!
Idea supported by markus@ and jdixon@.
-rw-r--r-- | sbin/ipsecctl/parse.y | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index bc2df9d18ee..39cbb5d3fc4 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.139 2008/10/17 14:33:15 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.140 2008/11/14 23:16:37 hshoexer Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1576,7 +1576,7 @@ host_v4(const char *s, int mask) ipa->tail = ipa; set_ipmask(ipa, bits); - if (bits != (ipa->af == AF_INET ? 32 : 128)) + if (strrchr(s, '/') != NULL) ipa->netaddress = 1; return (ipa); |