From: Roy Marples Date: Sun, 4 Nov 2018 13:01:15 +0000 (+0000) Subject: Linux: Use NETLINK_BROADCAST_ERROR X-Git-Tag: v7.1.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1e95fbbdc8b2f0b795c7750c7f477223113621b;p=thirdparty%2Fdhcpcd.git Linux: Use NETLINK_BROADCAST_ERROR This should allow dhcpcd to detect overflow on netlink, just like NetBSD and OpenBSD. --- diff --git a/src/if-linux.c b/src/if-linux.c index abd4cd52..b5f7983d 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -294,6 +294,9 @@ if_opensockets_os(struct dhcpcd_ctx *ctx) struct priv *priv; struct sockaddr_nl snl; socklen_t len; +#ifdef NETLINK_BROADCAST_ERROR + int on = 1; +#endif /* Open the link socket first so it gets pid() for the socket. * Then open our persistent route socket so we get a unique @@ -311,6 +314,10 @@ if_opensockets_os(struct dhcpcd_ctx *ctx) ctx->link_fd = _open_link_socket(&snl, NETLINK_ROUTE); if (ctx->link_fd == -1) return -1; +#ifdef NETLINK_BROADCAST_ERROR + setsockopt(ctx->link_fd, SOL_NETLINK, NETLINK_BROADCAST_ERROR, + &on, sizeof(on)); +#endif if ((priv = calloc(1, sizeof(*priv))) == NULL) return -1;