diff options
author | brian <brian@cvs.openbsd.org> | 2000-03-19 12:38:20 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2000-03-19 12:38:20 +0000 |
commit | e620177f9233eaa2fb727fd10bd057f2f66b3aa4 (patch) | |
tree | abb99dd151983223850289b5d359d4a264813aa8 | |
parent | a87be20b17931fb8bfca86e94ddcd22e8d37dc2b (diff) |
Add some diagnostics to prove that incoming IP fragments are
being dealt with correctly.
-rw-r--r-- | usr.sbin/ppp/ppp/nat_cmd.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c index edb62ecc7b4..955bcce02db 100644 --- a/usr.sbin/ppp/ppp/nat_cmd.c +++ b/usr.sbin/ppp/ppp/nat_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $OpenBSD: nat_cmd.c,v 1.5 2000/03/04 02:21:58 brian Exp $ + * $OpenBSD: nat_cmd.c,v 1.6 2000/03/19 12:38:19 brian Exp $ */ #include <sys/param.h> @@ -359,8 +359,9 @@ static struct mbuf * nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short *proto) { + static int gfrags; struct ip *pip, *piip; - int ret, len; + int ret, len, nfrags; struct mbuf **last; char *fptr; @@ -399,22 +400,31 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, fptr = malloc(bp->m_len); bp = mbuf_Read(bp, fptr, bp->m_len); PacketAliasSaveFragment(fptr); + log_Printf(LogDEBUG, "Store another frag (%lu) - now %d\n", + (unsigned long)((struct ip *)fptr)->ip_id, ++gfrags); break; case PKT_ALIAS_FOUND_HEADER_FRAGMENT: /* Fetch all the saved fragments and chain them on the end of `bp' */ last = &bp->m_nextpkt; + nfrags = 0; while ((fptr = PacketAliasGetFragment(MBUF_CTOP(bp))) != NULL) { - PacketAliasFragmentIn(MBUF_CTOP(bp), fptr); + nfrags++; + PacketAliasFragmentIn(MBUF_CTOP(bp), fptr); len = ntohs(((struct ip *)fptr)->ip_len); *last = m_get(len, MB_NATIN); memcpy(MBUF_CTOP(*last), fptr, len); free(fptr); last = &(*last)->m_nextpkt; } + gfrags -= nfrags; + log_Printf(LogDEBUG, "Found a frag header (%lu) - plus %d more frags (no" + "w %d)\n", (unsigned long)((struct ip *)MBUF_CTOP(bp))->ip_id, + nfrags, gfrags); break; default: + log_Printf(LogWARN, "nat_LayerPull: Dropped a packet....\n"); m_freem(bp); bp = NULL; break; |