Project

General

Profile

Feature #6899

Can't specify PPTP/L2TP gateway as FQDN

Added by Luka Pavlyuk 11 months ago. Updated 7 months ago.

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

100%


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.

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

Associated revisions

Revision c766ac7d
Added by Luka Pavlyuk 11 months ago

Fix #6899

Revision b20a6d67
Added by Luka Pavlyuk 11 months ago

Fix #6899

(cherry picked from commit c766ac7dd723f6e36980c48b0dd156b492556616)

Revision 35d393f0
Added by Jim Pingle 9 months ago

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

History

#1 Updated by Jim Pingle 11 months 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: https://doc.pfsense.org/index.php/How_can_I_get_a_feature_added

#2 Updated by Renato Botelho 11 months 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 9 months 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 9 months ago

  • Status changed from Assigned to Feedback

#5 Updated by Jim Pingle 9 months 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 7 months ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF