2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

datapath-windows: Fix NXM_OF_IP_TOS issue

Currenlty Ovs-windows can not change tos using NXM_OF_IP_TOS, this patch fixes it.

1, test with the following flow :
ovs-ofctl.exe add-flow br-int "table=0,priority=300,in_port=antrea-gw0,icmp actions=mod_nw_tos:28,load:0x1->NXM_NX_REG0[0..3],resubmit(,SpoofGuard)"
2, capture packet trace on destination side :
02:23:30.625049 IP (tos 0x1c, ttl 128, id 15237, offset 0, flags [none], proto ICMP (1), length 60)
    192.168.250.1 > 192.168.248.1: ICMP echo request, id 1, seq 10, length 40

Reported-at:openvswitch/ovs-issues#244
Signed-off-by: Frank Guo <frankg@vmware.com>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
This commit is contained in:
Frank Guo 2022-02-18 15:52:18 +08:00 committed by Alin-Gabriel Serdean
parent 4f933301f0
commit 7aaa5b8137

View File

@ -1712,6 +1712,15 @@ OvsUpdateIPv4Header(OvsForwardingContext *ovsFwdCtx,
ipHdr->ttl = ipAttr->ipv4_ttl; ipHdr->ttl = ipAttr->ipv4_ttl;
key->ipKey.nwTtl = ipAttr->ipv4_ttl; key->ipKey.nwTtl = ipAttr->ipv4_ttl;
} }
if (ipHdr->dscp != (ipAttr->ipv4_tos & 0xfc)) {
/* ECN + DSCP */
UINT8 newTos = (ipHdr->tos & 0x3) | (ipAttr->ipv4_tos & 0xfc);
if (ipHdr->check != 0) {
ipHdr->check = ChecksumUpdate16(ipHdr->check, ipHdr->tos, newTos);
}
ipHdr->tos = newTos;
key->ipKey.nwTos = newTos;
}
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }