Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-15 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/libosmogb.map
6 files changed, 364 insertions(+), 190 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 00879d7..8dd5699 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -82,6 +82,7 @@
/* osmocom own causes */
NS_AFF_CAUSE_SNS_CONFIGURED,
NS_AFF_CAUSE_SNS_FAILURE,
+   NS_AFF_CAUSE_SNS_NO_ENDPOINTS,
 };

 extern const struct value_string gprs_ns2_aff_cause_prim_strs[];
@@ -218,9 +219,11 @@
 void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi);

 /* create a VC SNS connection */
-int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
-   const struct osmo_sockaddr *remote,
-   uint16_t nsei);
+int gprs_ns2_sns_count(struct gprs_ns2_nse *nse);
+int gprs_ns2_sns_add_endpoint(struct gprs_ns2_nse *nse,
+  const struct osmo_sockaddr *saddr);
+int gprs_ns2_sns_del_endpoint(struct gprs_ns2_nse *nse,
+  const struct osmo_sockaddr *saddr);
 const struct osmo_sockaddr *gprs_ns2_nse_sns_remote(struct gprs_ns2_nse *nse);

 const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc 
*nsvc);
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 21c69cb..5e5dd83 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -953,42 +953,6 @@
return gprs_ns2_ip_connect(bind, remote, nse, nsvci);
 }

-/*! Create, connect and activate a new IP-SNS NSE.
- *  \param[in] bind bind in which the new NS-VC is to be created
- *  \param[in] remote remote address to which to connect
- *  \param[in] nsei NSEI of the NS Entity in which the NS-VC is to be created
- *  \return 0 on success; negative on error */
-int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
-   const struct osmo_sockaddr *remote,
-   uint16_t nsei)
-{
-   struct gprs_ns2_nse *nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei);
-   struct gprs_ns2_vc *nsvc;
-
-   if (!nse) {
-   nse = gprs_ns2_create_nse(bind->nsi, nsei, GPRS_NS2_LL_UDP, 
NS2_DIALECT_SNS);
-   if (!nse)
-   return -1;
-   }
-
-   if (nse->ll != GPRS_NS2_LL_UDP) {
-   return -2;
-   }
-
-   if (nse->dialect != NS2_DIALECT_SNS) {
-   return -2;
-   }
-
-   if (!nse->bss_sns_fi)
-   return -1;
-
-   nsvc = gprs_ns2_ip_bind_connect(bind, nse, remote);
-   if (!nsvc)
-   return -1;
-
-   return ns2_sns_bss_fsm_start(nse, nsvc, remote);
-}
-
 /*! Find NS-VC for given socket address.
  *  \param[in] nse NS Entity in which to search
  *  \param[in] sockaddr socket address to search for
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 9bfe0b0..d12c663 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -286,13 +286,15 @@
 struct gprs_ns2_vc *gprs_ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind,
 struct gprs_ns2_nse *nse,
 const struct osmo_sockaddr 
*remote);
+int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote);
+struct gprs_ns2_vc_bind *ns2_ip_get_bind_by_index(struct gprs_ns2_inst *nsi,
+ struct osmo_sockaddr *remote,
+ int index);

 /* sns */
 int gprs_ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct 
tlv_parsed *tp);
 struct osmo_fsm_inst *ns2_sns_bss_fsm_alloc(struct gprs_ns2_nse *nse,
 const char *id);
-int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc,
- const struct osmo_sockaddr *remote);
 void ns2_sns_free_nsvc(struct gprs_ns2_vc *nsvc);

 /* vc */
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 5d18d04..b7fbbf8 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -69,7 +69,7 @@
 };

 enum gprs_sns_event {
-   GPRS_SNS_EV_START,
+   

Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-13 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..


Patch Set 8:

(4 comments)

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_internal.h
File src/gb/gprs_ns2_internal.h:

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_internal.h@296
PS2, Line 296: int offset);
> offset means index here?
Ack


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@661
PS2, Line 661:  /* empty state - SNS Select will start by all action */
> You mean ns2_sns_st_all_action()?
Ack


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@1251
PS2, Line 1251: .in_event_mask = 0,
> worth adding a comment saying events are handled in all_state.
Ack


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@1338
PS2, Line 1338: else if (gss->initial->list.next == 
>sns_endpoints) /* last entry, continue with first */
> keep using {} if first clause use {}.
Ack



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 14 Dec 2020 01:00:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-13 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..


Patch Set 8: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Sun, 13 Dec 2020 12:14:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-10 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..


Patch Set 8: Code-Review+1


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 10 Dec 2020 14:41:28 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-10 Thread lynxis lazus
Hello Jenkins Builder,

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

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

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

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/libosmogb.map
6 files changed, 364 insertions(+), 190 deletions(-)


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-10 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..


Patch Set 7:

None of my comments was addressed/discussed.


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 7
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 10 Dec 2020 11:54:15 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-09 Thread lynxis lazus
Hello Jenkins Builder,

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

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

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

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/libosmogb.map
6 files changed, 361 insertions(+), 190 deletions(-)


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 7
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-09 Thread lynxis lazus
Hello Jenkins Builder,

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

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

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

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/gprs_ns2_vty2.c
M src/gb/libosmogb.map
7 files changed, 361 insertions(+), 193 deletions(-)


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-09 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21573 )

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..


