Change in libosmocore[master]: Gb: add a second NS implementation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Sep 8 21:52:43 UTC 2020


lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19417 )

Change subject: Gb: add a second NS implementation
......................................................................


Patch Set 24:

(28 comments)

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h 
File include/osmocom/gprs/gprs_ns2.h:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@26 
PS24, Line 26: /* TODO: remove ! */
> so we have a TODO: remove on a struct in a public header? That looks wrong ;)
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@40 
PS24, Line 40: 	NS2_VC_MODE_BLOCKRESET, /* The will only use ALIVE/ACK no initiation */
> "The VC will" […]
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@85 
PS24, Line 85: 			/* TODO: implement resource distribution */
> So future ABI break? […]
I'll out comment the link selector parameter.
If we add stuff here, it won't ABI breakage, since it's only adding things.


https://gerrit.osmocom.org/c/libosmocore/+/19417/23/include/osmocom/gprs/gprs_ns2.h 
File include/osmocom/gprs/gprs_ns2.h:

https://gerrit.osmocom.org/c/libosmocore/+/19417/23/include/osmocom/gprs/gprs_ns2.h@26 
PS23, Line 26: /* TODO: remove ! */
TODO remove


https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h 
File include/osmocom/gprs/gprs_ns2.h:

https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h@25 
PS22, Line 25: enum gprs_ns2_signal_ns {
             : 	S_NSVC_RESET, /* when a NSVC is in reset */
             : 	S_NSVC_BLOCK, /* when a NSVC become blocked */
             : 	S_NSVC_UNBLOCK, /* when a NSVC become unblocked */
             : 	S_NSVC_ALIVE_EXP, /* Tns-alive expired more than N times */
             : 	S_NSVC_REPLACED, /* nsvc object is replaced (sets old_nsvc) */
             : 	S_NSVC_MISMATCH, /* got an unexpected IE (sets msg, pdu_type, ie_type) */
             : 	S_NSVC_DELETED, /* when a NSVC gets deleted */
             : 	S_SNS_CONFIGURED, /* IP-SNS configuration completed */
             : 	S_NSE_AVAILABLE, /* NSE is available */
             : 	S_NSE_UNAVAILABLE, /* NSE is unavailable */
             : };
             : 
             : struct gprs_ns2_signal_data {
             : 	struct gprs_ns2_nse *nse;
             : 	uint16_t nsei;
             : 	struct gprs_ns2_vc *nsvc;
             : 	struct gprs_ns2_vc *old_nsvc;
             : 	uint8_t cause;
             : 	uint8_t pdu_type;
             : 	uint8_t ie_type;
             : 	struct msgb *msg;
             : };
             : 
             : enum gprs_ns2_vc_mode {
             : 	NS2_VC_MODE_ALIVE, /* The VC will use RESET/BLOCK/UNBLOCK to start the connection and do ALIVE/ACK */
             : 	NS2_VC_MODE_BLOCKRESET, /* The will only use ALIVE/ACK no initiation */
             : };
             : 
             : /*! Osmoco NS events */
             : enum gprs_ns2_evt {
             : 	GPRS_NS_EVT_UNIT_DATA,
             : };
             : 
             : /* callbacks for messages transfer */
             : /*! Osmocom GPRS callback function type */
             : typedef int gprs_ns2_cb_t(enum gprs_ns2_evt event, struct msgb *msg,
             : 			  uint16_t nsei, uint16_t bvci);
> I agree. I wasn't sure if it would be good to add even more time into it.
Done


https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h@65 
PS22, Line 65: gprs_ns2_cb_t
> this would then be a call-back that receives msgb-wrapped osmo_prim from NS to the NS-user
Done


https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h@71 
PS22, Line 71: int gprs_ns2_send(struct gprs_ns2_inst *inst,struct msgb *msg);
             : int gprs_ns2_send_nse(struct gprs_ns2_nse *nse, struct msgb *msg);
             : int gprs_ns2_send_nsei(struct gprs_ns2_inst *nsi, uint16_t nsei, struct msgb *msg);
             : int gprs_ns2_recv_vc(struct gprs_ns2_inst *nsi,
             : 		     struct gprs_ns2_vc *nsvc,
             : 		     struct msgb *msg);
> and those would basically be convenience wrapper functions which generate a msgb-wrapped osmo_prim s […]
Done


https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h@86 
PS22, Line 86: int gprs_ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause);
             : int gprs_ns2_tx_block_ack(struct gprs_ns2_vc *nsvc);
             : 
             : int gprs_ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause);
             : int gprs_ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc);
             : 
             : int gprs_ns2_tx_unblock(struct gprs_ns2_vc *nsvc);
             : int gprs_ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc);
             : 
             : int gprs_ns2_tx_alive(struct gprs_ns2_vc *nsvc);
             : int gprs_ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc);
