summaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-08-10 12:34:23 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-08-10 12:34:23 +0200
commitd9638539eb82b74d9efc7abb0d71b2deb68a2547 (patch)
tree291449768c8c4e6c84f8a6b5a10e3d026215787b /src/kernel/kernel.c
parent235551b84395233770f525714dee257ffb0e4842 (diff)
downloadabaos-d9638539eb82b74d9efc7abb0d71b2deb68a2547.tar.gz
abaos-d9638539eb82b74d9efc7abb0d71b2deb68a2547.tar.bz2
some renamed in ethernet/rtl8139
don't try tp play with the ethernet CRCs, they belong to layer 2 OSI, the firmware of the network card rtl8139: computing packet size correctly (sizeof uint32_t of the CRC was part of the payload len)
Diffstat (limited to 'src/kernel/kernel.c')
-rw-r--r--src/kernel/kernel.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c
index 0b10f45..d91c5d6 100644
--- a/src/kernel/kernel.c
+++ b/src/kernel/kernel.c
@@ -461,8 +461,8 @@ void handle_network_event( network_event_t *event, void *context )
char src_mac_addr[NETWORK_ETHERNET_MAC_ADDR_STRING];
char dst_mac_addr[NETWORK_ETHERNET_MAC_ADDR_STRING];
- network_mac_address_to_string( packet->header.src_addr, src_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
- network_mac_address_to_string( packet->header.dst_addr, dst_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
+ ethernet_mac_address_to_string( packet->header.src_addr, src_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
+ ethernet_mac_address_to_string( packet->header.dst_addr, dst_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
printf( "NETWORK DATA: src: %s, dst: %s, len: %d, type: %X\n",
src_mac_addr, dst_mac_addr,
event->buf.length,
@@ -473,8 +473,8 @@ void handle_network_event( network_event_t *event, void *context )
char src_ip[NETWORK_PROTOCOL_IPV4_ADDR_STRING];
char dst_ip[NETWORK_PROTOCOL_IPV4_ADDR_STRING];
- network_mac_address_to_string( arp->source_hardware_address, src_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
- network_mac_address_to_string( arp->destination_hardware_address, dst_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
+ ethernet_mac_address_to_string( arp->source_hardware_address, src_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
+ ethernet_mac_address_to_string( arp->destination_hardware_address, dst_mac_addr, NETWORK_ETHERNET_MAC_ADDR_STRING );
network_ipv4_address_to_string( arp->source_protocol_address, src_ip, NETWORK_PROTOCOL_IPV4_ADDR_STRING );
network_ipv4_address_to_string( arp->destination_protocol_address, dst_ip, NETWORK_PROTOCOL_IPV4_ADDR_STRING );
@@ -489,6 +489,9 @@ void handle_network_event( network_event_t *event, void *context )
arp->operation = ARP_OPERATION_ANSWER;
arp->destination_hardware_address = arp->source_hardware_address;
arp->source_hardware_address = global_context.network->mac_address;
+ network_ipv4_address_t tmp = arp->destination_protocol_address;
+ arp->destination_protocol_address = arp->source_protocol_address;
+ arp->source_protocol_address = tmp;
((network_vtable_t *)( global_context.network->base.vtable ))->write( global_context.network, event->buf );
}