Actually use proper MAC in packets.
Also, assign mac early enough in rtl driver.
This commit is contained in:
parent
bb616039fe
commit
334f8ccbd3
@ -12,8 +12,6 @@
|
||||
|
||||
static hashmap_t * dns_cache;
|
||||
|
||||
static uint8_t mac[6];
|
||||
|
||||
static hashmap_t *_tcp_sockets = NULL;
|
||||
static hashmap_t *_udp_sockets = NULL;
|
||||
|
||||
@ -337,7 +335,8 @@ static size_t write_dns_packet(uint8_t * buffer, size_t queries_len, uint8_t * q
|
||||
|
||||
/* Then, let's write an ethernet frame */
|
||||
struct ethernet_packet eth_out = {
|
||||
.source = { mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] },
|
||||
.source = { _netif.hwaddr[0], _netif.hwaddr[1], _netif.hwaddr[2],
|
||||
_netif.hwaddr[3], _netif.hwaddr[4], _netif.hwaddr[5] },
|
||||
.destination = BROADCAST_MAC,
|
||||
.type = htons(0x0800),
|
||||
};
|
||||
@ -769,7 +768,8 @@ size_t write_dhcp_packet(uint8_t * buffer) {
|
||||
|
||||
/* Then, let's write an ethernet frame */
|
||||
struct ethernet_packet eth_out = {
|
||||
.source = { mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] },
|
||||
.source = { _netif.hwaddr[0], _netif.hwaddr[1], _netif.hwaddr[2],
|
||||
_netif.hwaddr[3], _netif.hwaddr[4], _netif.hwaddr[5] },
|
||||
.destination = BROADCAST_MAC,
|
||||
.type = htons(0x0800),
|
||||
};
|
||||
@ -832,7 +832,8 @@ size_t write_dhcp_packet(uint8_t * buffer) {
|
||||
.siaddr = 0x000000,
|
||||
.giaddr = 0x000000,
|
||||
|
||||
.chaddr = {mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], 0x00},
|
||||
.chaddr = { _netif.hwaddr[0], _netif.hwaddr[1], _netif.hwaddr[2],
|
||||
_netif.hwaddr[3], _netif.hwaddr[4], _netif.hwaddr[5] },
|
||||
.sname = {0},
|
||||
.file = {0},
|
||||
.magic = htonl(DHCP_MAGIC),
|
||||
|
@ -392,6 +392,9 @@ int init_rtl(void) {
|
||||
|
||||
net_queue = list_create();
|
||||
|
||||
debug_print(NOTICE, "Initializing netif functions\n");
|
||||
init_netif_funcs(rtl_get_mac, rtl_get_packet, rtl_send_packet);
|
||||
|
||||
#if 1
|
||||
{
|
||||
debug_print(NOTICE, "Sending DHCP discover\n");
|
||||
@ -454,9 +457,6 @@ int init_rtl(void) {
|
||||
|
||||
debug_print(NOTICE, "Card is configured, going to start worker thread now.\n");
|
||||
|
||||
debug_print(NOTICE, "Initializing netif functions\n");
|
||||
|
||||
init_netif_funcs(rtl_get_mac, rtl_get_packet, rtl_send_packet);
|
||||
create_kernel_tasklet(net_handler, "[eth]", NULL);
|
||||
|
||||
debug_print(NOTICE, "Back from starting the worker thread.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user