> Ack
Done


https://gerrit.osmocom.org/c/libosmocore/+/19417/22/include/osmocom/gprs/gprs_ns2.h@104 
PS22, Line 104: nt gprs_ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause,
              : 			const struct gprs_ns_ie_ip4_elem *ip4_elems,
              : 			unsigned int num_ip4_elems,
              : 			const struct gprs_ns_ie_ip6_elem *ip6_elems,
              : 			unsigned int num_ip6_elems);
              : int gprs_ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag,
              : 			   const struct gprs_ns_ie_ip4_elem *ip4_elems,
              : 			   unsigned int num_ip4_elems,
              : 			   const struct gprs_ns_ie_ip6_elem *ip6_elems,
              : 			   unsigned int num_ip6_elems);
              : int gprs_ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
              : int gprs_ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc,
              : 			 int ip4_ep_nr, int ip6_ep_nr);
              : int gprs_ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
> Ack
Done


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c 
File src/gb/gprs_ns2.c:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@217 
PS24, Line 217: 			snprintf(buf, buf_len, "udp)%s:%u<%u>%s:%u",
> Ideally IPv6 should be enclosed in between breackets ([]) […]
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@227 
PS24, Line 227: 		snprintf(buf, buf_len, "frgre)");
> missing break?
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@229 
PS24, Line 229: 		snprintf(buf, buf_len, "e1)");
> missing break?
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@248 
PS24, Line 248: 	char *buf = talloc_size(ctx, INET6_ADDRSTRLEN+10);
> shouldn't this be INET6_ADDRSTRLEN*2 ? and +10 doesn't seem enough to me.
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@346 
PS24, Line 346: 	llist_add(&nsvc->list, &nse->nsvc);
> Easiest here is to add to several lists at the end before returning, then you can drop 2 lines from  […]
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@395 
PS24, Line 395: 	if (nsvc->priv && nsvc->bind->free_vc) {
> uneeded {}
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@408 
PS24, Line 408: 		"GPRS/NS");
> move to be in line with "(".
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@420 
PS24, Line 420:  * \param[out] result
> this documenttion needs updating.
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@554 
PS24, Line 554:  * \param[out] reject A message filled to be sent back. Only used in failure cases.
> docuemntation needs updating
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@675 
PS24, Line 675:  * \brief gprs_ns2_ip_connect
> documentation needs updating.
Ack


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@882 
PS24, Line 882: static bool gprs_fsm_vc_registered = false;
> what about this?
I don't care. Just took this over from NS1. What would be a better solution? Create a second function to init it? Or should I use a constructor?


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c 
File src/gb/gprs_ns2_frgre.c:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c@477 
PS24, Line 477: 	/* FIXME: actually send the data here instead of nsip_sendmsg() */
> This is yet not implemented?
Yes. I don't have a test case or a device to test against it. I would postpone this code until we have a real setup. The whole file also needs more work (e.g. IPv6 extension header).


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c@524 
PS24, Line 524: 		rc = handle_nsfrgre_read(bfd);
> Usual stuff: check if handle_nsfrgre_read() can cause the struct holding bfd to be freed. […]
Did I missed the free?


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c 
File src/gb/gprs_ns2_message.c:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c@43 
PS24, Line 43: #define ERR_IF_NSVC_USES_SNS(nsvc, reason) 							\
> ?
i'll remove this


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c@64 
PS24, Line 64: int gprs_ns2_validate_reset(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp, uint8_t *cause)
> returning 1 or 0? this looks strange...
what do you mean?


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c 
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@268 
PS24, Line 268: 	remote.u.sin6.sin6_port = ip6->udp_port;
> be careful, you may need htons() here
no


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@301 
PS24, Line 301: 		remote.u.sin.sin_port = ip4->udp_port;
> htons?
no


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@336 
PS24, Line 336: 		remote.u.sin6.sin6_port = ip6->udp_port;
> htons?
no


https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_vc_fsm.c 
File src/gb/gprs_ns2_vc_fsm.c:

https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_vc_fsm.c@121 
PS24, Line 121: 	{ GPRS_NS2_EV_BLOCK,	"BLOCK" },
> weird indentation
Ack



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3525beef205588dfab9d3880a34115f1a2676e48
Gerrit-Change-Number: 19417
Gerrit-PatchSet: 24
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Assignee: daniel <daniel at totalueberwachung.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-CC: daniel <daniel at totalueberwachung.de>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Tue, 08 Sep 2020 21:52:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: lynxis lazus <lynxis at fe80.eu>
Comment-In-Reply-To: pespin <pespin at sysmocom.de>
Comment-In-Reply-To: laforge <laforge at osmocom.org>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200908/6cd194c0/attachment.htm>


More information about the gerrit-log mailing list