@@ -35,8 +35,15 @@ function version_let() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "
3535# greater than or equal to
3636function version_get() { test " $( printf ' %s\n' " $@ " | sort -rV | head -n 1) " == " $1 " ; }
3737
38- if version_lt " $OVS_VERSION " " 2.13.0" || version_gt " $OVS_VERSION " " 2.15.1" ; then
39- echoerr " OVS_VERSION $OVS_VERSION is not supported (must be >= 2.13.0 and <= 2.15.1)"
38+ function apply_patch() {
39+ commit_sha=" $1 "
40+ shift
41+ curl -s " https://github.com/openvswitch/ovs/commit/$commit_sha .patch" | \
42+ git apply " $@ "
43+ }
44+
45+ if version_lt " $OVS_VERSION " " 2.13.0" || version_gt " $OVS_VERSION " " 2.17.0" ; then
46+ echoerr " OVS_VERSION $OVS_VERSION is not supported (must be >= 2.13.0 and <= 2.17.0)"
4047 exit 1
4148fi
4249
4653
4754# This patch (post 2.13.0) ensures that ct_nw_src/ct_nw_dst supports IP Mask.
4855if version_let " $OVS_VERSION " " 2.13.0" ; then
49- curl https://github.com/openvswitch/ovs/commit/1740aaf49dad6f533705dc3dce8d955a1840052a.patch | \
50- git apply
56+ apply_patch " 1740aaf49dad6f533705dc3dce8d955a1840052a"
5157fi
5258
5359if version_get " $OVS_VERSION " " 2.13.0" && version_lt " $OVS_VERSION " " 2.14.0" ; then
5460 # These 2 patches (post 2.13.x) ensures that datapath flows are not deleted on
5561 # ovs-vswitchd exit by default. Antrea relies on this to support hitless upgrade
5662 # of the Agent DaemonSet.
5763 # The second patch depends on the first one.
58- curl https://github.com/openvswitch/ovs/commit/586cd3101e7fda54d14fb5bf12d847f35d968627.patch | \
59- git apply
64+ apply_patch " 586cd3101e7fda54d14fb5bf12d847f35d968627"
6065 # We exclude 2 files which are likely to cause conflicts.
61- curl https://github.com/openvswitch/ovs/commit/79eadafeb1b47a3871cb792aa972f6e4d89d1a0b.patch | \
62- git apply --exclude NEWS --exclude vswitchd/ovs-vswitchd.8.in
66+ apply_patch " 586cd3101e7fda54d14fb5bf12d847f35d968627" " --exclude NEWS" " --exclude vswitchd/ovs-vswitchd.8.in"
6367
6468 # This patch (post 2.13.x) ensures that ovs-vswitchd does not delete datapath
6569 # ports on exit.
66- curl https://github.com/openvswitch/ovs/commit/7cc77b301f80a63cd4893198d82be0eef303f731.patch | \
67- git apply
70+ apply_patch " 7cc77b301f80a63cd4893198d82be0eef303f731"
6871
6972 # These patches (post 2.13.x) are needed to fix the debian build on Ubuntu 20.04.
70- curl https://github.com/openvswitch/ovs/commit/c101cd4171cfe04e214f858b4bbe089e56f13f9b.patch | \
71- git apply
72- curl https://github.com/openvswitch/ovs/commit/3c18bb0fe9f23308061217f72e2245f0e311b20b.patch | \
73- git apply
74- curl https://github.com/openvswitch/ovs/commit/fe175ac17352ceb2dbc9958112b4b1bc114d82f0.patch | \
75- git apply
73+ apply_patch " c101cd4171cfe04e214f858b4bbe089e56f13f9b"
74+ apply_patch " 3c18bb0fe9f23308061217f72e2245f0e311b20b"
75+ apply_patch " fe175ac17352ceb2dbc9958112b4b1bc114d82f0"
7676
7777 # The OVS ovs-monitor-ipsec script has a Python3 shebang but still includes some Python2-specific code.
7878 # Until the patch which fixes the script is merged upstream, we apply it here, or Antrea IPsec support will be broken.
79- curl https://github.com/openvswitch/ovs/commit/8a09c2590ef2ea0edc250ec46e3d41bd5874b4ab.patch | \
80- git apply
79+ apply_patch " 8a09c2590ef2ea0edc250ec46e3d41bd5874b4ab"
8180fi
8281
8382# Starting from version 5.7.0, strongSwan no longer supports specifying a configuration parameter
8483# with the path delimited by dots in a configuration file. This patch fixes the strongSwan
8584# configuration parameters that ovs-monitor-ipsec writes, to comply with the new strongSwan format.
8685if version_lt " $OVS_VERSION " " 2.14.1" ; then
87- curl https://github.com/openvswitch/ovs/commit/b424becaac58d8cb08fb19ea839be6807d3ed57f.patch | \
88- git apply
86+ apply_patch " b424becaac58d8cb08fb19ea839be6807d3ed57f"
8987fi
9088
9189# This patch is necessary to ensure that ovs-monitor-ipsec generates a correct IPsec configuration
9290# for strongSwan when using IPv6.
93- curl https://github.com/openvswitch/ovs/commit/e59194b606078d90b73f86092f9b76385afa73f0.patch | \
94- git apply
91+ if version_lt " $OVS_VERSION " " 2.15.4" || (version_get " $OVS_VERSION " " 2.16.0" && version_lt " $OVS_VERSION " " 2.16.3" ) ; then
92+ apply_patch " e59194b606078d90b73f86092f9b76385afa73f0"
93+ fi
94+
95+ # This patch fixes a log file leak in OVS.
96+ # See https://github.com/antrea-io/antrea/issues/2003
97+ # It is fixed in the OVS master branch and will be included starting with OVS 2.18.
98+ if version_lt " $OVS_VERSION " " 2.18.0" ; then
99+ apply_patch " 78ff3961ca9fb012eaaca3d3af1e8186fe1827e7"
100+ fi
95101
96102# OVS hardcodes the installation path to /usr/lib/python3.7/dist-packages/ but this location
97103# does not seem to be in the Python path in Ubuntu 20.04. There may be a better way to do this,
0 commit comments