Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Oct 2007 17:10:17 GMT
From:      Fredrik Lindberg <fli@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 127252 for review
Message-ID:  <200710061710.l96HAH3N007247@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127252

Change 127252 by fli@fli_nexus on 2007/10/06 17:09:15

	Only do the query using the address family that the consumer
	specified instead of blindly doing it using both ipv4 and ipv6.

Affected files ...

.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/queries.c#3 edit
.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/queries.h#3 edit

Differences ...

==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/queries.c#3 (text+ko) ====

@@ -370,22 +370,26 @@
 			return;
 	}
 
-	qs = mdns_pkg_getqset();
-	if (qs == NULL)
-		return;
-	mdns_qset_name_dup(qs, r->r_name);
-	qs->q_type = rt->rt_type;
-	qs->q_class = rc->rc_class;
-	aq_enqueue(&q->q_aq4, qs, 20, 500);
+	if (qt->qt_flags & QT_INET4) {
+		qs = mdns_pkg_getqset();
+		if (qs == NULL)
+			return;
+		mdns_qset_name_dup(qs, r->r_name);
+		qs->q_type = rt->rt_type;
+		qs->q_class = rc->rc_class;
+		aq_enqueue(&q->q_aq4, qs, 20, 500);
+	}
 
 #ifdef INET6
-	qs = mdns_pkg_getqset();
-	if (qs == NULL)
-		return;
-	mdns_qset_name_dup(qs, r->r_name);
-	qs->q_type = rt->rt_type;
-	qs->q_class = rc->rc_class;
-	aq_enqueue(&q->q_aq6, qs, 20, 500);
+	if (qt->qt_flags & QT_INET6) {
+		qs = mdns_pkg_getqset();
+		if (qs == NULL)
+			return;
+		mdns_qset_name_dup(qs, r->r_name);
+		qs->q_type = rt->rt_type;
+		qs->q_class = rc->rc_class;
+		aq_enqueue(&q->q_aq6, qs, 20, 500);
+	}
 #endif
 
 	qt->qt_flags |= QT_SENT;
@@ -561,6 +565,15 @@
 	qc->qc_fam = family;
 	TAILQ_INSERT_TAIL(&qt->qt_cons_list, qc, qc_next);
 
+	if (family == AF_INET)
+		qt->qt_flags |= QT_INET4;
+#ifdef INET6
+	else if (family == AF_INET6)
+		qt->qt_flags |= QT_INET6;
+#endif
+	else if (family == AF_UNSPEC)
+		qt->qt_flags |= (QT_INET4 | QT_INET6);
+
 	send_query(q, qt);
 
 	if (qc->qc_timeout != 0)

==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/queries.h#3 (text+ko) ====

@@ -80,6 +80,8 @@
 #define QT_INRETQ	0x01 /* scheduled for re-transmission */
 #define QT_SENT		0x02 /* query sent */
 #define QT_RESP		0x04 /* response received before timeout */
+#define QT_INET4	0x08 /* do inet4 query */
+#define QT_INET6	0x10 /* do inet6 query */
 	TAILQ_ENTRY(query_type) qt_ret_next; /* re-transmit delta list member */
 	int qt_retrel;	/* relative re-transmit value (book keeping only) */
 	int qt_retabs;	/* absolute re-transmission value */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710061710.l96HAH3N007247>