mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Add some diagnostics to prove that incoming IP fragments are
being dealt with correctly.
This commit is contained in:
parent
c317f0727a
commit
a1f961d3a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58285
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user