Skip to content

Commit 31b4b29

Browse files
committed
Add pfring_is_module_prefix
1 parent 3493634 commit 31b4b29

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

userland/lib/pfring.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ static pfring_module_info pfring_module_list[] = {
146146

147147
/* **************************************************** */
148148

149+
int pfring_is_module_prefix(const char *prefix) {
150+
int i = -1;
151+
152+
while (pfring_module_list[++i].name)
153+
if (strcmp(pfring_module_list[i].name, prefix) == 0)
154+
return 1;
155+
156+
return 0;
157+
}
158+
159+
/* **************************************************** */
160+
149161
pfring *pfring_open(const char *device_name, u_int32_t caplen, u_int32_t flags) {
150162
int i = -1;
151163
int mod_found = 0;

userland/lib/pfring.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,11 @@ pfring_if_t *pfring_findalldevs(void);
13691369
*/
13701370
void pfring_freealldevs(pfring_if_t *list);
13711371

1372+
/**
1373+
* Check if the prefix is a valid pf_ring module prefix
1374+
*/
1375+
int pfring_is_module_prefix(const char *prefix);
1376+
13721377
/* ********************************* */
13731378

13741379
int pfring_parse_bpf_filter(const char *filter_buffer, u_int caplen,

0 commit comments

Comments
 (0)