Skip to content

Commit af860e2

Browse files
committed
Support comments in ipMatchFromFile file via '#' token
1 parent 07514f9 commit af860e2

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.x.y - YYYY-MMM-DD (to be released)
22
-------------------------------------
33

4+
- Support comments in ipMatchFromFile file via '#' token
5+
[Issue #2554 - @tomsommer, @martinhsv]
46
- Fix: FILES_TMP_CONTENT collection key should use part name
57
[Issue #2831 - @airween]
68
- Use AS_HELP_STRING instead of obsolete AC_HELP_STRING macro

src/utils/ip_tree.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ IpTree::~IpTree() {
8888
bool IpTree::addFromBuffer(std::istream *ss, std::string *error) {
8989
char *error_msg = NULL;
9090
for (std::string line; std::getline(*ss, line); ) {
91+
size_t comment_start = line.find('#');
92+
if (comment_start != std::string::npos) {
93+
line = line.substr(0, comment_start);
94+
}
9195
int res = add_ip_from_param(line.c_str(), &m_tree, &error_msg);
9296
if (res != 0) {
9397
if (error_msg != NULL) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
127.0.0.1
2+
# Comment line
23
10.10.10.1
34
::1
45
200.249.12.31

0 commit comments

Comments
 (0)