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");
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);