diff --git a/test/maat_json.json b/test/maat_json.json index 29495f8..7880ede 100644 --- a/test/maat_json.json +++ b/test/maat_json.json @@ -1997,6 +1997,41 @@ ] } ] + }, + { + "compile_id": 184, + "user_region": "APP_ID=6006740;Liumengyan-Bugreport-20210515", + "description": "Hulu", + "is_valid": "yes", + "do_blacklist": 0, + "do_log": 0, + "action": 0, + "service": 0, + "groups": [ + { + "group_name": "Untitled", + "regions": [ + + { + "table_name": "IP_CONFIG", + "table_type": "ip", + "table_content": { + "protocol": 0, + "addr_type": "ipv6", + "direction": "double", + "src_ip": "::", + "dst_ip": "2620:100:3000::", + "src_port": "0", + "dst_port": "0", + "mask_src_port": "65535", + "mask_src_ip": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", + "mask_dst_port": "65535", + "mask_dst_ip": "ffff:ffff:ff00:0000:0000:0000:0000:0000" + } + } + ] + } + ] } ], "plugin_table": [ @@ -2040,7 +2075,8 @@ "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t1", "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t1", "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t1", - "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1" + "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1", + "105\t6\t2620:100:3000::\t2620:0100:30ff:ffff:ffff:ffff:ffff:ffff\tBugreport-liumengyan-20210517\t1" ] }, { diff --git a/test/test_maatframe.cpp b/test/test_maatframe.cpp index 745ee26..4755d6f 100644 --- a/test/test_maatframe.cpp +++ b/test/test_maatframe.cpp @@ -292,7 +292,7 @@ TEST(IP_Plugin_Table, EX_DATA) ip_plugin_EX_dup_cb, 0, &ip_plugin_ex_data_counter); ASSERT_TRUE(ret>=0); - EXPECT_EQ(ip_plugin_ex_data_counter, 4); + EXPECT_EQ(ip_plugin_ex_data_counter, 5); struct ip_address ipv4, ipv6; struct ip_plugin_ud* result[4]; ipv4.ip_type=4; @@ -315,6 +315,10 @@ TEST(IP_Plugin_Table, EX_DATA) { ip_plugin_EX_free_cb(0, (void**)&(result[i]), 0, NULL); } + //Reproduce BugReport-Liumengyan-20210515 + inet_pton(AF_INET6,"240e:97c:4010:104::17",&(ipv6.ipv6)); + ret=Maat_ip_plugin_get_EX_data(g_feather, table_id, &ipv6, (void**)result, 4); + ASSERT_EQ(ret, 0); } @@ -970,6 +974,30 @@ TEST(IPScan, IPv4_composition) Maat_clean_status(&mid); return; } +TEST(IPScan, BugReport20210515) +{ + //By Liu Mengyan 2021-5-15 + int table_id=0,ret=0; + struct Maat_rule_t result[4]; + struct ipaddr ipv6_addr; + struct stream_tuple4_v6 v6_addr; + scan_status_t mid=NULL; + + ipv6_addr.addrtype=ADDR_TYPE_IPV6; + inet_pton(AF_INET6,"2409:8915:3430:7e7:8c9b:ff2a:7aa1:e74",&(v6_addr.saddr)); + v6_addr.source=htons(41159); + inet_pton(AF_INET6,"240e:97c:4010:104::17",&(v6_addr.daddr)); + v6_addr.dest=htons(7706); + ipv6_addr.v6=&v6_addr; + const char* table_name="IP_CONFIG"; + table_id=Maat_table_register(g_feather, table_name); + EXPECT_GT(table_id, 0); + + ret=Maat_scan_proto_addr(g_feather, table_id, &ipv6_addr, 6, result, 4, &mid, 0); + EXPECT_EQ(ret, 0); + Maat_clean_status(&mid); + return; +} #define TEST_NOTLogic 1