Skip to content

Commit 6e36a6f

Browse files
zhhyu7xiaoxiang781216
authored andcommitted
ethernet: add ETHERTYPE define
adapts to third-party code compilation. in the process of porting ConnMan, we encounter some situations where the structure is not defined, or the returned data types do not match the expectations. Refer to the common implementation of other systems and add relevant definitions. Signed-off-by: zhanghongyu <[email protected]>
1 parent f6fdf88 commit 6e36a6f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

include/net/ethernet.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@
3333

3434
#define ETHER_ADDR_LEN 6
3535

36+
/* Ethernet protocol ID's */
37+
#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
38+
#define ETHERTYPE_SPRITE 0x0500 /* Sprite */
39+
#define ETHERTYPE_IP 0x0800 /* IP */
40+
#define ETHERTYPE_ARP 0x0806 /* Address resolution */
41+
#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
42+
#define ETHERTYPE_AT 0x809B /* AppleTalk protocol */
43+
#define ETHERTYPE_AARP 0x80F3 /* AppleTalk ARP */
44+
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
45+
#define ETHERTYPE_IPX 0x8137 /* IPX */
46+
#define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */
47+
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
48+
3649
/****************************************************************************
3750
* Public Type Definitions
3851
****************************************************************************/

include/nuttx/net/ethernet.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@
5555

5656
/* Recognized values of the type bytes in the Ethernet header */
5757

58-
#define ETHTYPE_ARP 0x0806 /* Address resolution protocol */
59-
#define ETHTYPE_IP 0x0800 /* IP protocol */
60-
#define ETHTYPE_IP6 0x86dd /* IP protocol version 6 */
58+
#define ETHTYPE_ARP ETHERTYPE_ARP /* Address resolution protocol */
59+
#define ETHTYPE_IP ETHERTYPE_IP /* IP protocol */
60+
#define ETHTYPE_IP6 ETHERTYPE_IPV6 /* IP protocol version 6 */
6161

6262
/* Tag protocol identifier (TPID) of 0x8100 identifies the frame as an
6363
* IEEE 802.1Q-tagged frame. This field is located at the same position as
6464
* the Ethernet type field in untagged frames and is thus used to
6565
* distinguish the frame from untagged frames.
6666
*/
6767

68-
#define TPID_8021QVLAN 0x8100
68+
#define TPID_8021QVLAN ETHERTYPE_VLAN
6969

7070
/* These are some of the types associated with QVLAN tagged
7171
* Ethernet packets.

0 commit comments

Comments
 (0)