<p>Kevin Harwell <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14829">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, approved; Approved for Submit
George Joseph: Looks good to me, but someone else must approve
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sip_nat_settings: Update script for latest Linux.<br><br>With the latest Linux, 'ifconfig' is not installed on default anymore.<br>Furthermore, the output of the current net-tools 'ifconfig' changed.<br>Therefore, parsing failed. This update uses 'ip addr show' instead.<br>Finally, the service for the external IP changed.<br><br>Change-Id: I9b1a7c3f457e3553b50a3e9a55524e40d70245a0<br>---<br>M contrib/scripts/sip_nat_settings<br>1 file changed, 7 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/contrib/scripts/sip_nat_settings b/contrib/scripts/sip_nat_settings</span><br><span>index 2a4fc07..444fb67 100755</span><br><span>--- a/contrib/scripts/sip_nat_settings</span><br><span>+++ b/contrib/scripts/sip_nat_settings</span><br><span>@@ -31,16 +31,8 @@</span><br><span> # along with this program; if not, write to the Free Software</span><br><span> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-WGET=`which wget`</span><br><span style="color: hsl(0, 100%, 40%);">-FETCH=`which fetch`</span><br><span style="color: hsl(0, 100%, 40%);">-if [ -x ${WGET} ]; then</span><br><span style="color: hsl(0, 100%, 40%);">- externip=`${WGET} -q -O- http://www.whatismyip.org`</span><br><span style="color: hsl(0, 100%, 40%);">-elif [ -x ${FETCH} ]; then</span><br><span style="color: hsl(0, 100%, 40%);">- externip=`${FETCH} -q -o - http://www.whatismyip.org`</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- echo "no binary found to contact http://www.whatismyip.org"</span><br><span style="color: hsl(0, 100%, 40%);">- exit 1</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(120, 100%, 40%);">+# see http://unix.stackexchange.com/q/22615</span><br><span style="color: hsl(120, 100%, 40%);">+externip=`dig @resolver1.opendns.com -4 myip.opendns.com A +short`</span><br><span> </span><br><span> # optional parameter: network interface to use. By default: none.</span><br><span> IFACE="$1"</span><br><span>@@ -49,8 +41,11 @@</span><br><span> case "$OS" in</span><br><span> Linux)</span><br><span> echo "externip = $externip"</span><br><span style="color: hsl(0, 100%, 40%);">- /sbin/ifconfig $IFACE | grep 'inet addr:' | grep Bcast \</span><br><span style="color: hsl(0, 100%, 40%);">- | sed -e 's/^.*Bcast:\([0-9.]*\)\s*Mask:\([0-9.]*\)\s*$/localnet = \1\/\2/'</span><br><span style="color: hsl(120, 100%, 40%);">+ if [ -x "${IFACE}" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+ ip --brief -family inet address show scope global up dev $IFACE | awk '{print "localnet = " $3}'</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ ip --brief -family inet address show scope global up | awk '{print "localnet = " $3}'</span><br><span style="color: hsl(120, 100%, 40%);">+ fi</span><br><span> ;;</span><br><span> OpenBSD|FreeBSD)</span><br><span> if [ "${OS}" = "FreeBSD" ]; then</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14829">change 14829</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14829"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I9b1a7c3f457e3553b50a3e9a55524e40d70245a0 </div>
<div style="display:none"> Gerrit-Change-Number: 14829 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>