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

Fix dependence on DNS and ROUTER messages during DHCP request
develop
Minexew 4 years ago committed by GitHub
commit ba7335967e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 2
      SnailNet/Dhcp.HC
  3. 5
      SnailNet/IPv4.HC

@ -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.

@ -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);

Loading…
Cancel
Save