diff --git a/README.md b/README.md index 24ed642..0aae5d8 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/SnailNet/Dhcp.HC b/SnailNet/Dhcp.HC index 88fad40..0c7839b 100644 --- a/SnailNet/Dhcp.HC +++ b/SnailNet/Dhcp.HC @@ -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; } diff --git a/SnailNet/IPv4.HC b/SnailNet/IPv4.HC index e467a4e..a06e6ed 100644 --- a/SnailNet/IPv4.HC +++ b/SnailNet/IPv4.HC @@ -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);