summaryrefslogtreecommitdiff
path: root/src/netlink.c
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2020-03-10 23:55:18 +0000
committerSimon Kelley <simon@thekelleys.org.uk>2020-03-10 23:55:18 +0000
commit1627d577af03cdf747285e79fa747b6aaae8033f (patch)
tree68c9853915d20ba708e57f36f6df27c93d5fef62 /src/netlink.c
parentb837c4528d5e6c9815ec5b610b5abe4822c3e548 (diff)
downloaddnsmasq-1627d577af03cdf747285e79fa747b6aaae8033f.tar.gz
Set NETLINK_NO_ENOBUFS in netlink socket, to avoid POLLERR returns.
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c
index d59bf62..a1ca5d1 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -22,6 +22,12 @@
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+/* Blergh. Radv does this, so that's our excuse. */
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+
+
/* linux 2.6.19 buggers up the headers, patch it up here. */
#ifndef IFA_RTA
# define IFA_RTA(r) \
@@ -44,6 +50,7 @@ void netlink_init(void)
{
struct sockaddr_nl addr;
socklen_t slen = sizeof(addr);
+ int opt = 1;
addr.nl_family = AF_NETLINK;
addr.nl_pad = 0;
@@ -72,6 +79,7 @@ void netlink_init(void)
}
if (daemon->netlinkfd == -1 ||
+ setsockopt(daemon->netlinkfd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &opt, sizeof(opt)) == -1 ||
getsockname(daemon->netlinkfd, (struct sockaddr *)&addr, &slen) == -1)
die(_("cannot create netlink socket: %s"), NULL, EC_MISC);