summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-11-20 00:56:17 +0000
committerLennart Poettering <lennart@poettering.net>2005-11-20 00:56:17 +0000
commit7b69d622fa87217ab85b1dc4879396b65bf75702 (patch)
tree990cc477dc32dab0c55a30d207f4856ed4fbfe59
parentef97e32ba2ed98b791af4504103b5f0378bb6b9b (diff)
deal with multiple address assigned to one interface
git-svn-id: file:///home/lennart/svn/public/nss-mdns/trunk@88 0ee8848e-81ea-0310-a63a-f631d1a40d77
-rw-r--r--doc/README.html.in2
-rw-r--r--src/query.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/doc/README.html.in b/doc/README.html.in
index 28e5402..e7d4443 100644
--- a/doc/README.html.in
+++ b/doc/README.html.in
@@ -46,7 +46,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p>
href="@PACKAGE_URL@nss-mdns-0.7.tar.gz">Version 0.7</a>
released. Changes include: Portability patch for ARM from Philipp
Zabel; make sure not to print any messages to STDERR; deal with OOM
-situations properly; other cleanups</p>
+situations properly; if multiple addresses are assigned to the same interface make sure to send a query packet only once; other cleanups</p>
<div class="news-date">Sun Aug 21 2005: </div> <p class="news-text"><a
href="@PACKAGE_URL@nss-mdns-0.6.tar.gz">Version 0.6</a>
diff --git a/src/query.c b/src/query.c
index 7a3e0bd..fe5d541 100644
--- a/src/query.c
+++ b/src/query.c
@@ -120,6 +120,7 @@ static int send_dns_packet(int fd, struct dns_packet *p) {
struct ifreq ifreq[32];
struct ifconf ifconf;
int n_sent = 0;
+ int last_index = -1;
assert(fd >= 0 && p);
assert(dns_packet_check_valid(p) >= 0);
@@ -181,8 +182,14 @@ static int send_dns_packet(int fd, struct dns_packet *p) {
if (ioctl(fd, SIOCGIFINDEX, &ifreq[i]) < 0)
continue; /* See above why we ignore this error */
-
- pkti->ipi_ifindex = ifreq[i].ifr_ifindex;
+
+ /* Only send the the packet once per interface. We assume that
+ * multiple addresses assigned to the same interface follow
+ * immediately one after the other.*/
+ if (last_index == ifreq[i].ifr_ifindex)
+ continue;
+
+ last_index = pkti->ipi_ifindex = ifreq[i].ifr_ifindex;
for (;;) {