int NetworkManager::doReply(const Client& client, const std::vector<RawOption>& extra) { int rc; /* Options.... */ VBoxNetDhcpWriteCursor Cursor(&m->BootPReplyMsg.BootPHeader, RTNET_DHCP_NORMAL_SIZE); /* The basics */ Cursor.optIPv4Addr(RTNET_DHCP_OPT_SERVER_ID, m->m_OurAddress); const Lease l = client.lease(); const std::map<uint8_t, RawOption>& options = l.options(); for(std::vector<RawOption>::const_iterator it = extra.begin(); it != extra.end(); ++it) { if (!Cursor.begin(it->u8OptId, it->cbRawOpt)) break; Cursor.put(it->au8RawOpt, it->cbRawOpt); } for(std::map<uint8_t, RawOption>::const_iterator it = options.begin(); it != options.end(); ++it) { if (!Cursor.begin(it->second.u8OptId, it->second.cbRawOpt)) break; Cursor.put(it->second.au8RawOpt, it->second.cbRawOpt); } Cursor.optEnd(); /* */ #if 0 /** @todo need to see someone set this flag to check that it's correct. */ if (!(pDhcpMsg->bp_flags & RTNET_DHCP_FLAGS_NO_BROADCAST)) { rc = VBoxNetUDPUnicast(m_pSession, m_hIf, m_pIfBuf, m_OurAddress, &m_OurMac, RTNETIPV4_PORT_BOOTPS, /* sender */ IPv4AddrBrdCast, &BootPReplyMsg.BootPHeader->bp_chaddr.Mac, RTNETIPV4_PORT_BOOTPC, /* receiver */ &BootPReplyMsg, cbBooPReplyMsg); } else #endif rc = m->m_service->hlpUDPBroadcast(RTNETIPV4_PORT_BOOTPS, /* sender */ RTNETIPV4_PORT_BOOTPC, &m->BootPReplyMsg, RTNET_DHCP_NORMAL_SIZE); AssertRCReturn(rc,rc); return VINF_SUCCESS; }