https://redmine.pfsense.org/https://redmine.pfsense.org/favicon.ico?16780521162013-02-15T01:06:07ZpfSense bugtrackerpfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=107662013-02-15T01:06:07ZDan Lundqvistbetateam.mrzaz@gmail.com
<ul></ul><p>Updated to "2.1-BETA1 (i386) built on Thu Feb 14 16:27:05 EST 2013" and <br />tried to tried to clear / apply / reconfigure / apply but same result.<br />Still does not get IPv4 addresses populated in the ipsecpinghosts.</p>
<p>/Dan Lundqvist</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=107692013-02-15T04:20:11ZRenato Botelhorenato@netgate.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Feedback</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset <a class="changeset" title="Fix #2818. Save information about all phase1 on ipsecpinghosts instead of only the last one" href="https://redmine.pfsense.org/projects/pfsense/repository/2/revisions/fa77faffbf284ce5e89b9bd36963a747adbf1fed">fa77faffbf284ce5e89b9bd36963a747adbf1fed</a>.</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=107952013-02-15T16:30:27ZDan Lundqvistbetateam.mrzaz@gmail.com
<ul></ul><p><strong>The correction does not work.</strong><br />The problem is that the $ipsecpinghosts is NOT treated as a table but rather as a single string.<br />Regardless where you place the @file_put_contents it will only contain the last read string into the $ipsecpinghosts when it is saved.</p>
<p>I am not 100% sure how the @file_put_contents function if it overwrites the file every time or appends ?<br />I suspect that every time when you try to do the @file_put_contents it overwrites any previous data so even if you<br />move it closer into the "foreach" loop it will still get the same result as file/data is getting overwritten every time.</p>
<p>At least this is what I am seeing when I am doing troubleshooting.</p>
<p>Looks like someone needs to rethink this and make a new correction.</p>
<p>//Dan Lundqvist</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=107962013-02-15T17:00:43ZDan Lundqvistbetateam.mrzaz@gmail.com
<ul></ul><p>Or there is something wrong so it doesn't create an array even if it suppose to do it (the $ipsecpinghosts*[]* )<br />Or there is something wrong that the @file_put_contents doesn't detect that it should save it as an array<br />and save it as a single-string (just getting the last item in the array).</p>
<p><a class="external" href="http://php.net/manual/en/function.file-put-contents.php">http://php.net/manual/en/function.file-put-contents.php</a></p>
<p>If I try to remove the IPv6 AutoPing IP (that is the 3rd IPsec tunnel), the IP from the 2nd IPsec shows up in the<br />ipsecpinghosts file but only that item.</p>
<p>//Dan Lundqvist</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=107972013-02-15T17:12:33ZDan Lundqvistbetateam.mrzaz@gmail.com
<ul></ul><p>I think I found the problem.</p>
<p>It needed to be even one more step out of the loop at the end of the foreach phase1 loop as you are doing an “unset($ipsecpinghosts);” which clears the variable<br />so it was cleared at every phase2 iteration instead of after the whole phase1/phase2 iteration causing only the last phase2 iteration to stick in the file.<br />I have now tested this and now it works OK...</p>
<pre><code>}<br /> $dstip = $ph2ent['pinghost'];<br /> if(is_ipaddrv6($dstip)) {<br /> $family = "inet6";<br /> } else {<br /> $family = "inet";<br /> }<br /> if (is_ipaddr($srcip))<br /> $ipsecpinghosts[] = "{$srcip}|{$dstip}|3|||||{$family}|\n";<br /> }<br /> }<br />ORIGINAL PLACE BEFORE CORRECTION<br /> }<br />OLD PLACE BY YOUR CORRECTION<br /> }<br />NEW PLACE @file_put_contents("{$g['vardb_path']}/ipsecpinghosts", $ipsecpinghosts);<br />NEW PLACE unset($ipsecpinghosts);<br /> }</code></pre>
<p>//Dan Lundqvist</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=108022013-02-16T10:00:13ZRenato Botelhorenato@netgate.com
<ul></ul><p>Applied in changeset <a class="changeset" title="Fix #2818. Last change didn't work, it needs to be one more step out of the loop." href="https://redmine.pfsense.org/projects/pfsense/repository/2/revisions/923e440b75eda660a5cdbd102912fe53d61d1237">923e440b75eda660a5cdbd102912fe53d61d1237</a>.</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=108052013-02-16T11:08:44ZDan Lundqvistbetateam.mrzaz@gmail.com
<ul></ul><p>Thanks for that Renato. :-)</p>
<p>//Dan</p> pfSense - Bug #2818: IPSec phase2 "Automatically ping host" function broken. Bug confirmed.https://redmine.pfsense.org/issues/2818?journal_id=108182013-02-17T07:58:44ZRenato Botelhorenato@netgate.com
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Resolved</i></li></ul>