diff --git a/SOURCES/openvswitch-3.3.0.patch b/SOURCES/openvswitch-3.3.0.patch index f8e2c06..91bb427 100644 --- a/SOURCES/openvswitch-3.3.0.patch +++ b/SOURCES/openvswitch-3.3.0.patch @@ -793,10 +793,27 @@ index 305822293b..df7bf8e6b3 100644 if (dp_packet_hwol_tx_ip_csum(p)) { diff --git a/lib/dp-packet.h b/lib/dp-packet.h -index 2fa17d8140..a75b1c5cdb 100644 +index 2fa17d8140..e816b9f20b 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h -@@ -604,25 +604,6 @@ dp_packet_get_nd_payload(const struct dp_packet *b) +@@ -529,6 +529,16 @@ dp_packet_inner_l3(const struct dp_packet *b) + : NULL; + } + ++static inline size_t ++dp_packet_inner_l3_size(const struct dp_packet *b) ++{ ++ return OVS_LIKELY(b->inner_l3_ofs != UINT16_MAX) ++ ? (const char *) dp_packet_tail(b) ++ - (const char *) dp_packet_inner_l3(b) ++ - dp_packet_l2_pad_size(b) ++ : 0; ++} ++ + static inline void * + dp_packet_inner_l4(const struct dp_packet *b) + { +@@ -604,25 +614,6 @@ dp_packet_get_nd_payload(const struct dp_packet *b) } #ifdef DPDK_NETDEV @@ -822,7 +839,7 @@ index 2fa17d8140..a75b1c5cdb 100644 static inline uint64_t * dp_packet_ol_flags_ptr(const struct dp_packet *b) { -@@ -642,24 +623,6 @@ dp_packet_flow_mark_ptr(const struct dp_packet *b) +@@ -642,24 +633,6 @@ dp_packet_flow_mark_ptr(const struct dp_packet *b) } #else @@ -847,7 +864,7 @@ index 2fa17d8140..a75b1c5cdb 100644 static inline uint32_t * dp_packet_ol_flags_ptr(const struct dp_packet *b) { -@@ -1300,6 +1263,14 @@ dp_packet_hwol_set_tunnel_vxlan(struct dp_packet *b) +@@ -1300,6 +1273,14 @@ dp_packet_hwol_set_tunnel_vxlan(struct dp_packet *b) *dp_packet_ol_flags_ptr(b) |= DP_PACKET_OL_TX_TUNNEL_VXLAN; } @@ -862,6 +879,36 @@ index 2fa17d8140..a75b1c5cdb 100644 /* Mark packet 'b' as a tunnel packet with outer IPv4 header. */ static inline void dp_packet_hwol_set_tx_outer_ipv4(struct dp_packet *b) +@@ -1419,11 +1400,26 @@ dp_packet_hwol_l3_ipv4(const struct dp_packet *b) + static inline void + dp_packet_ip_set_header_csum(struct dp_packet *p, bool inner) + { +- struct ip_header *ip = (inner) ? dp_packet_inner_l3(p) : dp_packet_l3(p); ++ struct ip_header *ip; ++ size_t l3_size; ++ size_t ip_len; ++ ++ if (inner) { ++ ip = dp_packet_inner_l3(p); ++ l3_size = dp_packet_inner_l3_size(p); ++ } else { ++ ip = dp_packet_l3(p); ++ l3_size = dp_packet_l3_size(p); ++ } + + ovs_assert(ip); +- ip->ip_csum = 0; +- ip->ip_csum = csum(ip, sizeof *ip); ++ ++ ip_len = IP_IHL(ip->ip_ihl_ver) * 4; ++ ++ if (OVS_LIKELY(ip_len >= IP_HEADER_LEN && ip_len < l3_size)) { ++ ip->ip_csum = 0; ++ ip->ip_csum = csum(ip, ip_len); ++ } + } + + /* Returns 'true' if the packet 'p' has good integrity and the diff --git a/lib/dpctl.c b/lib/dpctl.c index 34ee7d0e2d..cdff4206e2 100644 --- a/lib/dpctl.c @@ -4131,10 +4178,52 @@ index f321bae55f..8565a0bae9 100644 + echo "$0: unexpected error probing Python unit test requirements" >&2 ;; esac diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at -index 790b5a43af..bdc24cc307 100644 +index 790b5a43af..c16bdd0326 100644 --- a/tests/dpif-netdev.at +++ b/tests/dpif-netdev.at -@@ -1091,3 +1091,66 @@ OVS_VSWITCHD_STOP(["dnl +@@ -807,6 +807,41 @@ AT_CHECK([ovs-appctl netdev-dummy/receive p1 ${bad_frame}]) + AT_CHECK([ovs-pcap p2.pcap > p2.pcap.txt 2>&1]) + AT_CHECK_UNQUOTED([tail -n 1 p2.pcap.txt], [0], [${good_expected} + ]) ++ ++dnl Test with IP optional fields in a valid packet. Note that neither this ++dnl packet nor the following one contain a correct checksum. OVS is ++dnl expected to replace this dummy checksum with a valid one if possible. ++m4_define([OPT_PKT], m4_join([], ++dnl eth(dst=aa:aa:aa:aa:aa:aa,src=bb:bb:bb:bb:bb:bb,type=0x0800) ++[aaaaaaaaaaaabbbbbbbbbbbb0800], ++dnl ipv4(dst=10.0.0.2,src=10.0.0.1,proto=1,len=60,tot_len=68,csum=0xeeee) ++[4f000044abab00004001eeee0a0000010a000002], ++dnl IPv4 Opt: type 7 (Record Route) len 39 + type 0 (EOL). ++[07270c010203040a000003000000000000000000], ++[0000000000000000000000000000000000000000], ++dnl icmp(type=8,code=0), csum 0x3e2f incorrect, should be 0x412f. ++[08003e2fb6d00000])) ++ ++dnl IP header indicates optional fields but doesn't contain any. ++m4_define([MICROGRAM], m4_join([], ++dnl eth(dst=aa:aa:aa:aa:aa:aa,src=bb:bb:bb:bb:bb:bb,type=0x0800) ++[aaaaaaaaaaaabbbbbbbbbbbb0800], ++dnl ipv4(dst=10.0.0.2,src=10.0.0.1,proto=1,len=60,tot_len=68,csum=0xeeee) ++[4f000044abab00004001eeee0a0000010a000002])) ++ ++AT_CHECK([ovs-vsctl set Interface p1 options:ol_ip_csum=true]) ++AT_CHECK([ovs-vsctl set Interface p1 options:ol_ip_csum_set_good=true]) ++AT_CHECK([ovs-appctl netdev-dummy/receive p1 OPT_PKT]) ++AT_CHECK([ovs-appctl netdev-dummy/receive p1 MICROGRAM]) ++AT_CHECK([ovs-pcap p2.pcap > p2.pcap.txt 2>&1]) ++ ++dnl Build the expected modified packets. The first packet has a valid IPv4 ++dnl checksum and modified destination IP address. The second packet isn't ++dnl expected to change. ++AT_CHECK([echo "OPT_PKT" | sed -e "s/0a000002/c0a80101/" -e "s/eeee/dd2e/" > expout]) ++AT_CHECK([echo "MICROGRAM" >> expout]) ++AT_CHECK([tail -n 2 p2.pcap.txt], [0], [expout]) ++ + OVS_VSWITCHD_STOP + AT_CLEANUP + +@@ -1091,3 +1126,66 @@ OVS_VSWITCHD_STOP(["dnl /Error: unknown miniflow extract implementation superstudy./d /Error: invalid study_pkt_cnt value: -pmd./d"]) AT_CLEANUP diff --git a/SPECS/openvswitch3.3.spec b/SPECS/openvswitch3.3.spec index 1eaed23..f3cbb87 100644 --- a/SPECS/openvswitch3.3.spec +++ b/SPECS/openvswitch3.3.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.3.0 -Release: 44%{?dist} +Release: 45%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -769,6 +769,12 @@ exit 0 %endif %changelog +* Thu Aug 15 2024 Open vSwitch CI - 3.3.0-45 +- Merging upstream branch-3.3 [RH git: 7db7165705] + Commit list: + 1e6c691699 dp-packet: Correct IPv4 checksum calculation. () + + * Wed Aug 14 2024 Open vSwitch CI - 3.3.0-44 - Merging upstream branch-3.3 [RH git: 3cc89bc2a3] Commit list: