Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-13 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..

gprs_ns2_sns: add check for duplicates to add_ip6_elem()

The ip4 version already checks for duplicates.

Related: OS#5036
Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
---
M src/gb/gprs_ns2_sns.c
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index c50b2b9..1204266 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -452,10 +452,8 @@
 static int add_ip4_elem(struct ns2_sns_state *gss, struct ns2_sns_elems *elems,
const struct gprs_ns_ie_ip4_elem *ip4)
 {
-   unsigned int i;
-
/* check for duplicates */
-   for (i = 0; i < elems->num_ip4; i++) {
+   for (unsigned int i = 0; i < elems->num_ip4; i++) {
if (memcmp(>ip4[i], ip4, sizeof(*ip4)))
continue;
return -1;
@@ -507,6 +505,13 @@
 static int add_ip6_elem(struct ns2_sns_state *gss, struct ns2_sns_elems *elems,
const struct gprs_ns_ie_ip6_elem *ip6)
 {
+   /* check for duplicates */
+   for (unsigned int i = 0; i < elems->num_ip6; i++) {
+   if (memcmp(>ip6[i].ip_addr, >ip_addr, 
sizeof(ip6->ip_addr)) ||
+   elems->ip6[i].udp_port != ip6->udp_port)
+   continue;
+   return -1;
+   }

elems->ip6 = talloc_realloc(gss, elems->ip6, struct gprs_ns_ie_ip6_elem,
 elems->num_ip6+1);

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-13 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Sun, 13 Jun 2021 18:31:15 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-12 Thread lynxis lazus
Hello Jenkins Builder, pespin, dexter,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmocore/+/24586

to look at the new patch set (#2).

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..

gprs_ns2_sns: add check for duplicates to add_ip6_elem()

The ip4 version already checks for duplicates.

Related: OS#5036
Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
---
M src/gb/gprs_ns2_sns.c
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/24586/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-12 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/24586/1/src/gb/gprs_ns2_sns.c
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/24586/1/src/gb/gprs_ns2_sns.c@510
PS1, Line 510:  if (memcmp(>ip6[i], ip6, sizeof(*ip6)))
> I'm not sure we should rely on the fact that there is either no padding in 
> the elems struct, or that […]
Ack



--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Sat, 12 Jun 2021 20:22:38 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/24586/1/src/gb/gprs_ns2_sns.c
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/24586/1/src/gb/gprs_ns2_sns.c@510
PS1, Line 510:  if (memcmp(>ip6[i], ip6, sizeof(*ip6)))
I'm not sure we should rely on the fact that there is either no padding in the 
elems struct, or that it is always zero-initialized.



--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Mon, 07 Jun 2021 12:39:43 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Jun 2021 09:41:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-07 Thread dexter
dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )

Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Comment-Date: Mon, 07 Jun 2021 08:35:38 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: add check for duplicates to add_ip6_elem()

2021-06-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24586 )


Change subject: gprs_ns2_sns: add check for duplicates to add_ip6_elem()
..

gprs_ns2_sns: add check for duplicates to add_ip6_elem()

The ip4 version already checks for duplicates.

Related: OS#5036
Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
---
M src/gb/gprs_ns2_sns.c
1 file changed, 7 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/24586/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index c50b2b9..2e84d16 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -452,10 +452,8 @@
 static int add_ip4_elem(struct ns2_sns_state *gss, struct ns2_sns_elems *elems,
const struct gprs_ns_ie_ip4_elem *ip4)
 {
-   unsigned int i;
-
/* check for duplicates */
-   for (i = 0; i < elems->num_ip4; i++) {
+   for (unsigned int i = 0; i < elems->num_ip4; i++) {
if (memcmp(>ip4[i], ip4, sizeof(*ip4)))
continue;
return -1;
@@ -507,6 +505,12 @@
 static int add_ip6_elem(struct ns2_sns_state *gss, struct ns2_sns_elems *elems,
const struct gprs_ns_ie_ip6_elem *ip6)
 {
+   /* check for duplicates */
+   for (unsigned int i = 0; i < elems->num_ip6; i++) {
+   if (memcmp(>ip6[i], ip6, sizeof(*ip6)))
+   continue;
+   return -1;
+   }

elems->ip6 = talloc_realloc(gss, elems->ip6, struct gprs_ns_ie_ip6_elem,
 elems->num_ip6+1);

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4a1528ea3427946ce465085919b2b522d3cedd07
Gerrit-Change-Number: 24586
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange