[S] Change in libosmocore[master]: gprs_ns2_sns: improve search for same NS-VC
lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/39015?usp=email ) Change subject: gprs_ns2_sns: improve search for same NS-VC ...................................................................... gprs_ns2_sns: improve search for same NS-VC Adding a second NS-VC with the same IP+UDP isn't possible, even when the weights are different, because the NS-ALIVE wouldn't work. Also a NS-VC is identified by IP+UDP and not by the weights. IPv6 did this already. Use the same logic for IPv4. Further relax the search of NS-VC when removing NS-VC. Only take care of IP+UDP and ignore signalling weight and data weights. Related: OS#6611 Change-Id: Ibbc1a794a9a9f0ce6e583fd9743e7f02d52a99cf --- M src/gb/gprs_ns2_sns.c 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/39015/1 diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c index 6b92370..a17861b 100644 --- a/src/gb/gprs_ns2_sns.c +++ b/src/gb/gprs_ns2_sns.c @@ -501,7 +501,8 @@ { /* check for duplicates */ for (unsigned int i = 0; i < elems->num_ip4; i++) { - if (memcmp(&elems->ip4[i], ip4, sizeof(*ip4))) + if (elems->ip4[i].ip_addr != ip4->ip_addr || + elems->ip4[i].udp_port != ip4->udp_port) continue; return -1; } @@ -520,8 +521,10 @@ unsigned int i; for (i = 0; i < elems->num_ip4; i++) { - if (memcmp(&elems->ip4[i], ip4, sizeof(*ip4))) + if (elems->ip4[i].ip_addr != ip4->ip_addr || + elems->ip4[i].udp_port != ip4->udp_port) continue; + /* all array elements < i remain as they are; all > i are shifted left by one */ memmove(&elems->ip4[i], &elems->ip4[i+1], elems->num_ip4-i-1); elems->num_ip4 -= 1; @@ -574,7 +577,8 @@ unsigned int i; for (i = 0; i < elems->num_ip6; i++) { - if (memcmp(&elems->ip6[i], ip6, sizeof(*ip6))) + if (memcmp(&elems->ip6[i].ip_addr, &ip6->ip_addr, sizeof(ip6->ip_addr)) || + elems->ip6[i].udp_port != ip6->udp_port) continue; /* all array elements < i remain as they are; all > i are shifted left by one */ memmove(&elems->ip6[i], &elems->ip6[i+1], elems->num_ip6-i-1); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39015?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibbc1a794a9a9f0ce6e583fd9743e7f02d52a99cf Gerrit-Change-Number: 39015 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>
participants (1)
-
lynxis lazus