Small cleanup and comment update to htp code.

remotes/origin/master-1.0.x
Victor Julien 15 years ago
parent a9cdd2bbae
commit ead13bda4a

@ -37,15 +37,16 @@
#include "conf.h" #include "conf.h"
/* Need a linked list in order to keep track of these */ /** Need a linked list in order to keep track of these */
typedef struct HTPCfgRec_ HTPCfgRec; typedef struct HTPCfgRec_ HTPCfgRec;
struct HTPCfgRec_ { struct HTPCfgRec_ {
htp_cfg_t *cfg; htp_cfg_t *cfg;
HTPCfgRec *next; HTPCfgRec *next;
}; };
/* These are used to keep track of the various HTP configurations */ /** Fast lookup tree (radix) for the various HTP configurations */
static SCRadixTree *cfgtree; static SCRadixTree *cfgtree;
/** List of HTP configurations. */
static HTPCfgRec cfglist; static HTPCfgRec cfglist;
#ifdef DEBUG #ifdef DEBUG
@ -233,17 +234,18 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
AppLayerParserResult *output) AppLayerParserResult *output)
{ {
SCEnter(); SCEnter();
SCRadixNode *cfgnode = NULL;
int r = -1; int r = -1;
int ret = 1; int ret = 1;
HtpState *hstate = (HtpState *)htp_state; HtpState *hstate = (HtpState *)htp_state;
htp_cfg_t *htp = cfglist.cfg; /* Default to the global HTP config */
/* On the first invocation, create the connection parser structure to /* On the first invocation, create the connection parser structure to
* be used by HTP library. This is looked up via IP in the radix * be used by HTP library. This is looked up via IP in the radix
* tree. Failing that, the default HTP config is used. * tree. Failing that, the default HTP config is used.
*/ */
if (NULL == hstate->connp ) { if (NULL == hstate->connp ) {
htp_cfg_t *htp = cfglist.cfg; /* Default to the global HTP config */
SCRadixNode *cfgnode = NULL;
if (AF_INET == f->dst.family) { if (AF_INET == f->dst.family) {
SCLogDebug("Looking up HTP config for ipv4 %08x", *GET_IPV4_DST_ADDR_PTR(f)); SCLogDebug("Looking up HTP config for ipv4 %08x", *GET_IPV4_DST_ADDR_PTR(f));
cfgnode = SCRadixFindKeyIPV4BestMatch((uint8_t *)GET_IPV4_DST_ADDR_PTR(f), cfgtree); cfgnode = SCRadixFindKeyIPV4BestMatch((uint8_t *)GET_IPV4_DST_ADDR_PTR(f), cfgtree);
@ -260,6 +262,7 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
} }
if (NULL == htp) { if (NULL == htp) {
/* should never happen if HTPConfigure is properly invoked */
goto error; goto error;
} }

Loading…
Cancel
Save