Fixup ip_proto keyword.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent f58f437997
commit 8c747380ae

@ -73,6 +73,7 @@ int DetectProtoParse(DetectProto *dp, char *str) {
} else if (strcasecmp(str,"ip") == 0) { } else if (strcasecmp(str,"ip") == 0) {
/* Proto "ip" is treated as an "any" */ /* Proto "ip" is treated as an "any" */
dp->flags |= DETECT_PROTO_ANY; dp->flags |= DETECT_PROTO_ANY;
memset(dp->proto, 0xff, sizeof(dp->proto));
} else { } else {
uint8_t proto_u8; /* Used to avoid sign extension */ uint8_t proto_u8; /* Used to avoid sign extension */

@ -166,7 +166,10 @@ int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s,
data = DetectIPProtoParse((const char *)optstr); data = DetectIPProtoParse((const char *)optstr);
if (data == NULL) goto error; if (data == NULL) goto error;
/* reset our "any" (or "ip") state */
s->proto.flags &= ~DETECT_PROTO_ANY; s->proto.flags &= ~DETECT_PROTO_ANY;
memset(s->proto.proto, 0x00, sizeof(s->proto.proto));
switch (data->op) { switch (data->op) {
case DETECT_IPPROTO_OP_EQ: case DETECT_IPPROTO_OP_EQ:
s->proto.proto[data->proto/8] |= 1 << (data->proto%8); s->proto.proto[data->proto/8] |= 1 << (data->proto%8);

Loading…
Cancel
Save