Migrating from isakmpd to iked: interface name not recognized

Previous thread: Re: easy snapshot updates by Ahlsen-Girard, Edward F CTR USAF AFSOC AFSOC/A6OK on Monday, December 13, 2010 - 7:51 am. (1 message)

Next thread: C++ CGI script by Jean-Francois on Monday, December 13, 2010 - 2:18 pm. (8 messages)
From: Axel Rau
Date: Monday, December 13, 2010 - 10:50 am

Hi all,

in the man page for iked.conf, I read:
"Addresses can be specified in CIDR notation (matching netblocks), as
symbolic host names, interface names, or interface group names."

In my iked.conf, I have
        local pppoe0
but iked -vn complains:
	no IP address found for pppoe0
	/etc/iked.conf: 26: could not parse host specification
.
	ifconfig pppoe0 | grep inet
shows:
	inet 79.243.41.99 --> 87.186.224.28 netmask 0xffffffff

Clueless: Axel
---
axel.rau@chaos1.de  PGP-Key:29E99DD6  +49 151 2300 9283  computing @
chaos claudius

From: Axel Rau
Date: Tuesday, December 14, 2010 - 5:26 am

This happens with all devices, I have tried.
Anybody succeeded in using an interface name as argument of option
local?

This is 4.8 stable on i386 generic.

Axel
---
axel.rau@chaos1.de  PGP-Key:29E99DD6  +49 151 2300 9283  computing @
chaos claudius

From: Mike Belopuhov
Date: Tuesday, December 14, 2010 - 9:23 am

iked is still in the works.  you shouldn't try to migrate to it unless
you can come up with fixes for such problems yourself.

mask2prefixlen functions are taken from bgpd.  OK?

Index: parse.y
===================================================================
RCS file: /home/cvs/src/sbin/iked/parse.y,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 parse.y
--- parse.y	17 Nov 2010 16:43:45 -0000	1.14
+++ parse.y	14 Dec 2010 15:57:27 -0000
@@ -266,6 +266,8 @@ struct ipsec_addr_wrap	*host_v4(const ch
 struct ipsec_addr_wrap	*host_dns(const char *, int);
 struct ipsec_addr_wrap	*host_if(const char *, int);
 struct ipsec_addr_wrap	*host_any(void);
+u_int8_t		 mask2prefixlen(struct sockaddr_in *);
+u_int8_t		 mask2prefixlen6(struct sockaddr_in6 *);
 void			 ifa_load(void);
 int			 ifa_exists(const char *);
 struct ipsec_addr_wrap	*ifa_lookup(const char *ifa_name);
@@ -1712,6 +1714,65 @@ host_any(void)
 	return (ipa);
 }
 
+u_int8_t
+mask2prefixlen(struct sockaddr_in *sa_in)
+{
+	in_addr_t ina = sa_in->sin_addr.s_addr;
+
+	if (ina == 0)
+		return (0);
+	else
+		return (33 - ffs(ntohl(ina)));
+}
+
+u_int8_t
+mask2prefixlen6(struct sockaddr_in6 *sa_in6)
+{
+	u_int8_t	 l = 0, *ap, *ep;
+
+	/*
+	 * sin6_len is the size of the sockaddr so substract the offset of
+	 * the possibly truncated sin6_addr struct.
+	 */
+	ap = (u_int8_t *)&sa_in6->sin6_addr;
+	ep = (u_int8_t *)sa_in6 + sa_in6->sin6_len;
+	for (; ap < ep; ap++) {
+		/* this "beauty" is adopted from sbin/route/show.c ... */
+		switch (*ap) {
+		case 0xff:
+			l += 8;
+			break;
+		case 0xfe:
+			l += 7;
+			return (l);
+		case 0xfc:
+			l += 6;
+			return (l);
+		case 0xf8:
+			l += 5;
+			return (l);
+		case 0xf0:
+			l += 4;
+			return (l);
+		case 0xe0:
+			l += 3;
+			return (l);
+		case 0xc0:
+			l += 2;
+			return (l);
+		case 0x80:
+			l += 1;
+			return (l);
+		case 0x00:
+			return (l);
+		default:
+			fatalx("non continguous inet6 netmask");
+		}
+	}
+
+	return ...
From: Axel Rau
Date: Tuesday, December 14, 2010 - 10:58 am

Thanks, Axel
---
axel.rau@chaos1.de  PGP-Key:29E99DD6  +49 151 2300 9283  computing @
chaos claudius

Previous thread: Re: easy snapshot updates by Ahlsen-Girard, Edward F CTR USAF AFSOC AFSOC/A6OK on Monday, December 13, 2010 - 7:51 am. (1 message)

Next thread: C++ CGI script by Jean-Francois on Monday, December 13, 2010 - 2:18 pm. (8 messages)