ipv6.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. #include "u.h"
  2. #include "../port/lib.h"
  3. #include "mem.h"
  4. #include "dat.h"
  5. #include "fns.h"
  6. #include "../port/error.h"
  7. #include "ip.h"
  8. #include "ipv6.h"
  9. enum
  10. {
  11. IP4HDR = 20, /* sizeof(Ip4hdr) */
  12. IP6HDR = 40, /* sizeof(Ip6hdr) */
  13. IP_HLEN4 = 0x05, /* Header length in words */
  14. IP_DF = 0x4000, /* Don't fragment */
  15. IP_MF = 0x2000, /* More fragments */
  16. IP6FHDR = 8, /* sizeof(Fraghdr6) */
  17. IP_MAX = (32*1024), /* Maximum Internet packet size */
  18. };
  19. #define IPV6CLASS(hdr) ((hdr->vcf[0]&0x0F)<<2 | (hdr->vcf[1]&0xF0)>>2)
  20. #define BLKIPVER(xp) (((Ip6hdr*)((xp)->rp))->vcf[0]&0xF0)
  21. /*
  22. * This sleazy macro is stolen shamelessly from ip.c, see comment there.
  23. */
  24. #define BKFG(xp) ((Ipfrag*)((xp)->base))
  25. typedef struct IP IP;
  26. typedef struct Fragment4 Fragment4;
  27. typedef struct Fragment6 Fragment6;
  28. typedef struct Ipfrag Ipfrag;
  29. Block* ip6reassemble(IP*, int, Block*, Ip6hdr*);
  30. void ipfragfree6(IP*, Fragment6*);
  31. Fragment6* ipfragallo6(IP*);
  32. static Block* procxtns(IP *ip, Block *bp, int doreasm);
  33. int unfraglen(Block *bp, uchar *nexthdr, int setfh);
  34. Block* procopts(Block *bp);
  35. /* MIB II counters */
  36. enum
  37. {
  38. Forwarding,
  39. DefaultTTL,
  40. InReceives,
  41. InHdrErrors,
  42. InAddrErrors,
  43. ForwDatagrams,
  44. InUnknownProtos,
  45. InDiscards,
  46. InDelivers,
  47. OutRequests,
  48. OutDiscards,
  49. OutNoRoutes,
  50. ReasmTimeout,
  51. ReasmReqds,
  52. ReasmOKs,
  53. ReasmFails,
  54. FragOKs,
  55. FragFails,
  56. FragCreates,
  57. Nstats,
  58. };
  59. static char *statnames[] =
  60. {
  61. [Forwarding] "Forwarding",
  62. [DefaultTTL] "DefaultTTL",
  63. [InReceives] "InReceives",
  64. [InHdrErrors] "InHdrErrors",
  65. [InAddrErrors] "InAddrErrors",
  66. [ForwDatagrams] "ForwDatagrams",
  67. [InUnknownProtos] "InUnknownProtos",
  68. [InDiscards] "InDiscards",
  69. [InDelivers] "InDelivers",
  70. [OutRequests] "OutRequests",
  71. [OutDiscards] "OutDiscards",
  72. [OutNoRoutes] "OutNoRoutes",
  73. [ReasmTimeout] "ReasmTimeout",
  74. [ReasmReqds] "ReasmReqds",
  75. [ReasmOKs] "ReasmOKs",
  76. [ReasmFails] "ReasmFails",
  77. [FragOKs] "FragOKs",
  78. [FragFails] "FragFails",
  79. [FragCreates] "FragCreates",
  80. };
  81. struct Fragment4
  82. {
  83. Block* blist;
  84. Fragment4* next;
  85. ulong src;
  86. ulong dst;
  87. ushort id;
  88. ulong age;
  89. };
  90. struct Fragment6
  91. {
  92. Block* blist;
  93. Fragment6* next;
  94. uchar src[IPaddrlen];
  95. uchar dst[IPaddrlen];
  96. uint id;
  97. ulong age;
  98. };
  99. struct Ipfrag
  100. {
  101. ushort foff;
  102. ushort flen;
  103. };
  104. /* an instance of IP */
  105. struct IP
  106. {
  107. ulong stats[Nstats];
  108. QLock fraglock4;
  109. Fragment4* flisthead4;
  110. Fragment4* fragfree4;
  111. Ref id4;
  112. QLock fraglock6;
  113. Fragment6* flisthead6;
  114. Fragment6* fragfree6;
  115. Ref id6;
  116. int iprouting; /* true if we route like a gateway */
  117. };
  118. void
  119. ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos)
  120. {
  121. int tentative;
  122. Ipifc *ifc;
  123. uchar *gate, nexthdr;
  124. Ip6hdr *eh;
  125. int medialen, len, chunk, uflen, flen, seglen, lid, offset, fragoff, morefrags, blklen;
  126. Route *r, *sr;
  127. Fraghdr6 fraghdr;
  128. Block *xp, *nb;
  129. IP *ip;
  130. ip = f->ip;
  131. /* Fill out the ip header */
  132. eh = (Ip6hdr*)(bp->rp);
  133. ip->stats[OutRequests]++;
  134. /* Number of uchars in data and ip header to write */
  135. len = blocklen(bp);
  136. tentative = iptentative(f, eh->src);
  137. if(tentative){
  138. netlog(f, Logip, "reject tx of packet with tentative src address\n");
  139. goto free;
  140. }
  141. if(gating){
  142. chunk = nhgets(eh->ploadlen);
  143. if(chunk > len){
  144. ip->stats[OutDiscards]++;
  145. netlog(f, Logip, "short gated packet\n");
  146. goto free;
  147. }
  148. if(chunk + IPV6HDR_LEN < len)
  149. len = chunk + IPV6HDR_LEN;
  150. }
  151. if(len >= IP_MAX){
  152. print("len > IP_MAX, free\n");
  153. ip->stats[OutDiscards]++;
  154. netlog(f, Logip, "exceeded ip max size %I\n", eh->dst);
  155. goto free;
  156. }
  157. r = v6lookup(f, eh->dst);
  158. if(r == nil){
  159. print("no route for %I, src %I free\n", eh->dst, eh->src);
  160. ip->stats[OutNoRoutes]++;
  161. netlog(f, Logip, "no interface %I\n", eh->dst);
  162. goto free;
  163. }
  164. ifc = r->ifc;
  165. if(r->type & (Rifc|Runi))
  166. gate = eh->dst;
  167. else
  168. if(r->type & (Rbcast|Rmulti)) {
  169. gate = eh->dst;
  170. sr = v6lookup(f, eh->src);
  171. if(sr != nil && (sr->type & Runi))
  172. ifc = sr->ifc;
  173. }
  174. else
  175. gate = r->v6.gate;
  176. if(!gating)
  177. eh->vcf[0] = IP_VER6;
  178. eh->ttl = ttl;
  179. if(!gating) {
  180. eh->vcf[0] |= (tos >> 4);
  181. eh->vcf[1] = (tos << 4);
  182. }
  183. if(!canrlock(ifc)) {
  184. goto free;
  185. }
  186. if(waserror()){
  187. runlock(ifc);
  188. nexterror();
  189. }
  190. if(ifc->m == nil) {
  191. goto raise;
  192. }
  193. /* If we dont need to fragment just send it */
  194. medialen = ifc->maxmtu - ifc->m->hsize;
  195. if(len <= medialen) {
  196. hnputs(eh->ploadlen, len-IPV6HDR_LEN);
  197. ifc->m->bwrite(ifc, bp, V6, gate);
  198. runlock(ifc);
  199. poperror();
  200. return;
  201. }
  202. if(gating)
  203. if(ifc->reassemble <= 0) {
  204. /* v6 intermediate nodes are not supposed to fragment pkts;
  205. we fragment if ifc->reassemble is turned on; an exception
  206. needed for nat.
  207. */
  208. ip->stats[OutDiscards]++;
  209. icmppkttoobig6(f, ifc, bp);
  210. netlog(f, Logip, "%I: gated pkts not fragmented\n", eh->dst);
  211. goto raise;
  212. }
  213. /* start v6 fragmentation */
  214. uflen = unfraglen(bp, &nexthdr, 1);
  215. if(uflen > medialen) {
  216. ip->stats[FragFails]++;
  217. ip->stats[OutDiscards]++;
  218. netlog(f, Logip, "%I: unfragmentable part too big\n", eh->dst);
  219. goto raise;
  220. }
  221. flen = len - uflen;
  222. seglen = (medialen - (uflen + IP6FHDR)) & ~7;
  223. if(seglen < 8) {
  224. ip->stats[FragFails]++;
  225. ip->stats[OutDiscards]++;
  226. netlog(f, Logip, "%I: seglen < 8\n", eh->dst);
  227. goto raise;
  228. }
  229. lid = incref(&ip->id6);
  230. fraghdr.nexthdr = nexthdr;
  231. fraghdr.res = 0;
  232. hnputl(fraghdr.id, lid);
  233. xp = bp;
  234. offset = uflen;
  235. while (xp != nil && offset && offset >= BLEN(xp)) {
  236. offset -= BLEN(xp);
  237. xp = xp->next;
  238. }
  239. xp->rp += offset;
  240. fragoff = 0;
  241. morefrags = 1;
  242. for(; fragoff < flen; fragoff += seglen) {
  243. nb = allocb(uflen + IP6FHDR + seglen);
  244. if(fragoff + seglen >= flen) {
  245. seglen = flen - fragoff;
  246. morefrags = 0;
  247. }
  248. hnputs(eh->ploadlen, seglen+IP6FHDR);
  249. memmove(nb->wp, eh, uflen);
  250. nb->wp += uflen;
  251. hnputs(fraghdr.offsetRM, fragoff); // last 3 bits must be 0
  252. fraghdr.offsetRM[1] |= morefrags;
  253. memmove(nb->wp, &fraghdr, IP6FHDR);
  254. nb->wp += IP6FHDR;
  255. /* Copy data */
  256. chunk = seglen;
  257. while (chunk) {
  258. if(!xp) {
  259. ip->stats[OutDiscards]++;
  260. ip->stats[FragFails]++;
  261. freeblist(nb);
  262. netlog(f, Logip, "!xp: chunk in v6%d\n", chunk);
  263. goto raise;
  264. }
  265. blklen = chunk;
  266. if(BLEN(xp) < chunk)
  267. blklen = BLEN(xp);
  268. memmove(nb->wp, xp->rp, blklen);
  269. nb->wp += blklen;
  270. xp->rp += blklen;
  271. chunk -= blklen;
  272. if(xp->rp == xp->wp)
  273. xp = xp->next;
  274. }
  275. ifc->m->bwrite(ifc, nb, V6, gate);
  276. ip->stats[FragCreates]++;
  277. }
  278. ip->stats[FragOKs]++;
  279. raise:
  280. runlock(ifc);
  281. poperror();
  282. free:
  283. freeblist(bp);
  284. }
  285. void
  286. ipiput6(Fs *f, Ipifc *ifc, Block *bp)
  287. {
  288. int hl;
  289. int hop, tos;
  290. uchar proto;
  291. Ip6hdr *h;
  292. Proto *p;
  293. int notforme;
  294. int tentative;
  295. uchar v6dst[IPaddrlen];
  296. IP *ip;
  297. Route *r, *sr;
  298. ip = f->ip;
  299. ip->stats[InReceives]++;
  300. /*
  301. * Ensure we have all the header info in the first
  302. * block. Make life easier for other protocols by
  303. * collecting up to the first 64 bytes in the first block.
  304. */
  305. if(BLEN(bp) < 64) {
  306. hl = blocklen(bp);
  307. if(hl < IP6HDR)
  308. hl = IP6HDR;
  309. if(hl > 64)
  310. hl = 64;
  311. bp = pullupblock(bp, hl);
  312. if(bp == nil)
  313. return;
  314. }
  315. h = (Ip6hdr *)(bp->rp);
  316. memmove(&v6dst[0], &(h->dst)[0], IPaddrlen);
  317. notforme = ipforme(f, v6dst) == 0;
  318. tentative = iptentative(f, v6dst);
  319. if(tentative && (h->proto != ICMPv6)) {
  320. print("tentative addr, drop\n");
  321. freeblist(bp);
  322. return;
  323. }
  324. /* Check header version */
  325. if(BLKIPVER(bp) != IP_VER6) {
  326. ip->stats[InHdrErrors]++;
  327. netlog(f, Logip, "ip: bad version %ux\n", (h->vcf[0]&0xF0)>>2);
  328. freeblist(bp);
  329. return;
  330. }
  331. /* route */
  332. if(notforme) {
  333. if(!ip->iprouting){
  334. freeb(bp);
  335. return;
  336. }
  337. /* don't forward to source's network */
  338. sr = v6lookup(f, h->src);
  339. r = v6lookup(f, h->dst);
  340. if(r == nil || sr == r){
  341. ip->stats[OutDiscards]++;
  342. freeblist(bp);
  343. return;
  344. }
  345. /* don't forward if packet has timed out */
  346. hop = h->ttl;
  347. if(hop < 1) {
  348. ip->stats[InHdrErrors]++;
  349. icmpttlexceeded6(f, ifc, bp);
  350. freeblist(bp);
  351. return;
  352. }
  353. /* process headers & reassemble if the interface expects it */
  354. bp = procxtns(ip, bp, r->ifc->reassemble);
  355. if(bp == nil)
  356. return;
  357. ip->stats[ForwDatagrams]++;
  358. h = (Ip6hdr *) (bp->rp);
  359. tos = IPV6CLASS(h);
  360. hop = h->ttl;
  361. ipoput6(f, bp, 1, hop-1, tos);
  362. return;
  363. }
  364. /* reassemble & process headers if needed */
  365. bp = procxtns(ip, bp, 1);
  366. if(bp == nil)
  367. return;
  368. h = (Ip6hdr *) (bp->rp);
  369. proto = h->proto;
  370. p = Fsrcvpcol(f, proto);
  371. if(p != nil && p->rcv != nil) {
  372. ip->stats[InDelivers]++;
  373. (*p->rcv)(p, ifc, bp);
  374. return;
  375. }
  376. ip->stats[InDiscards]++;
  377. ip->stats[InUnknownProtos]++;
  378. freeblist(bp);
  379. }
  380. /*
  381. * ipfragfree6 - copied from ipfragfree4 - assume hold fraglock6
  382. */
  383. void
  384. ipfragfree6(IP *ip, Fragment6 *frag)
  385. {
  386. Fragment6 *fl, **l;
  387. if(frag->blist)
  388. freeblist(frag->blist);
  389. memset(frag->src, 0, IPaddrlen);
  390. frag->id = 0;
  391. frag->blist = nil;
  392. l = &ip->flisthead6;
  393. for(fl = *l; fl; fl = fl->next) {
  394. if(fl == frag) {
  395. *l = frag->next;
  396. break;
  397. }
  398. l = &fl->next;
  399. }
  400. frag->next = ip->fragfree6;
  401. ip->fragfree6 = frag;
  402. }
  403. /*
  404. * ipfragallo6 - copied from ipfragalloc4
  405. */
  406. Fragment6*
  407. ipfragallo6(IP *ip)
  408. {
  409. Fragment6 *f;
  410. while(ip->fragfree6 == nil) {
  411. /* free last entry on fraglist */
  412. for(f = ip->flisthead6; f->next; f = f->next)
  413. ;
  414. ipfragfree6(ip, f);
  415. }
  416. f = ip->fragfree6;
  417. ip->fragfree6 = f->next;
  418. f->next = ip->flisthead6;
  419. ip->flisthead6 = f;
  420. f->age = NOW + 30000;
  421. return f;
  422. }
  423. static Block*
  424. procxtns(IP *ip, Block *bp, int doreasm) {
  425. int offset;
  426. uchar proto;
  427. Ip6hdr *h;
  428. h = (Ip6hdr *) (bp->rp);
  429. offset = unfraglen(bp, &proto, 0);
  430. if((proto == FH) && (doreasm != 0)) {
  431. bp = ip6reassemble(ip, offset, bp, h);
  432. if(bp == nil)
  433. return nil;
  434. offset = unfraglen(bp, &proto, 0);
  435. }
  436. if(proto == DOH || offset > IP6HDR)
  437. bp = procopts(bp);
  438. return bp;
  439. }
  440. /* returns length of "Unfragmentable part", i.e., sum of lengths of ipv6 hdr,
  441. * hop-by-hop & routing headers if present; *nexthdr is set to nexthdr value
  442. * of the last header in the "Unfragmentable part"; if setfh != 0, nexthdr
  443. * field of the last header in the "Unfragmentable part" is set to FH.
  444. */
  445. int
  446. unfraglen(Block *bp, uchar *nexthdr, int setfh)
  447. {
  448. uchar *p, *q;
  449. int ufl, hs;
  450. p = bp->rp;
  451. q = p+6; /* proto, = p+sizeof(Ip6hdr.vcf)+sizeof(Ip6hdr.ploadlen) */
  452. *nexthdr = *q;
  453. ufl = IP6HDR;
  454. p += ufl;
  455. for(;;) {
  456. if(*nexthdr == HBH || *nexthdr == RH) {
  457. *nexthdr = *p;
  458. hs = ((int)*(p+1) + 1) * 8;
  459. ufl += hs;
  460. q = p;
  461. p += hs;
  462. }
  463. else
  464. break;
  465. }
  466. if(*nexthdr == FH)
  467. *q = *p;
  468. if(setfh)
  469. *q = FH;
  470. return ufl;
  471. }
  472. Block*
  473. procopts(Block *bp)
  474. {
  475. return bp;
  476. }
  477. Block*
  478. ip6reassemble(IP* ip, int uflen, Block* bp, Ip6hdr* ih)
  479. {
  480. int fend, offset;
  481. uint id;
  482. Fragment6 *f, *fnext;
  483. Fraghdr6 *fraghdr;
  484. uchar src[IPaddrlen], dst[IPaddrlen];
  485. Block *bl, **l, *last, *prev;
  486. int ovlap, len, fragsize, pktposn;
  487. fraghdr = (Fraghdr6 *) (bp->rp + uflen);
  488. memmove(src, ih->src, IPaddrlen);
  489. memmove(dst, ih->dst, IPaddrlen);
  490. id = nhgetl(fraghdr->id);
  491. offset = nhgets(fraghdr->offsetRM) & ~7;
  492. /*
  493. * block lists are too hard, pullupblock into a single block
  494. */
  495. if(bp->next){
  496. bp = pullupblock(bp, blocklen(bp));
  497. ih = (Ip6hdr *)(bp->rp);
  498. }
  499. qlock(&ip->fraglock6);
  500. /*
  501. * find a reassembly queue for this fragment
  502. */
  503. for(f = ip->flisthead6; f; f = fnext){
  504. fnext = f->next;
  505. if(ipcmp(f->src, src)==0 && ipcmp(f->dst, dst)==0 && f->id == id)
  506. break;
  507. if(f->age < NOW){
  508. ip->stats[ReasmTimeout]++;
  509. ipfragfree6(ip, f);
  510. }
  511. }
  512. /*
  513. * if this isn't a fragmented packet, accept it
  514. * and get rid of any fragments that might go
  515. * with it.
  516. */
  517. if(nhgets(fraghdr->offsetRM)==0) { // first frag is also the last
  518. if(f != nil) {
  519. ipfragfree6(ip, f);
  520. ip->stats[ReasmFails]++;
  521. }
  522. qunlock(&ip->fraglock6);
  523. return bp;
  524. }
  525. if(bp->base+sizeof(Ipfrag) >= bp->rp){
  526. bp = padblock(bp, sizeof(Ipfrag));
  527. bp->rp += sizeof(Ipfrag);
  528. }
  529. BKFG(bp)->foff = offset;
  530. BKFG(bp)->flen = nhgets(ih->ploadlen) + IP6HDR - uflen - IP6FHDR;
  531. /* First fragment allocates a reassembly queue */
  532. if(f == nil) {
  533. f = ipfragallo6(ip);
  534. f->id = id;
  535. memmove(f->src, src, IPaddrlen);
  536. memmove(f->dst, dst, IPaddrlen);
  537. f->blist = bp;
  538. qunlock(&ip->fraglock6);
  539. ip->stats[ReasmReqds]++;
  540. return nil;
  541. }
  542. /*
  543. * find the new fragment's position in the queue
  544. */
  545. prev = nil;
  546. l = &f->blist;
  547. bl = f->blist;
  548. while(bl != nil && BKFG(bp)->foff > BKFG(bl)->foff) {
  549. prev = bl;
  550. l = &bl->next;
  551. bl = bl->next;
  552. }
  553. /* Check overlap of a previous fragment - trim away as necessary */
  554. if(prev) {
  555. ovlap = BKFG(prev)->foff + BKFG(prev)->flen - BKFG(bp)->foff;
  556. if(ovlap > 0) {
  557. if(ovlap >= BKFG(bp)->flen) {
  558. freeblist(bp);
  559. qunlock(&ip->fraglock6);
  560. return nil;
  561. }
  562. BKFG(prev)->flen -= ovlap;
  563. }
  564. }
  565. /* Link onto assembly queue */
  566. bp->next = *l;
  567. *l = bp;
  568. /* Check to see if succeeding segments overlap */
  569. if(bp->next) {
  570. l = &bp->next;
  571. fend = BKFG(bp)->foff + BKFG(bp)->flen;
  572. /* Take completely covered segments out */
  573. while(*l) {
  574. ovlap = fend - BKFG(*l)->foff;
  575. if(ovlap <= 0)
  576. break;
  577. if(ovlap < BKFG(*l)->flen) {
  578. BKFG(*l)->flen -= ovlap;
  579. BKFG(*l)->foff += ovlap;
  580. /* move up ih hdrs */
  581. memmove((*l)->rp + ovlap, (*l)->rp, uflen);
  582. (*l)->rp += ovlap;
  583. break;
  584. }
  585. last = (*l)->next;
  586. (*l)->next = nil;
  587. freeblist(*l);
  588. *l = last;
  589. }
  590. }
  591. /*
  592. * look for a complete packet. if we get to a fragment
  593. * with the trailing bit of fraghdr->offsetRM[1] set, we're done.
  594. */
  595. pktposn = 0;
  596. for(bl = f->blist; bl; bl = bl->next) {
  597. if(BKFG(bl)->foff != pktposn)
  598. break;
  599. fraghdr = (Fraghdr6 *) (bl->rp + uflen);
  600. if((fraghdr->offsetRM[1] & 1) == 0) {
  601. bl = f->blist;
  602. /* get rid of frag header in first fragment */
  603. memmove(bl->rp + IP6FHDR, bl->rp, uflen);
  604. bl->rp += IP6FHDR;
  605. len = nhgets(((Ip6hdr*)(bl->rp))->ploadlen) - IP6FHDR;
  606. bl->wp = bl->rp + len + IP6HDR;
  607. /* Pullup all the fragment headers and
  608. * return a complete packet
  609. */
  610. for(bl = bl->next; bl; bl = bl->next) {
  611. fragsize = BKFG(bl)->flen;
  612. len += fragsize;
  613. bl->rp += uflen + IP6FHDR;
  614. bl->wp = bl->rp + fragsize;
  615. }
  616. bl = f->blist;
  617. f->blist = nil;
  618. ipfragfree6(ip, f);
  619. ih = (Ip6hdr*)(bl->rp);
  620. hnputs(ih->ploadlen, len);
  621. qunlock(&ip->fraglock6);
  622. ip->stats[ReasmOKs]++;
  623. return bl;
  624. }
  625. pktposn += BKFG(bl)->flen;
  626. }
  627. qunlock(&ip->fraglock6);
  628. return nil;
  629. }