Your last comment does not clarify if a destination record matching (ip, socket) has to be selected over one that matches (ip, port, proto). Can you present the order of selection based on matching the values for ip, port, proto or socket?
The strictness are defined by the flags combination:
#define DS_MATCHED_ADDR 1 #define DS_MATCHED_PORT (1 << 1) #define DS_MATCHED_PROTO (1 << 2) #define DS_MATCHED_SOCK (1 << 3)
in each iteration global variable ds_strictness are "OR-ed" with corresponding flag by criteria of matching, the winner is that which have the greatest value, for example if we have:
##ip, port, protocol 70 sip:192.168.1.1:5060;transport=udp 0 1 route=route1 #ip and socket 90 sip:192.168.1.1 0 1 route=route2;sockname=udp_5060
in first case we have flags: DS_MATCHED_ADDR | DS_MATCHED_PORT | DS_MATCHED_PROTO (7) in second: MATCHED_ADDR | DS_MATCHED_SOCK (9)
The winner will be second, in this case 90.