[Network]

- added broadcast flag
- removed hw types from dhcp
[test_emac]
- do dhcp discover on startup

git-svn-id: http://moon:8086/svn/mips@214 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2021-11-24 16:52:36 +00:00
parent 9c79fa3bd5
commit def3585764
3 changed files with 77 additions and 95 deletions
+4 -4
View File
@@ -12,7 +12,7 @@
#include "dhcp.h"
#define WITH_CLIENT_ID 1
const char hostname[] = "ML-402";
const char hostname[] = "ml402";
// -------------------------------------------------------------------------
// Testing
@@ -33,7 +33,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
pDHCP->hlen = 6;
pDHCP->hops = 0;
pDHCP->secs = 0;
pDHCP->flags = 0;
pDHCP->flags = DHCP_FLAGS_BROADCAST;
memcpy(pDHCP->chaddr, mac_addr_src, pDHCP->hlen);
switch(dhcp_msg_type)
@@ -69,7 +69,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
option_size += size;
size = 1;
pDHCP->options[option_size] = HWTYPE_ETHERNET;
pDHCP->options[option_size] = TYPE_HW_ETH10;
option_size += size;
size = 6;
@@ -124,7 +124,7 @@ void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_a
option_size += size;
size = 1;
pDHCP->options[option_size] = HWTYPE_ETHERNET;
pDHCP->options[option_size] = TYPE_HW_ETH10;
option_size += size;
size = 6;
+2 -21
View File
@@ -41,6 +41,8 @@ typedef struct _sdhcp_opt_hdr_t
} __attribute__ ((__packed__)) dhcp_opt_hdr_t;
#define DHCP_FLAGS_BROADCAST 0x8000
#define DHCP_OPT_HOSTNAME 12
#define DHCP_OPT_REQIP 50
#define DHCP_OPT_MSGTYPE 53
@@ -56,27 +58,6 @@ typedef struct _sdhcp_opt_hdr_t
#define DHCP_MSG_DHCPNAK 6
#define DHCP_MSG_DHCPRELEASE 7
// Hardware types RFC 1340
#define HWTYPE_ETHERNET 1
/*
1 Ethernet (10Mb) [JBP]
2 Experimental Ethernet (3Mb) [JBP]
3 Amateur Radio AX.25 [PXK]
4 Proteon ProNET Token Ring [JBP]
5 Chaos [GXP]
6 IEEE 802 Networks [JBP]
7 ARCNET [JBP]
8 Hyperchannel [JBP]
9 Lanstar [TU]
10 Autonet Short Address [MXB1]
11 LocalTalk [JKR1]
12 LocalNet (IBM PCNet or SYTEK LocalNET) [JXM]
13 Ultra link [RXD2]
14 SMDS [GXC1]
15 Frame Relay [AGM]
16 Asynchronous Transmission Mode (ATM) [JXB2]
*/
// -------------------------------------------------------------------------
void DHCP_request_send(packet_t *pPacket, uint32_t dhcp_msg_type, uint8_t *mac_addr_src, uint8_t *inet_addr_src, uint8_t *inet_addr_dst, DHCP *pLast);