Browse code

sst: log message when rejecting due to condition on min-se

(cherry picked from commit 5fc6f087cbb81fa2b9180cdd066c9912289426df)

Daniel-Constantin Mierla authored on 13/06/2017 09:19:55
Showing 1 changed files
... ...
@@ -224,7 +224,7 @@ void sst_handler_init(pv_spec_t *timeout_avp_p, unsigned int min_se,
224 224
  * the state tracking to figure out if and who supports SST.
225 225
  *
226 226
  * As per RFC4028: Request handling:
227
- * 
227
+ *
228 228
  * - The proxy may insert a SE header if none found.
229 229
  * - The SE value can be anything >= Min-SE (if found)
230 230
  * - The proxy MUST NOT add a refresher parameter to the SE.
... ...
@@ -266,7 +266,7 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
266 266
 		return;
267 267
 	}
268 268
 
269
-	/* 
269
+	/*
270 270
 	 * look only at INVITE
271 271
 	 */
272 272
 	if (msg->first_line.type != SIP_REQUEST ||
... ...
@@ -276,7 +276,7 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
276 276
 	}
277 277
 
278 278
 	/*
279
-	 * Gather all he information about SST for this message
279
+	 * Gather all the information about SST for this message
280 280
 	 */
281 281
 	if (parse_msg_for_sst_info(msg, &minfo)) {
282 282
 		LM_ERR("failed to parse sst information\n");
... ...
@@ -291,18 +291,18 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
291 291
 										  * later */
292 292
 
293 293
 	if (minfo.se != 0) {
294
-		/* 
294
+		/*
295 295
 		 * There is a SE already there, this is good, we just need to
296 296
 		 * check the values out a little before passing it along.
297 297
 		 */
298 298
 		if (minfo.se < sst_min_se) {
299
-			/* 
299
+			/*
300 300
 			 * Problem, the requested Session-Expires is too small for
301 301
 			 * our local policy. We need to fix it, or reject it or
302 302
 			 * ignore it.
303 303
 			 */
304 304
 			if (!minfo.supported) {
305
-				/* 
305
+				/*
306 306
 				 * Increase the Min-SE: value in the request and
307 307
 				 * forward it.
308 308
 				 */
... ...
@@ -320,6 +320,9 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
320 320
 			}
321 321
 			else if (sst_reject) {
322 322
 				/* Make sure that that all are at least 90 */
323
+				LM_DBG("rejecting 442 - local min se: %d - received min se: %d"
324
+						" - received se: %d\n",
325
+						sst_min_se, minfo.min_se, minfo.se);
323 326
 				send_reject(msg, MAX(MAX(sst_min_se, minfo.min_se), 90));
324 327
 				shm_free(info);
325 328
 				return;
... ...
@@ -331,7 +334,7 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
331 334
 		}
332 335
 	}
333 336
 	else {
334
-		/* 
337
+		/*
335 338
 		 * No Session-Expire: stated in request.
336 339
 		 */
337 340
 		str msehdr;
... ...
@@ -346,7 +349,7 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
346 349
 				/* What to do? Let is slide, we can still work */
347 350
 			}
348 351
 		}
349
-		
352
+
350 353
 		info->requester = SST_PXY;
351 354
 		sst_build_se_hdr(info->interval, &msehdr, NULL);
352 355
 		if (append_header(msg, msehdr.s)) {
... ...
@@ -440,11 +443,11 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type,
440 443
 		if ((msg->first_line.u.request.method_value == METHOD_INVITE ||
441 444
 						msg->first_line.u.request.method_value == METHOD_UPDATE)) {
442 445
 
443
-			LM_DBG("Update by a REQUEST. %.*s\n", 
444
-					msg->first_line.u.request.method.len, 
446
+			LM_DBG("Update by a REQUEST. %.*s\n",
447
+					msg->first_line.u.request.method.len,
445 448
 					msg->first_line.u.request.method.s);
446 449
 			if (parse_msg_for_sst_info(msg, &minfo)) {
447
-				LM_ERR("failed to parse sst information\n"); 
450
+				LM_ERR("failed to parse sst information\n");
448 451
 				return;
449 452
 			}
450 453
 			/* Early resetting of the value here */
... ...
@@ -474,9 +477,9 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type,
474 477
 			 * To spec (RFC) the internal time out value so not be reset
475 478
 			 * until here.
476 479
 			 */
477
-			LM_DBG("Update by a REPLY %d %.*s\n", 
480
+			LM_DBG("Update by a REPLY %d %.*s\n",
478 481
 					msg->first_line.u.reply.statuscode,
479
-					msg->first_line.u.reply.reason.len, 
482
+					msg->first_line.u.reply.reason.len,
480 483
 					msg->first_line.u.reply.reason.s);
481 484
 			if (parse_msg_for_sst_info(msg, &minfo)) {
482 485
 				LM_ERR("failed to parse sst information\n");
... ...
@@ -498,7 +501,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type,
498 501
  * @param params - The sst information
499 502
  */
500 503
 static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type,
501
-		struct dlg_cb_params * params) 
504
+		struct dlg_cb_params * params)
502 505
 {
503 506
 	struct sip_msg* msg = params->rpl;
504 507
 
... ...
@@ -511,9 +514,9 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type,
511 514
 		sst_msg_info_t minfo = {0,0,0,0};
512 515
 		sst_info_t *info = (sst_info_t *)*(params->param);
513 516
 
514
-		LM_DBG("Dialog seen REPLY %d %.*s\n", 
517
+		LM_DBG("Dialog seen REPLY %d %.*s\n",
515 518
 				msg->first_line.u.reply.statuscode,
516
-				msg->first_line.u.reply.reason.len, 
519
+				msg->first_line.u.reply.reason.len,
517 520
 				msg->first_line.u.reply.reason.s);
518 521
 		/*
519 522
 		 * Need to check to see if it is a 422 response. If it is,
... ...
@@ -539,7 +542,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type,
539 542
 			LM_ERR("failed to parse CSeq\n");
540 543
 			return;
541 544
 		}
542
-		
545
+
543 546
 		/* 2XX replies to INVITES only !*/
544 547
 		if (msg->first_line.u.reply.statuscode > 199 &&
545 548
 				msg->first_line.u.reply.statuscode < 300 &&
... ...
@@ -560,7 +563,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type,
560 563
 				/* no se header found, we want to resquest it. */
561 564
 				if (info->requester == SST_PXY || info->supported == SST_UAC) {
562 565
 					str sehdr;
563
-					
566
+
564 567
 					LM_DBG("appending the Session-Expires: header to the 2XX reply."
565 568
 							" UAC will deal with it.\n");
566 569
 					/*
... ...
@@ -653,7 +656,7 @@ int sst_check_min(struct sip_msg *msg, char *flag, char *str2)
653 656
 				 * not parse it.
654 657
 				 */
655 658
 				LM_ERR("failed to parse MIN-SE header.\n");
656
-				return -1; 
659
+				return -1;
657 660
 			}
658 661
 			/*
659 662
 			 * If not stated, use the value from the session-expires
... ...
@@ -662,7 +665,7 @@ int sst_check_min(struct sip_msg *msg, char *flag, char *str2)
662 665
 			LM_DBG("No MIN-SE header found.\n");
663 666
 			minse = 90; /* default by RFC4028, $5 */
664 667
 		}
665
-		
668
+
666 669
 		LM_DBG("Session-Expires: %d; MIN-SE: %d\n",	se.interval, minse);
667 670
 
668 671
 		/*
... ...
@@ -708,7 +711,7 @@ int sst_check_min(struct sip_msg *msg, char *flag, char *str2)
708 711
  * @return 0 on success, none-zero on an error.
709 712
  */
710 713
 static int send_response(struct sip_msg *request, int code, str *reason,
711
-		char *header, int header_len) 
714
+		char *header, int header_len)
712 715
 {
713 716
 
714 717
 	if (slb.freply != 0) {
... ...
@@ -792,7 +795,7 @@ static int remove_header(struct sip_msg *msg, const char *header)
792 795
 		LM_ERR("failed to parse headers in message.\n");
793 796
 		return(-1);
794 797
 	}
795
-	
798
+
796 799
 	for (hf = msg->headers; hf; hf = hf->next) {
797 800
 		if (hf->name.len != len) {
798 801
 			continue;
... ...
@@ -873,9 +876,9 @@ static int parse_msg_for_sst_info(struct sip_msg *msg, sst_msg_info_t *minfo)
873 876
 	if (!msg || !minfo) {
874 877
 		return (-1);
875 878
 	}
876
-	
877
-	/* 
878
-	 * parse the supported infor
879
+
880
+	/*
881
+	 * parse the supported info
879 882
 	 */
880 883
 	minfo->supported = 0; /*Clear it */
881 884
 	minfo->se = 0;