From 0acd3078ffad7e279007d33cda3b0b38c8b60e65 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Thu, 13 Apr 2023 23:36:00 +0800 Subject: [PATCH] ip6: add ip6-related definition 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 --- include/netinet/ip6.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/netinet/ip6.h b/include/netinet/ip6.h index b7a47995081..4a94b515561 100644 --- a/include/netinet/ip6.h +++ b/include/netinet/ip6.h @@ -32,6 +32,32 @@ * Public Type Definitions ****************************************************************************/ +struct ip6_hdr +{ + union + { + struct ip6_hdrctl + { + uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, 20 bits flow-ID */ + uint16_t ip6_un1_plen; /* payload length */ + uint8_t ip6_un1_nxt; /* next header */ + uint8_t ip6_un1_hlim; /* hop limit */ + } ip6_un1; + + uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ + } ip6_ctlun; + + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + /**************************************************************************** * Public Function Prototypes ****************************************************************************/