Projet

Général

Profil

« Précédent | Suivant » 

Révision 95589abd

Ajouté par jim-p il y a presque 10 ans

Move duplicated code into a function; Include local ID on mobile tunnel key line in ipsec.secrets.

Voir les différences:

etc/inc/ipsec.inc
669 669
		return $ipaddr;
670 670
}
671 671

  
672
function ipsec_find_id(& $ph1ent, $side = "local", $rgmap = array()) {
673
	if ($side == "local") {
674
		$id_type = $ph1ent['myid_type'];
675
		$id_data = $ph1ent['myid_data'];
676

  
677
		$addr = ipsec_get_phase1_src($ph1ent);
678
		if (!$addr)
679
			return array();
680
	} elseif ($side = "peer") {
681
		$id_type = $ph1ent['peerid_type'];
682
		$id_data = $ph1ent['peerid_data'];
683

  
684
		if (isset($ph1ent['mobile']))
685
			$addr = "%any";
686
		else
687
			$addr = $ph1ent['remote-gateway'];
688
	} else {
689
		return array();
690
	}
691

  
692

  
693
	$thisid_type = $id_type;
694
	switch ($thisid_type) {
695
	case "myaddress":
696
		$thisid_type = "address";
697
		$thisid_data = $addr;
698
		break;
699

  
700
	case "dyn_dns":
701
		$thisid_type = "address";
702
		$thisid_data = resolve_retry($id_data);
703
		break;
704

  
705
	case "peeraddress":
706
		$thisid_type = "address";
707
		$thisid_data = $rgmap[$ph1ent['remote-gateway']];
708
		break;
709

  
710
	case "address";
711
		$thisid_data = $id_data;
712
		break;
713

  
714
	case "fqdn";
715
	case "keyid tag";
716
	case "user_fqdn";
717
	case "asn1dn";
718
		$thisid_data = $id_data;
719
		if( $thisid_data )
720
			$thisid_data = "{$thisid_data}";
721
		break;
722
	}
723
	return array($thisid_type, $thisid_data);
724
}
672 725
?>

Formats disponibles : Unified diff