<p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237/1/ggsn/ggsn.c">File ggsn/ggsn.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/osmo-ggsn/+/24237/1/ggsn/ggsn.c@588">Patch Set #1, Line 588:</a> <code style="font-family:monospace,monospace">static uint16_t inet_checksum(void *data, int len) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">We already have a lib/icmpv6.c/h files, so it makes sense to move these helper functions to lib/icmpv4.c/h.<br>Also have a look at lib/checksum.h in case you can reuse something.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237/1/ggsn/ggsn.c@611">Patch Set #1, Line 611:</a> <code style="font-family:monospace,monospace">static void ipv4_host_unreach(struct tun_t *tun, void *pack, unsigned len)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">const void *pack</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237/1/ggsn/ggsn.c@613">Patch Set #1, Line 613:</a> <code style="font-family:monospace,monospace"> char send_buf[sizeof(struct ip) + sizeof(struct icmp) + len];</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I'm not sure it's really portable to define stack buffers with variable size. In a general case you could use "alloca()" instead, see "man alloca". In this case I think it makes more sense to use a msgb structure.</p><p style="white-space: pre-wrap; word-wrap: break-word;">You can then construct something similar to existing APi for icmpv6 "icmpv6_prepend_ip6hdr()", which can be used generically to prepend icmpv6 header to different messages.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237/1/ggsn/ggsn.c@614">Patch Set #1, Line 614:</a> <code style="font-family:monospace,monospace">      len = len - 20;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">this deserves an explanation ;)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237/1/ggsn/ggsn.c@723">Patch Set #1, Line 723:</a> <code style="font-family:monospace,monospace">               if (iph->version != 4)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Since we already have icmpv6.c/h, it may be quick to implement the ipv6 part too.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ggsn/+/24237">change 24237</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/osmo-ggsn/+/24237"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ggsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia2c708feab14bb4cada00b0a90e0cb56d680d1aa </div>
<div style="display:none"> Gerrit-Change-Number: 24237 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: keith <keith@rhizomatica.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 17 May 2021 11:09:45 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>