Mercurial > hg > freeDiameter
comparison libfdproto/messages.c @ 1062:56bf0377e2ff
Raise "Conflicting rules" to error level since it causes validation
errors and usually will stop a message from being accepted or sent.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Mon, 29 Apr 2013 12:43:52 +0200 |
parents | aecdc2fbf222 |
children | 74bba7975864 |
comparison
equal
deleted
inserted
replaced
1061:be24c7453aa6 | 1062:56bf0377e2ff |
---|---|
2349 min = 0; | 2349 min = 0; |
2350 else | 2350 else |
2351 min = 1; | 2351 min = 1; |
2352 } | 2352 } |
2353 if (count < min) { | 2353 if (count < min) { |
2354 TRACE_DEBUG(INFO, "Conflicting rule: the number of occurences (%d) is < the rule min (%d) for '%s'.", count, min, avp_name); | 2354 fd_log_error("Conflicting rule: the number of occurences (%d) is < the rule min (%d) for '%s'.", count, min, avp_name); |
2355 if (pr_data->pei) { | 2355 if (pr_data->pei) { |
2356 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; | 2356 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; |
2357 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); | 2357 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); |
2358 } | 2358 } |
2359 return EBADMSG; | 2359 return EBADMSG; |
2360 } | 2360 } |
2361 | 2361 |
2362 /* Check the "max" value */ | 2362 /* Check the "max" value */ |
2363 if ((rule->rule_max != -1) && (count > rule->rule_max)) { | 2363 if ((rule->rule_max != -1) && (count > rule->rule_max)) { |
2364 TRACE_DEBUG(INFO, "Conflicting rule: the number of occurences (%d) is > the rule max (%d) for '%s'.", count, rule->rule_max, avp_name); | 2364 fd_log_error("Conflicting rule: the number of occurences (%d) is > the rule max (%d) for '%s'.", count, rule->rule_max, avp_name); |
2365 if (pr_data->pei) { | 2365 if (pr_data->pei) { |
2366 if (rule->rule_max == 0) | 2366 if (rule->rule_max == 0) |
2367 pr_data->pei->pei_errcode = "DIAMETER_AVP_NOT_ALLOWED"; | 2367 pr_data->pei->pei_errcode = "DIAMETER_AVP_NOT_ALLOWED"; |
2368 else | 2368 else |
2369 pr_data->pei->pei_errcode = "DIAMETER_AVP_OCCURS_TOO_MANY_TIMES"; | 2369 pr_data->pei->pei_errcode = "DIAMETER_AVP_OCCURS_TOO_MANY_TIMES"; |
2380 break; | 2380 break; |
2381 | 2381 |
2382 case RULE_FIXED_HEAD: | 2382 case RULE_FIXED_HEAD: |
2383 /* Since "0*1<fixed>" is a valid rule specifier, we only reject cases where the AVP appears *after* its fixed position */ | 2383 /* Since "0*1<fixed>" is a valid rule specifier, we only reject cases where the AVP appears *after* its fixed position */ |
2384 if (first > rule->rule_order) { | 2384 if (first > rule->rule_order) { |
2385 TRACE_DEBUG(INFO, "Conflicting rule: the FIXED_HEAD AVP appears first in (%d) position, the rule requires (%d) for '%s'.", first, rule->rule_order, avp_name); | 2385 fd_log_error("Conflicting rule: the FIXED_HEAD AVP appears first in (%d) position, the rule requires (%d) for '%s'.", first, rule->rule_order, avp_name); |
2386 if (pr_data->pei) { | 2386 if (pr_data->pei) { |
2387 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; | 2387 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; |
2388 pr_data->pei->pei_message = "AVP was not in its fixed position"; | 2388 pr_data->pei->pei_message = "AVP was not in its fixed position"; |
2389 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); | 2389 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); |
2390 } | 2390 } |
2393 break; | 2393 break; |
2394 | 2394 |
2395 case RULE_FIXED_TAIL: | 2395 case RULE_FIXED_TAIL: |
2396 /* Since "0*1<fixed>" is a valid rule specifier, we only reject cases where the AVP appears *before* its fixed position */ | 2396 /* Since "0*1<fixed>" is a valid rule specifier, we only reject cases where the AVP appears *before* its fixed position */ |
2397 if (last > rule->rule_order) { /* We have a ">" here because we count in reverse order (i.e. from the end) */ | 2397 if (last > rule->rule_order) { /* We have a ">" here because we count in reverse order (i.e. from the end) */ |
2398 TRACE_DEBUG(INFO, "Conflicting rule: the FIXED_TAIL AVP appears last in (%d) position, the rule requires (%d) for '%s'.", last, rule->rule_order, avp_name); | 2398 fd_log_error("Conflicting rule: the FIXED_TAIL AVP appears last in (%d) position, the rule requires (%d) for '%s'.", last, rule->rule_order, avp_name); |
2399 if (pr_data->pei) { | 2399 if (pr_data->pei) { |
2400 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; | 2400 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; |
2401 pr_data->pei->pei_message = "AVP was not in its fixed position"; | 2401 pr_data->pei->pei_message = "AVP was not in its fixed position"; |
2402 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); | 2402 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); |
2403 } | 2403 } |