#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail --> The function isc_match_filter uses a local variable "firstflag", to handle the case of an HSS based terminating unregistered service.
In that case, the S-CSCF exchanges SAR/SAA with the HSS in order to learn the subscription data and the iFC for an unregistered user or for a PSI.
The firstflag is necessary to make a distiction between the FAILURE ROUTE that is used for this case and the FAILURE ROUTE that is used for transaction failure towards the AS.
The error is, the firstflag is set for the latter case, too, which leads to a wrong handling of communication errors towards the AS.
This PR introduces a new function that looks for the old ISCMARK in the lumps of the stored message and hence can make a distinction between the SAR/SAA case and the AS failure case. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4018
-- Commit Summary --
* ims_isc: bugfix: firstflag incorrect in isc_match_filter
-- File Changes --
M src/modules/ims_isc/ims_isc_mod.c (24) M src/modules/ims_isc/mark.c (51) M src/modules/ims_isc/mark.h (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4018.patch https://github.com/kamailio/kamailio/pull/4018.diff
@vingarzan commented on this pull request.
@@ -244,10 +244,17 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
int free_s = 0;
//the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag + // meaning of firstflag: + // firstflag == 0: + // request route: request has been received from AS, old ISCMARK found in Route header field + // failure route: request to AS has been rejected or timed out, old ISCMARK found in lumps
Does it makes sense to have 4 possible values instead of just 2? Is that even possible though? I'm thinking if that would make things more clear, instead of having to remember that each of the current values have 2 sub-cases.
@kilianwww commented on this pull request.
@@ -244,10 +244,17 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
int free_s = 0;
//the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag + // meaning of firstflag: + // firstflag == 0: + // request route: request has been received from AS, old ISCMARK found in Route header field + // failure route: request to AS has been rejected or timed out, old ISCMARK found in lumps
Good point, i will look into this
@kilianwww pushed 1 commit.
273e1350a50d32f4de33b1711c0cefb47e2070b5 ims_isc: bugfix: firstflag incorrect in isc_match_filter
@kilianwww pushed 1 commit.
064416edf19ccd59a06ad609d24367b22690350b ims_isc: bugfix: firstflag incorrect in isc_match_filter
@kilianwww commented on this pull request.
@@ -244,10 +244,17 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
int free_s = 0;
//the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag + // meaning of firstflag: + // firstflag == 0: + // request route: request has been received from AS, old ISCMARK found in Route header field + // failure route: request to AS has been rejected or timed out, old ISCMARK found in lumps
The firstflag variable is now replaced with an enum that describes the 4 states, this should clear things up a bit
Any other comments, or this can be merged?
@kilianwww pushed 1 commit.
35b85de8843b372e58b2edef0aeaff4e76e38613 ims_isc: bugfix: firstflag incorrect in isc_match_filter
(Forgot to format the additional changes - should be fixed now)
@kilianwww pushed 1 commit.
17ca70d1e62f8a543044c40a4b712e87416f7e4c ims_isc: bugfix: firstflag incorrect in isc_match_filter
@vingarzan commented on this pull request.
- str found = {0, 0};
+ + LM_DBG("isc_mark_get_from_lumps: Trying to get the mark from the add_rm " + "lumps \n"); + + memset(mark, 0, sizeof(isc_mark)); + + parse_headers(msg, HDR_EOH_F, 0); + + anchor_lump(msg, msg->headers->name.s - msg->buf, 0, 0); + + lmp = msg->add_rm; + while(lmp) { + tmp = lmp->before; + if(tmp && tmp->op == LUMP_ADD && tmp->u.value + && (found.s = strstr(tmp->u.value, ISC_MARK_USERNAME))) {
These things are null-terminated, I hope.
(I never liked lumps...)
@vingarzan commented on this pull request.
+enum isc_mark_status
+{ + ISCMARK_FOUND_ROUTE_HEADER = + 0, /*Request has been received from AS, old ISCMARK found in Route header field*/ + ISCMARK_FOUND_LUMPS = + 1, /*Request to AS has been rejected or timed out, old ISCMARK found in lumps*/ + ISCMARK_MISSING_START_TRIGGERING = + 2, /*Request has been received without old ISCMARK in Route header field*/ + ISCMARK_MISSING_START_TRIGGERING_SAR = + 3 /*SAR/SAA has happened with HSS, due to terminating request (no old ISCMARK)*/ +}; + +/* ISCMARK Status bits*/ + +/* ISCMARK is obtained in failure route*/ +#define ISCMARK_FAILURE (1 << 0) +/* ISCMARK could not be found */ +#define ISCMARK_MISSING (1 << 1)
Pretty clear now. Anyway, maybe to further reduce the cognitive load (I'm getting old :stuck_out_tongue_closed_eyes:), I'd suggest writing it like this.
```suggestion /* ISCMARK Status bits*/
/* ISCMARK is obtained in failure route*/ #define ISCMARK_FAILURE (1 << 0) /* ISCMARK could not be found */ #define ISCMARK_MISSING (1 << 1)
enum isc_mark_status { /** Request has been received from AS, old ISCMARK found in Route header field */ ISCMARK_FOUND_ROUTE_HEADER = 0, /** Request to AS has been rejected or timed out, old ISCMARK found in lumps */ ISCMARK_FOUND_LUMPS = ISCMARK_FAILURE, /** Request has been received without old ISCMARK in Route header field*/ ISCMARK_MISSING_START_TRIGGERING = ISCMARK_MISSING, /** SAR/SAA has happened with HSS, due to terminating request (no old ISCMARK) */ ISCMARK_MISSING_START_TRIGGERING_SAR = ISCMARK_MISSING|ISCMARK_FAILURE };
```
:+1: Just that there seem to be some CMake issues (if @kilianwww is stuck, maybe @xkaraman could help with that?), otherwise, if this was tested, I think it can be merged soon from my perspective.
👍 Just that there seem to be some CMake issues (if @kilianwww is stuck, maybe @xkaraman could help with that?), otherwise, if this was tested, I think it can be merged soon from my perspective.
@vingarzan CMake is failing due to docs generation in an unrelated commit. I just pushed a commit that disables the generation as discussed in https://github.com/kamailio/kamailio/issues/4052.
@kilianwww pushed 1 commit.
d76e5f4a264911b6faa4d7641d2fdc9cae45e715 ims_isc: bugfix: firstflag incorrect in isc_match_filter
Thanks, merging it.
Merged #4018 into master.