| plan 9 kernel history: overview | file list | diff list |
1997/0530/ip/gre.c (diff list | history)
| 1997/0524/sys/src/9/ip/gre.c:11,18 – 1997/0530/sys/src/9/ip/gre.c:11,18 (short | long | prev | next) | ||
| 1997/0327 | enum { | |
| 1997/0530 | GRE_IPONLY = 12, /* size of ip header */ GRE_IPPLUSGRE = 12, /* minimum size of GRE header */ | |
| 1997/0327 | IP_GREPROTO = 47, GRErxms = 200, | |
| 1997/0524/sys/src/9/ip/gre.c:122,127 – 1997/0530/sys/src/9/ip/gre.c:122,128 | ||
| 1997/0327 | { GREhdr *ghp; | |
| 1997/0524 | Block *bp; | |
| 1997/0530 | ulong raddr, laddr; | |
| 1997/0327 | USED(l); | |
| 1997/0524/sys/src/9/ip/gre.c:130,149 – 1997/0530/sys/src/9/ip/gre.c:131,157 | ||
| 1997/0327 | return; /* Make space to fit ip header (gre header already there) */ | |
| 1997/0530 | bp = padblock(bp, GRE_IPONLY); | |
| 1997/0327 | if(bp == nil) return; /* make sure the message has a GRE header */ | |
| 1997/0530 | bp = pullupblock(bp, GRE_IPONLY+GRE_IPPLUSGRE); | |
| 1997/0327 | if(bp == nil) return; ghp = (GREhdr *)(bp->rp); | |
| 1997/0530 | raddr = nhgetl(ghp->src); laddr = nhgetl(ghp->dst); if(raddr == 0) raddr = c->raddr; if(laddr == 0 || Mediaforme(ghp->dst) <= 0) laddr = c->laddr; | |
| 1997/0327 | ghp->proto = IP_GREPROTO; | |
| 1997/0530 | hnputl(ghp->dst, raddr); hnputl(ghp->src, laddr); | |
| 1997/0327 | hnputs(ghp->eproto, c->rport); | |
| 1997/0522 | ghp->frag[0] = 0; ghp->frag[1] = 0; | |
| 1997/0524/sys/src/9/ip/gre.c:184,195 – 1997/0530/sys/src/9/ip/gre.c:192,203 | ||
| 1997/0327 | /* * Trim the packet down to data size */ | |
| 1997/0530 | len = nhgets(ghp->len) - GRE_IPONLY; if(len < GRE_IPPLUSGRE){ | |
| 1997/0327 | freeblist(bp); return; } | |
| 1997/0530 | bp = trimblock(bp, GRE_IPONLY, len); | |
| 1997/0327 | if(bp == nil){ gre.lenerr++; return; | |