/* return interfaces bind to this port */
             $bind_list = used_bind_list($_POST['port']);
             if ($_POST['bind_iface'] == "all" || in_array("all", $bind_list) || in_array($_POST['bind_iface'], $bind_list)) {
                 /* binding in use */
                 $input_errors[] = "OpenVPN binding already in use by another OpenVPN daemon.";
             }
         }
     }
 } else {
     /* Creating a new entry */
     $ovpnent = array();
     /* port number syntactically valid, so lets check, if it is free */
     if ($_POST['port']) {
         /* new port number */
         $bind_list = used_bind_list($_POST['port']);
         if (in_array($_POST['port'], used_port_list())) {
             /* port in use, check binding */
             if ($_POST['bind_iface'] == "all" || in_array("all", $bind_list) || in_array($_POST['bind_iface'], $bind_list)) {
                 /* binding in use */
                 $input_errors[] = "Port {$_POST['port']} is already used for another interface.";
             }
         }
     }
     if (!($ovpnent['tun_iface'] = getnxt_if($_POST['type']))) {
         $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
     }
     /* double bridging? */
     if ($ovpnent['bridge'] != $_POST['bridge']) {
         /* double bridging? */
         if ($_POST['bridge'] && $_POST['type'] == "tap" && $_POST['authentication_method'] == "rsasig") {
             $retval = check_bridging($_POST['bridge']);
         for ($i = 0; isset($config['ovpn']['client']['tunnel'][$i]); $i++) {
             $current =& $config['ovpn']['client']['tunnel'][$i];
             if ($current['sport'] == $_POST['sport']) {
                 if ($current['proto'] == $_POST['proto']) {
                     $input_errors[] = "You already have this combination for port and protocol settings. You can't use it twice";
                 }
             }
         }
     }
     /* Test Server type hasn't changed */
     if ($ovpnent['type'] != $_POST['type']) {
         $input_errors[] = "Delete this interface first before changing the type of the tunnel to " . strtoupper($_POST['type']) . ".";
     }
     if (!isset($ovpnent['enable']) && !isset($_POST['disabled'])) {
         /* check if port number is free, else choose another one */
         if (in_array($ovpnent['cport'], used_port_list())) {
             $ovpnent['cport'] = getnxt_port();
         }
     }
 } else {
     /* Creating a new entry */
     $ovpnent = array();
     if (!($ovpnent['if'] = getnxt_if($_POST['type']))) {
         $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
     }
     $ovpnent['cport'] = getnxt_port();
     /* double bridging? */
     if ($_POST['bridge'] && $_POST['type'] == "tap" && $_POST['authentication_method'] == "rsasig") {
         $retval = check_bridging($_POST['bridge']);
         if (!empty($retval)) {
             $input_errors[] = $retval;