]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add IPv6 pktinfo stuff for lwresd.
authorBrian Wellington <source@isc.org>
Thu, 12 Oct 2000 20:45:19 +0000 (20:45 +0000)
committerBrian Wellington <source@isc.org>
Thu, 12 Oct 2000 20:45:19 +0000 (20:45 +0000)
bin/named/include/named/lwdclient.h
bin/named/lwdclient.c
bin/named/lwderror.c
bin/named/lwdgabn.c
bin/named/lwdgnba.c
bin/named/lwdnoop.c

index 100d6b0739c9ab2d92a6da68544d21b954cfa1a7..f23f365a31162d2db50316e33ce14ebd1759f427 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdclient.h,v 1.6 2000/09/07 21:54:39 explorer Exp $ */
+/* $Id: lwdclient.h,v 1.7 2000/10/12 20:45:19 bwelling Exp $ */
 
 #ifndef NAMED_LWDCLIENT_H
 #define NAMED_LWDCLIENT_H 1
 
 struct ns_lwdclient {
        isc_sockaddr_t          address;        /* where to reply */
+       struct in6_pktinfo      pktinfo;
+       isc_boolean_t           pktinfo_valid;
        ns_lwdclientmgr_t       *clientmgr;     /* our parent */
        ISC_LINK(ns_lwdclient_t) link;
        unsigned int            state;
-       void                   *arg;            /* packet processing state */
+       void                    *arg;           /* packet processing state */
 
        /*
         * Received data info.
@@ -197,6 +199,9 @@ ns_lwdclient_shutdown(isc_task_t *, isc_event_t *);
 void
 ns_lwdclient_send(isc_task_t *, isc_event_t *);
 
+isc_result_t
+ns_lwdclient_sendreply(ns_lwdclient_t *client, isc_region_t *r);
+
 /*
  * Processing functions of various types.
  */
index 8c37ff63cc4a61a564de0ecebce4dad7f7240627..d831a40ee66f5b3da79475a9a90e4fc267f07e00 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdclient.c,v 1.8 2000/10/04 23:18:51 bwelling Exp $ */
+/* $Id: lwdclient.c,v 1.9 2000/10/12 20:45:11 bwelling Exp $ */
 
 #include <config.h>
 
@@ -238,12 +238,13 @@ ns_lwdclient_recv(isc_task_t *task, isc_event_t *ev) {
                return;
        }
 
-       /*
-        * XXXMLG If we wanted to run on ipv6 as well, we'd need the pktinfo
-        * bits.  Right now we don't, so don't remember them.
-        */
        client->recvlength = dev->n;
        client->address = dev->address;
+       if ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0) {
+               client->pktinfo = dev->pktinfo;
+               client->pktinfo_valid = ISC_TRUE;
+       } else
+               client->pktinfo_valid = ISC_FALSE;
        isc_event_free(&ev);
        dev = NULL;
 
@@ -406,6 +407,19 @@ ns_lwdclient_send(isc_task_t *task, isc_event_t *ev) {
        isc_event_free(&ev);
 }
 
+isc_result_t
+ns_lwdclient_sendreply(ns_lwdclient_t *client, isc_region_t *r) {
+       struct in6_pktinfo *pktinfo;
+       ns_lwdclientmgr_t *cm = client->clientmgr;
+
+       if (client->pktinfo_valid)
+               pktinfo = &client->pktinfo;
+       else
+               pktinfo = NULL;
+       return (isc_socket_sendto(cm->sock, r, cm->task, ns_lwdclient_send,
+                                 client, &client->address, pktinfo));
+}
+
 void
 ns_lwdclient_initialize(ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr) {
        client->clientmgr = cmgr;
@@ -427,5 +441,7 @@ ns_lwdclient_initialize(ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr) {
        client->byaddr = NULL;
        client->addrinfo = NULL;
 
+       client->pktinfo_valid = ISC_FALSE;
+
        ISC_LIST_APPEND(cmgr->idle, client, link);
 }
index 804594b9ad6f512dd8dfa76dd93a48e8164bf46a..87933414d022b34bcbe2ef8e59323fd254dde63a 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwderror.c,v 1.4 2000/08/01 01:11:46 tale Exp $ */
+/* $Id: lwderror.c,v 1.5 2000/10/12 20:45:13 bwelling Exp $ */
 
 #include <config.h>
 
@@ -71,8 +71,7 @@ ns_lwdclient_errorpktsend(ns_lwdclient_t *client, isc_uint32_t _result) {
        r.base = client->buffer;
        r.length = b.used;
        client->sendbuf = client->buffer;
-       result = isc_socket_sendto(cm->sock, &r, cm->task, ns_lwdclient_send,
-                                  client, &client->address, NULL);
+       result = ns_lwdclient_sendreply(client, &r);
        if (result != ISC_R_SUCCESS) {
                ns_lwdclient_stateidle(client);
                return;
index dfa5a02874a891b26663350f571bcee319df0647..be13a990b4710d64d47873181627992498ba8672 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdgabn.c,v 1.6 2000/08/01 01:11:47 tale Exp $ */
+/* $Id: lwdgabn.c,v 1.7 2000/10/12 20:45:14 bwelling Exp $ */
 
 #include <config.h>
 
@@ -177,8 +177,7 @@ generate_reply(ns_lwdclient_t *client) {
        r.length = lwb.used;
        client->sendbuf = r.base;
        client->sendlength = r.length;
-       result = isc_socket_sendto(cm->sock, &r, cm->task, ns_lwdclient_send,
-                                  client, &client->address, NULL);
+       result = ns_lwdclient_sendreply(client, &r);
        if (result != ISC_R_SUCCESS)
                goto out;
 
index 6d9507100eea13cdfcc1558ecb96767b0708d058..fda1bf4a8a312cdd0c14b81c05f2f28d1cdbf8d3 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdgnba.c,v 1.6 2000/08/01 01:11:48 tale Exp $ */
+/* $Id: lwdgnba.c,v 1.7 2000/10/12 20:45:17 bwelling Exp $ */
 
 #include <config.h>
 
@@ -151,9 +151,7 @@ byaddr_done(isc_task_t *task, isc_event_t *event) {
        r.length = lwb.used;
        client->sendbuf = r.base;
        client->sendlength = r.length;
-       result = isc_socket_sendto(cm->sock, &r,
-                                  cm->task, ns_lwdclient_send,
-                                  client, &client->address, NULL);
+       result = ns_lwdclient_sendreply(client, &r);
        if (result != ISC_R_SUCCESS)
                goto out;
 
index c1f6a3e590f63587415fe91e4b1bbd349ddda7ae..8fd7760307c84c6f45c77b912ff586aa1c826964 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdnoop.c,v 1.4 2000/08/01 01:11:49 tale Exp $ */
+/* $Id: lwdnoop.c,v 1.5 2000/10/12 20:45:18 bwelling Exp $ */
 
 #include <config.h>
 
@@ -61,9 +61,7 @@ ns_lwdclient_processnoop(ns_lwdclient_t *client, lwres_buffer_t *b) {
        r.length = lwb.used;
        client->sendbuf = r.base;
        client->sendlength = r.length;
-       result = isc_socket_sendto(client->clientmgr->sock, &r,
-                                  client->clientmgr->task, ns_lwdclient_send,
-                                  client, &client->address, NULL);
+       result = ns_lwdclient_sendreply(client, &r);
        if (result != ISC_R_SUCCESS)
                goto out;