From e183eff0c8759ddc1f00298ad4b9d3912f4e46ff Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 19 Mar 2000 12:37:27 +0000 Subject: Add some diagnostics to prove that incoming IP fragments are being dealt with correctly. --- usr.sbin/ppp/nat_cmd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 9504207..12c1d78 100644 --- a/usr.sbin/ppp/nat_cmd.c +++ b/usr.sbin/ppp/nat_cmd.c @@ -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; -- cgit v1.1