<p style="white-space: pre-wrap; word-wrap: break-word;">Without knowing much about the context of this patch, I'd say it still needs a general review from its author to clean up stuff.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417">View Change</a></p><p>23 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h">File include/osmocom/gprs/gprs_ns2.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@26">Patch Set #24, Line 26:</a> <code style="font-family:monospace,monospace">/* TODO: remove ! */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">so we have a TODO: remove on a struct in a public header? That looks wrong ;)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@40">Patch Set #24, Line 40:</a> <code style="font-family:monospace,monospace">  NS2_VC_MODE_BLOCKRESET, /* The will only use ALIVE/ACK no initiation */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">"The VC will"<br>"on initiation"?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/include/osmocom/gprs/gprs_ns2.h@85">Patch Set #24, Line 85:</a> <code style="font-family:monospace,monospace">                     /* TODO: implement resource distribution */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">So future ABI break?<br>Can we keep the structure private?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c">File src/gb/gprs_ns2.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@117">Patch Set #24, Line 117:</a> <code style="font-family:monospace,monospace">         [NS_IE_IP_ADDR] = { TLV_TYPE_FIXED, 5 },</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">So parsing is going to fail for ipv6?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@217">Patch Set #24, Line 217:</a> <code style="font-family:monospace,monospace">                      snprintf(buf, buf_len, "udp)%s:%u<%u>%s:%u",</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Ideally IPv6 should be enclosed in between breackets ([])</p><p style="white-space: pre-wrap; word-wrap: break-word;">BTW, why is there no matching parenthesis, only ")" ?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@227">Patch Set #24, Line 227:</a> <code style="font-family:monospace,monospace">            snprintf(buf, buf_len, "frgre)");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">missing break?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@229">Patch Set #24, Line 229:</a> <code style="font-family:monospace,monospace">          snprintf(buf, buf_len, "e1)");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">missing break?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@248">Patch Set #24, Line 248:</a> <code style="font-family:monospace,monospace">     char *buf = talloc_size(ctx, INET6_ADDRSTRLEN+10);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">shouldn't this be INET6_ADDRSTRLEN*2 ? and +10 doesn't seem enough to me.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@346">Patch Set #24, Line 346:</a> <code style="font-family:monospace,monospace">        llist_add(&nsvc->list, &nse->nsvc);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Easiest here is to add to several lists at the end before returning, then you can drop 2 lines from "err:"</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@395">Patch Set #24, Line 395:</a> <code style="font-family:monospace,monospace">      if (nsvc->priv && nsvc->bind->free_vc) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">uneeded {}</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@408">Patch Set #24, Line 408:</a> <code style="font-family:monospace,monospace">                "GPRS/NS");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">move to be in line with "(".</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@420">Patch Set #24, Line 420:</a> <code style="font-family:monospace,monospace"> * \param[out] result</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">this documenttion needs updating.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@554">Patch Set #24, Line 554:</a> <code style="font-family:monospace,monospace"> * \param[out] reject A message filled to be sent back. Only used in failure cases.</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">docuemntation needs updating</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@675">Patch Set #24, Line 675:</a> <code style="font-family:monospace,monospace"> * \brief gprs_ns2_ip_connect</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">documentation needs updating.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2.c@882">Patch Set #24, Line 882:</a> <code style="font-family:monospace,monospace">static bool gprs_fsm_vc_registered = false;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">what about this?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c">File src/gb/gprs_ns2_frgre.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c@477">Patch Set #24, Line 477:</a> <code style="font-family:monospace,monospace"> /* FIXME: actually send the data here instead of nsip_sendmsg() */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">This is yet not implemented?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_frgre.c@524">Patch Set #24, Line 524:</a> <code style="font-family:monospace,monospace">               rc = handle_nsfrgre_read(bfd);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Usual stuff: check if handle_nsfrgre_read() can cause the struct holding bfd to be freed. In those paths, return -EBADF and check that in next if here.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c">File src/gb/gprs_ns2_message.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c@43">Patch Set #24, Line 43:</a> <code style="font-family:monospace,monospace">#define ERR_IF_NSVC_USES_SNS(nsvc, reason)                                                       \</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_message.c@64">Patch Set #24, Line 64:</a> <code style="font-family:monospace,monospace">int gprs_ns2_validate_reset(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp, uint8_t *cause)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">returning 1 or 0? this looks strange...</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c">File src/gb/gprs_ns2_sns.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@268">Patch Set #24, Line 268:</a> <code style="font-family:monospace,monospace">      remote.u.sin6.sin6_port = ip6->udp_port;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">be careful, you may need htons() here</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@301">Patch Set #24, Line 301:</a> <code style="font-family:monospace,monospace">               remote.u.sin.sin_port = ip4->udp_port;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">htons?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_sns.c@336">Patch Set #24, Line 336:</a> <code style="font-family:monospace,monospace">                remote.u.sin6.sin6_port = ip6->udp_port;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">htons?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_vc_fsm.c">File src/gb/gprs_ns2_vc_fsm.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19417/24/src/gb/gprs_ns2_vc_fsm.c@121">Patch Set #24, Line 121:</a> <code style="font-family:monospace,monospace">      { GPRS_NS2_EV_BLOCK,    "BLOCK" },</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">weird indentation</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/19417">change 19417</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/19417"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3525beef205588dfab9d3880a34115f1a2676e48 </div>
<div style="display:none"> Gerrit-Change-Number: 19417 </div>
<div style="display:none"> Gerrit-PatchSet: 24 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Assignee: daniel <daniel@totalueberwachung.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-CC: daniel <daniel@totalueberwachung.de> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 08 Sep 2020 18:58:08 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>