Print this page
OS-4741 Add support for multiple addresses & IPv6 to lx-branded zones
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
        
*** 34,43 ****
--- 34,44 ----
  #include <libcontract_priv.h>
  #include <unistd.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
+ #include <zone.h>
  
  #include "dhcpagent_ipc.h"
  #include "dhcpagent_util.h"
  
  /*
*** 123,133 ****
--- 124,140 ----
          dhcp_ipc_request_t      *request;
          dhcp_ipc_reply_t        *reply;
          int                     ctfd;
          pid_t                   childpid;
          ctid_t                  ct;
+         char                    dhcpcmd[MAXPATHLEN];
+         const char              *zroot = zone_get_nroot();
  
+         /* Prepend the root of the native code in the brand to the command */
+         (void) snprintf(dhcpcmd, sizeof (dhcpcmd), "%s%s", zroot != NULL ?
+             zroot : "", DHCP_AGENT_PATH);
+ 
          /*
           * just send a dummy request to the agent to find out if it's
           * up.  we do this instead of directly connecting to it since
           * we want to make sure we follow its IPC conventions
           * (otherwise, it will log warnings to syslog).
*** 158,168 ****
          switch (childpid) {
          case -1:
                  goto fail;
  
          case  0:
!                 (void) execl(DHCP_AGENT_PATH, DHCP_AGENT_PATH, (char *)0);
                  _exit(EXIT_FAILURE);
  
          default:
                  break;
          }
--- 165,175 ----
          switch (childpid) {
          case -1:
                  goto fail;
  
          case  0:
!                 (void) execl(dhcpcmd, dhcpcmd, (char *)0);
                  _exit(EXIT_FAILURE);
  
          default:
                  break;
          }