Work on task #14587: Create common header for IANA assigned numbers

Create include/lwip/prot/iana.h
Move DHCP and ARP #define in there
This commit is contained in:
Dirk Ziegelmeier
2017-08-07 21:06:19 +02:00
parent 42fd01547d
commit 629ec98dd8
6 changed files with 58 additions and 13 deletions

View File

@@ -78,6 +78,7 @@
#include "lwip/dns.h"
#include "lwip/etharp.h"
#include "lwip/prot/dhcp.h"
#include "lwip/prot/iana.h"
#include <string.h>
@@ -1908,7 +1909,7 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type, u16_t
msg_out->op = DHCP_BOOTREQUEST;
/* @todo: make link layer independent */
msg_out->htype = DHCP_HTYPE_ETH;
msg_out->htype = IANA_HWTYPE_ETHERNET;
msg_out->hlen = netif->hwaddr_len;
msg_out->xid = lwip_htonl(dhcp->xid);
/* we don't need the broadcast flag since we can receive unicast traffic

View File

@@ -52,6 +52,7 @@
#include "lwip/snmp.h"
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include "lwip/prot/iana.h"
#include "netif/ethernet.h"
#include <string.h>
@@ -650,7 +651,7 @@ etharp_input(struct pbuf *p, struct netif *netif)
hdr = (struct etharp_hdr *)p->payload;
/* RFC 826 "Packet Reception": */
if ((hdr->hwtype != PP_HTONS(HWTYPE_ETHERNET)) ||
if ((hdr->hwtype != PP_HTONS(IANA_HWTYPE_ETHERNET)) ||
(hdr->hwlen != ETH_HWADDR_LEN) ||
(hdr->protolen != sizeof(ip4_addr_t)) ||
(hdr->proto != PP_HTONS(ETHTYPE_IP))) {
@@ -1139,7 +1140,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
IPADDR_WORDALIGNED_COPY_FROM_IP4_ADDR_T(&hdr->sipaddr, ipsrc_addr);
IPADDR_WORDALIGNED_COPY_FROM_IP4_ADDR_T(&hdr->dipaddr, ipdst_addr);
hdr->hwtype = PP_HTONS(HWTYPE_ETHERNET);
hdr->hwtype = PP_HTONS(IANA_HWTYPE_ETHERNET);
hdr->proto = PP_HTONS(ETHTYPE_IP);
/* set hwlen and protolen */
hdr->hwlen = ETH_HWADDR_LEN;