gre: don't drop pptp packets when smaller than v4 header
This commit is contained in:
parent
9d0ba6f162
commit
9840c50a3e
|
@ -558,47 +558,45 @@ greiput(Proto *proto, Ipifc *, Block *bp)
|
||||||
if(flags & GRE_seq)
|
if(flags & GRE_seq)
|
||||||
hdrlen += 4;
|
hdrlen += 4;
|
||||||
|
|
||||||
if(BLEN(bp) - hdrlen < sizeof(Ip4hdr)){
|
|
||||||
print("greretunnel: packet too short (s=%V d=%V)\n",
|
|
||||||
gre->src, gre->dst);
|
|
||||||
freeb(bp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ip = (Ip4hdr *)(bp->rp + hdrlen);
|
|
||||||
|
|
||||||
qlock(proto);
|
qlock(proto);
|
||||||
/*
|
|
||||||
* Look for a conversation structure for this port and address, or
|
|
||||||
* match the retunnel part, or match on the raw flag.
|
|
||||||
*/
|
|
||||||
for(p = proto->conv; *p; p++) {
|
|
||||||
c = *p;
|
|
||||||
|
|
||||||
if(c->inuse == 0)
|
if(eproto != 0x880B && BLEN(bp) - hdrlen >= sizeof(Ip4hdr)){
|
||||||
continue;
|
ip = (Ip4hdr *)(bp->rp + hdrlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not stop this session - blocking here
|
* Look for a conversation structure for this port and address, or
|
||||||
* implies that etherread is blocked.
|
* match the retunnel part, or match on the raw flag.
|
||||||
*/
|
*/
|
||||||
grec = c->ptcl;
|
for(p = proto->conv; *p; p++) {
|
||||||
if(memcmp(ip->dst, grec->hoa, sizeof ip->dst) == 0){
|
c = *p;
|
||||||
grepdin++;
|
|
||||||
grebdin += BLEN(bp);
|
|
||||||
gredownlink(c, bp);
|
|
||||||
qunlock(proto);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(memcmp(ip->src, grec->hoa, sizeof ip->src) == 0){
|
if(c->inuse == 0)
|
||||||
grepuin++;
|
continue;
|
||||||
grebuin += BLEN(bp);
|
|
||||||
greuplink(c, bp);
|
/*
|
||||||
qunlock(proto);
|
* Do not stop this session - blocking here
|
||||||
return;
|
* implies that etherread is blocked.
|
||||||
|
*/
|
||||||
|
grec = c->ptcl;
|
||||||
|
if(memcmp(ip->dst, grec->hoa, sizeof ip->dst) == 0){
|
||||||
|
grepdin++;
|
||||||
|
grebdin += BLEN(bp);
|
||||||
|
gredownlink(c, bp);
|
||||||
|
qunlock(proto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(memcmp(ip->src, grec->hoa, sizeof ip->src) == 0){
|
||||||
|
grepuin++;
|
||||||
|
grebuin += BLEN(bp);
|
||||||
|
greuplink(c, bp);
|
||||||
|
qunlock(proto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* when we get here, none of the forwarding tunnels matched. now
|
* when we get here, none of the forwarding tunnels matched. now
|
||||||
* try to match on raw and conversational sessions.
|
* try to match on raw and conversational sessions.
|
||||||
|
|
Loading…
Reference in a new issue