Index: trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 17780)
+++ trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 17781)
@@ -905,4 +905,108 @@
 
 /**
+ * Deal with ARP queries.
+ *
+ * @returns true if ARP.
+ *
+ * @param   pSession        The support driver session.
+ * @param   hIf             The internal network interface handle.
+ * @param   pBuf            The internal network interface buffer.
+ * @param   pMacAddr        Our MAC address.
+ * @param   IPv4Addr        Our IPv4 address.
+ */
+bool VBoxNetHandleArpForIP(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf, PCRTMAC pMacAddr, RTNETADDRIPV4 IPv4Addr)
+{
+    /*
+     * Valid IntNet Ethernet frame?
+     */
+    PCINTNETHDR pHdr = (PINTNETHDR)((uintptr_t)pBuf + pBuf->Recv.offRead);
+    if (pHdr->u16Type != INTNETHDR_TYPE_FRAME)
+        return false;
+
+    size_t      cbFrame = pHdr->cbFrame;
+    const void *pvFrame = INTNETHdrGetFramePtr(pHdr, pBuf);
+    PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pvFrame;
+
+    /*
+     * Arp frame?
+     */
+    if (pEthHdr->EtherType != RT_H2N_U16_C(RTNET_ETHERTYPE_ARP))
+        return false;
+    if (    pEthHdr->DstMac.au16[0] != 0xffff
+        ||  pEthHdr->DstMac.au16[1] != 0xffff
+        ||  pEthHdr->DstMac.au16[2] != 0xffff)
+        return false;
+    if (cbFrame < sizeof(RTNETARPIPV4) + sizeof(RTNETETHERHDR))
+        return false;
+
+    PCRTNETARPHDR pArpHdr = (PCRTNETARPHDR)(pEthHdr + 1);
+    if (pArpHdr->ar_htype != RT_H2N_U16_C(RTNET_ARP_ETHER))
+        return false;
+    if (pArpHdr->ar_hlen != sizeof(RTMAC))
+        return false;
+    if (pArpHdr->ar_ptype != RT_H2N_U16_C(RTNET_ETHERTYPE_IPV4))
+        return false;
+    if (pArpHdr->ar_plen != sizeof(RTNETADDRIPV4))
+        return false;
+
+    /* It's ARP, alright. Anything we need to do something about. */
+    PCRTNETARPIPV4 pArp = (PCRTNETARPIPV4)pArpHdr;
+    switch (pArp->Hdr.ar_oper)
+    {
+        /* 'Who has ' */
+        case RTNET_ARPOP_REQUEST:
+        case RTNET_ARPOP_REVREQUEST:
+        ///@todo case RTNET_ARPOP_INVREQUEST:
+            break;
+        default:
+            return true;
+    }
+
+    /*
+     * Deal with the queries.
+     */
+    RTNETARPIPV4 Reply;
+    switch (pArp->Hdr.ar_oper)
+    {
+        /* 'Who has ar_tpa? Tell ar_spa.'  */
+        case RTNET_ARPOP_REQUEST:
+            if (pArp->ar_spa.u != IPv4Addr.u)
+                return true;
+            Reply.Hdr.ar_oper = RTNET_ARPOP_REPLY;
+            break;
+
+        case RTNET_ARPOP_REVREQUEST:
+            if (    pArp->ar_tha.au16[0] != pMacAddr->au16[0]
+                ||  pArp->ar_tha.au16[1] != pMacAddr->au16[1]
+                ||  pArp->ar_tha.au16[2] != pMacAddr->au16[2])
+                return true;
+            Reply.Hdr.ar_oper = RTNET_ARPOP_REVREPLY;
+            break;
+
+        case RTNET_ARPOP_INVREQUEST:
+            return true;
+            //Reply.Hdr.ar_oper = RTNET_ARPOP_INVREPLY;
+            //break;
+    }
+
+    /*
+     * Complete the reply and send it.
+     */
+    Reply.Hdr.ar_htype = RT_H2N_U16_C(RTNET_ARP_ETHER);
+    Reply.Hdr.ar_ptype = RT_H2N_U16_C(RTNET_ETHERTYPE_IPV4);
+    Reply.Hdr.ar_hlen  = sizeof(RTMAC);
+    Reply.Hdr.ar_plen  = sizeof(RTNETADDRIPV4);
+    Reply.ar_sha = *pMacAddr;
+    Reply.ar_spa = IPv4Addr;
+    Reply.ar_tha = pArp->ar_sha;
+    Reply.ar_tpa = pArp->ar_spa;
+
+
+
+    return true;
+}
+
+
+/**
  * Runs the DHCP server.
  *
@@ -965,4 +1069,6 @@
                 m_cbCurMsg = 0;
             }
+            else if (VBoxNetHandleArpForIP(m_pSession, m_hIf, m_pIfBuf, &m_MacAddress, m_Ipv4Address))
+                /* nothing */;
 
             /* Advance to the next frame. */
@@ -1475,4 +1581,6 @@
     bool optEnd(void)
     {
+        Assert((uintptr_t)(m_pbEnd - m_pbCur) < 4096);
+        *m_pbCur++ = RTNET_DHCP_OPT_END;
         return !hasOverflowed();
     }
Index: trunk/src/VBox/NetworkServices/UDPLib/VBoxNetUDP.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/UDPLib/VBoxNetUDP.cpp	(revision 17780)
+++ trunk/src/VBox/NetworkServices/UDPLib/VBoxNetUDP.cpp	(revision 17781)
@@ -315,8 +315,9 @@
     /* the IP header */
     RTNETIPV4 IpHdr;
+    size_t cbIdHdr = RT_UOFFSETOF(RTNETIPV4, ip_options);
     IpHdr.ip_v          = 4;
-    IpHdr.ip_hl         = sizeof(RTNETIPV4) / sizeof(uint32_t);
+    IpHdr.ip_hl         = cbIdHdr / sizeof(uint32_t);
     IpHdr.ip_tos        = 0;
-    IpHdr.ip_len        = RT_H2BE_U16(cbData + sizeof(RTNETUDP) + sizeof(RTNETIPV4));
+    IpHdr.ip_len        = RT_H2BE_U16(cbData + sizeof(RTNETUDP) + cbIdHdr);
     IpHdr.ip_id         = (uint16_t)RTRandU32();
     IpHdr.ip_off        = 0;
@@ -324,10 +325,10 @@
     IpHdr.ip_p          = RTNETIPV4_PROT_UDP;
     IpHdr.ip_sum        = 0;
-    IpHdr.ip_src.u      = 0;
-    IpHdr.ip_dst.u      = UINT32_C(0xffffffff); /* broadcast */
+    IpHdr.ip_src        = SrcIPv4Addr;
+    IpHdr.ip_dst        = DstIPv4Addr;
     IpHdr.ip_sum        = RTNetIPv4HdrChecksum(&IpHdr);
 
     aSegs[1].pv   = &IpHdr;
-    aSegs[1].cb   = sizeof(IpHdr);
+    aSegs[1].cb   = cbIdHdr;
     aSegs[1].Phys = NIL_RTHCPHYS;
 
