Attention is currently required from: daniel, fixeria, lynxis, ws1004.
2 comments:
File src/gb/gprs_ns2.c:
Patch Set #2, Line 755: /* The original PDU can be larger than what is left in our own
This all looks a bit too much convoluted imho. What about the following which doesn't need so much unsigned vs signed checks?
const unsigned int avail = (int)msgb_tailroom(msg);
unsigned int embed_len = msgb_l2len(orig_msg);
if (avail < 3)
embed_len = 0;
else if (avail < 3 + embed_len)
embed_len = avail - 3;
if (embed_len > 0)
msgb_tvlv_put(msg, NS_IE_PDU, embed_len, orig_msg->l2h);
File src/gb/gprs_ns2_message.c:
Patch Set #2, Line 469: else if (nsvc->bind->mtu - msgb_length(msg) < max_orig_len)
Again, this looks imho too convoluted. I propose this:
/* Trim available space to MTU: */
unsigned int avail = msgb_tailroom(msg);
if (msgb_length(msg) > nsvc->bind->mtu)
avail = 0;
else if (nsvc->bind->mtu - msgb_length(msg) > avail)
avail = nsvc->bind->mtu - msgb_length(msg);
/* Figure out how many origin PDU bytes we can fit given available space: */
if (avail < 3)
orig_len = 0;
else
orig_len = avail - 3;
if (orig_len > 0)
msgb_tvlv_put(msg, NS_IE_PDU, orig_len, orig_msg->l2h);
To view, visit change 44138. To unsubscribe, or for help writing mail filters, visit settings.