60 static bool DetectPortIsValidRange(
char *, uint16_t *);
108 for (cur =
head; cur != NULL; cur = cur->
next) {
131 for (cur =
head; cur != NULL; ) {
167 for (cur = *
head; cur != NULL; cur = cur->
next) {
184 if (cur->
next == NULL) {
196 if (cur->
prev != NULL)
213 r = DetectPortCut(
de_ctx, cur,
new, &c);
262 uint16_t a_port1 = a->
port;
263 uint16_t a_port2 = a->
port2;
264 uint16_t b_port1 = b->
port;
265 uint16_t b_port2 = b->
port2;
282 a->
port2 = b_port1 - 1;
293 tmp_c->
port = a_port2 + 1;
294 tmp_c->
port2 = b_port2;
305 a->
port2 = a_port1 - 1;
316 tmp_c->
port = b_port2 + 1;
317 tmp_c->
port2 = a_port2;
338 if (a_port1 == b_port1) {
343 b->
port = a_port2 + 1;
345 }
else if (a_port2 == b_port2) {
348 a->
port2 = a_port1 - 1;
355 a->
port2 = a_port1 - 1;
366 tmp_c->
port = a_port2 + 1;
367 tmp_c->
port2 = b_port2;
388 if (a_port1 == b_port1) {
393 b->
port = b_port2 + 1;
395 }
else if (a_port2 == b_port2) {
399 a->
port2 = b_port1 - 1;
407 a->
port2 = b_port1 - 1;
418 tmp_c->
port = b_port2 + 1;
419 tmp_c->
port2 = a_port2;
440 uint16_t a_port1 = a->
port;
441 uint16_t a_port2 = a->
port2;
446 if (a_port1 != 0x0000 && a_port2 != 0xFFFF) {
448 a->
port2 = a_port1 - 1;
456 tmp_b->
port = a_port2 + 1;
457 tmp_b->
port2 = 0xFFFF;
460 }
else if (a_port1 == 0x0000 && a_port2 != 0xFFFF) {
461 a->
port = a_port2 + 1;
464 }
else if (a_port1 != 0x0000 && a_port2 == 0xFFFF) {
466 a->
port2 = a_port1 - 1;
485 uint16_t a_port1 = a->
port;
486 uint16_t a_port2 = a->
port2;
487 uint16_t b_port1 = b->
port;
488 uint16_t b_port2 = b->
port2;
491 if (a_port1 == b_port1 && a_port2 == b_port2) {
495 }
else if (a_port1 >= b_port1 && a_port1 <= b_port2 && a_port2 <= b_port2) {
499 }
else if (a_port1 <= b_port1 && a_port2 >= b_port2) {
502 }
else if (a_port1 < b_port1 && a_port2 < b_port2 && a_port2 >= b_port1) {
505 }
else if (a_port1 < b_port1 && a_port2 < b_port2) {
508 }
else if (a_port1 > b_port1 && a_port1 <= b_port2 && a_port2 > b_port2) {
511 }
else if (a_port1 > b_port2) {
554 static int DetectPortMatch(
DetectPort *dp, uint16_t port)
556 if (port >= dp->
port &&
591 if (DetectPortMatch(p, port) == 1) {
616 while (item != NULL && it != NULL) {
626 return item == NULL && it == NULL;
674 if (DetectPortCutNot(port, &port2) < 0) {
680 if (DetectPortParseInsert(
head, port2) < 0) {
688 r = DetectPortParseInsert(
head, port);
695 SCLogError(
"DetectPortParseInsertString error");
725 const char *
s,
int negate,
726 ResolvedVariablesList *var_list,
int recur)
730 int o_set = 0, n_set = 0, d_set = 0;
733 size_t size = strlen(
s);
734 char port[1024] =
"";
735 const char *rule_var_port = NULL;
740 "limit reached (max 64)");
746 for (; u < size && x <
sizeof(port); u++) {
753 if (range == 1 &&
s[u] ==
'!') {
754 SCLogError(
"Can't have a negated value in a range.");
756 }
else if (!o_set &&
s[u] ==
'!') {
761 }
else if (
s[u] ==
'[') {
767 }
else if (
s[u] ==
']') {
770 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
773 r = DetectPortParseDo(
774 de_ctx,
head, nhead, port, negate ? negate : n_set, var_list, recur);
782 }
else if (depth == 0 &&
s[u] ==
',') {
785 }
else if (d_set == 1) {
786 char *temp_rule_var_port = NULL,
787 *alloc_rule_var_port = NULL;
792 if (rule_var_port == NULL)
794 if (strlen(rule_var_port) == 0) {
796 "to nothing. This is likely a misconfiguration. "
797 "Note that a negated port needs to be quoted, "
798 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
802 if (negate == 1 || n_set == 1) {
804 const size_t str_size = strlen(rule_var_port) + 3 + 1;
805 alloc_rule_var_port =
SCMalloc(str_size);
806 if (
unlikely(alloc_rule_var_port == NULL))
808 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
810 alloc_rule_var_port =
SCStrdup(rule_var_port);
811 if (
unlikely(alloc_rule_var_port == NULL))
814 temp_rule_var_port = alloc_rule_var_port;
815 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
816 (negate + n_set) % 2, var_list, recur);
818 SCFree(alloc_rule_var_port);
823 SCFree(alloc_rule_var_port);
826 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
828 if (negate == 0 && n_set == 0) {
829 r = DetectPortParseInsertString(
de_ctx,
head, port);
831 r = DetectPortParseInsertString(
de_ctx, nhead, port);
840 }
else if (depth == 0 &&
s[u] ==
'$') {
842 }
else if (depth == 0 && u == size-1) {
853 "groups declaration. This is likely a misconfiguration.");
859 char *temp_rule_var_port = NULL,
860 *alloc_rule_var_port = NULL;
863 if (rule_var_port == NULL)
865 if (strlen(rule_var_port) == 0) {
867 "to nothing. This is likely a misconfiguration. "
868 "Note that a negated port needs to be quoted, "
869 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
873 if ((negate + n_set) % 2) {
875 const size_t str_size = strlen(rule_var_port) + 3 + 1;
876 alloc_rule_var_port =
SCMalloc(str_size);
877 if (
unlikely(alloc_rule_var_port == NULL))
879 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
881 alloc_rule_var_port =
SCStrdup(rule_var_port);
882 if (
unlikely(alloc_rule_var_port == NULL))
885 temp_rule_var_port = alloc_rule_var_port;
886 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
887 (negate + n_set) % 2, var_list, recur);
888 SCFree(alloc_rule_var_port);
894 if (!((negate + n_set) % 2)) {
895 r = DetectPortParseInsertString(
de_ctx,
head, port);
897 r = DetectPortParseInsertString(
de_ctx, nhead, port);
903 }
else if (depth == 1 &&
s[u] ==
',') {
910 "properly closed in \"%s\", %d missing closing brackets (]). "
911 "Note: problem might be in a variable.",
914 }
else if (depth < 0) {
916 "properly opened in \"%s\", %d missing opening brackets ([). "
917 "Note: problem might be in a variable.",
932 static int DetectPortIsCompletePortSpace(
DetectPort *p)
934 uint16_t next_port = 0;
939 if (p->
port != 0x0000)
944 if (p->
port2 == 0xFFFF)
947 next_port = p->
port2 + 1;
950 for ( ; p != NULL; p = p->
next) {
951 if (p->
port != next_port)
954 if (p->
port2 == 0xFFFF)
957 next_port = p->
port2 + 1;
980 if (DetectPortIsCompletePortSpace(*nhead) == 1) {
990 if (*
head == NULL && *nhead != NULL) {
992 r = DetectPortParseInsertString(
de_ctx,
head,
"0:65535");
999 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1007 r = DetectPortParseInsert(
head, port);
1015 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1019 for (pg2 = *
head; pg2 != NULL;) {
1025 if (pg2->
prev != NULL)
1027 if (pg2->
next != NULL)
1041 for (pg2 = *
head; pg2 != NULL; pg2 = pg2->
next) {
1046 if (*
head == NULL) {
1047 SCLogError(
"no ports left after merging ports with negated ports");
1060 SCLogDebug(
"Testing port conf vars for any misconfigured values");
1062 ResolvedVariablesList var_list;
1066 if (port_vars_node == NULL) {
1080 if (seq_node->
val == NULL) {
1081 SCLogError(
"Port var \"%s\" probably has a sequence(something "
1082 "in brackets) value set without any quotes. Please "
1083 "quote it using \"..\".",
1089 int r = DetectPortParseDo(NULL, &gh, &ghn, seq_node->
val,
1096 SCLogError(
"failed to parse port var \"%s\" with value \"%s\". "
1097 "Please check its syntax",
1098 seq_node->
name, seq_node->
val);
1102 if (DetectPortIsCompletePortSpace(ghn)) {
1103 SCLogError(
"Port var - \"%s\" has the complete Port range negated "
1104 "with its value \"%s\". Port space range is NIL. "
1105 "Probably have a !any or a port range that supplies "
1106 "a NULL port range",
1107 seq_node->
name, seq_node->
val);
1151 if (DetectPortParseMergeNotPorts(
de_ctx,
head, &nhead) < 0)
1177 while (isspace(*
str))
1179 if (strlen(
str) >= 16)
1188 char *port = portstr;
1191 if (port[0] ==
'!') {
1196 if ((port2 = strchr(port,
':')) != NULL) {
1201 if (strcmp(port,
"") != 0) {
1202 if (!DetectPortIsValidRange(port, &dp->
port))
1208 if (strcmp(port2,
"") != 0) {
1209 if (!DetectPortIsValidRange(port2, &dp->
port2))
1219 if (strcasecmp(port,
"any") == 0) {
1223 if (!DetectPortIsValidRange(port, &dp->
port))
1247 static bool DetectPortIsValidRange(
char *port, uint16_t *port_val)
1266 static uint32_t DetectPortHashFunc(
HashListTable *ht,
void *data, uint16_t datalen)
1271 uint32_t hash = ((uint32_t)p->
port << 16) | p->
port2;
1290 static char DetectPortCompareFunc(
void *data1, uint16_t len1,
1291 void *data2, uint16_t len2)
1296 if (data1 == NULL || data2 == NULL)
1305 static void DetectPortHashFreeFunc(
void *ptr)
1323 DetectPortCompareFunc,
1324 DetectPortHashFreeFunc);
1388 static int PortTestParse01 (
void)
1400 static int PortTestParse02 (
void)
1414 static int PortTestParse03 (
void)
1428 static int PortTestParse04 (
void)
1441 static int PortTestParse05 (
void)
1459 static int PortTestParse07 (
void)
1479 static int PortTestParse08 (
void)
1493 static int PortTestParse09 (
void)
1511 static int PortTestParse10 (
void)
1514 int r =
DetectPortParse(NULL,&dd,
"77777777777777777777777777777777777777777777");
1522 static int PortTestParse11 (
void)
1534 static int PortTestParse12 (
void)
1546 static int PortTestParse13 (
void)
1557 static int PortTestParse14 (
void)
1561 int r = DetectPortParseInsertString(NULL, &dd,
"0:100");
1563 r = DetectPortParseInsertString(NULL, &dd,
"1000:65535");
1579 static int PortTestParse15 (
void)
1596 static int PortTestParse16 (
void)
1600 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1602 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1608 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1610 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1619 static int PortTestFunctions02(
void)
1632 if (r != 0 || dp1->
next == NULL)
1636 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp1);
1641 if (r != 0 || dp2->
next == NULL)
1645 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp2);
1649 if (!(
head->port == 200))
1651 if (!(
head->port2 == 300))
1669 static int PortTestFunctions03(
void)
1685 DetectPortCut(NULL, dp1, dp2, &dp3);
1689 if (!(dp1->
port == 200))
1691 if (!(dp1->
port2 == 249))
1693 if (!(dp2->
port == 250))
1695 if (!(dp2->
port2 == 300))
1704 DetectPortCut(NULL, dp1, dp2, &dp3);
1707 if (!(dp1->
port == 0))
1709 if (!(dp1->
port2 == 249))
1711 if (!(dp2->
port == 250))
1713 if (!(dp2->
port2 == 500))
1715 if (!(dp3->
port == 501))
1717 if (!(dp3->
port2 == 750))
1735 static int PortTestFunctions04(
void)
1746 r = DetectPortCutNot(dp1, &dp2);
1750 if (!(dp1->
port == 0))
1752 if (!(dp1->
port2 == 199))
1754 if (!(dp2->
port == 301))
1756 if (!(dp2->
port2 == 65535))
1771 static int PortTestFunctions07(
void)
1805 static int PortTestMatchReal(uint8_t *raw_eth_pkt, uint16_t pktsize,
const char *sig,
1820 static int PortTestMatchRealWrp(
const char *sig, uint32_t sid)
1826 uint8_t raw_eth_pkt[] = {
1827 0x00,0x50,0x56,0xea,0x00,0xbd,0x00,0x0c,
1828 0x29,0x40,0xc8,0xb5,0x08,0x00,0x45,0x00,
1829 0x01,0xa8,0xb9,0xbb,0x40,0x00,0x40,0x06,
1830 0xe0,0xbf,0xc0,0xa8,0x1c,0x83,0xc0,0xa8,
1831 0x01,0x01,0xb9,0x0a,0x00,0x50,0x6f,0xa2,
1832 0x92,0xed,0x7b,0xc1,0xd3,0x4d,0x50,0x18,
1833 0x16,0xd0,0xa0,0x6f,0x00,0x00,0x47,0x45,
1834 0x54,0x20,0x2f,0x20,0x48,0x54,0x54,0x50,
1835 0x2f,0x31,0x2e,0x31,0x0d,0x0a,0x48,0x6f,
1836 0x73,0x74,0x3a,0x20,0x31,0x39,0x32,0x2e,
1837 0x31,0x36,0x38,0x2e,0x31,0x2e,0x31,0x0d,
1838 0x0a,0x55,0x73,0x65,0x72,0x2d,0x41,0x67,
1839 0x65,0x6e,0x74,0x3a,0x20,0x4d,0x6f,0x7a,
1840 0x69,0x6c,0x6c,0x61,0x2f,0x35,0x2e,0x30,
1841 0x20,0x28,0x58,0x31,0x31,0x3b,0x20,0x55,
1842 0x3b,0x20,0x4c,0x69,0x6e,0x75,0x78,0x20,
1843 0x78,0x38,0x36,0x5f,0x36,0x34,0x3b,0x20,
1844 0x65,0x6e,0x2d,0x55,0x53,0x3b,0x20,0x72,
1845 0x76,0x3a,0x31,0x2e,0x39,0x2e,0x30,0x2e,
1846 0x31,0x34,0x29,0x20,0x47,0x65,0x63,0x6b,
1847 0x6f,0x2f,0x32,0x30,0x30,0x39,0x30,0x39,
1848 0x30,0x32,0x31,0x37,0x20,0x55,0x62,0x75,
1849 0x6e,0x74,0x75,0x2f,0x39,0x2e,0x30,0x34,
1850 0x20,0x28,0x6a,0x61,0x75,0x6e,0x74,0x79,
1851 0x29,0x20,0x46,0x69,0x72,0x65,0x66,0x6f,
1852 0x78,0x2f,0x33,0x2e,0x30,0x2e,0x31,0x34,
1853 0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,0x74,
1854 0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,
1855 0x74,0x6d,0x6c,0x2c,0x61,0x70,0x70,0x6c,
1856 0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x2f,
1857 0x78,0x68,0x74,0x6d,0x6c,0x2b,0x78,0x6d,
1858 0x6c,0x2c,0x61,0x70,0x70,0x6c,0x69,0x63,
1859 0x61,0x74,0x69,0x6f,0x6e,0x2f,0x78,0x6d,
1860 0x6c,0x3b,0x71,0x3d,0x30,0x2e,0x39,0x2c,
1861 0x2a,0x2f,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1862 0x38,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1863 0x74,0x2d,0x4c,0x61,0x6e,0x67,0x75,0x61,
1864 0x67,0x65,0x3a,0x20,0x65,0x6e,0x2d,0x75,
1865 0x73,0x2c,0x65,0x6e,0x3b,0x71,0x3d,0x30,
1866 0x2e,0x35,0x0d,0x0a,0x41,0x63,0x63,0x65,
1867 0x70,0x74,0x2d,0x45,0x6e,0x63,0x6f,0x64,
1868 0x69,0x6e,0x67,0x3a,0x20,0x67,0x7a,0x69,
1869 0x70,0x2c,0x64,0x65,0x66,0x6c,0x61,0x74,
1870 0x65,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1871 0x74,0x2d,0x43,0x68,0x61,0x72,0x73,0x65,
1872 0x74,0x3a,0x20,0x49,0x53,0x4f,0x2d,0x38,
1873 0x38,0x35,0x39,0x2d,0x31,0x2c,0x75,0x74,
1874 0x66,0x2d,0x38,0x3b,0x71,0x3d,0x30,0x2e,
1875 0x37,0x2c,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1876 0x37,0x0d,0x0a,0x4b,0x65,0x65,0x70,0x2d,
1877 0x41,0x6c,0x69,0x76,0x65,0x3a,0x20,0x33,
1878 0x30,0x30,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,
1879 0x65,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,
1880 0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69,
1881 0x76,0x65,0x0d,0x0a,0x0d,0x0a };
1884 return PortTestMatchReal(raw_eth_pkt, (uint16_t)
sizeof(raw_eth_pkt),
1891 static int PortTestMatchReal01(
void)
1894 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
1895 return PortTestMatchRealWrp(sig, 1);
1901 static int PortTestMatchReal02(
void)
1903 const char *sig =
"alert tcp any 47370 -> any any (msg:\"Nothing..\";"
1904 " content:\"GET\"; sid:1;)";
1905 return PortTestMatchRealWrp(sig, 1);
1911 static int PortTestMatchReal03(
void)
1913 const char *sig =
"alert tcp any 47370 -> any 80 (msg:\"Nothing..\";"
1914 " content:\"GET\"; sid:1;)";
1915 return PortTestMatchRealWrp(sig, 1);
1921 static int PortTestMatchReal04(
void)
1923 const char *sig =
"alert tcp any any -> any !80 (msg:\"Nothing..\";"
1924 " content:\"GET\"; sid:1;)";
1925 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1931 static int PortTestMatchReal05(
void)
1933 const char *sig =
"alert tcp any !47370 -> any any (msg:\"Nothing..\";"
1934 " content:\"GET\"; sid:1;)";
1935 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1941 static int PortTestMatchReal06(
void)
1943 const char *sig =
"alert tcp any !47370 -> any !80 (msg:\"Nothing..\";"
1944 " content:\"GET\"; sid:1;)";
1945 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1951 static int PortTestMatchReal07(
void)
1953 const char *sig =
"alert tcp any any -> any 70:100 (msg:\"Nothing..\";"
1954 " content:\"GET\"; sid:1;)";
1955 return PortTestMatchRealWrp(sig, 1);
1961 static int PortTestMatchReal08(
void)
1963 const char *sig =
"alert tcp any 47000:50000 -> any any (msg:\"Nothing..\";"
1964 " content:\"GET\"; sid:1;)";
1965 return PortTestMatchRealWrp(sig, 1);
1971 static int PortTestMatchReal09(
void)
1973 const char *sig =
"alert tcp any 47000:50000 -> any 70:100 (msg:\"Nothing..\";"
1974 " content:\"GET\"; sid:1;)";
1975 return PortTestMatchRealWrp(sig, 1);
1981 static int PortTestMatchReal10(
void)
1983 const char *sig =
"alert tcp any any -> any !70:100 (msg:\"Nothing..\";"
1984 " content:\"GET\"; sid:1;)";
1985 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1991 static int PortTestMatchReal11(
void)
1993 const char *sig =
"alert tcp any !47000:50000 -> any any (msg:\"Nothing..\";"
1994 " content:\"GET\"; sid:1;)";
1995 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2001 static int PortTestMatchReal12(
void)
2003 const char *sig =
"alert tcp any !47000:50000 -> any !70:100 (msg:\"Nothing..\";"
2004 " content:\"GET\"; sid:1;)";
2005 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2011 static int PortTestMatchReal13(
void)
2013 const char *sig =
"alert tcp any 47000:50000 -> any !81: (msg:\"Nothing..\";"
2014 " content:\"GET\"; sid:1;)";
2015 return PortTestMatchRealWrp(sig, 1);
2021 static int PortTestMatchReal14(
void)
2023 const char *sig =
"alert tcp any !48000:50000 -> any :100 (msg:\"Nothing..\";"
2024 " content:\"GET\"; sid:1;)";
2025 return PortTestMatchRealWrp(sig, 1);
2031 static int PortTestMatchReal15(
void)
2033 const char *sig =
"alert tcp any :50000 -> any 81:100 (msg:\"Nothing..\";"
2034 " content:\"GET\"; sid:1;)";
2035 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2041 static int PortTestMatchReal16(
void)
2043 const char *sig =
"alert tcp any 100: -> any ![0:79,81:65535] (msg:\"Nothing..\";"
2044 " content:\"GET\"; sid:1;)";
2045 return PortTestMatchRealWrp(sig, 1);
2051 static int PortTestMatchReal17(
void)
2053 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any ![0:80,82:65535] "
2054 "(msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
2055 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2061 static int PortTestMatchReal18(
void)
2063 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any 80 (msg:\"Nothing"
2064 " at all\"; content:\"GET\"; sid:1;)";
2065 return PortTestMatchRealWrp(sig, 1);
2071 static int PortTestMatchReal19(
void)
2073 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\";"
2074 " content:\"GET\"; sid:1;)";
2075 return PortTestMatchRealWrp(sig, 1);
2078 static int PortTestMatchDoubleNegation(
void)
2081 FAIL_IF(DetectPortParseDo(NULL, &
head, &nhead,
"![!80]", 0, NULL, 0) == -1);
2090 static int DetectPortParseDoTest(
void)
2096 const char *
str =
"[30:50, !45]";
2097 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2113 static int DetectPortParseDoTest2(
void)
2119 const char *
str =
"[30:50, !45]";
2120 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2129 static int PortParseTestLessThan14Spaces(
void)
2131 const char *
str =
" 45";
2141 static int PortParseTest14Spaces(
void)
2143 const char *
str =
" 45";
2153 static int PortParseTestMoreThan14Spaces(
void)
2155 const char *
str =
" 45";
2204 UtRegisterTest(
"PortTestMatchDoubleNegation", PortTestMatchDoubleNegation);
2206 UtRegisterTest(
"DetectPortParseDoTest2", DetectPortParseDoTest2);
2207 UtRegisterTest(
"PortParseTestLessThan14Spaces", PortParseTestLessThan14Spaces);
2209 UtRegisterTest(
"PortParseTestMoreThan14Spaces", PortParseTestMoreThan14Spaces);