diff options
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/unbound.inc | 4 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 24 |
2 files changed, 19 insertions, 9 deletions
diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index dcf2e01..043ced2 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -171,11 +171,11 @@ EOF; $outgoing_interfaces = explode(",", $config['unbound']['outgoing_interface']); foreach ($outgoing_interfaces as $outif) { $outip = get_interface_ip($outif); - if (!is_null($outip)) { + if (is_ipaddr($outip)) { $outgoingints .= "outgoing-interface: $outip\n"; } $outip = get_interface_ipv6($outif); - if (!is_null($outip)) { + if (is_ipaddrv6($outip)) { $outgoingints .= "outgoing-interface: $outip\n"; } } diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index b328975..aaf7c09 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -823,23 +823,33 @@ EOD; } list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, 'local'); - if ($myid_type != 'address' && $myid_type != 'keyid') { + if ($myid_type != 'address' && $myid_type != 'keyid' && $myid_type != 'asn1dn') { $myid_data = "{$myid_type}:{$myid_data}"; + } elseif ($myid_type == "asn1dn" && !empty($myid_data)) { + if ($myid_data[0] == '#') { /* asn1dn needs double quotes */ - if ($myid_type == "asn1dn") { - $myid_data = '"' . $myid_data . '"'; + $myid_data = "\"{$myid_type}:{$myid_data}\""; + } else { + $myid_data = "\"{$myid_data}\""; } } + $leftid = ''; + if (!empty($myid_data)) { + $leftid = "leftid = {$myid_data}"; + } /* Only specify peer ID if we are not dealing with a mobile PSK-only tunnel */ $peerid_spec = ''; if (!isset($ph1ent['mobile'])) { list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, 'peer', $rgmap); - if ($peerid_type != 'address' && $peerid_type != 'keyid') { + if ($peerid_type != 'address' && $peerid_type != 'keyid' && $peerid_type != 'asn1dn') { $peerid_spec = "{$peerid_type}:{$peerid_data}"; + } elseif ($peerid_type == "asn1dn") { /* asn1dn needs double quotes */ - if ($peerid_type == "asn1dn") { - $peerid_spec = '"' . $peerid_spec . '"'; + if ($peerid_data[0] == '#') { + $peerid_spec = "\"{$peerid_type}:{$peerid_data}\""; + } elseif (!empty($peerid_data)) { + $peerid_spec = "\"{$peerid_data}\""; } } else { $peerid_spec = $peerid_data; @@ -1161,7 +1171,7 @@ EOD; auto = {$passive} left = {$left_spec} right = {$right_spec} - leftid = {$myid_data} + {$leftid} EOD; |