device: Add function to build interface list from config

This patch adds a new function which build the list of interfaces to
use by parsing the configuration file. This is using the new format
and thus only af-packet can benefit of this feature.
remotes/origin/master-1.1.x
Eric Leblond 14 years ago committed by Victor Julien
parent df7dbe36b6
commit e253da092c

@ -84,3 +84,31 @@ char *LiveGetDevice(int number) {
return NULL;
}
int LiveBuildIfaceList(char * runmode)
{
ConfNode *base = ConfGetNode(runmode);
ConfNode *child;
int i = 0;
if (base == NULL)
return 0;
TAILQ_FOREACH(child, &base->head, next) {
if (!strncmp(child->val, "interface", sizeof(child->val))) {
ConfNode *subchild;
TAILQ_FOREACH(subchild, &child->head, next) {
if ((!strcmp(subchild->name, "interface"))) {
SCLogInfo("Adding interface %s from config file",
subchild->val);
LiveRegisterDevice(subchild->val);
i++;
}
}
}
}
return i;
}

@ -30,5 +30,6 @@ typedef struct LiveDevice_ {
int LiveRegisterDevice(char *dev);
int LiveGetDeviceCount(void);
char *LiveGetDevice(int number);
int LiveBuildIfaceList(char * base);
#endif /* __UTIL_DEVICE_H__ */

Loading…
Cancel
Save