summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2022-09-24 14:40:35 +0800
committerKhem Raj <raj.khem@gmail.com>2022-09-29 13:32:15 -0700
commitf6846875916e6e1c6db825685cf4dfa2e9a24749 (patch)
tree3e94e85d18f3d42668a4665525bd232fdf564c2b /meta-networking/recipes-protocols
parentcdc175009d163509543d26867f8b0b1052471cb2 (diff)
downloadmeta-openembedded-f6846875916e6e1c6db825685cf4dfa2e9a24749.tar.gz
frr: upgrade 8.2.2 -> 8.3.1
Backport patches to fix build error with --disable-ospfapi and CVE-2022-37035. Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
-rw-r--r--meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch151
-rw-r--r--meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch4
-rw-r--r--meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch48
-rw-r--r--meta-networking/recipes-protocols/frr/frr_8.3.1.bb (renamed from meta-networking/recipes-protocols/frr/frr_8.2.2.bb)6
4 files changed, 206 insertions, 3 deletions
diff --git a/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch b/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch
new file mode 100644
index 000000000..40284d6f4
--- /dev/null
+++ b/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch
@@ -0,0 +1,151 @@
1From 71ca5b09bc71e8cbe38177cf41e83fe164e52eee Mon Sep 17 00:00:00 2001
2From: Mark Stapp <mstapp@nvidia.com>
3Date: Thu, 8 Sep 2022 16:14:36 -0400
4Subject: [PATCH] bgpd: avoid notify race between io and main pthreads
5
6The "bgp_notify_" apis in bgp_packet.c generate a notification
7to a peer, usually during error handling. The io pthread wants
8to send notifications in a couple of cases during early
9received-packet validation - but the existing api interacts
10with the peer struct itself, and that's not safe.
11
12Add a new api for use by the io pthread, and adjust the main
13notify api so that it can avoid touching the peer struct.
14
15Signed-off-by: Mark Stapp <mstapp@nvidia.com>
16
17CVE: CVE-2022-37035
18
19Upstream-Status: Backport
20[https://github.com/FRRouting/frr/commit/71ca5b09bc71e8cbe38177cf41e83fe164e52eee]
21
22Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
23---
24 bgpd/bgp_io.c | 17 ++++++++---------
25 bgpd/bgp_packet.c | 32 ++++++++++++++++++++++++++++----
26 bgpd/bgp_packet.h | 2 ++
27 3 files changed, 38 insertions(+), 13 deletions(-)
28
29diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
30index 7af1fae28..f9bb8d518 100644
31--- a/bgpd/bgp_io.c
32+++ b/bgpd/bgp_io.c
33@@ -37,7 +37,7 @@
34 #include "bgpd/bgp_debug.h" // for bgp_debug_neighbor_events, bgp_type_str
35 #include "bgpd/bgp_errors.h" // for expanded error reference information
36 #include "bgpd/bgp_fsm.h" // for BGP_EVENT_ADD, bgp_event
37-#include "bgpd/bgp_packet.h" // for bgp_notify_send_with_data, bgp_notify...
38+#include "bgpd/bgp_packet.h" // for bgp_notify_io_invalid...
39 #include "bgpd/bgp_trace.h" // for frrtraces
40 #include "bgpd/bgpd.h" // for peer, BGP_MARKER_SIZE, bgp_master, bm
41 /* clang-format on */
42@@ -526,8 +526,8 @@ static bool validate_header(struct peer *peer)
43 return false;
44
45 if (memcmp(m_correct, m_rx, BGP_MARKER_SIZE) != 0) {
46- bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
47- BGP_NOTIFY_HEADER_NOT_SYNC);
48+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR,
49+ BGP_NOTIFY_HEADER_NOT_SYNC, NULL, 0);
50 return false;
51 }
52
53@@ -547,9 +547,8 @@ static bool validate_header(struct peer *peer)
54 zlog_debug("%s unknown message type 0x%02x", peer->host,
55 type);
56
57- bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR,
58- BGP_NOTIFY_HEADER_BAD_MESTYPE, &type,
59- 1);
60+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR,
61+ BGP_NOTIFY_HEADER_BAD_MESTYPE, &type, 1);
62 return false;
63 }
64
65@@ -574,9 +573,9 @@ static bool validate_header(struct peer *peer)
66
67 uint16_t nsize = htons(size);
68
69- bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR,
70- BGP_NOTIFY_HEADER_BAD_MESLEN,
71- (unsigned char *)&nsize, 2);
72+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR,
73+ BGP_NOTIFY_HEADER_BAD_MESLEN,
74+ (unsigned char *)&nsize, 2);
75 return false;
76 }
77
78diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
79index 7daac4494..90695219a 100644
80--- a/bgpd/bgp_packet.c
81+++ b/bgpd/bgp_packet.c
82@@ -871,8 +871,9 @@ bool bgp_notify_received_hard_reset(struct peer *peer, uint8_t code,
83 * @param data Data portion
84 * @param datalen length of data portion
85 */
86-void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
87- uint8_t sub_code, uint8_t *data, size_t datalen)
88+static void bgp_notify_send_internal(struct peer *peer, uint8_t code,
89+ uint8_t sub_code, uint8_t *data,
90+ size_t datalen, bool use_curr)
91 {
92 struct stream *s;
93 bool hard_reset = bgp_notify_send_hard_reset(peer, code, sub_code);
94@@ -917,8 +918,11 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
95 * If possible, store last packet for debugging purposes. This check is
96 * in place because we are sometimes called with a doppelganger peer,
97 * who tends to have a plethora of fields nulled out.
98+ *
99+ * Some callers should not attempt this - the io pthread for example
100+ * should not touch internals of the peer struct.
101 */
102- if (peer->curr) {
103+ if (use_curr && peer->curr) {
104 size_t packetsize = stream_get_endp(peer->curr);
105 assert(packetsize <= peer->max_packet_size);
106 memcpy(peer->last_reset_cause, peer->curr->data, packetsize);
107@@ -1001,7 +1005,27 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
108 */
109 void bgp_notify_send(struct peer *peer, uint8_t code, uint8_t sub_code)
110 {
111- bgp_notify_send_with_data(peer, code, sub_code, NULL, 0);
112+ bgp_notify_send_internal(peer, code, sub_code, NULL, 0, true);
113+}
114+
115+/*
116+ * Enqueue notification; called from the main pthread, peer object access is ok.
117+ */
118+void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
119+ uint8_t sub_code, uint8_t *data, size_t datalen)
120+{
121+ bgp_notify_send_internal(peer, code, sub_code, data, datalen, true);
122+}
123+
124+/*
125+ * For use by the io pthread, queueing a notification but avoiding access to
126+ * the peer object.
127+ */
128+void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code,
129+ uint8_t *data, size_t datalen)
130+{
131+ /* Avoid touching the peer object */
132+ bgp_notify_send_internal(peer, code, sub_code, data, datalen, false);
133 }
134
135 /*
136diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h
137index a0eb579db..9f6d772bc 100644
138--- a/bgpd/bgp_packet.h
139+++ b/bgpd/bgp_packet.h
140@@ -62,6 +62,8 @@ extern void bgp_open_send(struct peer *);
141 extern void bgp_notify_send(struct peer *, uint8_t, uint8_t);
142 extern void bgp_notify_send_with_data(struct peer *, uint8_t, uint8_t,
143 uint8_t *, size_t);
144+void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code,
145+ uint8_t *data, size_t datalen);
146 extern void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
147 uint8_t orf_type, uint8_t when_to_refresh,
148 int remove, uint8_t subtype);
149--
1502.25.1
151
diff --git a/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch b/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch
index 4b218a61e..20e847223 100644
--- a/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch
+++ b/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch
@@ -6,7 +6,9 @@ Subject: [PATCH] configure: Check for readline() function instead of main
6main is not a function found in libreadline, its better to check for a 6main is not a function found in libreadline, its better to check for a
7function thats provided by it. 7function thats provided by it.
8 8
9Upstream-Status: Submitted [https://github.com/FRRouting/frr/pull/11893] 9Upstream-Status: Backport
10[https://github.com/FRRouting/frr/commit/9399d58c13257849179d3c2b3698a2b43bc1b2a0]
11
10Signed-off-by: Khem Raj <raj.khem@gmail.com> 12Signed-off-by: Khem Raj <raj.khem@gmail.com>
11--- 13---
12 configure.ac | 2 +- 14 configure.ac | 2 +-
diff --git a/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch b/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch
new file mode 100644
index 000000000..09988946b
--- /dev/null
+++ b/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch
@@ -0,0 +1,48 @@
1From ec3bb054c331f9d928ac21a1747e0f921b51dfbc Mon Sep 17 00:00:00 2001
2From: Michal Ruprich <michalruprich@gmail.com>
3Date: Tue, 6 Sep 2022 12:25:01 +0200
4Subject: [PATCH] ospfd: Adding SUPPORT_OSPF_API define in ospf_spf.c
5
6It is not possible to build ospf_spf.c file with --disable-ospfapi because
7ospf_apiserver.c has SUPPORT_OSPF_API around all function definitions and
8that results in an undefined reference to the ospf_apiserver_notify_reachable
9function error while building.
10
11Signed-off-by: Michal Ruprich <mruprich@redhat.com>
12
13Upstream-Status: Backport
14[https://github.com/FRRouting/frr/commit/ec3bb054c331f9d928ac21a1747e0f921b51dfbc]
15
16Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
17---
18 ospfd/ospf_spf.c | 5 +++++
19 1 file changed, 5 insertions(+)
20
21diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
22index 46492ff6b..4edc1de81 100644
23--- a/ospfd/ospf_spf.c
24+++ b/ospfd/ospf_spf.c
25@@ -48,7 +48,10 @@
26 #include "ospfd/ospf_sr.h"
27 #include "ospfd/ospf_ti_lfa.h"
28 #include "ospfd/ospf_errors.h"
29+
30+#ifdef SUPPORT_OSPF_API
31 #include "ospfd/ospf_apiserver.h"
32+#endif
33
34 /* Variables to ensure a SPF scheduled log message is printed only once */
35
36@@ -1895,7 +1898,9 @@ static void ospf_spf_calculate_schedule_worker(struct thread *thread)
37 /* Update all routers routing table */
38 ospf->oall_rtrs = ospf->all_rtrs;
39 ospf->all_rtrs = all_rtrs;
40+#ifdef SUPPORT_OSPF_API
41 ospf_apiserver_notify_reachable(ospf->oall_rtrs, ospf->all_rtrs);
42+#endif
43
44 /* Free old ABR/ASBR routing table */
45 if (ospf->old_rtrs)
46--
472.25.1
48
diff --git a/meta-networking/recipes-protocols/frr/frr_8.2.2.bb b/meta-networking/recipes-protocols/frr/frr_8.3.1.bb
index 607ed8b9d..c69720e6f 100644
--- a/meta-networking/recipes-protocols/frr/frr_8.2.2.bb
+++ b/meta-networking/recipes-protocols/frr/frr_8.3.1.bb
@@ -9,12 +9,14 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
9LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 9LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
10 file://COPYING-LGPLv2.1;md5=4fbd65380cdd255951079008b364516c" 10 file://COPYING-LGPLv2.1;md5=4fbd65380cdd255951079008b364516c"
11 11
12SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.2 \ 12SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.3 \
13 file://0001-configure-Check-for-readline-function-instead-of-mai.patch \ 13 file://0001-configure-Check-for-readline-function-instead-of-mai.patch \
14 file://0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch \
15 file://0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch \
14 file://frr.pam \ 16 file://frr.pam \
15 " 17 "
16 18
17SRCREV = "79188bf710e92acf42fb5b9b0a2e9593a5ee9b05" 19SRCREV = "a74f7a9ad9623e6f9654fe4a7177e5da0b194828"
18 20
19S = "${WORKDIR}/git" 21S = "${WORKDIR}/git"
20 22