pcap: restore backward compatibility

remotes/origin/master-1.1.x
Eric Leblond 14 years ago
parent 21663acd3b
commit b2598f97e7

@ -84,12 +84,22 @@ void *ParsePcapConfig(const char *iface)
return NULL; return NULL;
} }
strlcpy(aconf->iface, iface, sizeof(aconf->iface)); strlcpy(aconf->iface, iface, sizeof(aconf->iface));
aconf->buffer_size = 0; aconf->buffer_size = 0;
/* If set command line option has precedence over config */
if ((ConfGetInt("pcap.buffer_size", &value)) == 1) {
aconf->buffer_size = value;
}
aconf->bpf_filter = NULL;
if ((ConfGet("bpf-filter", &tmpbpf)) == 1) {
aconf->bpf_filter = tmpbpf;
}
/* Find initial node */ /* Find initial node */
pcap_node = ConfGetNode("pcap"); pcap_node = ConfGetNode("pcap");
if (pcap_node == NULL) { if (pcap_node == NULL) {
SCLogInfo("Unable to find af-packet config using default value"); SCLogInfo("Unable to find pcap config using default value");
return aconf; return aconf;
} }
@ -101,18 +111,22 @@ void *ParsePcapConfig(const char *iface)
return aconf; return aconf;
} }
if ((ConfGetChildValueInt(if_root, "buffer-size", &value)) == 1) { if (aconf->buffer_size == 0) {
aconf->buffer_size = value; if ((ConfGetChildValueInt(if_root, "buffer-size", &value)) == 1) {
} else { aconf->buffer_size = value;
aconf->buffer_size = 0; }
} }
/* set bpf filter if we have one */ if (aconf->bpf_filter == NULL) {
if (ConfGetChildValue(if_root, "bpf-filter", &tmpbpf) != 1) { /* set bpf filter if we have one */
SCLogDebug("could not get bpf or none specified"); if (ConfGetChildValue(if_root, "bpf-filter", &tmpbpf) != 1) {
SCLogDebug("could not get bpf or none specified");
} else {
/* TODO free this */
aconf->bpf_filter = strdup(tmpbpf);
}
} else { } else {
/* TODO free this */ SCLogInfo("BPF filter set from command line or via old 'bpf-filter' option.");
aconf->bpf_filter = strdup(tmpbpf);
} }
return aconf; return aconf;

Loading…
Cancel
Save