From a5f035960006556beab51c42e6948985635e261a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Oct 2014 16:52:38 +0200 Subject: resolved: simplify detection of packets from the loopback device We can simplify our code quite a bit if we explicitly check for the ifindex being 1 on Linux as a loopback check. Apparently, this is hardcoded on Linux on the kernel, and effectively exported to userspace via rtnl and such, hence we should be able to rely on it. --- src/resolve/resolved-dns-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/resolve/resolved-dns-stream.c') diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index 8aad5e4df1..3690679ec6 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -157,7 +157,7 @@ static int dns_stream_identify(DnsStream *s) { * device if the connection came from the local host since it * avoids the routing table in such a case. Let's unset the * interface index in such a case. */ - if (s->ifindex > 0 && manager_ifindex_is_loopback(s->manager, s->ifindex) != 0) + if (s->ifindex == LOOPBACK_IFINDEX) s->ifindex = 0; /* If we don't know the interface index still, we look for the -- cgit v1.2.3-54-g00ecf