Patch Set 2:

(4 comments)

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_internal.h
File src/gb/gprs_ns2_internal.h:

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_internal.h@296
PS2, Line 296: int offset);
offset means index here?


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@661
PS2, Line 661:  /* empty state - SNS Select will start by all action */
You mean ns2_sns_st_all_action()?


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@1251
PS2, Line 1251: .in_event_mask = 0,
worth adding a comment saying events are handled in all_state.


https://gerrit.osmocom.org/c/libosmocore/+/21573/2/src/gb/gprs_ns2_sns.c@1338
PS2, Line 1338: else if (gss->initial->list.next == 
>sns_endpoints) /* last entry, continue with first */
keep using {} if first clause use {}.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Wed, 09 Dec 2020 12:26:58 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

2020-12-08 Thread lynxis lazus
Hello Jenkins Builder,

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

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

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

Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/libosmogb.map
6 files changed, 334 insertions(+), 190 deletions(-)


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
Gerrit-Change-Number: 21573
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: gprs_ns2_sns: rework IP-SNS initial remote

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


Change subject: gprs_ns2_sns: rework IP-SNS initial remote
..

gprs_ns2_sns: rework IP-SNS initial remote

The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_udp.c
M src/gb/libosmogb.map
6 files changed, 334 insertions(+), 190 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/21573/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 3c3c63a..bc89b6a 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -83,6 +83,7 @@
/* osmocom own causes */
NS_AFF_CAUSE_SNS_CONFIGURED,
NS_AFF_CAUSE_SNS_FAILURE,
+   NS_AFF_CAUSE_SNS_NO_ENDPOINTS,
 };

 extern const struct value_string gprs_ns2_aff_cause_prim_strs[];
@@ -219,9 +220,10 @@
 void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi);

 /* create a VC SNS connection */
-int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
-   const struct osmo_sockaddr *remote,
-   uint16_t nsei);
+int gprs_ns2_sns_add_endpoint(struct gprs_ns2_nse *nse,
+  const struct osmo_sockaddr *saddr);
+int gprs_ns2_sns_del_endpoint(struct gprs_ns2_nse *nse,
+  const struct osmo_sockaddr *saddr);
 const struct osmo_sockaddr *gprs_ns2_nse_sns_remote(struct gprs_ns2_nse *nse);

 const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc 
*nsvc);
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6d4b079..9947e59 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -953,42 +953,6 @@
return gprs_ns2_ip_connect(bind, remote, nse, nsvci);
 }

-/*! Create, connect and activate a new IP-SNS NSE.
- *  \param[in] bind bind in which the new NS-VC is to be created
- *  \param[in] remote remote address to which to connect
- *  \param[in] nsei NSEI of the NS Entity in which the NS-VC is to be created
- *  \return 0 on success; negative on error */
-int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
-   const struct osmo_sockaddr *remote,
-   uint16_t nsei)
-{
-   struct gprs_ns2_nse *nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei);
-   struct gprs_ns2_vc *nsvc;
-
-   if (!nse) {
-   nse = gprs_ns2_create_nse(bind->nsi, nsei, GPRS_NS2_LL_UDP, 
NS2_DIALECT_SNS);
-   if (!nse)
-   return -1;
-   }
-
-   if (nse->ll != GPRS_NS2_LL_UDP) {
-   return -2;
-   }
-
-   if (nse->dialect != NS2_DIALECT_SNS) {
-   return -2;
-   }
-
-   if (!nse->bss_sns_fi)
-   return -1;
-
-   nsvc = gprs_ns2_ip_bind_connect(bind, nse, remote);
-   if (!nsvc)
-   return -1;
-
-   return ns2_sns_bss_fsm_start(nse, nsvc, remote);
-}
-
 /*! Find NS-VC for given socket address.
  *  \param[in] nse NS Entity in which to search
  *  \param[in] sockaddr socket address to search for
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 3ef0906..5a090c2 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -290,13 +290,15 @@
 struct gprs_ns2_vc *gprs_ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind,
 struct gprs_ns2_nse *nse,
 const struct osmo_sockaddr 
*remote);
+int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote);
+struct gprs_ns2_vc_bind *ns2_ip_get_bind_by_offset(struct gprs_ns2_inst *nsi,
+  struct osmo_sockaddr *remote,
+  int offset);
 
 /* sns */
 int gprs_ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct 
tlv_parsed *tp);
 struct osmo_fsm_inst *ns2_sns_bss_fsm_alloc(struct gprs_ns2_nse *nse,
 const char *id);
-int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc,
- const struct osmo_sockaddr *remote);
 void ns2_sns_free_nsvc(struct gprs_ns2_vc *nsvc);

 /* vc */
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index d13d920..718d075 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -69,7 +69,7 @@
 };

 enum gprs_sns_event {
-   GPRS_SNS_EV_START,
+   GPRS_SNS_EV_SELECT_ENDPOINT,/*!< Select a SNS endpoint from the 
list */