Project

General

Profile

Actions

Feature #6899

closed

Can't specify PPTP/L2TP gateway as FQDN

Added by Luka Pavlyuk about 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Interfaces
Target version:
Start date:
11/05/2016
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:

Description

Actually I don't know that's a bug report or a feature request actually.
Nevertheless I'm using the following workaround to fix this issue:
in file /etc/inc/interfaces.inc
in function interface_ppps_configure($interface)
there is the solution code snippet

            case "pptp":
            case "l2tp":
                /* configure interface */
                if (is_ipaddr($localips[$pid])) {
                    // Manually configure interface IP/subnet
                    pfSense_interface_setaddress($port, "{$localips[$pid]}/{$subnets[$pid]}");
                    interfaces_bring_up($port);
                } else if (empty($localips[$pid])) {
                    $localips[$pid] = get_interface_ip($port); // try to get the interface IP from the port
                }

                if (!is_ipaddr($localips[$pid])) {
                    log_error(sprintf(gettext("Could not get a Local IP address for PPTP/L2TP link on %s in interfaces_ppps_configure. Using 0.0.0.0 ip!"), $port));
                    $localips[$pid] = "0.0.0.0";
                }
                if(!$g['booting'] && !is_ipaddr($gateways[$pid]) && is_hostname($gateways[$pid])){
                    $gateways[$pid] = gethostbyname($gateways[$pid]);
                }
                if (!is_ipaddr($gateways[$pid])) {
                    log_error(sprintf(gettext('Could not get a PPTP/L2TP Remote IP address from %1$s for %2$s in interfaces_ppps_configure.'), $dhcp_gateway, $gway));
                    return 0;
                }
                pfSense_ngctl_attach(".", $port);
                break;

As you can see, the code
                if(!$g['booting'] && !is_ipaddr($gateways[$pid]) && is_hostname($gateways[$pid])){
                    $gateways[$pid] = gethostbyname($gateways[$pid]);
                }

is written and inserted by me - the goal is to resolve L2TP server name if the one is specified and use it as PPTP/L2TP gateway to connect to the Internet (Yes, my ISP provides access to the Internet via L2TP connection and uses dynamic IP L2TP server for this purpose).
This workaround works flawless.
Maybe this should help you to fix this misconception.


Files

interfaces.inc (177 KB) interfaces.inc Solution Luka Pavlyuk, 11/05/2016 12:43 PM
Actions

Also available in: Atom PDF