Package: keepalived
Version: 1:1.2.24-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu zesty ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* debian/patches/fix_message_truncation_with_large_pagesizes.patch:
Resolve "Netlink: error: message truncated" messages. Thanks to
David Wilder <[email protected]>. Closes LP: #1642763.
Thanks for considering the patch.
diff -Nru
keepalived-1.2.24/debian/patches/fix_message_truncation_with_large_pagesizes.patch
keepalived-1.2.24/debian/patches/fix_message_truncation_with_large_pagesizes.patch
---
keepalived-1.2.24/debian/patches/fix_message_truncation_with_large_pagesizes.patch
1969-12-31 16:00:00.000000000 -0800
+++
keepalived-1.2.24/debian/patches/fix_message_truncation_with_large_pagesizes.patch
2016-11-29 09:45:12.000000000 -0800
@@ -0,0 +1,71 @@
+Description: Resolve "Netlink: error: message truncated" messages
+Author: David Wilder <[email protected]>
+Origin: upstream,
https://github.com/acassen/keepalived/commit/9f327bbf3e86def1055a106eda0633638bda0345
+Bug-Ubuntu: https://launchpad.net/bugs/1642763
+Forwarded: not-needed
+Last-Update: 2016-11-29
+
+--- keepalived-1.2.24.orig/keepalived/core/main.c
++++ keepalived-1.2.24/keepalived/core/main.c
+@@ -39,6 +39,7 @@
+ #if HAVE_DECL_CLONE_NEWNET
+ #include "namespaces.h"
+ #endif
++#include "vrrp_netlink.h"
+
+ #define LOG_FACILITY_MAX 7
+ #define VERSION_STRING PACKAGE_NAME " v" PACKAGE_VERSION " ("
VERSION_DATE ")"
+@@ -735,6 +736,8 @@ keepalived_main(int argc, char **argv)
+ /* Handle any core file requirements */
+ core_dump_init();
+
++ netlink_set_recv_buf_size();
++
+ /* Check we can read the configuration file(s).
+ NOTE: the working directory will be / if we
+ forked, but will be the current working directory
+--- keepalived-1.2.24.orig/keepalived/include/vrrp_netlink.h
++++ keepalived-1.2.24/keepalived/include/vrrp_netlink.h
+@@ -68,6 +68,7 @@ extern nl_handle_t nl_cmd; /* Command ch
+ extern int netlink_error_ignore; /* If we get this error, ignore it */
+
+ /* prototypes */
++extern void netlink_set_recv_buf_size(void);
+ extern int addattr_l(struct nlmsghdr *, size_t, int, void *, size_t);
+ extern int addattr8(struct nlmsghdr *, size_t, int, uint8_t);
+ extern int addattr32(struct nlmsghdr *, size_t, int, uint32_t);
+--- keepalived-1.2.24.orig/keepalived/vrrp/vrrp_netlink.c
++++ keepalived-1.2.24/keepalived/vrrp/vrrp_netlink.c
+@@ -58,6 +58,23 @@ int netlink_error_ignore; /* If we get t
+
+ /* Static vars */
+ static nl_handle_t nl_kernel; /* Kernel reflection channel */
++static size_t nlmsg_buf_size; /* Size of netlink message buffer */
++
++void
++netlink_set_recv_buf_size(void)
++{
++ /* The size of the read buffer for the NL socket is based on page
++ * size however, it should not exceed 8192. See the comment in:
++ * linux/include/linux/netlink.h (copied below):
++ * skb should fit one page. This choice is good for headerless malloc
++ * But we should limit to 8K so that userspace does not have to
++ * use enormous buffer sizes on recvmsg() calls just to avoid
++ * MSG_TRUNC when PAGE_SIZE is very large.
++ */
++ nlmsg_buf_size = getpagesize();
++ if (nlmsg_buf_size > 8192)
++ nlmsg_buf_size = 8192;
++}
+
+ /* Create a socket to netlink interface_t */
+ static int
+@@ -513,7 +530,7 @@ netlink_parse_info(int (*filter) (struct
+ int error;
+
+ while (1) {
+- char buf[4096];
++ char buf[nlmsg_buf_size];
+ struct iovec iov = {
+ .iov_base = buf,
+ .iov_len = sizeof buf
diff -Nru keepalived-1.2.24/debian/patches/series
keepalived-1.2.24/debian/patches/series
--- keepalived-1.2.24/debian/patches/series 2015-08-15 06:01:53.000000000
-0700
+++ keepalived-1.2.24/debian/patches/series 2016-11-29 09:45:12.000000000
-0800
@@ -0,0 +1 @@
+fix_message_truncation_with_large_pagesizes.patch
-- System Information:
Debian Release: stretch/sid
APT prefers yakkety-updates
APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500,
'yakkety'), (400, 'yakkety-proposed'), (100, 'yakkety-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.8.0-27-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd