bugfix: Fixed a bug in forwarding packets. updated logging
This commit is contained in:
parent
676852a5f9
commit
1fcf89bb52
|
@ -49,15 +49,13 @@ impl Processor {
|
||||||
packet.answers.iter().map(|q| q.name).collect::<Vec<_>>()
|
packet.answers.iter().map(|q| q.name).collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
for conf in &self.config.mdns {
|
for conf in &self.config.mdns {
|
||||||
let mut forward = false;
|
|
||||||
let mut dst_ifs = vec![];
|
let mut dst_ifs = vec![];
|
||||||
|
|
||||||
for query in &packet.questions {
|
for query in &packet.questions {
|
||||||
forward |= conf.destinations.contains(&src_ifname)
|
if conf.destinations.contains(&src_ifname)
|
||||||
&& (conf.filters.is_empty()
|
&& (conf.filters.is_empty()
|
||||||
|| conf.filters.contains(&query.qname.to_string()));
|
|| conf.filters.contains(&query.qname.to_string()))
|
||||||
|
{
|
||||||
if forward {
|
|
||||||
dst_ifs.extend(
|
dst_ifs.extend(
|
||||||
conf.sources
|
conf.sources
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -67,11 +65,10 @@ impl Processor {
|
||||||
}
|
}
|
||||||
|
|
||||||
for answer in &packet.answers {
|
for answer in &packet.answers {
|
||||||
forward |= conf.sources.contains(&src_ifname)
|
if conf.sources.contains(&src_ifname)
|
||||||
&& (conf.filters.is_empty()
|
&& (conf.filters.is_empty()
|
||||||
|| conf.filters.contains(&answer.name.to_string()));
|
|| conf.filters.contains(&answer.name.to_string()))
|
||||||
|
{
|
||||||
if forward {
|
|
||||||
dst_ifs.extend(
|
dst_ifs.extend(
|
||||||
conf.destinations
|
conf.destinations
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -84,8 +81,8 @@ impl Processor {
|
||||||
let dst_ifid = ifname_to_ifidx(dst_if.name.to_string());
|
let dst_ifid = ifname_to_ifidx(dst_if.name.to_string());
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"forwarding {:?} from {:?} to {:?}({})",
|
"forwarding {:?} from {} to {}",
|
||||||
packet, src_ifname, dst_if, dst_ifid
|
packet, src_ifname, dst_if.name
|
||||||
);
|
);
|
||||||
// TODO(ishan): Take a note of transaction id
|
// TODO(ishan): Take a note of transaction id
|
||||||
// and avoid feedback loops
|
// and avoid feedback loops
|
||||||
|
|
Loading…
Reference in New Issue
Block a user