Skip to content

Commit 856447d

Browse files
jessegrossPravin B Shelar
authored andcommitted
openvswitch: Fix checksum calculation when modifying ICMPv6 packets.
The checksum of ICMPv6 packets uses the IP pseudoheader as part of the calculation, unlike ICMP in IPv4. This was not implemented, which means that modifying the IP addresses of an ICMPv6 packet would cause the checksum to no longer be correct as the psuedoheader did not match. Introduced by commit 3fdbd1c ("openvswitch: add ipv6 'set' action"). Reported-by: Neal Shrader <icosahedral@gmail.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
1 parent ab64f16 commit 856447d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎net/openvswitch/actions.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto,
246246
{
247247
int transport_len = skb->len - skb_transport_offset(skb);
248248

249-
if (l4_proto == IPPROTO_TCP) {
249+
if (l4_proto == NEXTHDR_TCP) {
250250
if (likely(transport_len >= sizeof(struct tcphdr)))
251251
inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb,
252252
addr, new_addr, 1);
253-
} else if (l4_proto == IPPROTO_UDP) {
253+
} else if (l4_proto == NEXTHDR_UDP) {
254254
if (likely(transport_len >= sizeof(struct udphdr))) {
255255
struct udphdr *uh = udp_hdr(skb);
256256

@@ -261,6 +261,10 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto,
261261
uh->check = CSUM_MANGLED_0;
262262
}
263263
}
264+
} else if (l4_proto == NEXTHDR_ICMP) {
265+
if (likely(transport_len >= sizeof(struct icmp6hdr)))
266+
inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum,
267+
skb, addr, new_addr, 1);
264268
}
265269
}
266270

0 commit comments

Comments
 (0)