Project

General

Profile

Actions

Feature #1086

closed

[patch] CARP IPs as outer source addressed for GRE and GIF tunnels

Added by Fulvio Scapin over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Interfaces
Target version:
Start date:
12/09/2010
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:

Description

I applied the code from the ipsec/openvpn interface lists to include CARP VIP interfaces as outer source addresses for GRE/GIF interfaces.
It is of high importance in order to tunnel dynamic routing information exchanges.
The patch is as follows.

diff --git a/usr/local/www/interfaces_gif_edit.php b/usr/local/www/interfaces_gif_edit.php
index efbf036..e66bbc5 100644
--- a/usr/local/www/interfaces_gif_edit.php
+++ b/usr/local/www/interfaces_gif_edit.php
@@ -136,6 +136,9 @@ include("head.inc");
                     <select name="if" class="formselect">
                       <?php
                                                $portlist = get_configured_interface_with_descr();
+                                               $carplist = get_configured_carp_interface_list();
+                                               foreach ($carplist as $cif => $carpip)
+                                                       $portlist[$cif] = $carpip." (".get_vip_descr($carpip).")";
                                                foreach ($portlist as $ifn => $ifinfo) {
                                                        echo "<option value=\"{$ifn}\"";
                                                        if ($ifn == $pconfig['if'])
diff --git a/usr/local/www/interfaces_gre_edit.php b/usr/local/www/interfaces_gre_edit.php
index f0f0a84..ce9f324 100644
--- a/usr/local/www/interfaces_gre_edit.php
+++ b/usr/local/www/interfaces_gre_edit.php
@@ -139,6 +139,9 @@ include("head.inc");
                     <select name="if" class="formselect">
                       <?php
                                                $portlist = get_configured_interface_with_descr();
+                                               $carplist = get_configured_carp_interface_list();
+                                               foreach ($carplist as $cif => $carpip)
+                                                       $portlist[$cif] = $carpip." (".get_vip_descr($carpip).")";
                                                foreach ($portlist as $ifn => $ifinfo) {
                                                        echo "<option value=\"{$ifn}\"";
                                                        if ($ifn == $pconfig['if'])

The code is also present in the repository/branch trantorvega-clone/carp_tunnels at rcs.pfsense.org

PS I've been told that the "merge requests" feature at rcs.pfsense.org was broken. Is that still the case?

Actions #1

Updated by Chris Buechler over 13 years ago

  • Target version set to 2.0
Actions #3

Updated by Fulvio Scapin over 13 years ago

Forgot to add the patch to visualise CARP IPs/Parent Interfaces in the GRE/GIF interfaces summary

diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php
index 7134225..c88223d 100644
--- a/usr/local/www/interfaces_gif.php
+++ b/usr/local/www/interfaces_gif.php
@@ -111,7 +111,18 @@ include("head.inc");
                          <?php $i = 0; foreach ($a_gifs as $gif): ?>
                 <tr  ondblclick="document.location='interfaces_gif_edit.php?id=<?=$i;?>'">
                   <td class="listlr">
-                                       <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']));?>
+                                       <?php
+                        $valori = array();
+                        if ( preg_match('/vip([0-9]+)/',$gif['if'],&$valori) )
+                        {
+                            foreach ($config['virtualip']['vip'] as $vip) {
+                                if (($vip['mode'] == "carp" || $vip['mode'] == "carpdev") and $vip['vhid'] == $valori[1])
+                                    echo strtoupper($gif['if']) . " CARP " . strtoupper($vip['interface']) . " " . $vip['subnet'];
+                            }
+                        } else {
+                            echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']));
+                        }
+                    ?>
                   </td>
                   <td class="listr">
                                        <?=htmlspecialchars($gif['remote-addr']);?>
diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php
index c9fa525..07cf22e 100644
--- a/usr/local/www/interfaces_gre.php
+++ b/usr/local/www/interfaces_gre.php
@@ -112,7 +112,18 @@ include("head.inc");
                          <?php $i = 0; foreach ($a_gres as $gre): ?>
                 <tr  ondblclick="document.location='interfaces_vlan_gre.php?id=<?=$i;?>'">
                   <td class="listlr">
-                                       <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));?>
+                                       <?php
+                        $valori = array();
+                        if ( preg_match('/vip([0-9]+)/',$gre['if'],&$valori) )
+                        {
+                            foreach ($config['virtualip']['vip'] as $vip) {
+                                if (($vip['mode'] == "carp" || $vip['mode'] == "carpdev") and $vip['vhid'] == $valori[1])
+                                    echo strtoupper($gre['if']) . " CARP " . strtoupper($vip['interface']) . " " . $vip['subnet'];
+                            }
+                        } else {
+                            echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));
+                        }
+                    ?>
                   </td>
                   <td class="listr">
                                        <?=htmlspecialchars($gre['remote-addr']);?>

An example label follows : "VIP1 CARP WAN XXX.XXX.XXX.XXX"
I improvised with the format so change it as you see fit.

Sorry about that and thanks.

Actions #4

Updated by Ermal Luçi over 13 years ago

  • Priority changed from High to Normal

Should be ok in new snapshots.
The method used is different.

Actions #5

Updated by Chris Buechler over 13 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF