PPP, VJ: Use pbuf_clone to replace pbuf_alloc+pbuf_copy

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2017-07-02 23:39:01 +08:00 committed by goldsimon
parent ecd6c7ceae
commit a92a281455

View File

@ -202,16 +202,11 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf **pb)
/* TCP stack requires that we don't change the packet payload, therefore we copy
* the whole packet before compression. */
np = pbuf_alloc(PBUF_RAW, np->tot_len, PBUF_POOL);
np = pbuf_clone(PBUF_RAW, PBUF_POOL, *pb);
if (!np) {
return (TYPE_IP);
}
if (pbuf_copy(np, *pb) != ERR_OK) {
pbuf_free(np);
return (TYPE_IP);
}
*pb = np;
ip = (struct ip_hdr *)np->payload;