- fixed Eth_pkt_recv

- DHCP sending of client id is disabled

git-svn-id: http://moon:8086/svn/mips@209 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2021-11-24 07:17:01 +00:00
parent 6c957b9e84
commit 001e7af3e3
3 changed files with 37 additions and 34 deletions
+7 -3
View File
@@ -4,12 +4,12 @@
// 21.12.2003, J. Ahrensfeld
//
// -------------------------------------------------------------------------
#include <string.h>
#include <libsys/libsys.h>
#include "ethernet.h"
#include "ipv4.h"
#include "udp.h"
#include "dhcp.h"
#include "string.h"
const char hostname[] = "ML-402";
@@ -46,6 +46,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
pos = 0;
size = sizeof(magic);
memset(&pDHCP->options[pos], 0xAA, sizeof(pDHCP->options));
memcpy(&pDHCP->options[pos], &magic, size);
pos += size;
@@ -60,6 +61,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
pDHCP->options[pos] = dhcp_msg_type;
pos += size;
#ifdef WITH_CLIENT_ID
// Set client ID
size = sizeof(dhcp_opt_hdr_t);
pOpt_hdr = (dhcp_opt_hdr_t*)&pDHCP->options[pos];
@@ -70,7 +72,8 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
size = pOpt_hdr->len;
memcpy(&pDHCP->options[pos], mac_addr_src, size);
pos += size;
#endif
// Set client name
size = sizeof(dhcp_opt_hdr_t);
pOpt_hdr = (dhcp_opt_hdr_t*)&pDHCP->options[pos];
@@ -107,6 +110,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
pDHCP->options[pos] = dhcp_msg_type;
pos += size;
#ifdef WITH_CLIENT_ID
// Set client ID
size = sizeof(dhcp_opt_hdr_t);
pOpt_hdr = (dhcp_opt_hdr_t*)&pDHCP->options[pos];
@@ -117,7 +121,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
size = pOpt_hdr->len;
memcpy(&pDHCP->options[pos], mac_addr_src, size);
pos += size;
#endif
// Set client name
size = sizeof(dhcp_opt_hdr_t);
pOpt_hdr = (dhcp_opt_hdr_t*)&pDHCP->options[pos];
+5 -2
View File
@@ -124,8 +124,8 @@ uint32_t Eth_pkt_recv(uint8_t *pData)
volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE;
volatile uint32_t *pEmac_data = (uint32_t*)SYS_EMAC_DATA;
uint32_t crc32, i, num_words, num_bytes, pkt_size;
uint32_t i, num_words, num_bytes;
if(EMAC_RX_is_avail())
{
@@ -143,11 +143,14 @@ uint32_t Eth_pkt_recv(uint8_t *pData)
EMAC_RX_request();
for (i=0; i < num_words; i++)
{
((uint32_t*)pData)[i] = *pEmac_data;
}
EMAC_RX_free();
}
}
return num_bytes;
}
uint16_t htons(uint16_t a)