ref: ba38aa8b9d6456d4d281a01a7565d59d546a4638
parent: 58fe71b2f56fade7db49069c123c97a69f53ac02
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Nov 8 17:33:19 EST 2016
gre: check nil for pullupblock()
--- a/sys/src/9/ip/gre.c
+++ b/sys/src/9/ip/gre.c
@@ -300,6 +300,8 @@
/* make sure the message has a GRE header */
bp = pullupblock(bp, GRE_IPONLY+GRE_IPPLUSGRE);
+ if(bp == nil)
+ return;
gre = (GREhdr *)bp->rp;
gre->vihl = IP_VER4;
@@ -528,11 +530,8 @@
* that when the block is forwarded, devether.c puts the block into
* a queue that also uses ->next. Just do not use ->next here!
*/
- if(bp->next){
- len = blocklen(bp);
- bp = pullupblock(bp, len);
- assert(BLEN(bp) == len && bp->next == nil);
- }
+ if(bp->next != nil)
+ bp = pullupblock(bp, blocklen(bp));
gre = (GREhdr *)bp->rp;
if(BLEN(bp) < sizeof(GREhdr) || gre->proto != IP_GREPROTO){