mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 23:29:25 +00:00
Added an additional option LWIP_ETHERNET to support ethernet without ARP (necessary for pure PPPoE) - no changes in the ppp code yet
This commit is contained in:
parent
bf261f4f13
commit
a1c0b9da7b
@ -272,11 +272,11 @@ tcpip_thread(void *arg)
|
||||
|
||||
case TCPIP_MSG_INPKT:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg));
|
||||
#if LWIP_ARP
|
||||
#if LWIP_ETHERNET
|
||||
if (msg->msg.inp.netif->flags & NETIF_FLAG_ETHARP) {
|
||||
ethernet_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||
} else
|
||||
#endif /* LWIP_ARP */
|
||||
#endif /* LWIP_ETHERNET */
|
||||
{ ip_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||
}
|
||||
memp_free(MEMP_TCPIP_MSG_INPKT, msg);
|
||||
|
@ -171,6 +171,9 @@
|
||||
#if PPP_SUPPORT && !PPPOS_SUPPORT & !PPPOE_SUPPORT
|
||||
#error "PPP_SUPPORT needs either PPPOS_SUPPORT or PPPOE_SUPPORT turned on"
|
||||
#endif
|
||||
#if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
|
||||
#error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT"
|
||||
#endif
|
||||
|
||||
|
||||
/* Compile-time checks for deprecated options.
|
||||
|
@ -376,6 +376,13 @@
|
||||
#define ETHARP_SUPPORT_VLAN 0
|
||||
#endif
|
||||
|
||||
/** LWIP_ETHERNET==1: enable ethernet support for PPPoE even though ARP
|
||||
* might be disabled
|
||||
*/
|
||||
#ifndef LWIP_ETHERNET
|
||||
#define LWIP_ETHERNET (LWIP_ARP || PPPOE_SUPPORT)
|
||||
#endif
|
||||
|
||||
/*
|
||||
--------------------------------
|
||||
---------- IP options ----------
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
|
||||
#if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
@ -139,6 +139,8 @@ PACK_STRUCT_END
|
||||
#define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
|
||||
#define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
|
||||
|
||||
#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
/** ARP message types (opcodes) */
|
||||
#define ARP_REQUEST 1
|
||||
#define ARP_REPLY 2
|
||||
@ -169,8 +171,6 @@ err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr);
|
||||
* From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
|
||||
#define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr)
|
||||
|
||||
err_t ethernet_input(struct pbuf *p, struct netif *netif);
|
||||
|
||||
#if LWIP_AUTOIP
|
||||
err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
const struct eth_addr *ethdst_addr,
|
||||
@ -179,14 +179,18 @@ err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
const u16_t opcode);
|
||||
#endif /* LWIP_AUTOIP */
|
||||
|
||||
#endif /* LWIP_ARP */
|
||||
|
||||
err_t ethernet_input(struct pbuf *p, struct netif *netif);
|
||||
|
||||
#define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0)
|
||||
|
||||
extern const struct eth_addr ethbroadcast, ethzero;
|
||||
|
||||
#endif /* LWIP_ARP || LWIP_ETHERNET */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ARP */
|
||||
|
||||
#endif /* __NETIF_ARP_H__ */
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
|
||||
#if LWIP_ARP || LWIP_ETHERNET
|
||||
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/ip.h"
|
||||
@ -61,6 +61,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
|
||||
const struct eth_addr ethzero = {{0,0,0,0,0,0}};
|
||||
|
||||
#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
/** the time an ARP entry stays valid after its last update,
|
||||
* for ARP_TMR_INTERVAL = 5000, this is
|
||||
* (240 * 5) seconds = 20 minutes.
|
||||
@ -103,8 +108,6 @@ struct etharp_entry {
|
||||
struct netif *netif;
|
||||
};
|
||||
|
||||
const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
|
||||
const struct eth_addr ethzero = {{0,0,0,0,0,0}};
|
||||
static struct etharp_entry arp_table[ARP_TABLE_SIZE];
|
||||
#if !LWIP_NETIF_HWADDRHINT
|
||||
static u8_t etharp_cached_entry;
|
||||
@ -1134,6 +1137,7 @@ etharp_request(struct netif *netif, struct ip_addr *ipaddr)
|
||||
(struct eth_addr *)netif->hwaddr, &netif->ip_addr, ðzero,
|
||||
ipaddr, ARP_REQUEST);
|
||||
}
|
||||
#endif /* LWIP_ARP */
|
||||
|
||||
/**
|
||||
* Process received ethernet frames. Using this function instead of directly
|
||||
@ -1175,6 +1179,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
#endif /* ETHARP_SUPPORT_VLAN */
|
||||
|
||||
switch (type) {
|
||||
#if LWIP_ARP
|
||||
/* IP packet? */
|
||||
case ETHTYPE_IP:
|
||||
#if ETHARP_TRUST_IP_MAC
|
||||
@ -1196,7 +1201,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
/* pass p to ARP module */
|
||||
etharp_arp_input(netif, (struct eth_addr*)(netif->hwaddr), p);
|
||||
break;
|
||||
|
||||
#endif /* LWIP_ARP */
|
||||
#if PPPOE_SUPPORT
|
||||
case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */
|
||||
pppoe_disc_input(netif, p);
|
||||
@ -1219,4 +1224,4 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
so the caller doesn't have to free it again */
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* LWIP_ARP */
|
||||
#endif /* LWIP_ARP || LWIP_ETHERNET */
|
||||
|
Loading…
Reference in New Issue
Block a user