Commit b4f70527 authored by Simon Horman's avatar Simon Horman Committed by David S. Miller

openvswitch: use flow protocol when recalculating ipv6 checksums

When using masked actions the ipv6_proto field of an action
to set IPv6 fields may be zero rather than the prevailing protocol
which will result in skipping checksum recalculation.

This patch resolves the problem by relying on the protocol
in the flow key rather than that in the set field action.

Fixes: 83d2b9ba ("net: openvswitch: Support masked set actions.")
Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0d43780
...@@ -461,7 +461,7 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, ...@@ -461,7 +461,7 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key,
mask_ipv6_addr(saddr, key->ipv6_src, mask->ipv6_src, masked); mask_ipv6_addr(saddr, key->ipv6_src, mask->ipv6_src, masked);
if (unlikely(memcmp(saddr, masked, sizeof(masked)))) { if (unlikely(memcmp(saddr, masked, sizeof(masked)))) {
set_ipv6_addr(skb, key->ipv6_proto, saddr, masked, set_ipv6_addr(skb, flow_key->ip.proto, saddr, masked,
true); true);
memcpy(&flow_key->ipv6.addr.src, masked, memcpy(&flow_key->ipv6.addr.src, masked,
sizeof(flow_key->ipv6.addr.src)); sizeof(flow_key->ipv6.addr.src));
...@@ -483,7 +483,7 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, ...@@ -483,7 +483,7 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key,
NULL, &flags) NULL, &flags)
!= NEXTHDR_ROUTING); != NEXTHDR_ROUTING);
set_ipv6_addr(skb, key->ipv6_proto, daddr, masked, set_ipv6_addr(skb, flow_key->ip.proto, daddr, masked,
recalc_csum); recalc_csum);
memcpy(&flow_key->ipv6.addr.dst, masked, memcpy(&flow_key->ipv6.addr.dst, masked,
sizeof(flow_key->ipv6.addr.dst)); sizeof(flow_key->ipv6.addr.dst));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment