Index: trunk/src/VBox/NetworkServices/DHCP/NetworkManagerDhcp.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/NetworkManagerDhcp.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/DHCP/NetworkManagerDhcp.cpp	(revision 55365)
@@ -55,5 +55,6 @@
 {
     RawOption opt;
-    memset(&opt, 0, sizeof(RawOption));
+    RT_ZERO(opt);
+
     /* 1. Find client */
     ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
Index: trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 55365)
@@ -221,5 +221,5 @@
     m_cbCurMsg              = 0;
     m_pCurMsg               = NULL;
-    memset(&m_CurHdrs, '\0', sizeof(m_CurHdrs));
+    RT_ZERO(m_CurHdrs);
 
     m_fIgnoreCmdLineParameters = true;
@@ -499,5 +499,5 @@
      */
     AssertRCReturn(virtualbox.isNull(), VERR_INTERNAL_ERROR);
-    std::string networkName = getNetwork();
+    std::string networkName = getNetworkName();
 
     int rc = findDhcpServer(virtualbox, networkName, m_DhcpServer);
@@ -616,6 +616,14 @@
         {
             ComPtr <INATNetworkStartStopEvent> pStartStopEvent = pEvent;
+
+            com::Bstr networkName;
+            HRESULT hrc = pStartStopEvent->COMGETTER(NetworkName)(networkName.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+            if (networkName.compare(getNetworkName().c_str()))
+                break; /* change not for our network */
+
             BOOL fStart = TRUE;
-            HRESULT hrc = pStartStopEvent->COMGETTER(StartEvent)(&fStart);
+            hrc = pStartStopEvent->COMGETTER(StartEvent)(&fStart);
+            AssertComRCReturn(hrc, hrc);
             if (!fStart)
                 shutdown();
Index: trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp	(revision 55365)
@@ -203,6 +203,5 @@
  * @note: this work on Event thread.
  */
-HRESULT VBoxNetLwipNAT::HandleEvent(VBoxEventType_T aEventType,
-                                                  IEvent *pEvent)
+HRESULT VBoxNetLwipNAT::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
 {
     HRESULT hrc = S_OK;
@@ -211,24 +210,25 @@
         case VBoxEventType_OnNATNetworkSetting:
         {
-            ComPtr<INATNetworkSettingEvent> evSettings(pEvent);
+            ComPtr<INATNetworkSettingEvent> pSettingsEvent(pEvent);
+
+            com::Bstr networkName;
+            hrc = pSettingsEvent->COMGETTER(NetworkName)(networkName.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+            if (networkName.compare(getNetworkName().c_str()))
+                break; /* change not for our network */
+
             // XXX: only handle IPv6 default route for now
-
             if (!m_ProxyOptions.ipv6_enabled)
-            {
                 break;
-            }
 
             BOOL fIPv6DefaultRoute = FALSE;
-            hrc = evSettings->COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(&fIPv6DefaultRoute);
-            AssertReturn(SUCCEEDED(hrc), hrc);
+            hrc = pSettingsEvent->COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(&fIPv6DefaultRoute);
+            AssertComRCReturn(hrc, hrc);
 
             if (m_ProxyOptions.ipv6_defroute == fIPv6DefaultRoute)
-            {
                 break;
-            }
 
             m_ProxyOptions.ipv6_defroute = fIPv6DefaultRoute;
             tcpip_callback_with_block(proxy_rtadvd_do_quick, &m_LwipNetIf, 0);
-
             break;
         }
@@ -236,39 +236,46 @@
         case VBoxEventType_OnNATNetworkPortForward:
         {
-            com::Bstr name, strHostAddr, strGuestAddr;
-            LONG lHostPort, lGuestPort;
-            BOOL fCreateFW, fIPv6FW;
+            ComPtr<INATNetworkPortForwardEvent> pForwardEvent = pEvent;
+
+            com::Bstr networkName;
+            hrc = pForwardEvent->COMGETTER(NetworkName)(networkName.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+            if (networkName.compare(getNetworkName().c_str()))
+                break; /* change not for our network */
+
+            BOOL fCreateFW;
+            hrc = pForwardEvent->COMGETTER(Create)(&fCreateFW);
+            AssertComRCReturn(hrc, hrc);
+
+            BOOL  fIPv6FW;
+            hrc = pForwardEvent->COMGETTER(Ipv6)(&fIPv6FW);
+            AssertComRCReturn(hrc, hrc);
+
+            com::Bstr name;
+            hrc = pForwardEvent->COMGETTER(Name)(name.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+
             NATProtocol_T proto = NATProtocol_TCP;
-
-
-            ComPtr<INATNetworkPortForwardEvent> pfEvt = pEvent;
-
-            hrc = pfEvt->COMGETTER(Create)(&fCreateFW);
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(Ipv6)(&fIPv6FW);
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(Name)(name.asOutParam());
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(Proto)(&proto);
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(HostIp)(strHostAddr.asOutParam());
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(HostPort)(&lHostPort);
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(GuestIp)(strGuestAddr.asOutParam());
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            hrc = pfEvt->COMGETTER(GuestPort)(&lGuestPort);
-            AssertReturn(SUCCEEDED(hrc), hrc);
-
-            VECNATSERVICEPF& rules = (fIPv6FW ?
-                                      m_vecPortForwardRule6 :
-                                      m_vecPortForwardRule4);
+            hrc = pForwardEvent->COMGETTER(Proto)(&proto);
+            AssertComRCReturn(hrc, hrc);
+
+            com::Bstr strHostAddr;
+            hrc = pForwardEvent->COMGETTER(HostIp)(strHostAddr.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+
+            LONG lHostPort;
+            hrc = pForwardEvent->COMGETTER(HostPort)(&lHostPort);
+            AssertComRCReturn(hrc, hrc);
+
+            com::Bstr strGuestAddr;
+            hrc = pForwardEvent->COMGETTER(GuestIp)(strGuestAddr.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+
+            LONG lGuestPort;
+            hrc = pForwardEvent->COMGETTER(GuestPort)(&lGuestPort);
+            AssertComRCReturn(hrc, hrc);
+
+            VECNATSERVICEPF& rules = fIPv6FW ? m_vecPortForwardRule6
+                                             : m_vecPortForwardRule4;
 
             NATSEVICEPORTFORWARDRULE r;
@@ -320,8 +327,8 @@
 
             RTStrPrintf(r.Pfr.szPfrName, sizeof(r.Pfr.szPfrName),
-                      "%s", com::Utf8Str(name).c_str());
+                        "%s", com::Utf8Str(name).c_str());
 
             RTStrPrintf(r.Pfr.szPfrHostAddr, sizeof(r.Pfr.szPfrHostAddr),
-                      "%s", com::Utf8Str(strHostAddr).c_str());
+                        "%s", com::Utf8Str(strHostAddr).c_str());
 
             /* XXX: limits should be checked */
@@ -329,5 +336,5 @@
 
             RTStrPrintf(r.Pfr.szPfrGuestAddr, sizeof(r.Pfr.szPfrGuestAddr),
-                      "%s", com::Utf8Str(strGuestAddr).c_str());
+                        "%s", com::Utf8Str(strGuestAddr).c_str());
 
             /* XXX: limits should be checked */
@@ -386,7 +393,5 @@
                                               /* :block */ 0);
             if (error != ERR_OK && ppcszNameServers != NULL)
-            {
                 RTMemFree(ppcszNameServers);
-            }
             break;
         }
@@ -395,6 +400,15 @@
         {
             ComPtr <INATNetworkStartStopEvent> pStartStopEvent = pEvent;
+
+            com::Bstr networkName;
+            hrc = pStartStopEvent->COMGETTER(NetworkName)(networkName.asOutParam());
+            AssertComRCReturn(hrc, hrc);
+            if (networkName.compare(getNetworkName().c_str()))
+                break; /* change not for our network */
+
             BOOL fStart = TRUE;
             hrc = pStartStopEvent->COMGETTER(StartEvent)(&fStart);
+            AssertComRCReturn(hrc, hrc);
+
             if (!fStart)
                 shutdown();
@@ -641,6 +655,6 @@
     m_ProxyOptions.src4 = NULL;
     m_ProxyOptions.src6 = NULL;
-    memset(&m_src4, 0, sizeof(m_src4));
-    memset(&m_src6, 0, sizeof(m_src6));
+    RT_ZERO(m_src4);
+    RT_ZERO(m_src6);
     m_src4.sin_family = AF_INET;
     m_src6.sin6_family = AF_INET6;
@@ -774,6 +788,6 @@
 
 
-/** This method executed on main thread, only at the end threr're one threads started explcitly (LWIP and later in ::run()
- * RECV)
+/** 
+ * Main thread. Starts also the LWIP thread.
  */
 int VBoxNetLwipNAT::init()
@@ -785,5 +799,5 @@
     AssertRCReturn(rc, rc);
 
-    std::string networkName = getNetwork();
+    std::string networkName = getNetworkName();
     rc = findNatNetwork(virtualbox, networkName, m_net);
     AssertRCReturn(rc, rc);
@@ -894,7 +908,5 @@
     rc = g_pLwipNat->tryGoOnline();
     if (RT_FAILURE(rc))
-    {
         return rc;
-    }
 
     /* this starts LWIP thread */
@@ -908,30 +920,20 @@
 const char **VBoxNetLwipNAT::getHostNameservers()
 {
-    HRESULT hrc;
-
     if (m_host.isNull())
-    {
         return NULL;
-    }
 
     com::SafeArray<BSTR> aNameServers;
-    hrc = m_host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(aNameServers));
+    HRESULT hrc = m_host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(aNameServers));
     if (FAILED(hrc))
-    {
         return NULL;
-    }
 
     const size_t cNameServers = aNameServers.size();
     if (cNameServers == 0)
-    {
         return NULL;
-    }
 
     const char **ppcszNameServers =
         (const char **)RTMemAllocZ(sizeof(char *) * (cNameServers + 1));
     if (ppcszNameServers == NULL)
-    {
         return NULL;
-    }
 
     size_t idxLast = 0;
@@ -941,7 +943,5 @@
         ppcszNameServers[idxLast] = RTStrDup(strNameServer.c_str());
         if (ppcszNameServers[idxLast] != NULL)
-        {
             ++idxLast;
-        }
     }
 
@@ -989,7 +989,5 @@
     struct pbuf *p = pbuf_alloc(PBUF_RAW, cbFrame + ETH_PAD_SIZE, PBUF_POOL);
     if (RT_UNLIKELY(p == NULL))
-    {
         return VERR_NO_MEMORY;
-    }
 
     /*
@@ -1200,12 +1198,8 @@
 
     if (RT_SUCCESS(rc))
-    {
         rc = g_pLwipNat->init();
-    }
 
     if (RT_SUCCESS(rc))
-    {
         g_pLwipNat->run();
-    }
 
     delete g_pLwipNat;
@@ -1249,14 +1243,10 @@
 
     if (pcszNetwork == NULL)
-    {
         return VERR_MISSING;
-    }
 
     char szNetwork[RTPATH_MAX];
     rc = RTStrCopy(szNetwork, sizeof(szNetwork), pcszNetwork);
     if (RT_FAILURE(rc))
-    {
         return rc;
-    }
 
     // sanitize network name to be usable as a path component
@@ -1264,7 +1254,5 @@
     {
         if (RTPATH_IS_SEP(*p))
-        {
             *p = '_';
-        }
     }
 
@@ -1293,7 +1281,5 @@
                       "VBOXNET_%s_RELEASE_LOG", szNetwork);
     if (cch >= sizeof(szEnvVarBase))
-    {
         return VERR_BUFFER_OVERFLOW;
-    }
 
     char szError[RTPATH_MAX + 128];
@@ -1321,5 +1307,5 @@
     else
         hrc = nat->COMGETTER(PortForwardRules4)(ComSafeArrayAsOutParam(rules));
-    AssertReturn(SUCCEEDED(hrc), VERR_INTERNAL_ERROR);
+    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
 
     NATSEVICEPORTFORWARDRULE Rule;
Index: trunk/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp	(revision 55365)
@@ -136,5 +136,5 @@
 
     uint8_t abTrailer[60 - sizeof(Reply) - sizeof(EthHdr)];
-    memset(abTrailer, '\0', sizeof(abTrailer));
+    RT_ZERO(abTrailer);
 
     INTNETSEG aSegs[3];
Index: trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp	(revision 55365)
@@ -73,7 +73,7 @@
 struct VBoxNetBaseService::Data
 {
-    Data(const std::string& aName, const std::string& aNetworkName):
-      m_Name(aName),
-      m_Network(aNetworkName),
+    Data(const std::string& aServiceName, const std::string& aNetworkName):
+      m_ServiceName(aServiceName),
+      m_NetworkName(aNetworkName),
       m_enmTrunkType(kIntNetTrunkType_WhateverNone),
       m_pSession(NIL_RTR0PTR),
@@ -92,6 +92,6 @@
     };
 
-    std::string         m_Name;
-    std::string         m_Network;
+    std::string         m_ServiceName;
+    std::string         m_NetworkName;
     std::string         m_TrunkName;
     INTNETTRUNKTYPE     m_enmTrunkType;
@@ -268,9 +268,9 @@
         {
             case 'N': // --name
-                m->m_Name = Val.psz;
+                m->m_ServiceName = Val.psz;
                 break;
 
             case 'n': // --network
-                m->m_Network = Val.psz;
+                m->m_NetworkName = Val.psz;
                 break;
 
@@ -393,7 +393,7 @@
     OpenReq.Hdr.cbReq = sizeof(OpenReq);
     OpenReq.pSession = m->m_pSession;
-    strncpy(OpenReq.szNetwork, m->m_Network.c_str(), sizeof(OpenReq.szNetwork));
+    RTStrCopy(OpenReq.szNetwork, sizeof(OpenReq.szNetwork), m->m_NetworkName.c_str());
     OpenReq.szNetwork[sizeof(OpenReq.szNetwork) - 1] = '\0';
-    strncpy(OpenReq.szTrunk, m->m_TrunkName.c_str(), sizeof(OpenReq.szTrunk));
+    RTStrCopy(OpenReq.szTrunk, sizeof(OpenReq.szTrunk), m->m_TrunkName.c_str());
     OpenReq.szTrunk[sizeof(OpenReq.szTrunk) - 1] = '\0';
     OpenReq.enmTrunkType = m->m_enmTrunkType;
@@ -581,25 +581,25 @@
 
 
-const std::string VBoxNetBaseService::getName() const
-{
-    return m->m_Name;
-}
-
-
-void VBoxNetBaseService::setName(const std::string& aName)
-{
-    m->m_Name = aName;
-}
-
-
-const std::string VBoxNetBaseService::getNetwork() const
-{
-    return m->m_Network;
-}
-
-
-void VBoxNetBaseService::setNetwork(const std::string& aNetwork)
-{
-    m->m_Network = aNetwork;
+const std::string VBoxNetBaseService::getServiceName() const
+{
+    return m->m_ServiceName;
+}
+
+
+void VBoxNetBaseService::setServiceName(const std::string& aName)
+{
+    m->m_ServiceName = aName;
+}
+
+
+const std::string VBoxNetBaseService::getNetworkName() const
+{
+    return m->m_NetworkName;
+}
+
+
+void VBoxNetBaseService::setNetworkName(const std::string& aName)
+{
+    m->m_NetworkName = aName;
 }
 
Index: trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
===================================================================
--- trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h	(revision 55364)
+++ trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h	(revision 55365)
@@ -87,9 +87,9 @@
 
 protected:
-    const std::string getName() const;
-    void setName(const std::string&);
+    const std::string getServiceName() const;
+    void setServiceName(const std::string&);
 
-    const std::string getNetwork() const;
-    void setNetwork(const std::string&);
+    const std::string getNetworkName() const;
+    void setNetworkName(const std::string&);
 
     const RTMAC getMacAddress() const;
Index: trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp	(revision 55364)
+++ trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp	(revision 55365)
@@ -234,5 +234,5 @@
     AssertPtrReturn(pPfr, VERR_INVALID_PARAMETER);
 
-    memset(pPfr, 0, sizeof(PORTFORWARDRULE));
+    RT_ZERO(*pPfr);
 
     pszHostAddr = &pPfr->szPfrHostAddr[0];
@@ -271,4 +271,5 @@
                   pszRaw);
         pszRaw += cbToken; /* move to separator */
+        cbRaw -= cbToken;
     }
 
@@ -277,7 +278,6 @@
 
     pszRaw++; /* skip separator */
+    cbRaw--;
     idxRaw = 0;
-
-    cbRaw--;
 
     if (  (  (fTcpProto = (RTStrNICmp(pszRaw, "tcp", 3) == 0))
@@ -293,5 +293,4 @@
     pszRaw += idxRaw;
     cbRaw -= idxRaw;
-    idxRaw = 0;
 
     idxRaw = netPfStrAddressPortPairParse(pszRaw, cbRaw,
@@ -306,11 +305,7 @@
     Assert(pszRaw[0] == PF_FIELD_SEPARATOR);
 
-    idxRaw = 0;
-
     idxRaw = netPfStrAddressPortPairParse(pszRaw, cbRaw,
-                                          pszGuestAddr,
-                                          INET6_ADDRSTRLEN,
-                                          false,
-                                          &u16GuestPort);
+                                          pszGuestAddr, INET6_ADDRSTRLEN,
+                                          false, &u16GuestPort);
 
     if (idxRaw < 0)
@@ -344,5 +339,5 @@
     RTStrFree(pszRawBegin);
     if (pPfr)
-        memset(pPfr, 0, sizeof(PORTFORWARDRULE));
+        RT_ZERO(*pPfr);
     return VERR_INVALID_PARAMETER;
 }
