Skip to content

Commit a434f7c

Browse files
ip stuff
1 parent 88c4271 commit a434f7c

File tree

4 files changed

+286
-47
lines changed

4 files changed

+286
-47
lines changed

include/icmp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,13 @@ typedef struct icmp_timestamp_packet {
105105
void icmp_handle_packet([[maybe_unused]] ip_packet_t* encap_packet, icmp_packet_t* packet, size_t len);
106106

107107
void icmp_send_echo(uint32_t destination, uint16_t id, uint16_t seq);
108+
109+
void icmp_send_time_exceeded(ip_packet_t* original_ip, uint8_t code);
110+
111+
void icmp_send_destination_unreachable(ip_packet_t* original_ip, uint8_t code);
112+
113+
void icmp_send_parameter_problem(ip_packet_t* original_ip, uint8_t pointer_offset);
114+
115+
void icmp_send_redirect(ip_packet_t* original_ip, uint8_t code, uint32_t new_gateway_ip);
116+
117+
void icmp_send_fragmentation_needed(ip_packet_t* original_ip, uint16_t mtu);

src/arp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void arp_handle_packet(arp_packet_t* arp_packet, [[maybe_unused]] int len) {
3535
if (gethostaddr(addr)) {
3636
my_ip = *(uint32_t*)addr;
3737
}
38-
if (memcmp(arp_packet->dst_protocol_addr, &my_ip, 4)) {
38+
if (memcmp(arp_packet->dst_protocol_addr, &my_ip, 4) == 0) {
3939

4040
netdev_t* dev = get_active_network_device();
4141
if (!dev) {
@@ -61,8 +61,7 @@ void arp_handle_packet(arp_packet_t* arp_packet, [[maybe_unused]] int len) {
6161

6262
ethernet_send_packet(dst_hardware_addr, (uint8_t*)arp_packet, sizeof(arp_packet_t), ETHERNET_TYPE_ARP);
6363
}
64-
}
65-
else if(ntohs(arp_packet->opcode) == ARP_REPLY) {
64+
} else if(ntohs(arp_packet->opcode) == ARP_REPLY) {
6665
}
6766

6867
uint8_t dummy[6];

0 commit comments

Comments
 (0)