git: 115a4eea6e34 - main - net/frr10: Update to 10.2

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Wed, 04 Dec 2024 15:00:16 UTC
The branch main has been updated by olivier:

URL: https://cgit.FreeBSD.org/ports/commit/?id=115a4eea6e34d97ada6b4bf255aa67dde9dfcbd7

commit 115a4eea6e34d97ada6b4bf255aa67dde9dfcbd7
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2024-12-04 14:56:06 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2024-12-04 14:59:54 +0000

    net/frr10: Update to 10.2
    
    ChangeLog:      https://github.com/FRRouting/frr/releases/tag/frr-10.2
    PR:             282958
    Reported by:    portscout, pi
    Sponsored by:   Netflix
---
 net/frr10/Makefile                  |  3 +--
 net/frr10/distinfo                  |  6 ++---
 net/frr10/files/patch-Makefile.am   | 10 +++----
 net/frr10/files/patch-lib_event.c   | 14 ----------
 net/frr10/files/patch-lib_libfrr.c  | 14 ----------
 net/frr10/files/patch-lib_libfrr.h  | 11 --------
 net/frr10/files/patch-lib_sockopt.c | 33 +++++++++++++++++++++++
 net/frr10/files/patch-lib_sockopt.h | 13 ++++++++++
 net/frr10/files/patch-lib_vty.c     | 52 +++++++++++++++++++++++++++++++++++++
 net/frr10/files/patch-lib_vty.h     | 12 +++++++++
 net/frr10/files/patch-vtysh_vtysh.c | 22 ++++++++++++++++
 net/frr10/pkg-plist                 |  2 +-
 12 files changed, 142 insertions(+), 50 deletions(-)

diff --git a/net/frr10/Makefile b/net/frr10/Makefile
index e6282111df78..3b564c48739b 100644
--- a/net/frr10/Makefile
+++ b/net/frr10/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	frr
 DISTVERSIONPREFIX=	frr-
-DISTVERSION=	10.1.1
-PORTREVISION=	1
+DISTVERSION=	10.2
 CATEGORIES=	net
 .if defined(PYTHONTOOLS)
 PKGNAMESUFFIX=	10-pythontools
diff --git a/net/frr10/distinfo b/net/frr10/distinfo
index d65c514ef47f..3dbe8cf4ce78 100644
--- a/net/frr10/distinfo
+++ b/net/frr10/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1727640851
-SHA256 (FRRouting-frr-frr-10.1.1_GH0.tar.gz) = 76004c312de3348b6164f6ae15db4c0cf0f504945f8c69aed871c0b4dcedfa29
-SIZE (FRRouting-frr-frr-10.1.1_GH0.tar.gz) = 11044980
+TIMESTAMP = 1732620979
+SHA256 (FRRouting-frr-frr-10.2_GH0.tar.gz) = f9212701a8bba9ce32b4f2d361149db7778bb7bdc053bfb27415ec1948d83a47
+SIZE (FRRouting-frr-frr-10.2_GH0.tar.gz) = 11173035
diff --git a/net/frr10/files/patch-Makefile.am b/net/frr10/files/patch-Makefile.am
index 626f17a2d784..7941b6a84ce7 100644
--- a/net/frr10/files/patch-Makefile.am
+++ b/net/frr10/files/patch-Makefile.am
@@ -1,11 +1,11 @@
---- Makefile.am.orig	2021-11-08 12:44:24.000000000 +0900
-+++ Makefile.am	2021-12-23 09:23:13.400659000 +0900
-@@ -168,7 +168,7 @@
+--- Makefile.am.orig	2024-11-12 16:20:46 UTC
++++ Makefile.am
+@@ -182,7 +182,7 @@ include grpc/subdir.am
  include qpb/subdir.am
  include fpm/subdir.am
  include grpc/subdir.am
 -include tools/subdir.am
 +# include tools/subdir.am
  
