OMPUB-1426: ipport_plugin table support CIDR format, while table_info not changed

This commit is contained in:
root
2024-09-19 03:39:12 +00:00
parent e0c20d27ed
commit db8a811a75
4 changed files with 87 additions and 78 deletions

View File

@@ -5624,7 +5624,7 @@ void ipport_plugin_ex_new_cb(const char *table_name, int table_id, const char *k
ud->rule_id = atoll(table_line + column_offset);
ret = get_column_pos(table_line, 6, &column_offset, &column_len);
ret = get_column_pos(table_line, 5, &column_offset, &column_len);
EXPECT_EQ(ret, 0);
ud->buffer = ALLOC(char, column_len + 1);
@@ -5684,7 +5684,7 @@ TEST_F(IPPortPluginTable, EX_DATA) {
EXPECT_EQ(ret, 1);
EXPECT_EQ(results[0]->rule_id, 103);
ret = inet_pton(AF_INET, "192.168.100.5", &ipv4.ipv4);
ret = inet_pton(AF_INET, "192.168.200.5", &ipv4.ipv4);
EXPECT_EQ(ret, 1);
port = htons(150);

View File

@@ -4189,10 +4189,10 @@
{
"table_name": "TEST_IPPORT_PLUGIN_WITH_EXDATA",
"table_content": [
"101\t4\t192.168.100.1\t192.168.100.1\t0\t255\t1",
"102\t4\t192.168.100.2\t192.168.100.100\t100\t200\t1",
"103\t4\t192.168.100.1\t192.168.100.1\t255\t300\t1",
"104\t6\t2001:db8:1234::5210\t2001:db8:1234::5220\t255\t512\t1"
"101\t4\t192.168.100.1/32\t0\t255\t1",
"102\t4\t192.168.200.1/24\t100\t200\t1",
"103\t4\t192.168.100.1\t255\t300\t1",
"104\t6\t2001:db8:1234::5210/64\t255\t512\t1"
]
},
{

View File

@@ -634,15 +634,14 @@
"table_id":52,
"table_name":"TEST_IPPORT_PLUGIN_WITH_EXDATA",
"table_type":"ipport_plugin",
"valid_column":7,
"valid_column":6,
"custom": {
"gc_timeout_s": 3,
"item_id":1,
"ip_type":2,
"start_ip":3,
"end_ip":4,
"port1":5,
"port2":6
"ip_addr":3,
"port1":4,
"port2":5
}
},
{