ADDRESS_MAX - strlen(addrbuf), "/%d", pf_key_v2_mask_to_bits((u_int32_t) * (addr + sizeof(struct in_addr))));
ADDRESS_MAX - strlen(addrbuf), "/%d", pf_key_v2_mask_to_bits(*(u_int32_t *)(addr + sizeof(struct in_addr))));
pf_key_v2_convert_id(u_int8_t * id, int idlen, size_t * reslen, int *idtype){	u_int8_t       *addr, *res = 0;	char            addrbuf[ADDRESS_MAX + 5];	switch (id[0]) {	case IPSEC_ID_FQDN:		res = calloc(idlen - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ,			     sizeof(u_int8_t));		if (!res)			return 0;		*reslen = idlen - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ;		memcpy(res, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ, *reslen);		*idtype = SADB_IDENTTYPE_FQDN;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: FQDN %.*s",			 (int) *reslen, res));		return res;	case IPSEC_ID_USER_FQDN:		res = calloc(idlen - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ,			     sizeof(u_int8_t));		if (!res)			return 0;		*reslen = idlen - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ;		memcpy(res, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ, *reslen);		*idtype = SADB_IDENTTYPE_USERFQDN;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: UFQDN %.*s",			 (int) *reslen, res));		return res;	case IPSEC_ID_IPV4_ADDR:	/* XXX CONNECTION ? */		if (inet_ntop(AF_INET, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ,			      addrbuf, ADDRESS_MAX) == NULL)			return 0;		*reslen = strlen(addrbuf) + 3;		strlcat(addrbuf, "/32", ADDRESS_MAX + 5);		res = (u_int8_t *) strdup(addrbuf);		if (!res)			return 0;		*idtype = SADB_IDENTTYPE_PREFIX;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: "		    "IPv4 address %s", res));		return res;	case IPSEC_ID_IPV6_ADDR:	/* XXX CONNECTION ? */		if (inet_ntop(AF_INET6,		    id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ,		    addrbuf, ADDRESS_MAX) == NULL)			return 0;		*reslen = strlen(addrbuf) + 4;		strlcat(addrbuf, "/128", ADDRESS_MAX + 5);		res = (u_int8_t *) strdup(addrbuf);		if (!res)			return 0;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: "		    "IPv6 address %s", res));		*idtype = SADB_IDENTTYPE_PREFIX;		return res;	case IPSEC_ID_IPV4_ADDR_SUBNET:	/* XXX PREFIX */		addr = id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ;		if (inet_ntop(AF_INET, addr, addrbuf, ADDRESS_MAX) == NULL)			return 0;		snprintf(addrbuf + strlen(addrbuf),		    ADDRESS_MAX - strlen(addrbuf),		    "/%d", pf_key_v2_mask_to_bits((u_int32_t)			* (addr + sizeof(struct in_addr))));		*reslen = strlen(addrbuf);		res = (u_int8_t *) strdup(addrbuf);		if (!res)			return 0;		*idtype = SADB_IDENTTYPE_PREFIX;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: "		    "IPv4 subnet %s", res));		return res;	case IPSEC_ID_IPV6_ADDR_SUBNET:	/* XXX PREFIX */		addr = id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ;		if (inet_ntop(AF_INET6, addr, addrbuf, ADDRESS_MAX) == NULL)			return 0;		snprintf(addrbuf + strlen(addrbuf),		    ADDRESS_MAX - strlen(addrbuf), "/%d",		    pf_key_v2_mask6_to_bits(addr +			sizeof(struct in6_addr)));		*reslen = strlen(addrbuf);		res = (u_int8_t *) strdup(addrbuf);		if (!res)			return 0;		LOG_DBG((LOG_SYSDEP, 40, "pf_key_v2_convert_id: "		    "IPv6 subnet %s", res));		*idtype = SADB_IDENTTYPE_PREFIX;		return res;	case IPSEC_ID_IPV4_RANGE:	case IPSEC_ID_IPV6_RANGE:	case IPSEC_ID_DER_ASN1_DN:	case IPSEC_ID_DER_ASN1_GN:	case IPSEC_ID_KEY_ID:		/* XXX Not implemented yet.  */		return 0;	}	return 0;}