Feature #6899

Can't specify PPTP/L2TP gateway as FQDN

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

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


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

Associated revisions

Revision c766ac7d (diff)
Added by Luka Pavlyuk over 4 years ago

Fix #6899

Revision b20a6d67 (diff)
Added by Luka Pavlyuk over 4 years ago

Fix #6899

(cherry picked from commit c766ac7dd723f6e36980c48b0dd156b492556616)

Revision 35d393f0 (diff)
Added by Jim Pingle over 4 years ago

Change type of L2TP/PPTP WAN remote address to 'text' as it supports hostnames now, and the 'V4' type rejects them. Fixes #6899


#1 Updated by Jim Pingle over 4 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:

#2 Updated by Renato Botelho over 4 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!

#3 Updated by Jim Pingle over 4 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.

#4 Updated by Jim Pingle over 4 years ago

  • Status changed from Assigned to Feedback

#5 Updated by Jim Pingle over 4 years ago

  • Status changed from Feedback to Resolved

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

#6 Updated by Jim Pingle about 4 years ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF