defrag: tracker initialization cleanup

Remove the old tracker reset macro which is no longer being used.
Clear last_seen and remove flags on initialization.
Remove extra call to DefragTrackerInit as it was being called 2x
for each new tracker.

Now that DefragTrackerNew is just a wrapper for DefragTrackerAlloc,
remove it and just call DefragTrackerAlloc directly.
pull/1675/head
Jason Ish 10 years ago committed by Victor Julien
parent 69b4218afc
commit 3aa7e38c14

@ -96,24 +96,13 @@ static void DefragTrackerInit(DefragTracker *dt, Packet *p)
dt->vlan_id[1] = p->vlan_id[1];
dt->policy = DefragGetOsPolicy(p);
dt->host_timeout = DefragPolicyGetHostTimeout(p);
dt->remove = 0;
dt->seen_last = 0;
TAILQ_INIT(&dt->frags);
(void) DefragTrackerIncrUsecnt(dt);
}
static DefragTracker *DefragTrackerNew(Packet *p)
{
DefragTracker *dt = DefragTrackerAlloc();
if (dt == NULL)
goto error;
DefragTrackerInit(dt, p);
return dt;
error:
return NULL;
}
void DefragTrackerRelease(DefragTracker *t)
{
(void) DefragTrackerDecrUsecnt(t);
@ -467,7 +456,7 @@ static DefragTracker *DefragTrackerGetNew(Packet *p)
/* freed a tracker, but it's unlocked */
} else {
/* now see if we can alloc a new tracker */
dt = DefragTrackerNew(p);
dt = DefragTrackerAlloc();
if (dt == NULL) {
return NULL;
}

@ -71,20 +71,6 @@ typedef struct Frag_ {
TAILQ_ENTRY(Frag_) next; /**< Pointer to next fragment for tailq. */
} Frag;
/** \brief Reset tracker fields except "lock" */
#define DEFRAG_TRACKER_RESET(t) { \
(t)->timeout = 0; \
(t)->id = 0; \
(t)->policy = 0; \
(t)->af = 0; \
(t)->seen_last = 0; \
(t)->remove = 0; \
CLEAR_ADDR(&(t)->src_addr); \
CLEAR_ADDR(&(t)->dst_addr); \
(t)->frags.tqh_first = NULL; \
(t)->frags.tqh_last = NULL; \
}
/**
* A defragmentation tracker. Used to track fragments that make up a
* single packet.

Loading…
Cancel
Save