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 if (!(item == NULL && it == NULL)) {
678 if (DetectPortCutNot(port, &port2) < 0) {
684 if (DetectPortParseInsert(
head, port2) < 0) {
692 r = DetectPortParseInsert(
head, port);
699 SCLogError(
"DetectPortParseInsertString error");
729 const char *
s,
int negate,
730 ResolvedVariablesList *var_list,
int recur)
734 int o_set = 0, n_set = 0, d_set = 0;
737 size_t size = strlen(
s);
738 char port[1024] =
"";
739 const char *rule_var_port = NULL;
744 "limit reached (max 64)");
750 for (; u < size && x <
sizeof(port); u++) {
757 if (range == 1 &&
s[u] ==
'!') {
758 SCLogError(
"Can't have a negated value in a range.");
760 }
else if (!o_set &&
s[u] ==
'!') {
765 }
else if (
s[u] ==
'[') {
771 }
else if (
s[u] ==
']') {
774 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
777 r = DetectPortParseDo(
778 de_ctx,
head, nhead, port, negate ? negate : n_set, var_list, recur);
786 }
else if (depth == 0 &&
s[u] ==
',') {
789 }
else if (d_set == 1) {
790 char *temp_rule_var_port = NULL,
791 *alloc_rule_var_port = NULL;
796 if (rule_var_port == NULL)
798 if (strlen(rule_var_port) == 0) {
800 "to nothing. This is likely a misconfiguration. "
801 "Note that a negated port needs to be quoted, "
802 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
806 if (negate == 1 || n_set == 1) {
808 const size_t str_size = strlen(rule_var_port) + 3 + 1;
809 alloc_rule_var_port =
SCMalloc(str_size);
810 if (
unlikely(alloc_rule_var_port == NULL))
812 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
814 alloc_rule_var_port =
SCStrdup(rule_var_port);
815 if (
unlikely(alloc_rule_var_port == NULL))
818 temp_rule_var_port = alloc_rule_var_port;
819 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
820 (negate + n_set) % 2, var_list, recur);
822 SCFree(alloc_rule_var_port);
827 SCFree(alloc_rule_var_port);
830 SCLogDebug(
"Parsed port from DetectPortParseDo - %s", port);
832 if (negate == 0 && n_set == 0) {
833 r = DetectPortParseInsertString(
de_ctx,
head, port);
835 r = DetectPortParseInsertString(
de_ctx, nhead, port);
844 }
else if (depth == 0 &&
s[u] ==
'$') {
846 }
else if (depth == 0 && u == size-1) {
857 "groups declaration. This is likely a misconfiguration.");
863 char *temp_rule_var_port = NULL,
864 *alloc_rule_var_port = NULL;
867 if (rule_var_port == NULL)
869 if (strlen(rule_var_port) == 0) {
871 "to nothing. This is likely a misconfiguration. "
872 "Note that a negated port needs to be quoted, "
873 "\"!$HTTP_PORTS\" instead of !$HTTP_PORTS. See issue #295.",
877 if ((negate + n_set) % 2) {
879 const size_t str_size = strlen(rule_var_port) + 3 + 1;
880 alloc_rule_var_port =
SCMalloc(str_size);
881 if (
unlikely(alloc_rule_var_port == NULL))
883 snprintf(alloc_rule_var_port, str_size,
"[%s]", rule_var_port);
885 alloc_rule_var_port =
SCStrdup(rule_var_port);
886 if (
unlikely(alloc_rule_var_port == NULL))
889 temp_rule_var_port = alloc_rule_var_port;
890 r = DetectPortParseDo(
de_ctx,
head, nhead, temp_rule_var_port,
891 (negate + n_set) % 2, var_list, recur);
892 SCFree(alloc_rule_var_port);
898 if (!((negate + n_set) % 2)) {
899 r = DetectPortParseInsertString(
de_ctx,
head, port);
901 r = DetectPortParseInsertString(
de_ctx, nhead, port);
907 }
else if (depth == 1 &&
s[u] ==
',') {
914 "properly closed in \"%s\", %d missing closing brackets (]). "
915 "Note: problem might be in a variable.",
918 }
else if (depth < 0) {
920 "properly opened in \"%s\", %d missing opening brackets ([). "
921 "Note: problem might be in a variable.",
936 static int DetectPortIsCompletePortSpace(
DetectPort *p)
938 uint16_t next_port = 0;
943 if (p->
port != 0x0000)
948 if (p->
port2 == 0xFFFF)
951 next_port = p->
port2 + 1;
954 for ( ; p != NULL; p = p->
next) {
955 if (p->
port != next_port)
958 if (p->
port2 == 0xFFFF)
961 next_port = p->
port2 + 1;
984 if (DetectPortIsCompletePortSpace(*nhead) == 1) {
994 if (*
head == NULL && *nhead != NULL) {
996 r = DetectPortParseInsertString(
de_ctx,
head,
"0:65535");
1003 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1011 r = DetectPortParseInsert(
head, port);
1019 for (pg = *nhead; pg != NULL; pg = pg->
next) {
1023 for (pg2 = *
head; pg2 != NULL;) {
1029 if (pg2->
prev != NULL)
1031 if (pg2->
next != NULL)
1045 for (pg2 = *
head; pg2 != NULL; pg2 = pg2->
next) {
1050 if (*
head == NULL) {
1051 SCLogError(
"no ports left after merging ports with negated ports");
1064 SCLogDebug(
"Testing port conf vars for any misconfigured values");
1069 if (port_vars_node == NULL) {
1083 if (seq_node->
val == NULL) {
1084 SCLogError(
"Port var \"%s\" probably has a sequence(something "
1085 "in brackets) value set without any quotes. Please "
1086 "quote it using \"..\".",
1092 int r = DetectPortParseDo(NULL, &gh, &ghn, seq_node->
val,
1099 SCLogError(
"failed to parse port var \"%s\" with value \"%s\". "
1100 "Please check its syntax",
1101 seq_node->
name, seq_node->
val);
1105 if (DetectPortIsCompletePortSpace(ghn)) {
1106 SCLogError(
"Port var - \"%s\" has the complete Port range negated "
1107 "with its value \"%s\". Port space range is NIL. "
1108 "Probably have a !any or a port range that supplies "
1109 "a NULL port range",
1110 seq_node->
name, seq_node->
val);
1154 if (DetectPortParseMergeNotPorts(
de_ctx,
head, &nhead) < 0)
1180 while (isspace(*
str))
1182 if (strlen(
str) >= 16)
1191 char *port = portstr;
1194 if (port[0] ==
'!') {
1199 if ((port2 = strchr(port,
':')) != NULL) {
1204 if (strcmp(port,
"") != 0) {
1205 if (!DetectPortIsValidRange(port, &dp->
port))
1211 if (strcmp(port2,
"") != 0) {
1212 if (!DetectPortIsValidRange(port2, &dp->
port2))
1222 if (strcasecmp(port,
"any") == 0) {
1226 if (!DetectPortIsValidRange(port, &dp->
port))
1250 static bool DetectPortIsValidRange(
char *port, uint16_t *port_val)
1272 static uint32_t DetectPortHashFunc(
HashListTable *ht,
void *data, uint16_t datalen)
1277 uint32_t hash = ((uint32_t)p->
port << 16) | p->
port2;
1296 static char DetectPortCompareFunc(
void *data1, uint16_t len1,
1297 void *data2, uint16_t len2)
1302 if (data1 == NULL || data2 == NULL)
1311 static void DetectPortHashFreeFunc(
void *ptr)
1329 DetectPortCompareFunc,
1330 DetectPortHashFreeFunc);
1394 static int PortTestParse01 (
void)
1406 static int PortTestParse02 (
void)
1420 static int PortTestParse03 (
void)
1434 static int PortTestParse04 (
void)
1447 static int PortTestParse05 (
void)
1465 static int PortTestParse07 (
void)
1485 static int PortTestParse08 (
void)
1499 static int PortTestParse09 (
void)
1517 static int PortTestParse10 (
void)
1520 int r =
DetectPortParse(NULL,&dd,
"77777777777777777777777777777777777777777777");
1528 static int PortTestParse11 (
void)
1540 static int PortTestParse12 (
void)
1552 static int PortTestParse13 (
void)
1563 static int PortTestParse14 (
void)
1567 int r = DetectPortParseInsertString(NULL, &dd,
"0:100");
1569 r = DetectPortParseInsertString(NULL, &dd,
"1000:65535");
1585 static int PortTestParse15 (
void)
1602 static int PortTestParse16 (
void)
1606 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1608 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1614 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\
1616 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\
1625 static int PortTestFunctions02(
void)
1638 if (r != 0 || dp1->
next == NULL)
1642 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp1);
1647 if (r != 0 || dp2->
next == NULL)
1651 r = DetectPortParseMergeNotPorts(NULL, &
head, &dp2);
1655 if (!(
head->port == 200))
1657 if (!(
head->port2 == 300))
1675 static int PortTestFunctions03(
void)
1691 DetectPortCut(NULL, dp1, dp2, &dp3);
1695 if (!(dp1->
port == 200))
1697 if (!(dp1->
port2 == 249))
1699 if (!(dp2->
port == 250))
1701 if (!(dp2->
port2 == 300))
1710 DetectPortCut(NULL, dp1, dp2, &dp3);
1713 if (!(dp1->
port == 0))
1715 if (!(dp1->
port2 == 249))
1717 if (!(dp2->
port == 250))
1719 if (!(dp2->
port2 == 500))
1721 if (!(dp3->
port == 501))
1723 if (!(dp3->
port2 == 750))
1741 static int PortTestFunctions04(
void)
1752 r = DetectPortCutNot(dp1, &dp2);
1756 if (!(dp1->
port == 0))
1758 if (!(dp1->
port2 == 199))
1760 if (!(dp2->
port == 301))
1762 if (!(dp2->
port2 == 65535))
1777 static int PortTestFunctions07(
void)
1811 static int PortTestMatchReal(uint8_t *raw_eth_pkt, uint16_t pktsize,
const char *sig,
1826 static int PortTestMatchRealWrp(
const char *sig, uint32_t sid)
1832 uint8_t raw_eth_pkt[] = {
1833 0x00,0x50,0x56,0xea,0x00,0xbd,0x00,0x0c,
1834 0x29,0x40,0xc8,0xb5,0x08,0x00,0x45,0x00,
1835 0x01,0xa8,0xb9,0xbb,0x40,0x00,0x40,0x06,
1836 0xe0,0xbf,0xc0,0xa8,0x1c,0x83,0xc0,0xa8,
1837 0x01,0x01,0xb9,0x0a,0x00,0x50,0x6f,0xa2,
1838 0x92,0xed,0x7b,0xc1,0xd3,0x4d,0x50,0x18,
1839 0x16,0xd0,0xa0,0x6f,0x00,0x00,0x47,0x45,
1840 0x54,0x20,0x2f,0x20,0x48,0x54,0x54,0x50,
1841 0x2f,0x31,0x2e,0x31,0x0d,0x0a,0x48,0x6f,
1842 0x73,0x74,0x3a,0x20,0x31,0x39,0x32,0x2e,
1843 0x31,0x36,0x38,0x2e,0x31,0x2e,0x31,0x0d,
1844 0x0a,0x55,0x73,0x65,0x72,0x2d,0x41,0x67,
1845 0x65,0x6e,0x74,0x3a,0x20,0x4d,0x6f,0x7a,
1846 0x69,0x6c,0x6c,0x61,0x2f,0x35,0x2e,0x30,
1847 0x20,0x28,0x58,0x31,0x31,0x3b,0x20,0x55,
1848 0x3b,0x20,0x4c,0x69,0x6e,0x75,0x78,0x20,
1849 0x78,0x38,0x36,0x5f,0x36,0x34,0x3b,0x20,
1850 0x65,0x6e,0x2d,0x55,0x53,0x3b,0x20,0x72,
1851 0x76,0x3a,0x31,0x2e,0x39,0x2e,0x30,0x2e,
1852 0x31,0x34,0x29,0x20,0x47,0x65,0x63,0x6b,
1853 0x6f,0x2f,0x32,0x30,0x30,0x39,0x30,0x39,
1854 0x30,0x32,0x31,0x37,0x20,0x55,0x62,0x75,
1855 0x6e,0x74,0x75,0x2f,0x39,0x2e,0x30,0x34,
1856 0x20,0x28,0x6a,0x61,0x75,0x6e,0x74,0x79,
1857 0x29,0x20,0x46,0x69,0x72,0x65,0x66,0x6f,
1858 0x78,0x2f,0x33,0x2e,0x30,0x2e,0x31,0x34,
1859 0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,0x74,
1860 0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,
1861 0x74,0x6d,0x6c,0x2c,0x61,0x70,0x70,0x6c,
1862 0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x2f,
1863 0x78,0x68,0x74,0x6d,0x6c,0x2b,0x78,0x6d,
1864 0x6c,0x2c,0x61,0x70,0x70,0x6c,0x69,0x63,
1865 0x61,0x74,0x69,0x6f,0x6e,0x2f,0x78,0x6d,
1866 0x6c,0x3b,0x71,0x3d,0x30,0x2e,0x39,0x2c,
1867 0x2a,0x2f,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1868 0x38,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1869 0x74,0x2d,0x4c,0x61,0x6e,0x67,0x75,0x61,
1870 0x67,0x65,0x3a,0x20,0x65,0x6e,0x2d,0x75,
1871 0x73,0x2c,0x65,0x6e,0x3b,0x71,0x3d,0x30,
1872 0x2e,0x35,0x0d,0x0a,0x41,0x63,0x63,0x65,
1873 0x70,0x74,0x2d,0x45,0x6e,0x63,0x6f,0x64,
1874 0x69,0x6e,0x67,0x3a,0x20,0x67,0x7a,0x69,
1875 0x70,0x2c,0x64,0x65,0x66,0x6c,0x61,0x74,
1876 0x65,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,
1877 0x74,0x2d,0x43,0x68,0x61,0x72,0x73,0x65,
1878 0x74,0x3a,0x20,0x49,0x53,0x4f,0x2d,0x38,
1879 0x38,0x35,0x39,0x2d,0x31,0x2c,0x75,0x74,
1880 0x66,0x2d,0x38,0x3b,0x71,0x3d,0x30,0x2e,
1881 0x37,0x2c,0x2a,0x3b,0x71,0x3d,0x30,0x2e,
1882 0x37,0x0d,0x0a,0x4b,0x65,0x65,0x70,0x2d,
1883 0x41,0x6c,0x69,0x76,0x65,0x3a,0x20,0x33,
1884 0x30,0x30,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,
1885 0x65,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,
1886 0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69,
1887 0x76,0x65,0x0d,0x0a,0x0d,0x0a };
1890 return PortTestMatchReal(raw_eth_pkt, (uint16_t)
sizeof(raw_eth_pkt),
1897 static int PortTestMatchReal01(
void)
1900 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
1901 return PortTestMatchRealWrp(sig, 1);
1907 static int PortTestMatchReal02(
void)
1909 const char *sig =
"alert tcp any 47370 -> any any (msg:\"Nothing..\";"
1910 " content:\"GET\"; sid:1;)";
1911 return PortTestMatchRealWrp(sig, 1);
1917 static int PortTestMatchReal03(
void)
1919 const char *sig =
"alert tcp any 47370 -> any 80 (msg:\"Nothing..\";"
1920 " content:\"GET\"; sid:1;)";
1921 return PortTestMatchRealWrp(sig, 1);
1927 static int PortTestMatchReal04(
void)
1929 const char *sig =
"alert tcp any any -> any !80 (msg:\"Nothing..\";"
1930 " content:\"GET\"; sid:1;)";
1931 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1937 static int PortTestMatchReal05(
void)
1939 const char *sig =
"alert tcp any !47370 -> any any (msg:\"Nothing..\";"
1940 " content:\"GET\"; sid:1;)";
1941 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1947 static int PortTestMatchReal06(
void)
1949 const char *sig =
"alert tcp any !47370 -> any !80 (msg:\"Nothing..\";"
1950 " content:\"GET\"; sid:1;)";
1951 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1957 static int PortTestMatchReal07(
void)
1959 const char *sig =
"alert tcp any any -> any 70:100 (msg:\"Nothing..\";"
1960 " content:\"GET\"; sid:1;)";
1961 return PortTestMatchRealWrp(sig, 1);
1967 static int PortTestMatchReal08(
void)
1969 const char *sig =
"alert tcp any 47000:50000 -> any any (msg:\"Nothing..\";"
1970 " content:\"GET\"; sid:1;)";
1971 return PortTestMatchRealWrp(sig, 1);
1977 static int PortTestMatchReal09(
void)
1979 const char *sig =
"alert tcp any 47000:50000 -> any 70:100 (msg:\"Nothing..\";"
1980 " content:\"GET\"; sid:1;)";
1981 return PortTestMatchRealWrp(sig, 1);
1987 static int PortTestMatchReal10(
void)
1989 const char *sig =
"alert tcp any any -> any !70:100 (msg:\"Nothing..\";"
1990 " content:\"GET\"; sid:1;)";
1991 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
1997 static int PortTestMatchReal11(
void)
1999 const char *sig =
"alert tcp any !47000:50000 -> any any (msg:\"Nothing..\";"
2000 " content:\"GET\"; sid:1;)";
2001 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2007 static int PortTestMatchReal12(
void)
2009 const char *sig =
"alert tcp any !47000:50000 -> any !70:100 (msg:\"Nothing..\";"
2010 " content:\"GET\"; sid:1;)";
2011 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2017 static int PortTestMatchReal13(
void)
2019 const char *sig =
"alert tcp any 47000:50000 -> any !81: (msg:\"Nothing..\";"
2020 " content:\"GET\"; sid:1;)";
2021 return PortTestMatchRealWrp(sig, 1);
2027 static int PortTestMatchReal14(
void)
2029 const char *sig =
"alert tcp any !48000:50000 -> any :100 (msg:\"Nothing..\";"
2030 " content:\"GET\"; sid:1;)";
2031 return PortTestMatchRealWrp(sig, 1);
2037 static int PortTestMatchReal15(
void)
2039 const char *sig =
"alert tcp any :50000 -> any 81:100 (msg:\"Nothing..\";"
2040 " content:\"GET\"; sid:1;)";
2041 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2047 static int PortTestMatchReal16(
void)
2049 const char *sig =
"alert tcp any 100: -> any ![0:79,81:65535] (msg:\"Nothing..\";"
2050 " content:\"GET\"; sid:1;)";
2051 return PortTestMatchRealWrp(sig, 1);
2057 static int PortTestMatchReal17(
void)
2059 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any ![0:80,82:65535] "
2060 "(msg:\"Nothing..\"; content:\"GET\"; sid:1;)";
2061 return (PortTestMatchRealWrp(sig, 1) == 0)? 1 : 0;
2067 static int PortTestMatchReal18(
void)
2069 const char *sig =
"alert tcp any ![0:39999,48000:50000] -> any 80 (msg:\"Nothing"
2070 " at all\"; content:\"GET\"; sid:1;)";
2071 return PortTestMatchRealWrp(sig, 1);
2077 static int PortTestMatchReal19(
void)
2079 const char *sig =
"alert tcp any any -> any 80 (msg:\"Nothing..\";"
2080 " content:\"GET\"; sid:1;)";
2081 return PortTestMatchRealWrp(sig, 1);
2084 static int PortTestMatchDoubleNegation(
void)
2087 FAIL_IF(DetectPortParseDo(NULL, &
head, &nhead,
"![!80]", 0, NULL, 0) == -1);
2096 static int DetectPortParseDoTest(
void)
2102 const char *
str =
"[30:50, !45]";
2103 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2119 static int DetectPortParseDoTest2(
void)
2125 const char *
str =
"[30:50, !45]";
2126 int r = DetectPortParseDo(
de_ctx, &
head, &nhead,
str, 0, NULL, 0);
2135 static int PortParseTestLessThan14Spaces(
void)
2137 const char *
str =
" 45";
2147 static int PortParseTest14Spaces(
void)
2149 const char *
str =
" 45";
2159 static int PortParseTestMoreThan14Spaces(
void)
2161 const char *
str =
" 45";
2210 UtRegisterTest(
"PortTestMatchDoubleNegation", PortTestMatchDoubleNegation);
2212 UtRegisterTest(
"DetectPortParseDoTest2", DetectPortParseDoTest2);
2213 UtRegisterTest(
"PortParseTestLessThan14Spaces", PortParseTestLessThan14Spaces);
2215 UtRegisterTest(
"PortParseTestMoreThan14Spaces", PortParseTestMoreThan14Spaces);