git: 2d1887b68b12 - main - mail/cyrus-imapd3[24]: NOTIFY(EVENT): datagram too large when using notifyd.
Hajimu UMEMOTO
ume at FreeBSD.org
Sat Jun 19 08:48:19 UTC 2021
The branch main has been updated by ume:
URL: https://cgit.FreeBSD.org/ports/commit/?id=2d1887b68b126bf7cec16962f807ac266dc4c4df
commit 2d1887b68b126bf7cec16962f807ac266dc4c4df
Author: Hajimu UMEMOTO <ume at FreeBSD.org>
AuthorDate: 2021-06-19 08:39:13 +0000
Commit: Hajimu UMEMOTO <ume at FreeBSD.org>
CommitDate: 2021-06-19 08:48:06 +0000
mail/cyrus-imapd3[24]: NOTIFY(EVENT): datagram too large when using notifyd.
PR: 256478
Reported by: jsm
---
mail/cyrus-imapd32/Makefile | 2 +-
mail/cyrus-imapd32/files/patch-imap__notify.c | 45 +++++++++++++++++++++
mail/cyrus-imapd32/files/patch-notifyd__notifyd.c | 44 +++++++++++++++++++++
mail/cyrus-imapd34/Makefile | 2 +-
mail/cyrus-imapd34/files/patch-imap__notify.c | 48 +++++++++++++++++++++++
mail/cyrus-imapd34/files/patch-notifyd__notifyd.c | 44 +++++++++++++++++++++
6 files changed, 183 insertions(+), 2 deletions(-)
diff --git a/mail/cyrus-imapd32/Makefile b/mail/cyrus-imapd32/Makefile
index a5bce0236cfd..465c680cf5a0 100644
--- a/mail/cyrus-imapd32/Makefile
+++ b/mail/cyrus-imapd32/Makefile
@@ -1,6 +1,6 @@
PORTNAME= cyrus-imapd
PORTVERSION= 3.2.7
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= https://github.com/cyrusimap/cyrus-imapd/releases/download/${PORTNAME}-${PORTVERSION}/
PKGNAMESUFFIX= 32
diff --git a/mail/cyrus-imapd32/files/patch-imap__notify.c b/mail/cyrus-imapd32/files/patch-imap__notify.c
new file mode 100644
index 000000000000..17908c1c9f2f
--- /dev/null
+++ b/mail/cyrus-imapd32/files/patch-imap__notify.c
@@ -0,0 +1,45 @@
+--- imap/notify.c.orig 2021-05-10 04:16:13 UTC
++++ imap/notify.c
+@@ -49,6 +49,9 @@
+ #include <syslog.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -191,6 +194,24 @@ EXPORTED void notify(const char *method,
+ FNAME_NOTIFY_SOCK, sizeof(sun_data.sun_path));
+ }
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING,
++ "unable to setsockopt(SO_SNDBUF) on notify socket: %m");
++ }
++#else
+ /* Get send buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
+@@ -201,6 +222,7 @@ EXPORTED void notify(const char *method,
+
+ /* Use minimum of 1/10 of send buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ /*
+ * build request of the form:
diff --git a/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c b/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c
new file mode 100644
index 000000000000..0719b98c13f6
--- /dev/null
+++ b/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c
@@ -0,0 +1,44 @@
+--- notifyd/notifyd.c.orig 2021-05-05 03:21:59 UTC
++++ notifyd/notifyd.c
+@@ -50,6 +50,9 @@
+ #include <sysexits.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -111,6 +114,23 @@ static int do_notify(void)
+ unsigned bufsiz;
+ socklen_t optlen;
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING, "unable to setsockopt(SO_RCVBUF) on notify socket: %m");
++ }
++#else
+ /* Get receive buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, &optlen);
+@@ -121,6 +141,7 @@ static int do_notify(void)
+
+ /* Use minimum of 1/10 of receive buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ while (1) {
+ method = class = priority = user = mailbox = message = reply = NULL;
diff --git a/mail/cyrus-imapd34/Makefile b/mail/cyrus-imapd34/Makefile
index bd34281568e4..a8ccaa44d76a 100644
--- a/mail/cyrus-imapd34/Makefile
+++ b/mail/cyrus-imapd34/Makefile
@@ -1,6 +1,6 @@
PORTNAME= cyrus-imapd
PORTVERSION= 3.4.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= mail
MASTER_SITES= https://github.com/cyrusimap/cyrus-imapd/releases/download/${PORTNAME}-${PORTVERSION}/
PKGNAMESUFFIX= ${CYRUS_IMAPD_VER}
diff --git a/mail/cyrus-imapd34/files/patch-imap__notify.c b/mail/cyrus-imapd34/files/patch-imap__notify.c
new file mode 100644
index 000000000000..e093378fc10d
--- /dev/null
+++ b/mail/cyrus-imapd34/files/patch-imap__notify.c
@@ -0,0 +1,48 @@
+--- imap/notify.c.orig 2021-05-10 04:34:24 UTC
++++ imap/notify.c
+@@ -49,6 +49,9 @@
+ #include <syslog.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -209,6 +212,27 @@ EXPORTED void notify(const char *method,
+ FNAME_NOTIFY_SOCK, sizeof(sun_data.sun_path));
+ }
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to sysctlbyname(kern.ipc.maxsockbuf): %m",
++ loginfo);
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to setsockopt(SO_SNDBUF) on socket: %m",
++ loginfo);
++ }
++#else
+ /* Get send buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
+@@ -221,6 +245,7 @@ EXPORTED void notify(const char *method,
+
+ /* Use minimum of 1/10 of send buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ /*
+ * build request of the form:
diff --git a/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c b/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c
new file mode 100644
index 000000000000..0719b98c13f6
--- /dev/null
+++ b/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c
@@ -0,0 +1,44 @@
+--- notifyd/notifyd.c.orig 2021-05-05 03:21:59 UTC
++++ notifyd/notifyd.c
+@@ -50,6 +50,9 @@
+ #include <sysexits.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -111,6 +114,23 @@ static int do_notify(void)
+ unsigned bufsiz;
+ socklen_t optlen;
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING, "unable to setsockopt(SO_RCVBUF) on notify socket: %m");
++ }
++#else
+ /* Get receive buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, &optlen);
+@@ -121,6 +141,7 @@ static int do_notify(void)
+
+ /* Use minimum of 1/10 of receive buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ while (1) {
+ method = class = priority = user = mailbox = message = reply = NULL;
More information about the dev-commits-ports-all
mailing list