59 static bool DetectPortIsValidRange(
char *, uint16_t *);
107 for (cur =
head; cur != NULL; cur = cur->
next) {
130 for (cur =
head; cur != NULL; ) {
166 for (cur = *
head; cur != NULL; cur = cur->
next) {
183 if (cur->
next == NULL) {
195 if (cur->
prev != NULL)
212 r = DetectPortCut(
de_ctx, cur,
new, &c);
261 uint16_t a_port1 = a->
port;
262 uint16_t a_port2 = a->
port2;
263 uint16_t b_port1 = b->
port;
264 uint16_t b_port2 = b->
port2;
281 a->
port2 = b_port1 - 1;
292 tmp_c->
port = a_port2 + 1;
293 tmp_c->
port2 = b_port2;
304 a->
port2 = a_port1 - 1;
315 tmp_c->
port = b_port2 + 1;
316 tmp_c->
port2 = a_port2;
337 if (a_port1 == b_port1) {
342 b->
port = a_port2 + 1;
344 }
else if (a_port2 == b_port2) {
347 a->
port2 = a_port1 - 1;
354 a->
port2 = a_port1 - 1;
365 tmp_c->
port = a_port2 + 1;
366 tmp_c->
port2 = b_port2;
387 if (a_port1 == b_port1) {
392 b->
port = b_port2 + 1;
394 }
else if (a_port2 == b_port2) {
398 a->
port2 = b_port1 - 1;
406 a->
port2 = b_port1 - 1;
417 tmp_c->
port = b_port2 + 1;
418 tmp_c->
port2 = a_port2;
439 uint16_t a_port1 = a->
port;
440 uint16_t a_port2 = a->
port2;
445 if (a_port1 != 0x0000 && a_port2 != 0xFFFF) {
447 a->
port2 = a_port1 - 1;
455 tmp_b->
port = a_port2 + 1;
456 tmp_b->
port2 = 0xFFFF;
459 }
else if (a_port1 == 0x0000 && a_port2 != 0xFFFF) {
460 a->
port = a_port2 + 1;
463 }
else if (a_port1 != 0x0000 && a_port2 == 0xFFFF) {
465 a->
port2 = a_port1 - 1;
484 uint16_t a_port1 = a->
port;
485 uint16_t a_port2 = a->
port2;
486 uint16_t b_port1 = b->
port;
487 uint16_t b_port2 = b->
port2;
490 if (a_port1 == b_port1 && a_port2 == b_port2) {
494 }
else if (a_port1 >= b_port1 && a_port1 <= b_port2 && a_port2 <= b_port2) {
498 }
else if (a_port1 <= b_port1 && a_port2 >= b_port2) {
501 }
else if (a_port1 < b_port1 && a_port2 < b_port2 && a_port2 >= b_port1) {
504 }
else if (a_port1 < b_port1 && a_port2 < b_port2) {
507 }
else if (a_port1 > b_port1 && a_port1 <= b_port2 && a_port2 > b_port2) {
510 }
else if (a_port1 > b_port2) {
553 static int DetectPortMatch(
DetectPort *dp, uint16_t port)
555 if (port >= dp->
port &&
590 if (DetectPortMatch(
p, port) == 1) {
615 while (item != NULL && it != NULL) {
625 return item == NULL && it == NULL;
673 if (DetectPortCutNot(port, &port2) < 0) {
679 if (DetectPortParseInsert(
head, port2) < 0) {
687 r = DetectPortParseInsert(
head, port);
694 SCLogError(
"DetectPortParseInsertString error");
724 const char *
s,
int negate,
725 ResolvedVariablesList *var_list,
int recur)
729 int o_set = 0, n_set = 0, d_set = 0;
732 size_t size = strlen(
s);
733 char port[1024] =
"";
734 const char *rule_var_port = NULL;
739 "limit reached (max 64)");
745 for (; u < size && x <
sizeof(port); u++) {
752 if (range == 1 &&
s[u] ==
'!') {
753 SCLogError(
"Can't have a negated value in a range.");
755 }
else if (!o_set &&
s[u] ==
'!') {
760 }
else if (
s[u] ==
'[') {
766 }
else if (
s[u] ==
']') {
769 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
772 r = DetectPortParseDo(
773 de_ctx,
head, nhead, port, negate ? negate : n_set, var_list, recur);
781 }
else if (depth == 0 &&
s[u] ==
',') {
784 }
else if (d_set == 1) {
785 char *temp_rule_var_port = NULL,
786 *alloc_rule_var_port = NULL;
791 if (rule_var_port == NULL)
793 if (strlen(rule_var_port) == 0) {
795 "to nothing. This is likely a misconfiguration. "
796 "Note that a negated port needs to be quoted, "
797 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
801 if (negate == 1 || n_set == 1) {
803 const size_t str_size = strlen(rule_var_port) + 3 + 1;
804 alloc_rule_var_port =
SCMalloc(str_size);
805 if (
unlikely(alloc_rule_var_port == NULL))
807 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
809 alloc_rule_var_port =
SCStrdup(rule_var_port);
810 if (
unlikely(alloc_rule_var_port == NULL))
813 temp_rule_var_port = alloc_rule_var_port;
814 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
815 (negate + n_set) % 2, var_list, recur);
817 SCFree(alloc_rule_var_port);
822 SCFree(alloc_rule_var_port);
825 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
827 if (negate == 0 && n_set == 0) {
828 r = DetectPortParseInsertString(
de_ctx,
head, port);
830 r = DetectPortParseInsertString(
de_ctx, nhead, port);
839 }
else if (depth == 0 &&
s[u] ==
'$') {
841 }
else if (depth == 0 && u == size-1) {
852 "groups declaration. This is likely a misconfiguration.");
858 char *temp_rule_var_port = NULL,
859 *alloc_rule_var_port = NULL;
862 if (rule_var_port == NULL)
864 if (strlen(rule_var_port) == 0) {
866 "to nothing. This is likely a misconfiguration. "
867 "Note that a negated port needs to be quoted, "
868 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
872 if ((negate + n_set) % 2) {
874 const size_t str_size = strlen(rule_var_port) + 3 + 1;
875 alloc_rule_var_port =
SCMalloc(str_size);
876 if (
unlikely(alloc_rule_var_port == NULL))
878 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
880 alloc_rule_var_port =
SCStrdup(rule_var_port);
881 if (
unlikely(alloc_rule_var_port == NULL))
884 temp_rule_var_port = alloc_rule_var_port;
885 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
886 (negate + n_set) % 2, var_list, recur);
887 SCFree(alloc_rule_var_port);
893 if (!((negate + n_set) % 2)) {
894 r = DetectPortParseInsertString(
de_ctx,
head, port);
896 r = DetectPortParseInsertString(
de_ctx, nhead, port);
902 }
else if (depth == 1 &&
s[u] ==
',') {
909 "properly closed in \"%s\", %d missing closing brackets (]). "
910 "Note: problem might be in a variable.",
913 }
else if (depth < 0) {
915 "properly opened in \"%s\", %d missing opening brackets ([). "
916 "Note: problem might be in a variable.",
931 static int DetectPortIsCompletePortSpace(
DetectPort *
p)
933 uint16_t next_port = 0;
938 if (
p->port != 0x0000)
943 if (
p->port2 == 0xFFFF)
946 next_port =
p->port2 + 1;
949 for ( ;
p != NULL;
p =
p->
next) {
950 if (
p->port != next_port)
953 if (
p->port2 == 0xFFFF)
956 next_port =
p->port2 + 1;
979 if (DetectPortIsCompletePortSpace(*nhead) == 1) {
989 if (*
head == NULL && *nhead != NULL) {
991 r = DetectPortParseInsertString(
de_ctx,
head,
"0:65535");
998 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1006 r = DetectPortParseInsert(
head, port);
1014 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1018 for (pg2 = *
head; pg2 != NULL;) {
1024 if (pg2->
prev != NULL)
1026 if (pg2->
next != NULL)
1040 for (pg2 = *
head; pg2 != NULL; pg2 = pg2->
next) {
1045 if (*
head == NULL) {
1046 SCLogError(
"no ports left after merging ports with negated ports");
1059 SCLogDebug(
"Testing port conf vars for any misconfigured values");
1061 ResolvedVariablesList var_list;
1065 if (port_vars_node == NULL) {
1079 if (seq_node->
val == NULL) {
1080 SCLogError(
"Port var \"%s\" probably has a sequence(something "
1081 "in brackets) value set without any quotes. Please "
1082 "quote it using \"..\".",
1088 int r = DetectPortParseDo(NULL, &gh, &ghn, seq_node->
val,
1095 SCLogError(
"failed to parse port var \"%s\" with value \"%s\". "
1096 "Please check its syntax",
1097 seq_node->
name, seq_node->
val);
1101 if (DetectPortIsCompletePortSpace(ghn)) {
1102 SCLogError(
"Port var - \"%s\" has the complete Port range negated "
1103 "with its value \"%s\". Port space range is NIL. "
1104 "Probably have a !any or a port range that supplies "
1105 "a NULL port range",
1106 seq_node->
name, seq_node->
val);
1150 if (DetectPortParseMergeNotPorts(
de_ctx,
head, &nhead) < 0)
1176 while (isspace(*
str))
1178 if (strlen(
str) >= 16)
1187 char *port = portstr;
1190 if (port[0] ==
'!') {
1195 if ((port2 = strchr(port,
':')) != NULL) {
1200 if (strcmp(port,
"") != 0) {
1201 if (!DetectPortIsValidRange(port, &dp->
port))
1207 if (strcmp(port2,
"") != 0) {
1208 if (!DetectPortIsValidRange(port2, &dp->
port2))
1218 if (strcasecmp(port,
"any") == 0) {
1222 if (!DetectPortIsValidRange(port, &dp->
port))
1246 static bool DetectPortIsValidRange(
char *port, uint16_t *port_val)
1265 static uint32_t DetectPortHashFunc(
HashListTable *ht,
void *data, uint16_t datalen)
1270 uint32_t hash = ((uint32_t)
p->port << 16) |
p->port2;
1289 static char DetectPortCompareFunc(
void *data1, uint16_t len1,
1290 void *data2, uint16_t len2)
1295 if (data1 == NULL || data2 == NULL)
1304 static void DetectPortHashFreeFunc(
void *ptr)
1322 DetectPortCompareFunc,
1323 DetectPortHashFreeFunc);
1387 static int PortTestParse01 (
void)
1399 static int PortTestParse02 (
void)
1413 static int PortTestParse03 (
void)
1427 static int PortTestParse04 (
void)
1440 static int PortTestParse05 (
void)
1458 static int PortTestParse07 (
void)
1478 static int PortTestParse08 (
void)
1492 static int PortTestParse09 (
void)
1510 static int PortTestParse10 (
void)
1513 int r =
DetectPortParse(NULL,&dd,
"77777777777777777777777777777777777777777777");
1521 static int PortTestParse11 (
void)
1533 static int PortTestParse12 (
void)
1545 static int PortTestParse13 (
void)
1556 static int PortTestParse14 (
void)
1560 int r = DetectPortParseInsertString(NULL, &dd,
"0:100");
1562 r = DetectPortParseInsertString(NULL, &dd,
"1000:65535");
1578 static int PortTestParse15 (
void)
1595 static int PortTestParse16 (
void)
1599 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1601 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1607 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1609 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1618 static int PortTestFunctions02(
void)
1631 if (r != 0 || dp1->
next == NULL)
1635 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp1);
1640 if (r != 0 || dp2->
next == NULL)
1644 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp2);
1648 if (!(
head->port == 200))
1650 if (!(
head->port2 == 300))
1668 static int PortTestFunctions03(
void)
1684 DetectPortCut(NULL, dp1, dp2, &dp3);
1688 if (!(dp1->
port == 200))
1690 if (!(dp1->
port2 == 249))
1692 if (!(dp2->
port == 250))
1694 if (!(dp2->
port2 == 300))
1703 DetectPortCut(NULL, dp1, dp2, &dp3);
1706 if (!(dp1->
port == 0))
1708 if (!(dp1->
port2 == 249))
1710 if (!(dp2->
port == 250))
1712 if (!(dp2->
port2 == 500))
1714 if (!(dp3->
port == 501))
1716 if (!(dp3->
port2 == 750))
1734 static int PortTestFunctions04(
void)
1745 r = DetectPortCutNot(dp1, &dp2);
1749 if (!(dp1->
port == 0))
1751 if (!(dp1->
port2 == 199))
1753 if (!(dp2->
port == 301))
1755 if (!(dp2->
port2 == 65535))
1770 static int PortTestFunctions07(
void)
1804 static int PortTestMatchReal(uint8_t *raw_eth_pkt, uint16_t pktsize,
const char *sig,
1819 static int PortTestMatchRealWrp(
const char *sig, uint32_t sid)
1825 uint8_t raw_eth_pkt[] = {
1826 0x00,0x50,0x56,0xea,0x00,0xbd,0x00,0x0c,
1827 0x29,0x40,0xc8,0xb5,0x08,0x00,0x45,0x00,
1828 0x01,0xa8,0xb9,0xbb,0x40,0x00,0x40,0x06,
1829 0xe0,0xbf,0xc0,0xa8,0x1c,0x83,0xc0,0xa8,
1830 0x01,0x01,0xb9,0x0a,0x00,0x50,0x6f,0xa2,
1831 0x92,0xed,0x7b,0xc1,0xd3,0x4d,0x50,0x18,
1832 0x16,0xd0,0xa0,0x6f,0x00,0x00,0x47,0x45,
1833 0x54,0x20,0x2f,0x20,0x48,0x54,0x54,0x50,
1834 0x2f,0x31,0x2e,0x31,0x0d,0x0a,0x48,0x6f,
1835 0x73,0x74,0x3a,0x20,0x31,0x39,0x32,0x2e,
1836 0x31,0x36,0x38,0x2e,0x31,0x2e,0x31,0x0d,
1837 0x0a,0x55,0x73,0x65,0x72,0x2d,0x41,0x67,
1838 0x65,0x6e,0x74,0x3a,0x20,0x4d,0x6f,0x7a,
1839 0x69,0x6c,0x6c,0x61,0x2f,0x35,0x2e,0x30,
1840 0x20,0x28,0x58,0x31,0x31,0x3b,0x20,0x55,
1841 0x3b,0x20,0x4c,0x69,0x6e,0x75,0x78,0x20,
1842 0x78,0x38,0x36,0x5f,0x36,0x34,0x3b,0x20,
1843 0x65,0x6e,0x2d,0x55,0x53,0x3b,0x20,0x72,
1844 0x76,0x3a,0x31,0x2e,0x39,0x2e,0x30,0x2e,
1845 0x31,0x34,0x29,0x20,0x47,0x65,0x63,0x6b,
1846 0x6f,0x2f,0x32,0x30,0x30,0x39,0x30,0x39,
1847 0x30,0x32,0x31,0x37,0x20,0x55,0x62,0x75,
1848 0x6e,0x74,0x75,0x2f,0x39,0x2e,0x30,0x34,
1849 0x20,0x28,0x6a,0x61,0x75,0x6e,0x74,0x79,
1850 0x29,0x20,0x46,0x69,0x72,0x65,0x66,0x6f,
1851 0x78,0x2f,0x33,0x2e,0x30,0x2e,0x31,0x34,
1852 0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,0x74,
1853 0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,
1854 0x74,0x6d,0x6c,0x2c,0x61,0x70,0x70,0x6c,
1855 0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x2f,
1856 0x78,0x68,0x74,0x6d,0x6c,0x2b,0x78,0x6d,
1857 0x6c,0x2c,0x61,0x70,0x70,0x6c,0x69,0x63,
1858 0x61,0x74,0x69,0x6f,0x6e,0x2f,0x78,0x6d,
1859 0x6c,0x3b,0x71,0x3d,0x30,0x2e,0x39,0x2c,
1860 0x2a,0x2f,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1861 0x38,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1862 0x74,0x2d,0x4c,0x61,0x6e,0x67,0x75,0x61,
1863 0x67,0x65,0x3a,0x20,0x65,0x6e,0x2d,0x75,
1864 0x73,0x2c,0x65,0x6e,0x3b,0x71,0x3d,0x30,
1865 0x2e,0x35,0x0d,0x0a,0x41,0x63,0x63,0x65,
1866 0x70,0x74,0x2d,0x45,0x6e,0x63,0x6f,0x64,
1867 0x69,0x6e,0x67,0x3a,0x20,0x67,0x7a,0x69,
1868 0x70,0x2c,0x64,0x65,0x66,0x6c,0x61,0x74,
1869 0x65,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1870 0x74,0x2d,0x43,0x68,0x61,0x72,0x73,0x65,
1871 0x74,0x3a,0x20,0x49,0x53,0x4f,0x2d,0x38,
1872 0x38,0x35,0x39,0x2d,0x31,0x2c,0x75,0x74,
1873 0x66,0x2d,0x38,0x3b,0x71,0x3d,0x30,0x2e,
1874 0x37,0x2c,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1875 0x37,0x0d,0x0a,0x4b,0x65,0x65,0x70,0x2d,
1876 0x41,0x6c,0x69,0x76,0x65,0x3a,0x20,0x33,
1877 0x30,0x30,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,
1878 0x65,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,
1879 0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69,
1880 0x76,0x65,0x0d,0x0a,0x0d,0x0a };
1883 return PortTestMatchReal(raw_eth_pkt, (uint16_t)
sizeof(raw_eth_pkt),
1890 static int PortTestMatchReal01(
void)
1893 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
1894 return PortTestMatchRealWrp(sig, 1);
1900 static int PortTestMatchReal02(
void)
1902 const char *sig =
"alert tcp any 47370 -> any any (msg:\"Nothing..\";"
1903 " content:\"GET\"; sid:1;)";
1904 return PortTestMatchRealWrp(sig, 1);
1910 static int PortTestMatchReal03(
void)
1912 const char *sig =
"alert tcp any 47370 -> any 80 (msg:\"Nothing..\";"
1913 " content:\"GET\"; sid:1;)";
1914 return PortTestMatchRealWrp(sig, 1);
1920 static int PortTestMatchReal04(
void)
1922 const char *sig =
"alert tcp any any -> any !80 (msg:\"Nothing..\";"
1923 " content:\"GET\"; sid:1;)";
1924 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1930 static int PortTestMatchReal05(
void)
1932 const char *sig =
"alert tcp any !47370 -> any any (msg:\"Nothing..\";"
1933 " content:\"GET\"; sid:1;)";
1934 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1940 static int PortTestMatchReal06(
void)
1942 const char *sig =
"alert tcp any !47370 -> any !80 (msg:\"Nothing..\";"
1943 " content:\"GET\"; sid:1;)";
1944 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1950 static int PortTestMatchReal07(
void)
1952 const char *sig =
"alert tcp any any -> any 70:100 (msg:\"Nothing..\";"
1953 " content:\"GET\"; sid:1;)";
1954 return PortTestMatchRealWrp(sig, 1);
1960 static int PortTestMatchReal08(
void)
1962 const char *sig =
"alert tcp any 47000:50000 -> any any (msg:\"Nothing..\";"
1963 " content:\"GET\"; sid:1;)";
1964 return PortTestMatchRealWrp(sig, 1);
1970 static int PortTestMatchReal09(
void)
1972 const char *sig =
"alert tcp any 47000:50000 -> any 70:100 (msg:\"Nothing..\";"
1973 " content:\"GET\"; sid:1;)";
1974 return PortTestMatchRealWrp(sig, 1);
1980 static int PortTestMatchReal10(
void)
1982 const char *sig =
"alert tcp any any -> any !70:100 (msg:\"Nothing..\";"
1983 " content:\"GET\"; sid:1;)";
1984 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1990 static int PortTestMatchReal11(
void)
1992 const char *sig =
"alert tcp any !47000:50000 -> any any (msg:\"Nothing..\";"
1993 " content:\"GET\"; sid:1;)";
1994 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2000 static int PortTestMatchReal12(
void)
2002 const char *sig =
"alert tcp any !47000:50000 -> any !70:100 (msg:\"Nothing..\";"
2003 " content:\"GET\"; sid:1;)";
2004 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2010 static int PortTestMatchReal13(
void)
2012 const char *sig =
"alert tcp any 47000:50000 -> any !81: (msg:\"Nothing..\";"
2013 " content:\"GET\"; sid:1;)";
2014 return PortTestMatchRealWrp(sig, 1);
2020 static int PortTestMatchReal14(
void)
2022 const char *sig =
"alert tcp any !48000:50000 -> any :100 (msg:\"Nothing..\";"
2023 " content:\"GET\"; sid:1;)";
2024 return PortTestMatchRealWrp(sig, 1);
2030 static int PortTestMatchReal15(
void)
2032 const char *sig =
"alert tcp any :50000 -> any 81:100 (msg:\"Nothing..\";"
2033 " content:\"GET\"; sid:1;)";
2034 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2040 static int PortTestMatchReal16(
void)
2042 const char *sig =
"alert tcp any 100: -> any ![0:79,81:65535] (msg:\"Nothing..\";"
2043 " content:\"GET\"; sid:1;)";
2044 return PortTestMatchRealWrp(sig, 1);
2050 static int PortTestMatchReal17(
void)
2052 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any ![0:80,82:65535] "
2053 "(msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
2054 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2060 static int PortTestMatchReal18(
void)
2062 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any 80 (msg:\"Nothing"
2063 " at all\"; content:\"GET\"; sid:1;)";
2064 return PortTestMatchRealWrp(sig, 1);
2070 static int PortTestMatchReal19(
void)
2072 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\";"
2073 " content:\"GET\"; sid:1;)";
2074 return PortTestMatchRealWrp(sig, 1);
2077 static int PortTestMatchDoubleNegation(
void)
2080 FAIL_IF(DetectPortParseDo(NULL, &
head, &nhead,
"![!80]", 0, NULL, 0) == -1);
2089 static int DetectPortParseDoTest(
void)
2095 const char *
str =
"[30:50, !45]";
2096 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2112 static int DetectPortParseDoTest2(
void)
2118 const char *
str =
"[30:50, !45]";
2119 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2128 static int PortParseTestLessThan14Spaces(
void)
2130 const char *
str =
" 45";
2140 static int PortParseTest14Spaces(
void)
2142 const char *
str =
" 45";
2152 static int PortParseTestMoreThan14Spaces(
void)
2154 const char *
str =
" 45";
2203 UtRegisterTest(
"PortTestMatchDoubleNegation", PortTestMatchDoubleNegation);
2205 UtRegisterTest(
"DetectPortParseDoTest2", DetectPortParseDoTest2);
2206 UtRegisterTest(
"PortParseTestLessThan14Spaces", PortParseTestLessThan14Spaces);
2208 UtRegisterTest(
"PortParseTestMoreThan14Spaces", PortParseTestMoreThan14Spaces);