1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00

net/frr8: Update to 8.3

This commit is contained in:
Olivier Cochard 2022-07-21 23:35:04 +02:00
parent 0db9eb0bd4
commit 6482e542eb
4 changed files with 8 additions and 179 deletions

View File

@ -1,5 +1,5 @@
PORTNAME= frr
PORTVERSION= 8.2.2
PORTVERSION= 8.3
DISTVERSIONPREFIX= frr-
CATEGORIES= net
.if defined(PYTHONTOOLS)

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1648249835
SHA256 (FRRouting-frr-frr-8.2.2_GH0.tar.gz) = 33e974e2a622618e139983f65d93e92e7f1a735936ef18b18244403b15be002f
SIZE (FRRouting-frr-frr-8.2.2_GH0.tar.gz) = 9439460
TIMESTAMP = 1658433791
SHA256 (FRRouting-frr-frr-8.3_GH0.tar.gz) = bfc625936c72e64397acfa9182b1977a86b41ff4b3be96b41a59a6cb1621f4a6
SIZE (FRRouting-frr-frr-8.3_GH0.tar.gz) = 9676363

View File

@ -1,175 +0,0 @@
From 5362aa8ce565554973b282e47084e8b3cacabadb Mon Sep 17 00:00:00 2001
From: Bijan <bijanebrahimi@riseup.net>
Date: Tue, 1 Feb 2022 11:03:00 +0330
Subject: [PATCH 1/2] zebra: Keep the interface flags safe on multiple ioctl
calls
Trying to call multiple ioctl calls on ifreq will result in
overwriting ifreq with garbage data. On if_get_flags call,
try to keep the flags field safe from another possible ioctl
call before applying the flags field.
Modified code as per Code Review, done by Donald Sharp.
Signed-off-by: Bijan <bijanebrahimi@riseup.net>
(cherry picked from commit 16dca7cec5f47b7a6f83822a1e681652b7d2d60d)
---
zebra/ioctl.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git zebra/ioctl.c zebra/ioctl.c
index 8b30eea9f11..9b6aaf1d85a 100644
--- zebra/ioctl.c
+++ zebra/ioctl.c
@@ -410,11 +410,14 @@ int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
void if_get_flags(struct interface *ifp)
{
int ret;
- struct ifreq ifreq;
+ struct ifreq ifreqflags;
+ struct ifreq ifreqdata;
- ifreq_set_name(&ifreq, ifp);
+ ifreq_set_name(&ifreqflags, ifp);
+ ifreq_set_name(&ifreqdata, ifp);
- ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf->vrf_id);
+ ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreqflags,
+ ifp->vrf->vrf_id);
if (ret < 0) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"vrf_if_ioctl(SIOCGIFFLAGS %s) failed: %s",
@@ -448,8 +451,8 @@ void if_get_flags(struct interface *ifp)
struct if_data ifd = {.ifi_link_state = 0};
struct if_data *ifdata = &ifd;
- ifreq.ifr_data = (caddr_t)ifdata;
- ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifreq, ifp->vrf->vrf_id);
+ ifreqdata.ifr_data = (caddr_t)ifdata;
+ ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifreqdata, ifp->vrf->vrf_id);
#endif
if (ret == -1)
@@ -459,12 +462,12 @@ void if_get_flags(struct interface *ifp)
safe_strerror(errno));
else {
if (ifdata->ifi_link_state >= LINK_STATE_UP)
- SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ SET_FLAG(ifreqflags.ifr_flags, IFF_RUNNING);
else if (ifdata->ifi_link_state == LINK_STATE_UNKNOWN)
/* BSD traditionally treats UNKNOWN as UP */
- SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ SET_FLAG(ifreqflags.ifr_flags, IFF_RUNNING);
else
- UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ UNSET_FLAG(ifreqflags.ifr_flags, IFF_RUNNING);
}
#elif defined(HAVE_BSD_LINK_DETECT)
@@ -489,14 +492,14 @@ void if_get_flags(struct interface *ifp)
ifp->name, safe_strerror(errno));
} else if (ifmr.ifm_status & IFM_AVALID) { /* media state is valid */
if (ifmr.ifm_status & IFM_ACTIVE) /* media is active */
- SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ SET_FLAG(ifreqflags.ifr_flags, IFF_RUNNING);
else
- UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ UNSET_FLAG(ifreqflags.ifr_flags, IFF_RUNNING);
}
#endif /* HAVE_BSD_LINK_DETECT */
out:
- if_flags_update(ifp, (ifreq.ifr_flags & 0x0000ffff));
+ if_flags_update(ifp, (ifreqflags.ifr_flags & 0x0000ffff));
}
/* Set interface flags */
From f26e0528634a8ad8e401ba8d9f708335a9349be1 Mon Sep 17 00:00:00 2001
From: Donald Sharp <sharpd@nvidia.com>
Date: Thu, 24 Mar 2022 12:57:01 -0400
Subject: [PATCH 2/2] zebra: Don't send uninited data to kernel on FreeBSD
When running zebra w/ valgrind, it was noticed that there
was a bunch of passing uninitialized data to the kernel:
==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194== at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194== by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194== by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194== by 0x2AFF39: if_get_mtu (ioctl.c:161)
==38194== by 0x2B12C3: ifm_read (kernel_socket.c:653)
==38194== by 0x2A7F76: interface_list (if_sysctl.c:129)
==38194== by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194== by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194== by 0x2B3F82: main (main.c:401)
==38194== Address 0x7fc000967 is on thread 1's stack
==38194== in frame #3, created by if_get_mtu (ioctl.c:155)
==38194==
==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194== at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194== by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194== by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194== by 0x2AFED9: if_get_metric (ioctl.c:143)
==38194== by 0x2B12CB: ifm_read (kernel_socket.c:655)
==38194== by 0x2A7F76: interface_list (if_sysctl.c:129)
==38194== by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194== by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194== by 0x2B3F82: main (main.c:401)
==38194== Address 0x7fc000967 is on thread 1's stack
==38194== in frame #3, created by if_get_metric (ioctl.c:137)
==38194==
==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194== at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194== by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194== by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194== by 0x2B052D: if_get_flags (ioctl.c:419)
==38194== by 0x2B1CF1: ifam_read (kernel_socket.c:930)
==38194== by 0x2A7F57: interface_list (if_sysctl.c:132)
==38194== by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194== by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194== by 0x2B3F82: main (main.c:401)
==38194== Address 0x7fc000707 is on thread 1's stack
==38194== in frame #3, created by if_get_flags (ioctl.c:411)
Valgrind is no longer reporting these issues.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit ceacdc721682cdc929835ff3adc1e0f824f83dcb)
---
zebra/ioctl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git zebra/ioctl.c zebra/ioctl.c
index 9b6aaf1d85a..a895ed94100 100644
--- zebra/ioctl.c
+++ zebra/ioctl.c
@@ -136,7 +136,7 @@ static int if_ioctl_ipv6(unsigned long request, caddr_t buffer)
void if_get_metric(struct interface *ifp)
{
#ifdef SIOCGIFMETRIC
- struct ifreq ifreq;
+ struct ifreq ifreq = {};
ifreq_set_name(&ifreq, ifp);
@@ -153,7 +153,7 @@ void if_get_metric(struct interface *ifp)
/* get interface MTU */
void if_get_mtu(struct interface *ifp)
{
- struct ifreq ifreq;
+ struct ifreq ifreq = {};
ifreq_set_name(&ifreq, ifp);
@@ -410,8 +410,8 @@ int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
void if_get_flags(struct interface *ifp)
{
int ret;
- struct ifreq ifreqflags;
- struct ifreq ifreqdata;
+ struct ifreq ifreqflags = {};
+ struct ifreq ifreqdata = {};
ifreq_set_name(&ifreqflags, ifp);
ifreq_set_name(&ifreqdata, ifp);

View File

@ -3,7 +3,9 @@
include/frr/agg_table.h
include/frr/atomlist.h
include/frr/assert.h
include/frr/base64.h
include/frr/bfdd/bfddp_packet.h
include/frr/cspf.h
include/frr/libfrr_trace.h
include/frr/link_state.h
include/frr/resolver.h
@ -12,6 +14,8 @@ include/frr/xref.h
include/frr/yang.h
include/frr/yang_translator.h
include/frr/yang_wrappers.h
include/frr/zlog_5424.h
include/frr/zlog_live.h
include/frr/bfd.h
include/frr/bitfield.h
include/frr/buffer.h