components/dnsmasq/patches/05_dhcp_bind_fix.patch
author Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
Mon, 26 Sep 2016 16:23:01 -0700
changeset 6979 93dcf1920c71
permissions -rw-r--r--
24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6979
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     1
Patch to address a scalability issue when using dnsmasq in Openstack,
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     2
that causes DHCP to be extremely slow.
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     3
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     4
This patch was developed in-house. Since it is Solaris-specific, it is not
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     5
suitable for upstream.
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     6
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     7
--- dnsmasq-2.75/src/dhcp-common.c	2015-07-30 12:59:07.000000000 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     8
+++ new/src/dhcp-common.c	2016-09-22 15:12:02.104708123 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
     9
@@ -493,6 +493,58 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    10
       errno != EPERM)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    11
     die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    12
 }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    13
+#elif defined(HAVE_SOLARIS_NETWORK)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    14
+int which_ifindex(void)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    15
+{
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    16
+  /* If we are doing DHCP on exactly one interface, and using Solaris, we want
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    17
+   * to limit packet transmission/reception to that interface using IP_BOUND_IF
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    18
+   * for IPv4 and IPV6_BOUND_IF for IPv6. This is for the use case of OpenStack,
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    19
+   * which runs a new dnsmasq instance for each network it creates. Without this
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    20
+   * socket option, each of the dnsmasq process would unnecessarily process 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    21
+   * packets that arrive on other interfaces as well, thus slowing down the 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    22
+   * entire DHCP process.
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    23
+   */
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    24
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    25
+   struct irec *iface, *found;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    26
+   struct iname *if_tmp;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    27
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    28
+   if (!daemon->if_names)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    29
+     return -1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    30
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    31
+   for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    32
+     if (if_tmp->name && (!if_tmp->used || strchr(if_tmp->name, '*')))
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    33
+       return -1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    34
+ 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    35
+   for (found = NULL, iface = daemon->interfaces; iface; iface = iface->next)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    36
+     if (iface->dhcp_ok)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    37
+       {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    38
+	 if (!found)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    39
+	   found = iface;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    40
+	 else if (strcmp(found->name, iface->name) != 0)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    41
+	   return -1; /* more than one. */
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    42
+       }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    43
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    44
+   if (found)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    45
+     return found->index;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    46
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    47
+   return -1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    48
+}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    49
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    50
+void bindtoif(int ifindex, int fd, int is_dhcp6)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    51
+{
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    52
+  if (is_dhcp6)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    53
+    {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    54
+      if (setsockopt(fd, IPPROTO_IPV6, IPV6_BOUND_IF, (char *)&ifindex, sizeof(ifindex)) == -1 && 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    55
+          errno != EPERM)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    56
+        die(_("failed to set IPv6_BOUND_IF on DHCP socket: %s"), NULL, EC_BADNET);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    57
+    }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    58
+  else
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    59
+    {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    60
+      if (setsockopt(fd, IPPROTO_IP, IP_BOUND_IF, &ifindex, sizeof(ifindex)) == -1 &&
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    61
+          errno != EPERM)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    62
+        die(_("failed to set IP_BOUND_IF on DHCP socket: %s"), NULL, EC_BADNET);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    63
+    }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    64
+}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    65
 #endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    66
 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    67
 static const struct opttab_t {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    68
--- dnsmasq-2.75/src/dnsmasq.h	2016-09-22 15:20:19.502011580 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    69
+++ new/src/dnsmasq.h	2016-09-22 13:17:03.865473011 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    70
@@ -1464,6 +1464,9 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    71
 #ifdef HAVE_LINUX_NETWORK
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    72
 char *whichdevice(void);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    73
 void bindtodevice(char *device, int fd);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    74
+#elif defined(HAVE_SOLARIS_NETWORK)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    75
+int which_ifindex(void);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    76
+void bindtoif(int ifindex, int fd, int is_dhcp6);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    77
 #endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    78
 #  ifdef HAVE_DHCP6
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    79
 void display_opts6(void);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    80
--- dnsmasq-2.75/src/dnsmasq.c	2015-07-30 12:59:07.000000000 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    81
+++ new/src/dnsmasq.c	2016-09-22 15:20:03.040122945 -0700
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    82
@@ -54,6 +54,10 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    83
   char *bound_device = NULL;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    84
   int did_bind = 0;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    85
 #endif 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    86
+#if defined(HAVE_SOLARIS_NETWORK)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    87
+  int bound_ifindex = -1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    88
+  int did_bind = 0;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    89
+#endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    90
 #if defined(HAVE_DHCP) || defined(HAVE_DHCP6)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    91
   struct dhcp_context *context;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    92
   struct dhcp_relay *relay;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    93
@@ -306,6 +310,23 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    94
 	      did_bind = 1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    95
 	    }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    96
 	}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    97
+#elif defined(HAVE_SOLARIS_NETWORK) && defined(HAVE_DHCP)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    98
+      bound_ifindex = which_ifindex();
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
    99
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   100
+      if (daemon->dhcp)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   101
+	{
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   102
+          if (!daemon->relay4 && bound_ifindex >= 0)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   103
+            {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   104
+	      bindtoif(bound_ifindex, daemon->dhcpfd, 0);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   105
+	      did_bind = 1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   106
+	    }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   107
+
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   108
+	  if (daemon->enable_pxe && bound_ifindex >= 0)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   109
+	    {
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   110
+              bindtoif(bound_ifindex, daemon->pxefd, 0);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   111
+	      did_bind = 1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   112
+	    }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   113
+	}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   114
 #endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   115
 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   116
 #if defined(HAVE_LINUX_NETWORK) && defined(HAVE_DHCP6)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   117
@@ -314,6 +335,12 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   118
 	  bindtodevice(bound_device, daemon->dhcp6fd);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   119
 	  did_bind = 1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   120
 	}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   121
+#elif defined(HAVE_SOLARIS_NETWORK) && defined(HAVE_DHCP6)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   122
+      if (daemon->doing_dhcp6 && !daemon->relay6 && bound_ifindex >= 0)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   123
+	{
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   124
+          bindtoif(bound_ifindex, daemon->dhcp6fd, 1);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   125
+	  did_bind = 1;
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   126
+	}
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   127
 #endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   128
     }
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   129
   else 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   130
@@ -788,6 +815,9 @@
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   131
 #  ifdef HAVE_LINUX_NETWORK
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   132
   if (did_bind)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   133
     my_syslog(MS_DHCP | LOG_INFO, _("DHCP, sockets bound exclusively to interface %s"), bound_device);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   134
+#  elif defined(HAVE_SOLARIS_NETWORK)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   135
+  if (did_bind)
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   136
+    my_syslog(MS_DHCP | LOG_INFO, _("DHCP, sockets bound exclusively to interface index %d"), bound_ifindex);
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   137
 #  endif
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   138
 
93dcf1920c71 24623299 hundreds of dnsmasq processes causes DHCP to never succeed
Vardhnee Ramanujam Ravi <vardhnee.ramanujam.ravi@oracle.com>
parents:
diff changeset
   139
   /* after dhcp_contruct_contexts */