From: brian Date: Sun, 19 Mar 2000 12:38:19 +0000 (+0000) Subject: Add some diagnostics to prove that incoming IP fragments are X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7242a5187dce5745bc223fef5c87a12357b18b6b;p=openbsd Add some diagnostics to prove that incoming IP fragments are being dealt with correctly. --- 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 , * 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 @@ -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;