mirror of
https://github.com/minexew/Shrine.git
synced 2026-05-26 15:22:22 +00:00
Merge pull request #16 from tuxcrafting/fix-dhcp-pedanticness
Fix dependence on DNS and ROUTER messages during DHCP request
This commit is contained in:
@@ -20,7 +20,7 @@ Software included in Shrine:
|
||||
Setting up with networking
|
||||
==========================
|
||||
- Native Stack (highly experimental)
|
||||
- configure your VM networking: *Adapter Type: PCnet-PCI II* (`pcnet` in QEMU)
|
||||
- configure your VM networking: *Adapter Type: PCnet-PCI II* (QEMU: `-netdev user,id=u1 -device pcnet,netdev=u1`)
|
||||
- *Attached to: NAT* seems to be the most reliable setting, Bridged Mode also works somewhat
|
||||
- On boot, Shrine will automatically attempt to acquire an IP address. If you don't get a message about "Configuring network", the adapter was not detected.
|
||||
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@ I64 DhcpParseOffer(U32 xid, U8* data, I64 length, U32* yiaddr_out,
|
||||
|
||||
//"DhcpParseOffer: end %d %d %d %d\n", have_type, have_dns, have_subnet, have_router;
|
||||
|
||||
if (have_type && have_dns && have_subnet && have_router) {
|
||||
if (have_type && have_subnet) {
|
||||
*yiaddr_out = ntohl(hdr->yiaddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,11 @@ static I64 GetEthernetAddressForIP(U32 ip, U8** mac_out) {
|
||||
}
|
||||
// outside this subnet; needs routing
|
||||
else if ((ip & ipv4_subnet_mask) != (my_ip & ipv4_subnet_mask)) {
|
||||
// no gateway
|
||||
if (ipv4_router_addr == 0) {
|
||||
return IPV4_EADDR_INVALID;
|
||||
}
|
||||
|
||||
// FIXME: infinite loop if mis-configured
|
||||
|
||||
return GetEthernetAddressForIP(ipv4_router_addr, mac_out);
|
||||
|
||||
Reference in New Issue
Block a user