Feature #6899


Can't specify PPTP/L2TP gateway as FQDN

Added by Luka Pavlyuk over 7 years ago. Updated about 7 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Plus Target Version:
Release Notes:


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/
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]}");
                } 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 ip!"), $port));
                    $localips[$pid] = "";
                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);

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 (177 KB) Solution Luka Pavlyuk, 11/05/2016 12:43 PM
Actions #1

Updated by Jim Pingle over 7 years ago

  • Tracker changed from Bug to Feature
  • Status changed from New to Needs Patch
  • Assignee set to Luka Pavlyuk

Thanks for the proposal. This would be considered a feature request (I changed the type for you). Code submissions should be done on github in the form of a pull request. See option #1 here:

Actions #2

Updated by Renato Botelho over 7 years ago

  • Status changed from Needs Patch to Feedback
  • Assignee changed from Luka Pavlyuk to Renato Botelho
  • Target version set to 2.4.0
  • % Done changed from 0 to 100

Pull request has been merged. Thanks!

Actions #3

Updated by Jim Pingle about 7 years ago

  • Status changed from Feedback to Assigned
  • Assignee changed from Renato Botelho to Jim Pingle

The JS input validation still rejects hostnames on the page. I'll push a fix shortly.

Actions #4

Updated by Jim Pingle about 7 years ago

  • Status changed from Assigned to Feedback
Actions #5

Updated by Jim Pingle about 7 years ago

  • Status changed from Feedback to Resolved

Works as expected with that last commit, when the client can resolve the hostname it connects.

Actions #6

Updated by Jim Pingle about 7 years ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF