Blob Blame Raw
From: Ovidiu Sas <osas@voipembedded.com>
Date: Mon, 5 Feb 2018 15:32:03 -0500
Subject: [PATCH] nathelper: revert commit
 a45d4dcaf046bb273cfe5905ac035845a6867945  - add comments to better explain
 logic behind code

(cherry picked from commit 1e36fa1afafb90fcffcd88fdecc5c74e24ceb990)

diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c
index a919af12d..41b7388d8 100644
--- a/modules/nathelper/nathelper.c
+++ b/modules/nathelper/nathelper.c
@@ -984,7 +984,11 @@ alter_mediaip(struct sip_msg *msg, str *body, str *oldip, int oldpf,
 	str omip, nip, oip;
 
 	/* check that updating mediaip is really necessary */
-	if (oldpf == newpf || isnulladdr(oldip, oldpf))
+	/* Conditions:
+	- same IP protocol format for received IP and new IP
+	- null IP received
+	*/
+	if (oldpf == newpf && isnulladdr(oldip, oldpf))
 		return 0;
 	if (newip->len == oldip->len &&
 	    memcmp(newip->s, oldip->s, newip->len) == 0)