+
+ }
+
+ /* check configured peers identifier against cert IDs */
+ /* allows checking of specified ID against multiple ids in the cert */
+ /* such as multiple domain names */
+ if (iph1->rmconf->cert_verification_option == VERIFICATION_OPTION_PEERS_IDENTIFIER) {
+ u_int8_t doi_type = 255;
+ void *peers_id = NULL;
+ int peers_id_len = 0;
+
+ if (iph1->rmconf->idvtype_p == IDTYPE_ADDRESS) {
+ switch (((struct sockaddr *)(iph1->rmconf->idv_p->v))->sa_family) {
+ case AF_INET:
+ doi_type = IPSECDOI_ID_IPV4_ADDR;
+ peers_id_len = sizeof(struct in_addr);
+ peers_id = &(((struct sockaddr_in *)(iph1->rmconf->idv_p->v))->sin_addr.s_addr);
+ break;
+#ifdef INET6
+ case AF_INET6:
+ doi_type = IPSECDOI_ID_IPV6_ADDR;
+ peers_id_len = sizeof(struct in6_addr);
+ peers_id = &(((struct sockaddr_in6 *)(iph1->rmconf->idv_p->v))->sin6_addr.s6_addr);
+ break;
+#endif
+ default:
+ plog(LLV_ERROR, LOCATION, NULL,
+ "unknown address type for peers identifier.\n");
+ return ISAKMP_NTYPE_AUTHENTICATION_FAILED;
+ break;
+ }
+
+ } else {
+ doi_type = idtype2doi(iph1->rmconf->idvtype_p);
+ peers_id = iph1->rmconf->idv_p->v;
+ peers_id_len = iph1->rmconf->idv_p->l;
+ }
+
+ if ((error = oakley_check_certid(doi_type, peers_id_len,
+ peers_id, iph1->cert_p)) != 0)
+ return error;