Skip to content

Commit

Permalink
Merge "Fix the interpretation of priority nibbles in ipv6 header" int…
Browse files Browse the repository at this point in the history
…o R3.1
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Aug 24, 2016
2 parents b00f41f + b5f99f0 commit fd8d047
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions include/vr_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,30 +473,30 @@ struct vr_ip6_pseudo {
struct vr_ip6 {
#ifdef __KERNEL__
#if defined(__LITTLE_ENDIAN_BITFIELD)
uint8_t ip6_priority_l:4,
ip6_version:4;
uint8_t ip6_priority_h:4,
ip6_flow_l:4;
ip6_version:4;
uint8_t ip6_flow_h:4,
ip6_priority_l:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
uint8_t ip6_version:4,
ip6_priority_l:4;
uint8_t ip6_flow_l:4,
ip6_prioirty_h:4;
ip6_priority_h:4;
uint8_t ip6_priority_l:4,
ip6_flow_h:4;
#endif
#else
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
uint8_t ip6_priority_l:4,
ip6_version:4;
uint8_t ip6_priority_h:4,
ip6_flow_l:4;
ip6_version:4;
uint8_t ip6_flow_h:4,
ip6_priority_l:4;
#elif (__BYTE_ORDER == __BIG_ENDIAN)
uint8_t ip6_version:4,
ip6_priority_l:4;
uint8_t ip6_flow_l:4,
ip6_prioirty_h:4;
ip6_priority_h:4;
uint8_t ip6_priority_l:4,
ip6_flow_h:4;
#endif
#endif
uint16_t ip6_flow_h;
uint16_t ip6_flow_l;
uint16_t ip6_plen;
uint8_t ip6_nxt;
uint8_t ip6_hlim;
Expand All @@ -510,14 +510,14 @@ struct vr_ip6 {
static inline uint8_t
vr_inet6_get_tos(struct vr_ip6 *ip6h)
{
return (((ip6h->ip6_priority_h << 4) | (ip6h->ip6_priority_l)) & 0x3F);
return ((((ip6h->ip6_priority_h << 4) | (ip6h->ip6_priority_l)) >> 2) & 0x3F);
}

static inline void
vr_inet6_set_tos(struct vr_ip6 *ip6h, uint8_t tos)
{
ip6h->ip6_priority_h = (tos >> 4) & 0x3;
ip6h->ip6_priority_l = (tos & 0xF);
ip6h->ip6_priority_h = ((tos << 2) >> 4);
ip6h->ip6_priority_l = ((tos << 2) & 0xF);

return;
}
Expand Down

0 comments on commit fd8d047

Please sign in to comment.