}
dp->sh = NULL;
- if (dp->dst_ph != NULL && !(dp->flags & PORT_GROUP_PORTS_COPY)) {
- DetectPortCleanupList(dp->dst_ph);
- }
- dp->dst_ph = NULL;
-
- //BUG_ON(dp->next != NULL);
-
detect_port_memory -= sizeof(DetectPort);
detect_port_free_cnt++;
SCFree(dp);
/* exact overlap/match */
if (cur != new) {
SigGroupHeadCopySigs(de_ctx, new->sh, &cur->sh);
- cur->cnt += new->cnt;
DetectPortFree(new);
return 0;
}
SigGroupHeadCopySigs(de_ctx,b->sh,&tmp_c->sh); /* copy old b to c */
SigGroupHeadCopySigs(de_ctx,a->sh,&b->sh); /* copy a to b */
- tmp_c->cnt += b->cnt;
- b->cnt += a->cnt;
-
/**
* We have 3 parts: [bbb[baba]aaa]
* part a: b_port1 <-> a_port1 - 1
SigGroupHeadClearSigs(tmp->sh); /* clean tmp list */
- tmp->cnt += a->cnt;
- a->cnt = 0;
- tmp_c->cnt += tmp->cnt;
- a->cnt += b->cnt;
- b->cnt += tmp->cnt;
- tmp->cnt = 0;
-
/**
* We have 2 or three parts:
*
/** 'b' overlaps 'a' so 'a' needs the 'b' sigs */
SigGroupHeadCopySigs(de_ctx,b->sh,&a->sh);
- a->cnt += b->cnt;
} else if (a_port2 == b_port2) {
SCLogDebug("2");
* clear a
* copy tmp to a */
SigGroupHeadCopySigs(de_ctx,b->sh,&tmp->sh); /* store old a list */
- tmp->cnt = b->cnt;
SigGroupHeadCopySigs(de_ctx,a->sh,&b->sh);
- b->cnt += a->cnt;
SigGroupHeadClearSigs(a->sh); /* clean a list */
SigGroupHeadCopySigs(de_ctx,tmp->sh,&a->sh);/* merge old a with b */
- a->cnt = tmp->cnt;
SigGroupHeadClearSigs(tmp->sh); /* clean tmp list */
} else {
SCLogDebug("3");
SigGroupHeadCopySigs(de_ctx,tmp->sh,&b->sh);/* merge old a with b */
SigGroupHeadClearSigs(tmp->sh); /* clean tmp list */
-
- tmp->cnt += a->cnt;
- a->cnt = 0;
- tmp_c->cnt += b->cnt;
- a->cnt += b->cnt;
- b->cnt += tmp->cnt;
- tmp->cnt = 0;
}
/**
* We have 2 or three parts:
SigGroupHeadClearSigs(tmp->sh);
- tmp->cnt += b->cnt;
- b->cnt = 0;
- b->cnt += a->cnt;
- a->cnt += tmp->cnt;
- tmp->cnt = 0;
-
} else if (a_port2 == b_port2) {
SCLogDebug("2");
/** 'a' overlaps 'b' so 'b' needs the 'a' sigs */
SigGroupHeadCopySigs(de_ctx,a->sh,&b->sh);
- b->cnt += a->cnt;
-
} else {
SCLogDebug("3");
a->port = a_port1;
SigGroupHeadCopySigs(de_ctx,a->sh,&b->sh);
SigGroupHeadCopySigs(de_ctx,a->sh,&tmp_c->sh);
-
- b->cnt += a->cnt;
- tmp_c->cnt += a->cnt;
}
}
if (target == NULL || source == NULL)
return -1;
- target->cnt += source->cnt;
SigGroupHeadCopySigs(de_ctx,source->sh,&target->sh);
if (source->port < target->port)
#define PORT_FLAG_ANY 0x01 /**< 'any' special port */
#define PORT_FLAG_NOT 0x02 /**< negated port */
#define PORT_SIGGROUPHEAD_COPY 0x04 /**< sgh is a ptr copy */
-#define PORT_GROUP_PORTS_COPY 0x08 /**< dst_ph is a ptr copy */
/** \brief Port structure for detection engine */
typedef struct DetectPort_ {
uint16_t port;
uint16_t port2;
+ uint8_t flags; /**< flags for this port */
+
/* signatures that belong in this group */
struct SigGroupHead_ *sh;
- struct DetectPort_ *dst_ph;
-
- /* double linked list */
- union {
- struct DetectPort_ *prev;
- struct DetectPort_ *hnext; /* hash next */
- };
+ struct DetectPort_ *prev;
struct DetectPort_ *next;
-
- uint32_t cnt;
- uint8_t flags; /**< flags for this port */
} DetectPort;
/* Signature flags */