2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 16:55:42 +00:00

datapath: Set the correct bits for OFPAT_SET_NW_TOS action.

The DSCP bits are the high bits, not the low bits.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
This commit is contained in:
Ben Pfaff
2010-02-11 15:19:26 -08:00
committed by Justin Pettit
parent 2d38e234f4
commit f119330116
4 changed files with 11 additions and 6 deletions

View File

@@ -1179,8 +1179,8 @@ dp_netdev_set_nw_tos(struct ofpbuf *packet, flow_t *key,
struct ip_header *nh = packet->l3;
uint8_t *field = &nh->ip_tos;
/* We only set the lower 6 bits. */
uint8_t new = (a->nw_tos & 0x3f) | (nh->ip_tos & 0xc0);
/* Set the DSCP bits and preserve the ECN bits. */
uint8_t new = (a->nw_tos & IP_DSCP_MASK) | (nh->ip_tos & IP_ECN_MASK);
nh->ip_csum = recalc_csum16(nh->ip_csum, htons((uint16_t)*field),
htons((uint16_t)a->nw_tos));