Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/iputils/, net-misc/iputils/files/
Date: Thu, 14 Oct 2021 03:16:48
Message-Id: 1634181347.c8e7cf5b4f813a24758f4d81e722df07bba85017.sam@gentoo
1 commit: c8e7cf5b4f813a24758f4d81e722df07bba85017
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 14 03:15:47 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 14 03:15:47 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8e7cf5b
7
8 net-misc/iputils: backport no-IPv6 ping patch
9
10 Bug: https://bugs.gentoo.org/818022
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../files/iputils-20210722-fix-no-ipv6-ping.patch | 47 +++++
14 net-misc/iputils/iputils-20210722-r1.ebuild | 192 +++++++++++++++++++++
15 2 files changed, 239 insertions(+)
16
17 diff --git a/net-misc/iputils/files/iputils-20210722-fix-no-ipv6-ping.patch b/net-misc/iputils/files/iputils-20210722-fix-no-ipv6-ping.patch
18 new file mode 100644
19 index 00000000000..61f9f5c03fd
20 --- /dev/null
21 +++ b/net-misc/iputils/files/iputils-20210722-fix-no-ipv6-ping.patch
22 @@ -0,0 +1,47 @@
23 +https://github.com/iputils/iputils/commit/79d713eab6181e219bf932b404706f6f59ff2539.patch
24 +https://bugs.gentoo.org/818022
25 +
26 +From: Byron Stanoszek <gandalf@×××××.org>
27 +Date: Thu, 16 Sep 2021 23:38:54 +0200
28 +Subject: [PATCH] ping: Remove 'unsupported IPv6' warning on disabled IPv6
29 +
30 +Regression was introduced in d141cb6 as introduced condition
31 +
32 +if ((errno == EAFNOSUPPORT && socktype == AF_INET6) || options & F_VERBOSE || requisite)
33 +
34 +was wrong, it should have been:
35 +
36 +if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) || options & F_VERBOSE)
37 +
38 +but bug was hidden as `family == AF_INET6' was always false until
39 +otherwise correct fix 904cdb6 ("ping: AF_INET6 is address family not
40 +socket type [lgtm scan]") propagated the error.
41 +
42 +Tested on kernel booted with ipv6.disable=1 (disabling via sysctl, i.e.
43 +sysctl -w net.ipv6.conf.all.disable_ipv6=1; sysctl -w net.ipv6.conf.default.disable_ipv6=1
44 +does not trigger the issue as it exit with "socket: Address family not
45 +supported by protocol" - errno EADDRNOTAVAIL).
46 +
47 +Fixes: d141cb6 ("ping: work with older kernels that don't support ping sockets")
48 +Closes: https://github.com/iputils/iputils/issues/293
49 +Closes: https://github.com/iputils/iputils/pull/370
50 +
51 +Reported-by: lekto <lekto@××.pl>
52 +Reviewed-by: Andrew Clayton <andrew@××××××××××××××.net>
53 +Reviewed-by: Petr Vorel <pvorel@××××.cz>
54 +Signed-off-by: Byron Stanoszek <gandalf@×××××.org>
55 +[ pvorel: create commit from Byron's patch on the issue, do analysis and wrote commit message ]
56 +Signed-off-by: Petr Vorel <pvorel@××××.cz>
57 +--- a/ping/ping.c
58 ++++ b/ping/ping.c
59 +@@ -150,8 +150,8 @@ static void create_socket(struct ping_rts *rts, socket_st *sock, int family,
60 + /* Report error related to disabled IPv6 only when IPv6 also failed or in
61 + * verbose mode. Report other errors always.
62 + */
63 +- if ((errno == EAFNOSUPPORT && family == AF_INET6) ||
64 +- rts->opt_verbose || requisite)
65 ++ if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) ||
66 ++ rts->opt_verbose)
67 + error(0, errno, "socket");
68 + if (requisite)
69 + exit(2);
70
71 diff --git a/net-misc/iputils/iputils-20210722-r1.ebuild b/net-misc/iputils/iputils-20210722-r1.ebuild
72 new file mode 100644
73 index 00000000000..7d70dc9970a
74 --- /dev/null
75 +++ b/net-misc/iputils/iputils-20210722-r1.ebuild
76 @@ -0,0 +1,192 @@
77 +# Copyright 1999-2021 Gentoo Authors
78 +# Distributed under the terms of the GNU General Public License v2
79 +
80 +# For released versions, we precompile the man/html pages and store
81 +# them in a tarball on our mirrors. This avoids ugly issues while
82 +# building stages, and reduces dependencies.
83 +# To regenerate man/html pages emerge iputils-99999999[doc] with
84 +# EGIT_COMMIT set to release tag, all USE flags enabled and
85 +# tar ${S}/doc folder.
86 +
87 +EAPI="7"
88 +
89 +PLOCALES="de fr ja pt_BR tr uk zh_CN"
90 +
91 +inherit fcaps flag-o-matic meson plocale systemd toolchain-funcs
92 +
93 +if [[ ${PV} == "99999999" ]] ; then
94 + EGIT_REPO_URI="https://github.com/iputils/iputils.git"
95 + inherit git-r3
96 +else
97 + SRC_URI="https://github.com/iputils/iputils/archive/${PV}.tar.gz -> ${P}.tar.gz
98 + https://dev.gentoo.org/~whissi/dist/iputils/${PN}-manpages-${PV}.tar.xz"
99 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
100 +fi
101 +
102 +DESCRIPTION="Network monitoring tools including ping and ping6"
103 +HOMEPAGE="https://wiki.linuxfoundation.org/networking/iputils"
104 +
105 +LICENSE="BSD GPL-2+ rdisc"
106 +SLOT="0"
107 +IUSE="+arping caps clockdiff doc gcrypt idn ipv6 nettle nls rarpd rdisc ssl static test tftpd tracepath traceroute6"
108 +RESTRICT="!test? ( test )"
109 +
110 +BDEPEND="
111 + virtual/pkgconfig
112 + test? ( sys-apps/iproute2 )
113 + nls? ( sys-devel/gettext )
114 +"
115 +
116 +LIB_DEPEND="
117 + caps? ( sys-libs/libcap[static-libs(+)] )
118 + idn? ( net-dns/libidn2:=[static-libs(+)] )
119 + nls? ( virtual/libintl[static-libs(+)] )
120 +"
121 +
122 +RDEPEND="
123 + traceroute6? ( !net-analyzer/traceroute )
124 + !static? ( ${LIB_DEPEND//\[static-libs(+)]} )
125 +"
126 +
127 +DEPEND="
128 + ${RDEPEND}
129 + virtual/os-headers
130 + static? ( ${LIB_DEPEND} )
131 +"
132 +
133 +if [[ ${PV} == "99999999" ]] ; then
134 + BDEPEND+="
135 + app-text/docbook-xml-dtd:4.2
136 + app-text/docbook-xml-dtd:4.5
137 + app-text/docbook-xsl-ns-stylesheets
138 + app-text/docbook-xsl-stylesheets
139 + dev-libs/libxslt:0
140 + "
141 +fi
142 +
143 +PATCHES=(
144 + # Upstream; drop on bump
145 + "${FILESDIR}"/${P}-optional-tests.patch
146 + # Upstream; drop on bump
147 + "${FILESDIR}"/${P}-fix-no-ipv6-ping.patch
148 +)
149 +
150 +src_prepare() {
151 + default
152 +
153 + plocale_get_locales > po/LINGUAS || die
154 +}
155 +
156 +src_configure() {
157 + use static && append-ldflags -static
158 +
159 + local emesonargs=(
160 + -DUSE_CAP="$(usex caps true false)"
161 + -DUSE_IDN="$(usex idn true false)"
162 + -DBUILD_ARPING="$(usex arping true false)"
163 + -DBUILD_CLOCKDIFF="$(usex clockdiff true false)"
164 + -DBUILD_PING="true"
165 + -DBUILD_RARPD="$(usex rarpd true false)"
166 + -DBUILD_RDISC="$(usex rdisc true false)"
167 + -DENABLE_RDISC_SERVER="$(usex rdisc true false)"
168 + -DBUILD_TFTPD="$(usex tftpd true false)"
169 + -DBUILD_TRACEPATH="$(usex tracepath true false)"
170 + -DBUILD_TRACEROUTE6="$(usex ipv6 $(usex traceroute6 true false) false)"
171 + -DBUILD_NINFOD="false"
172 + -DNINFOD_MESSAGES="false"
173 + -DNO_SETCAP_OR_SUID="true"
174 + -Dsystemdunitdir="$(systemd_get_systemunitdir)"
175 + -DUSE_GETTEXT="$(usex nls true false)"
176 + $(meson_use !test SKIP_TESTS)
177 + )
178 +
179 + if [[ "${PV}" == 99999999 ]] ; then
180 + emesonargs+=(
181 + -DBUILD_HTML_MANS="$(usex doc true false)"
182 + -DBUILD_MANS="true"
183 + )
184 + else
185 + emesonargs+=(
186 + -DBUILD_HTML_MANS="false"
187 + -DBUILD_MANS="false"
188 + )
189 + fi
190 +
191 + meson_src_configure
192 +}
193 +
194 +src_compile() {
195 + tc-export CC
196 + meson_src_compile
197 +}
198 +
199 +src_test() {
200 + if [[ ${EUID} != 0 ]]; then
201 + einfo "Tests require root privileges; Skipping ..."
202 + return
203 + fi
204 +
205 + meson_src_test
206 +}
207 +
208 +src_install() {
209 + meson_src_install
210 +
211 + dodir /bin
212 + local my_bin
213 + for my_bin in $(usex arping arping '') ping ; do
214 + mv "${ED}"/usr/bin/${my_bin} "${ED}"/bin/ || die
215 + done
216 + dosym ping /bin/ping4
217 +
218 + if use tracepath ; then
219 + dosym tracepath /usr/bin/tracepath4
220 + fi
221 +
222 + if use ipv6 ; then
223 + dosym ping /bin/ping6
224 +
225 + if use tracepath ; then
226 + dosym tracepath /usr/bin/tracepath6
227 + dosym tracepath.8 /usr/share/man/man8/tracepath6.8
228 + fi
229 + fi
230 +
231 + if [[ "${PV}" != 99999999 ]] ; then
232 + local -a man_pages
233 + local -a html_man_pages
234 +
235 + while IFS= read -r -u 3 -d $'\0' my_bin
236 + do
237 + my_bin=$(basename "${my_bin}")
238 + [[ -z "${my_bin}" ]] && continue
239 +
240 + if [[ -f "${S}/doc/${my_bin}.8" ]] ; then
241 + man_pages+=( ${my_bin}.8 )
242 + fi
243 +
244 + if [[ -f "${S}/doc/${my_bin}.html" ]] ; then
245 + html_man_pages+=( ${my_bin}.html )
246 + fi
247 + done 3< <(find "${ED}"/{bin,usr/bin,usr/sbin} -type f -perm -a+x -print0 2>/dev/null)
248 +
249 + pushd doc &>/dev/null || die
250 + doman "${man_pages[@]}"
251 + if use doc ; then
252 + docinto html
253 + dodoc "${html_man_pages[@]}"
254 + fi
255 + popd &>/dev/null || die
256 + else
257 + if use doc ; then
258 + mv "${ED}"/usr/share/${PN} "${ED}"/usr/share/doc/${PF}/html || die
259 + fi
260 + fi
261 +}
262 +
263 +pkg_postinst() {
264 + fcaps cap_net_raw \
265 + bin/ping \
266 + $(usex arping 'bin/arping' '') \
267 + $(usex clockdiff 'usr/bin/clockdiff' '')
268 +}