Index: trunk/src/apps/adpctl/VBoxNetAdpCtl.cpp
===================================================================
--- trunk/src/apps/adpctl/VBoxNetAdpCtl.cpp	(revision 24854)
+++ trunk/src/apps/adpctl/VBoxNetAdpCtl.cpp	(revision 25826)
@@ -56,8 +56,13 @@
 #define VBOXADPCTL_IFCONFIG_PATH "/sbin/ifconfig"
 
-#ifdef RT_OS_LINUX
-#define VBOXADPCTL_DEL_CMD "del"
+#if defined(RT_OS_LINUX)
+# define VBOXADPCTL_DEL_CMD "del"
+# define VBOXADPCTL_ADD_CMD "add"
+#elif defined(RT_OS_SOLARIS)
+# define VBOXADPCTL_DEL_CMD "removeif"
+# define VBOXADPCTL_ADD_CMD "addif"
 #else
-#define VBOXADPCTL_DEL_CMD "delete"
+# define VBOXADPCTL_DEL_CMD "delete"
+# define VBOXADPCTL_ADD_CMD "add"
 #endif
 
@@ -224,6 +229,6 @@
 {
     char szAdapterName[VBOXNETADP_MAX_NAME_LEN];
-    char *pszAdapterName;
-    const char *pszAddress;
+    char *pszAdapterName = NULL;
+    const char *pszAddress = NULL;
     const char *pszNetworkMask = NULL;
     const char *pszOption = NULL;
@@ -235,4 +240,6 @@
     {
         case 5:
+        {
+            /* Add a netmask to existing interface */
             if (strcmp("netmask", argv[3]))
             {
@@ -246,5 +253,9 @@
             pszAddress = argv[2];
             break;
+        }
+
         case 4:
+        {
+            /* Remove a single address from existing interface */
             if (strcmp("remove", argv[3]))
             {
@@ -257,5 +268,9 @@
             pszAddress = argv[2];
             break;
+        }
+
         case 3:
+        {
+            /* Remove an existing interface */
             pszAdapterName = argv[1];
             pszAddress = argv[2];
@@ -265,19 +280,33 @@
                 if (rc)
                     return rc;
+#ifdef RT_OS_SOLARIS
+                return 1;
+#else
                 memset(&Req, '\0', sizeof(Req));
                 snprintf(Req.szName, sizeof(Req.szName), "%s", szAdapterName);
                 return doIOCtl(VBOXNETADP_CTL_REMOVE, &Req);
+#endif
             }
             break;
+        }
+
         case 2:
+        {
+            /* Create a new interface */
             if (strcmp("add", argv[1]) == 0)
             {
+#ifdef RT_OS_SOLARIS
+                return 1;
+#else
                 memset(&Req, '\0', sizeof(Req));
                 rc = doIOCtl(VBOXNETADP_CTL_ADD, &Req);
                 if (rc == 0)
                     puts(Req.szName);
+#endif
                 return rc;
             }
             /* Fall through */
+        }
+
         default:
             fprintf(stderr, "Invalid number of arguments.\n\n");
@@ -300,8 +329,13 @@
         else
         {
-#ifdef RT_OS_LINUX
+#if defined(RT_OS_LINUX)
             rc = executeIfconfig(pszAdapterName, "0.0.0.0");
 #else
-            rc = executeIfconfig(pszAdapterName, "delete", pszAddress);
+            rc = executeIfconfig(pszAdapterName, VBOXADPCTL_DEL_CMD, pszAddress);
+#endif
+
+#ifdef RT_OS_SOLARIS
+            /* On Solaris we can unplumb the ipv4 interface */
+            executeIfconfig(pszAdapterName, "inet", "unplumb");
 #endif
         }
@@ -312,4 +346,9 @@
         if (strchr(pszAddress, ':'))
         {
+#ifdef RT_OS_SOLARIS
+            /* On Solaris we need to plumb the interface first if it's not already plumbed. */
+            if (executeIfconfig(pszAdapterName, "inet6") != 0)
+                executeIfconfig(pszAdapterName, "inet6", "plumb", "up");
+#endif
             /*
              * Before we set IPv6 address we'd like to remove
@@ -320,8 +359,15 @@
                 rc = EXIT_FAILURE;
             else
-                rc = executeIfconfig(pszAdapterName, "inet6", "add", pszAddress, pszOption, pszNetworkMask);
+                rc = executeIfconfig(pszAdapterName, "inet6", VBOXADPCTL_ADD_CMD, pszAddress, pszOption, pszNetworkMask);
         }
         else
+        {
+#ifdef RT_OS_SOLARIS
+            /* On Solaris we need to plumb the interface first if it's not already plumbed. */
+            if (executeIfconfig(pszAdapterName, "inet") != 0)
+                executeIfconfig(pszAdapterName, "plumb", "up");
+#endif
             rc = executeIfconfig(pszAdapterName, pszAddress, pszOption, pszNetworkMask);
+        }
     }
     return rc;
