diff freeDiameter/p_out.c @ 165:4679ff581d6a

Fix invalid restore of the hop-by-hop id on forwarded answers
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 27 Jan 2010 10:56:54 +0900
parents abd3c441780b
children e1da03ba112f
line wrap: on
line diff
--- a/freeDiameter/p_out.c	Tue Jan 26 14:44:32 2010 +0900
+++ b/freeDiameter/p_out.c	Wed Jan 27 10:56:54 2010 +0900
@@ -43,6 +43,7 @@
 	uint8_t * buf;
 	size_t sz;
 	int ret;
+	uint32_t bkp_hbh = 0;
 	
 	TRACE_ENTRY("%p %p %p %p", msg, cnx, hbh, srl);
 	
@@ -53,6 +54,7 @@
 	if (msg_is_a_req) {
 		CHECK_PARAMS(hbh && srl);
 		/* Alloc the hop-by-hop id and increment the value for next message */
+		bkp_hbh = hdr->msg_hbhid;
 		hdr->msg_hbhid = *hbh;
 		*hbh = hdr->msg_hbhid + 1;
 	}
@@ -70,7 +72,7 @@
 	
 	/* Save a request before sending so that there is no race condition with the answer */
 	if (msg_is_a_req) {
-		CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid), { free(buf); return ret; } );
+		CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), { free(buf); return ret; } );
 	}
 	
 	/* Send the message */
"Welcome to our mercurial repository"