- include bgpd/subdir.am
- include bgpd/rfp-example/librfp/subdir.am
+ include mgmtd/subdir.am
+ 
diff --git a/net/frr10/files/patch-lib_event.c b/net/frr10/files/patch-lib_event.c
deleted file mode 100644
index 96acbf3265ce..000000000000
--- a/net/frr10/files/patch-lib_event.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- lib/event.c.orig	2024-09-12 07:46:05 UTC
-+++ lib/event.c
-@@ -571,8 +571,9 @@ struct event_loop *event_master_create(const char *nam
- 	}
- 
- 	if (rv->fd_limit > STUPIDLY_LARGE_FD_SIZE) {
--		zlog_warn("FD Limit set: %u is stupidly large.  Is this what you intended?  Consider using --limit-fds also limiting size to %u",
--			  rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
-+		if (frr_is_daemon())
-+			zlog_warn("FD Limit set: %u is stupidly large.  Is this what you intended?  Consider using --limit-fds also limiting size to %u",
-+				  rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
- 
- 		rv->fd_limit = STUPIDLY_LARGE_FD_SIZE;
- 	}
diff --git a/net/frr10/files/patch-lib_libfrr.c b/net/frr10/files/patch-lib_libfrr.c
deleted file mode 100644
index ece5de3d82e5..000000000000
--- a/net/frr10/files/patch-lib_libfrr.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- lib/libfrr.c.orig	2024-09-12 07:46:05 UTC
-+++ lib/libfrr.c
-@@ -1463,3 +1463,11 @@ const char *frr_vers2str(uint32_t version, char *buf, 
- 
- 	return buf;
- }
-+
-+bool frr_is_daemon(void)
-+{
-+	if (di)
-+		return true;
-+
-+	return false;
-+}
diff --git a/net/frr10/files/patch-lib_libfrr.h b/net/frr10/files/patch-lib_libfrr.h
deleted file mode 100644
index fdc368a90369..000000000000
--- a/net/frr10/files/patch-lib_libfrr.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/libfrr.h.orig	2024-09-12 07:46:05 UTC
-+++ lib/libfrr.h
-@@ -188,7 +188,7 @@ extern bool frr_is_startup_fd(int fd);
- extern enum frr_cli_mode frr_get_cli_mode(void);
- extern uint32_t frr_get_fd_limit(void);
- extern bool frr_is_startup_fd(int fd);
--
-+extern bool frr_is_daemon(void);
- /* call order of these hooks is as ordered here */
- DECLARE_HOOK(frr_early_init, (struct event_loop * tm), (tm));
- DECLARE_HOOK(frr_late_init, (struct event_loop * tm), (tm));
diff --git a/net/frr10/files/patch-lib_sockopt.c b/net/frr10/files/patch-lib_sockopt.c
new file mode 100644
index 000000000000..8c996de059ef
--- /dev/null
+++ b/net/frr10/files/patch-lib_sockopt.c
@@ -0,0 +1,33 @@
+--- lib/sockopt.c.orig	2024-11-12 16:20:46 UTC
++++ lib/sockopt.c
+@@ -19,7 +19,7 @@
+ #define HAVE_BSD_STRUCT_IP_MREQ_HACK
+ #endif
+ 
+-void setsockopt_so_recvbuf(int sock, int size)
++int setsockopt_so_recvbuf(int sock, int size)
+ {
+ 	int orig_req = size;
+ 
+@@ -34,9 +34,11 @@ void setsockopt_so_recvbuf(int sock, int size)
+ 		flog_err(EC_LIB_SOCKET,
+ 			 "%s: fd %d: SO_RCVBUF set to %d (requested %d)",
+ 			 __func__, sock, size, orig_req);
++
++	return size;
+ }
+ 
+-void setsockopt_so_sendbuf(const int sock, int size)
++int setsockopt_so_sendbuf(const int sock, int size)
+ {
+ 	int orig_req = size;
+ 
+@@ -51,6 +53,8 @@ void setsockopt_so_sendbuf(const int sock, int size)
+ 		flog_err(EC_LIB_SOCKET,
+ 			 "%s: fd %d: SO_SNDBUF set to %d (requested %d)",
+ 			 __func__, sock, size, orig_req);
++
++	return size;
+ }
+ 
+ int getsockopt_so_sendbuf(const int sock)
diff --git a/net/frr10/files/patch-lib_sockopt.h b/net/frr10/files/patch-lib_sockopt.h
new file mode 100644
index 000000000000..7d6b615fe700
--- /dev/null
+++ b/net/frr10/files/patch-lib_sockopt.h
@@ -0,0 +1,13 @@
+--- lib/sockopt.h.orig	2024-11-12 16:20:46 UTC
++++ lib/sockopt.h
+@@ -12,8 +12,8 @@ extern "C" {
+ extern "C" {
+ #endif
+ 
+-extern void setsockopt_so_recvbuf(int sock, int size);
+-extern void setsockopt_so_sendbuf(const int sock, int size);
++extern int setsockopt_so_recvbuf(int sock, int size);
++extern int setsockopt_so_sendbuf(const int sock, int size);
+ extern int getsockopt_so_sendbuf(const int sock);
+ extern int getsockopt_so_recvbuf(const int sock);
+ 
diff --git a/net/frr10/files/patch-lib_vty.c b/net/frr10/files/patch-lib_vty.c
new file mode 100644
index 000000000000..45af30dcecf5
--- /dev/null
+++ b/net/frr10/files/patch-lib_vty.c
@@ -0,0 +1,52 @@
+--- lib/vty.c.orig	2024-11-12 16:20:46 UTC
++++ lib/vty.c
+@@ -43,6 +43,7 @@
+ #include "northbound_cli.h"
+ #include "printfrr.h"
+ #include "json.h"
++#include "sockopt.h"
+ 
+ #include <arpa/telnet.h>
+ #include <termios.h>
+@@ -352,7 +353,7 @@ int vty_out(struct vty *vty, const char *format, ...)
+ 		 * put the data of collective vty->obuf Linked List items on the
+ 		 * socket and free the vty->obuf data.
+ 		 */
+-		if (vty->vty_buf_size_accumulated >= VTY_MAX_INTERMEDIATE_FLUSH) {
++		if (vty->vty_buf_size_accumulated >= vty->buf_size_intermediate) {
+ 			vty->vty_buf_size_accumulated = 0;
+ 			vtysh_flush(vty);
+ 		}
+@@ -2157,15 +2158,15 @@ static void vtysh_accept(struct event *thread)
+ 	 * Increasing the SEND socket buffer size so that the socket can hold
+ 	 * before sending it to VTY shell.
+ 	 */
+-	ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&sndbufsize,
+-			 sizeof(sndbufsize));
+-	if (ret < 0) {
++	ret = setsockopt_so_sendbuf(sock, sndbufsize);
++	if (ret <= 0) {
+ 		flog_err(EC_LIB_SOCKET,
+ 			 "Cannot set socket %d send buffer size, %s", sock,
+ 			 safe_strerror(errno));
+ 		close(sock);
+ 		return;
+ 	}
++
+ 	set_cloexec(sock);
+ 
+ #ifdef VTYSH_DEBUG
+@@ -2173,6 +2174,13 @@ static void vtysh_accept(struct event *thread)
+ #endif /* VTYSH_DEBUG */
+ 
+ 	vty = vty_new();
++
++	vty->buf_size_set = ret;
++	if (vty->buf_size_set < VTY_MAX_INTERMEDIATE_FLUSH)
++		vty->buf_size_intermediate = vty->buf_size_set / 2;
++	else
++		vty->buf_size_intermediate = VTY_MAX_INTERMEDIATE_FLUSH;
++
+ 	vty->fd = sock;
+ 	vty->wfd = sock;
+ 	vty->type = VTY_SHELL_SERV;
diff --git a/net/frr10/files/patch-lib_vty.h b/net/frr10/files/patch-lib_vty.h
new file mode 100644
index 000000000000..397ea225cce1
--- /dev/null
+++ b/net/frr10/files/patch-lib_vty.h
@@ -0,0 +1,12 @@
+--- lib/vty.h.orig	2024-11-12 16:20:46 UTC
++++ lib/vty.h
+@@ -237,6 +237,9 @@ struct vty {
+ 	bool mgmt_locked_candidate_ds;
+ 	bool mgmt_locked_running_ds;
+ 	uint64_t vty_buf_size_accumulated;
++
++	int buf_size_set;
++	uint64_t buf_size_intermediate;
+ };
+ 
+ static inline void vty_push_context(struct vty *vty, int node, uint64_t id)
diff --git a/net/frr10/files/patch-vtysh_vtysh.c b/net/frr10/files/patch-vtysh_vtysh.c
new file mode 100644
index 000000000000..a6f09b5a5980
--- /dev/null
+++ b/net/frr10/files/patch-vtysh_vtysh.c
@@ -0,0 +1,22 @@
+--- vtysh/vtysh.c.orig	2024-11-12 16:20:46 UTC
++++ vtysh/vtysh.c
+@@ -39,6 +39,7 @@
+ #include "frrstr.h"
+ #include "json.h"
+ #include "ferr.h"
++#include "sockopt.h"
+ 
+ DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy");
+ 
+@@ -4694,9 +4695,8 @@ static int vtysh_connect(struct vtysh_client *vclient)
+ 	 * Increasing the RECEIVE socket buffer size so that the socket can hold
+ 	 * after receving from other process.
+ 	 */
+-	ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&rcvbufsize,
+-			 sizeof(rcvbufsize));
+-	if (ret < 0) {
++	ret = setsockopt_so_recvbuf(sock, rcvbufsize);
++	if (ret <= 0) {
+ #ifdef DEBUG
+ 		fprintf(stderr, "Cannot set socket %d rcv buffer size, %s\n",
+ 			sock, safe_strerror(errno));
diff --git a/net/frr10/pkg-plist b/net/frr10/pkg-plist
index b8d9fec72859..0a69c6bee67d 100644
--- a/net/frr10/pkg-plist
+++ b/net/frr10/pkg-plist
@@ -261,4 +261,4 @@ share/yang/ietf-netconf-acm.yang
 share/yang/ietf-netconf-with-defaults.yang
 share/yang/ietf-netconf.yang
 share/yang/ietf-routing-types.yang
-@dir(frr,frr,750) /var/run/frr
+@dir(frr,frr,755) /var/run/frr