Merge pull request #16 from tuxcrafting/fix-dhcp-pedanticness

Fix dependence on DNS and ROUTER messages during DHCP request
This commit is contained in:
Minexew
2018-04-19 22:20:45 +02:00
committed by GitHub
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -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
View File
@@ -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;
}
+5
View File
@@ -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);