aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMarvin Borner2020-11-10 22:03:38 +0100
committerMarvin Borner2020-11-10 22:03:38 +0100
commit2c9c650c70a0622a2097105745eaba52e9170dd1 (patch)
tree72f75a5216e96814610c5a417e9e1fe4b0be71ff /kernel
parent5306a2195107027a33777c97e6fbc8ffecfbc25c (diff)
Fixes
yup
Diffstat (limited to 'kernel')
-rw-r--r--kernel/features/net.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/features/net.c b/kernel/features/net.c
index eb22afc..dae7d2d 100644
--- a/kernel/features/net.c
+++ b/kernel/features/net.c
@@ -331,6 +331,7 @@ void dhcp_handle_packet(struct dhcp_packet *packet)
memcpy(&subnet_mask, dhcp_get_options(packet, 1), 4);
memcpy(&gateway_addr, dhcp_get_options(packet, 3), 4);
+ memcpy(gateway_mac, dhcp_get_options(packet, 3), 4);
subnet_mask = htonl(subnet_mask);
gateway_addr = htonl(gateway_addr);
@@ -338,6 +339,7 @@ void dhcp_handle_packet(struct dhcp_packet *packet)
printf("New IP: %x\n", current_ip_addr);
printf("Gateway: %x\n", gateway_addr);
assert(same_net(current_ip_addr));
+ // TODO: Get mac from ethernet packet directly
arp_send_packet(zero_hardware_addr, gateway_addr, ARP_REQUEST);
/* sti(); */
/* while (!arp_lookup(gateway_mac, gateway_addr)) */
@@ -634,6 +636,7 @@ int net_connect(struct socket *socket, u32 ip_addr, u16 dst_port)
u32 time = timer_get();
while (tcp->state != 3 && tcp->state != 5 && timer_get() - time < 1000)
;
+ cli();
if (tcp->state != 3 && tcp->state != 5)
return 0;
} else {