add IPv4 & IPv6 frag reassemble test case
This commit is contained in:
@@ -100,8 +100,6 @@ static inline struct ip6_frag *ipv6_hdr_get_frag_ext(const struct ip6_hdr *hdr)
|
||||
return (struct ip6_frag *)((char *)hdr + sizeof(struct ip6_hdr));
|
||||
}
|
||||
|
||||
// TODO IPv6 extension headers
|
||||
|
||||
/******************************************************************************
|
||||
* set
|
||||
******************************************************************************/
|
||||
@@ -146,7 +144,56 @@ static inline void ipv6_hdr_set_dst_in6_addr(struct ip6_hdr *hdr, struct in6_add
|
||||
hdr->ip6_dst = dst_addr;
|
||||
}
|
||||
|
||||
// TODO IPv6 extension headers
|
||||
/******************************************************************************
|
||||
* IPv6 frag extension headers
|
||||
******************************************************************************/
|
||||
|
||||
static inline uint8_t ipv6_frag_get_next_header(const struct ip6_frag *frag)
|
||||
{
|
||||
return frag->ip6f_nxt;
|
||||
}
|
||||
|
||||
static inline uint16_t ipv6_frag_get_offset(const struct ip6_frag *frag)
|
||||
{
|
||||
return ntohs(frag->ip6f_offlg & IP6F_OFF_MASK);
|
||||
}
|
||||
|
||||
static inline uint32_t ipv6_frag_get_ident(const struct ip6_frag *frag)
|
||||
{
|
||||
return ntohl(frag->ip6f_ident);
|
||||
}
|
||||
|
||||
static inline bool ipv6_frag_get_more(const struct ip6_frag *frag)
|
||||
{
|
||||
return (frag->ip6f_offlg & IP6F_MORE_FRAG);
|
||||
}
|
||||
|
||||
static inline void ipv6_frag_set_next_header(struct ip6_frag *frag, uint8_t next_header)
|
||||
{
|
||||
frag->ip6f_nxt = next_header;
|
||||
}
|
||||
|
||||
static inline void ipv6_frag_set_offset(struct ip6_frag *frag, uint16_t offset)
|
||||
{
|
||||
frag->ip6f_offlg = (frag->ip6f_offlg & ~IP6F_OFF_MASK) | htons(offset);
|
||||
}
|
||||
|
||||
static inline void ipv6_frag_set_ident(struct ip6_frag *frag, uint32_t ident)
|
||||
{
|
||||
frag->ip6f_ident = htonl(ident);
|
||||
}
|
||||
|
||||
static inline void ipv6_frag_set_more(struct ip6_frag *frag, bool more)
|
||||
{
|
||||
if (more)
|
||||
{
|
||||
frag->ip6f_offlg |= IP6F_MORE_FRAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
frag->ip6f_offlg &= ~IP6F_MORE_FRAG;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user