Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. sccp_user_find: optimize: search PC only for valid PC arg Though, since in current practice, not many users exist, and all incoming messages have a valid PC, this is unlikely to have any noticeable effect. Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe --- M src/sccp_user.c 1 file changed, 6 insertions(+), 4 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/sccp_user.c b/src/sccp_user.c index a36ac93..d8a7357 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -50,10 +50,12 @@ { struct osmo_sccp_user *scu; - /* First try to find match for PC + SSN */ - llist_for_each_entry(scu, &inst->users, list) { - if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && scu->ssn == ssn) - return scu; + if (osmo_ss7_pc_is_valid(pc)) { + /* First try to find match for PC + SSN */ + llist_for_each_entry(scu, &inst->users, list) { + if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && scu->ssn == ssn) + return scu; + } } /* Then try to match on SSN only */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 2 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-MessageType: merged
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-Comment-Date: Mon, 15 Jun 2020 08:51:48 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-Comment-Date: Mon, 15 Jun 2020 07:27:42 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c File src/sccp_user.c: https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c@53 PS1, Line 53: if (osmo_ss7_pc_is_valid(pc)) { > Ah I see now, good point. […] It is possible to configure an SCCP user that serves an SSN *without* limiting on a specific point-code. So if a user has a valid PC configured that matches, that user gets selected with higher prio. After that, a user with only SSN set can catch all remaining messages on that SSN. -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-Comment-Date: Mon, 15 Jun 2020 01:00:17 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Comment-In-Reply-To: neels Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c File src/sccp_user.c: https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c@53 PS1, Line 53: if (osmo_ss7_pc_is_valid(pc)) { > the logic here got me confused at first, but see: […] Ah I see now, good point. However, after having a look at osmo_ss7_pc_is_valid(), I think it makes more sense to simply OSMO_ASSERT(osmo_ss7_pc_is_valid(pc)) or return NULL since it makes no sense to pass an invalid pc imho. Agree? -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 27 May 2020 10:24:21 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Comment-In-Reply-To: neels Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c File src/sccp_user.c: https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c@53 PS1, Line 53: if (osmo_ss7_pc_is_valid(pc)) { > So after this change, if an invalid "pc" is passed, and a matching ssn with a > valid pc exists, it wi […] the logic here got me confused at first, but see: in this loop it says osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc which implies osmo_ss7_pc_is_valid(pc) This patch simply puts that condition above the loop because if the pc is invalid, there is no point in looping. We are still going to match with ssn-only scus below. There should be no functional change. -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 27 May 2020 10:16:55 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c File src/sccp_user.c: https://gerrit.osmocom.org/c/libosmo-sccp/+/18503/1/src/sccp_user.c@53 PS1, Line 53: if (osmo_ss7_pc_is_valid(pc)) { So after this change, if an invalid "pc" is passed, and a matching ssn with a valid pc exists, it will still not be returned. Is that expected? -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 27 May 2020 07:56:34 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in libosmo-sccp[master]: sccp_user_find: optimize: search PC only for valid PC arg
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 ) Change subject: sccp_user_find: optimize: search PC only for valid PC arg .. sccp_user_find: optimize: search PC only for valid PC arg Though, since in current practice, not many users exist, and all incoming messages have a valid PC, this is unlikely to have any noticeable effect. Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe --- M src/sccp_user.c 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/03/18503/1 diff --git a/src/sccp_user.c b/src/sccp_user.c index a36ac93..d8a7357 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -50,10 +50,12 @@ { struct osmo_sccp_user *scu; - /* First try to find match for PC + SSN */ - llist_for_each_entry(scu, &inst->users, list) { - if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && scu->ssn == ssn) - return scu; + if (osmo_ss7_pc_is_valid(pc)) { + /* First try to find match for PC + SSN */ + llist_for_each_entry(scu, &inst->users, list) { + if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && scu->ssn == ssn) + return scu; + } } /* Then try to match on SSN only */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe Gerrit-Change-Number: 18503 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-MessageType: newchange