[arch-commits] Commit in dhcpcd/trunk (2 files)

Giancarlo Razzolini grazzolini at archlinux.org
Fri Jul 10 13:00:42 UTC 2020


    Date: Friday, July 10, 2020 @ 13:00:42
  Author: grazzolini
Revision: 391533

upgpkg: dhcpcd 9.1.4-1

Modified:
  dhcpcd/trunk/PKGBUILD
Deleted:
  dhcpcd/trunk/0001-generic_netlink_ssid_privsep.patch

-----------------------------------------+
 0001-generic_netlink_ssid_privsep.patch |  196 ------------------------------
 PKGBUILD                                |   15 --
 2 files changed, 6 insertions(+), 205 deletions(-)

Deleted: 0001-generic_netlink_ssid_privsep.patch
===================================================================
--- 0001-generic_netlink_ssid_privsep.patch	2020-07-10 11:28:41 UTC (rev 391532)
+++ 0001-generic_netlink_ssid_privsep.patch	2020-07-10 13:00:42 UTC (rev 391533)
@@ -1,196 +0,0 @@
-From 5d5ff024cbffa09bb3b3457a5a45be688adca949 Mon Sep 17 00:00:00 2001
-From: Roy Marples <roy at marples.name>
-Date: Mon, 22 Jun 2020 21:56:16 +0100
-Subject: Linux: keep the generic netlink socket around to get ssid with
- privsep
-
-While here, improve our reading of netlink(7) and terminate on either
-ERROR or DONE. If neither are in the message, read again unless it's
-the link receiving socket.
-Also, only callback if this is the sequence number expected.
----
- src/if-linux.c | 81 ++++++++++++++++++++++++++++++++++------------------------
- 1 file changed, 48 insertions(+), 33 deletions(-)
-
-diff --git a/src/if-linux.c b/src/if-linux.c
-index b3ab8280..815a06b7 100644
---- a/src/if-linux.c
-+++ b/src/if-linux.c
-@@ -130,6 +130,7 @@ int if_getssid_wext(const char *ifname, uint8_t *ssid);
- 
- struct priv {
- 	int route_fd;
-+	int generic_fd;
- 	uint32_t route_pid;
- };
- 
-@@ -414,6 +415,12 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
- 	if (getsockname(priv->route_fd, (struct sockaddr *)&snl, &len) == -1)
- 		return -1;
- 	priv->route_pid = snl.nl_pid;
-+
-+	memset(&snl, 0, sizeof(snl));
-+	priv->generic_fd = if_linksocket(&snl, NETLINK_GENERIC, 0);
-+	if (priv->generic_fd == -1)
-+		return -1;
-+
- 	return 0;
- }
- 
-@@ -425,6 +432,7 @@ if_closesockets_os(struct dhcpcd_ctx *ctx)
- 	if (ctx->priv != NULL) {
- 		priv = (struct priv *)ctx->priv;
- 		close(priv->route_fd);
-+		close(priv->generic_fd);
- 	}
- }
- 
-@@ -465,26 +473,27 @@ if_getnetlink(struct dhcpcd_ctx *ctx, struct iovec *iov, int fd, int flags,
- 	};
- 	ssize_t len;
- 	struct nlmsghdr *nlm;
--	int r;
-+	int r = 0;
- 	unsigned int again;
-+	bool terminated;
- 
- recv_again:
--	if ((len = recvmsg(fd, &msg, flags)) == -1)
--		return -1;
--	if (len == 0)
--		return 0;
-+	len = recvmsg(fd, &msg, flags);
-+	if (len == -1 || len == 0)
-+		return (int)len;
- 
- 	/* Check sender */
- 	if (msg.msg_namelen != sizeof(nladdr)) {
- 		errno = EINVAL;
- 		return -1;
- 	}
-+
- 	/* Ignore message if it is not from kernel */
- 	if (nladdr.nl_pid != 0)
- 		return 0;
- 
--	r = 0;
- 	again = 0;
-+	terminated = false;
- 	for (nlm = iov->iov_base;
- 	     nlm && NLMSG_OK(nlm, (size_t)len);
- 	     nlm = NLMSG_NEXT(nlm, len))
-@@ -492,6 +501,7 @@ recv_again:
- 		again = (nlm->nlmsg_flags & NLM_F_MULTI);
- 		if (nlm->nlmsg_type == NLMSG_NOOP)
- 			continue;
-+
- 		if (nlm->nlmsg_type == NLMSG_ERROR) {
- 			struct nlmsgerr *err;
- 
-@@ -504,17 +514,21 @@ recv_again:
- 				errno = -err->error;
- 				return -1;
- 			}
-+			again = 0;
-+			terminated = true;
- 			break;
- 		}
- 		if (nlm->nlmsg_type == NLMSG_DONE) {
- 			again = 0;
-+			terminated = true;
- 			break;
- 		}
--		if (cb != NULL && (r = cb(ctx, cbarg, nlm)) != 0)
--			break;
-+		if (cb != NULL &&
-+		   (nlm->nlmsg_seq == (uint32_t)ctx->seq || fd == ctx->link_fd))
-+			r = cb(ctx, cbarg, nlm);
- 	}
- 
--	if (r == 0 && again)
-+	if ((again || !terminated) && (ctx != NULL && ctx->link_fd != fd))
- 		goto recv_again;
- 
- 	return r;
-@@ -982,16 +996,19 @@ static int
- if_sendnetlink(struct dhcpcd_ctx *ctx, int protocol, struct nlmsghdr *hdr,
-     int (*cb)(struct dhcpcd_ctx *, void *, struct nlmsghdr *), void *cbarg)
- {
--	int s, r;
-+	int s;
- 	struct sockaddr_nl snl = { .nl_family = AF_NETLINK };
- 	struct iovec iov = { .iov_base = hdr, .iov_len = hdr->nlmsg_len };
- 	struct msghdr msg = {
- 	    .msg_name = &snl, .msg_namelen = sizeof(snl),
- 	    .msg_iov = &iov, .msg_iovlen = 1
- 	};
--	bool use_rfd;
--
--	use_rfd = (protocol == NETLINK_ROUTE && hdr->nlmsg_type != RTM_GETADDR);
-+	struct priv *priv = (struct priv *)ctx->priv;
-+	unsigned char buf[16 * 1024];
-+	struct iovec riov = {
-+		.iov_base = buf,
-+		.iov_len = sizeof(buf),
-+	};
- 
- 	/* Request a reply */
- 	hdr->nlmsg_flags |= NLM_F_ACK;
-@@ -1002,13 +1019,16 @@ if_sendnetlink(struct dhcpcd_ctx *ctx, int protocol, struct nlmsghdr *hdr,
- 		return (int)ps_root_sendnetlink(ctx, protocol, &msg);
- #endif
- 
--	if (use_rfd) {
--		struct priv *priv = (struct priv *)ctx->priv;
--
--		s = priv->route_fd;
--	} else {
--		if ((s = if_linksocket(&snl, protocol, 0)) == -1)
--			return -1;
-+	switch (protocol) {
-+	case NETLINK_ROUTE:
-+		if (hdr->nlmsg_type != RTM_GETADDR) {
-+			s = priv->route_fd;
-+			break;
-+		}
-+		/* FALLTHROUGH */
-+	case NETLINK_GENERIC:
-+		s = priv->generic_fd;
-+#if 0
- #ifdef NETLINK_GET_STRICT_CHK
- 		if (hdr->nlmsg_type == RTM_GETADDR) {
- 			int on = 1;
-@@ -1018,22 +1038,17 @@ if_sendnetlink(struct dhcpcd_ctx *ctx, int protocol, struct nlmsghdr *hdr,
- 				logerr("%s: NETLINK_GET_STRICT_CHK", __func__);
- 		}
- #endif
-+#endif
-+		break;
-+	default:
-+		errno = EINVAL;
-+		return -1;
- 	}
- 
--	if (sendmsg(s, &msg, 0) != -1) {
--		unsigned char buf[16 * 1024];
--		struct iovec riov = {
--			.iov_base = buf,
--			.iov_len = sizeof(buf),
--		};
--
--		r = if_getnetlink(ctx, &riov, s, 0, cb, cbarg);
--	} else
--		r = -1;
-+	if (sendmsg(s, &msg, 0) == -1)
-+		return -1;
- 
--	if (!use_rfd)
--		close(s);
--	return r;
-+	return if_getnetlink(ctx, &riov, s, 0, cb, cbarg);
- }
- 
- #define NLMSG_TAIL(nmsg)						\
--- 
-cgit v1.2.3
-

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-10 11:28:41 UTC (rev 391532)
+++ PKGBUILD	2020-07-10 13:00:42 UTC (rev 391533)
@@ -4,8 +4,8 @@
 # Contributor: Judd Vinet <jvinet.zeroflux.org>
 
 pkgname=dhcpcd
-pkgver=9.1.2
-pkgrel=2
+pkgver=9.1.4
+pkgrel=1
 pkgdesc="RFC2131 compliant DHCP client daemon"
 url="https://roy.marples.name/projects/dhcpcd/"
 arch=('x86_64')
@@ -22,19 +22,16 @@
         dhcpcd.tmpfiles
         0001-generic_netlink_ssid_privsep.patch)
 validpgpkeys=('A785ED2755955D9E93EA59F6597F97EA9AD45549')  # Roy Marples (NetBSD) <roy at NetBSD.org>
-sha256sums=('ed053839beb9aaf6424c94ff340826446af2df754db7c7137a09de2a71fb512c'
+sha256sums=('5fe133e5497d8af6d26bd6e6b8dd48ab12d124d6cc4cefe6de6536ff97f76820'
             '37acd53a589711f5e1db2fcaebb4ccf1c90dc4bcd309626bde25beb7b630a545'
             '20bccbf8a05b1bc2be365c8b4b526c38c752f48229ba53c3be113ac5b634f210'
             'df33c69a79fb30895217db8fe6a46ad0658a70b32a280bc91fc04a09b584fa62'
             'e0cef3b7cbe047393e4ecb60369f67d2d73e616b56cea9401070f2aff28a7434'
             '0887ace3e43d468528d808c6cf9f62d2926a1b61e3cae254410ecd2e8471a5cb')
-prepare () {
-  cd ${pkgname}-${pkgver}
+# prepare () {
+#   cd ${pkgname}-${pkgver}
+# }
 
-  # patch for keep the generic netlink socket around to get ssid with privsep
-  patch -Np1 < $srcdir/0001-generic_netlink_ssid_privsep.patch
-}
-
 build() {
   cd ${pkgname}-${pkgver}
 



More information about the arch-commits mailing list