public static DhcpOffer FromDhcpPacket(DhcpPacket packet) { if (packet.MessageType != DhcpMessageType.Offer) { return(null); } return(new DhcpOffer { DhcpServer = packet.GetOption <DhcpServerIdentifierOption>().ServerAddress, ClientAddress = packet.YourClientAddress, Gateway = packet.GetOption <DhcpRouterOption>()?.Routers[0], DnsServer = packet.GetOption <DhcpDomainNameServerOption>()?.DomainNameServers[0], Domain = packet.GetOption <DhcpDomainNameOption>()?.DomainName, SubnetMask = packet.GetOption <DhcpSubnetMaskOption>()?.Mask, RelayAgnetAddress = packet.RelayAgentAddress }); }