[Devel] [ openser-Bugs-1720478 ] Bad Sort lcr records by prefix_len
and priority
SourceForge.net
noreply at sourceforge.net
Thu May 17 17:14:56 CEST 2007
Bugs item #1720478, was opened at 2007-05-17 06:11
Message generated for change (Comment added) made by sackrtp
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1720478&group_id=139143
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver 1.2.x
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Angel Carpintero (sackrtp)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bad Sort lcr records by prefix_len and priority
Initial Comment:
I guess that comp_lcrs() function in modules/lcr/lcr_mod.c is not ordering correctly by priority.
if (lcr_record1.priority < lcr_record2.priority) {
result = 1;
}
else if (lcr_record1.priority == lcr_record2.priority) {
/* Nothing to do. */
result = 0;
}
Higher priority should return 1.
So a simple change to fix that issue will be :
if (lcr_record1.priority > lcr_record2.priority) {
* svn diff
Index: modules/lcr/lcr_mod.c
===================================================================
--- modules/lcr/lcr_mod.c (revisión: 2220)
+++ modules/lcr/lcr_mod.c (copia de trabajo)
@@ -592,7 +592,7 @@
}
else if (lcr_record1.prefix_len == lcr_record2.prefix_len) {
/* Sort by priority. */
- if (lcr_record1.priority < lcr_record2.priority) {
+ if (lcr_record1.priority > lcr_record2.priority) {
result = 1;
}
else if (lcr_record1.priority == lcr_record2.priority) {
----------------------------------------------------------------------
>Comment By: Angel Carpintero (sackrtp)
Date: 2007-05-17 17:14
Message:
Logged In: YES
user_id=822905
Originator: YES
Thanks , was a problem of interpretation.
----------------------------------------------------------------------
Comment By: Ovidiu Sas (osas)
Date: 2007-05-17 15:40
Message:
Logged In: YES
user_id=1395524
Originator: NO
>From the lcr README:
Matching gateways are then ordered for forwarding purpose:
(1) according to longest user part match,
(2) according to gateway's priority,
(3) randomly.
I coded this using the assumption that 0 is the highest priority, followed
by 1, then 2 and so on (priority being an unsigned int). I think that we
should keep it as is and update the documentation, otherwise it will be
confusing for 1.1.x to 1.2.x migration (backward compatibility).
----------------------------------------------------------------------
Comment By: Juha Heinanen (juhe)
Date: 2007-05-17 14:31
Message:
Logged In: YES
user_id=1332122
Originator: NO
This part of lcr code was written by Ovidiu Sas. I'll let him comment on
this ticket.
// Juha
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1720478&group_id=139143
More information about the Devel
mailing list