Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/iproute2/, sys-apps/iproute2/files/
Date: Sat, 02 May 2015 23:42:16
Message-Id: 1430610174.b9660100a94d218462eddd7ee011f54b0dbec7bb.blueness@gentoo
1 commit: b9660100a94d218462eddd7ee011f54b0dbec7bb
2 Author: Felix Janda <felix.janda <AT> posteo <DOT> de>
3 AuthorDate: Sat May 2 18:26:19 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat May 2 23:42:54 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=b9660100
7
8 sys-apps/iproute2: bump to 3.19.0
9
10 .../iproute2/files/iproute2-3.10.0-no-ipv6.patch | 41 +++++++
11 sys-apps/iproute2/files/iproute2-3.19.0-musl.patch | 22 ++++
12 sys-apps/iproute2/iproute2-3.19.0-r99.ebuild | 126 +++++++++++++++++++++
13 3 files changed, 189 insertions(+)
14
15 diff --git a/sys-apps/iproute2/files/iproute2-3.10.0-no-ipv6.patch b/sys-apps/iproute2/files/iproute2-3.10.0-no-ipv6.patch
16 new file mode 100644
17 index 0000000..86d80d2
18 --- /dev/null
19 +++ b/sys-apps/iproute2/files/iproute2-3.10.0-no-ipv6.patch
20 @@ -0,0 +1,41 @@
21 +https://bugs.gentoo.org/326849
22 +
23 +allow ipv6 to be disabled
24 +
25 +--- a/ip/iptunnel.c
26 ++++ b/ip/iptunnel.c
27 +@@ -629,13 +629,6 @@ int do_iptunnel(int argc, char **argv)
28 + break;
29 + case AF_INET:
30 + break;
31 +- /*
32 +- * This is silly enough but we have no easy way to make it
33 +- * protocol-independent because of unarranged structure between
34 +- * IPv4 and IPv6.
35 +- */
36 +- case AF_INET6:
37 +- return do_ip6tunnel(argc, argv);
38 + default:
39 + fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
40 + exit(-1);
41 +--- a/ip/Makefile
42 ++++ b/ip/Makefile
43 +@@ -1,6 +1,6 @@
44 + IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
45 +- rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
46 +- ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \
47 ++ rtm_map.o iptunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
48 ++ ipmaddr.o ipmonitor.o ipmroute.o iptuntap.o iptoken.o \
49 + ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
50 + iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
51 + iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o \
52 +--- a/ip/ipmonitor.c
53 ++++ b/ip/ipmonitor.c
54 +@@ -96,7 +96,6 @@ static int accept_msg(const struct socka
55 + if (n->nlmsg_type == RTM_NEWPREFIX) {
56 + if (prefix_banner)
57 + fprintf(fp, "[PREFIX]");
58 +- print_prefix(who, n, arg);
59 + return 0;
60 + }
61 + if (n->nlmsg_type == RTM_NEWRULE || n->nlmsg_type == RTM_DELRULE) {
62
63 diff --git a/sys-apps/iproute2/files/iproute2-3.19.0-musl.patch b/sys-apps/iproute2/files/iproute2-3.19.0-musl.patch
64 new file mode 100644
65 index 0000000..6ebc808
66 --- /dev/null
67 +++ b/sys-apps/iproute2/files/iproute2-3.19.0-musl.patch
68 @@ -0,0 +1,22 @@
69 +diff -ur a/iproute2-3.19.0/include/linux/if_bridge.h b/iproute2-3.19.0/include/linux/if_bridge.h
70 +--- a/iproute2-3.19.0/include/linux/if_bridge.h 2015-02-11 01:14:32.000000000 -0200
71 ++++ b/iproute2-3.19.0/include/linux/if_bridge.h 2015-04-25 21:39:38.130830774 -0200
72 +@@ -15,7 +15,6 @@
73 +
74 + #include <linux/types.h>
75 + #include <linux/if_ether.h>
76 +-#include <linux/in6.h>
77 +
78 + #define SYSFS_BRIDGE_ATTR "bridge"
79 + #define SYSFS_BRIDGE_FDB "brforward"
80 +diff -ur a/iproute2-3.19.0/lib/namespace.c b/iproute2-3.19.0/lib/namespace.c
81 +--- a/iproute2-3.19.0/lib/namespace.c 2015-02-11 01:14:32.000000000 -0200
82 ++++ b/iproute2-3.19.0/lib/namespace.c 2015-04-25 21:39:01.273291557 -0200
83 +@@ -9,6 +9,7 @@
84 +
85 + #include <fcntl.h>
86 + #include <dirent.h>
87 ++#include <sys/param.h>
88 +
89 + #include "utils.h"
90 + #include "namespace.h"
91
92 diff --git a/sys-apps/iproute2/iproute2-3.19.0-r99.ebuild b/sys-apps/iproute2/iproute2-3.19.0-r99.ebuild
93 new file mode 100644
94 index 0000000..63bccbd
95 --- /dev/null
96 +++ b/sys-apps/iproute2/iproute2-3.19.0-r99.ebuild
97 @@ -0,0 +1,126 @@
98 +# Copyright 1999-2015 Gentoo Foundation
99 +# Distributed under the terms of the GNU General Public License v2
100 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/iproute2/iproute2-3.19.0.ebuild,v 1.5 2015/04/25 12:36:09 zlogene Exp $
101 +
102 +EAPI="5"
103 +
104 +inherit eutils toolchain-funcs flag-o-matic multilib
105 +
106 +if [[ ${PV} == "9999" ]] ; then
107 + EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
108 + inherit git-2
109 +else
110 + SRC_URI="mirror://kernel/linux/utils/net/${PN}/${P}.tar.xz"
111 + KEYWORDS="amd64 ~arm ~mips ~ppc x86"
112 +fi
113 +
114 +DESCRIPTION="kernel routing and traffic control utilities"
115 +HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2"
116 +
117 +LICENSE="GPL-2"
118 +SLOT="0"
119 +IUSE="atm berkdb +iptables ipv6 minimal selinux"
120 +
121 +RDEPEND="!net-misc/arpd
122 + iptables? ( >=net-firewall/iptables-1.4.20:= )
123 + !minimal? ( berkdb? ( sys-libs/db ) )
124 + atm? ( net-dialup/linux-atm )
125 + selinux? ( sys-libs/libselinux )"
126 +DEPEND="${RDEPEND}
127 + app-arch/xz-utils
128 + iptables? ( virtual/pkgconfig )
129 + sys-devel/bison
130 + sys-devel/flex
131 + >=sys-kernel/linux-headers-2.6.27
132 + elibc_glibc? ( >=sys-libs/glibc-2.7 )"
133 +
134 +src_prepare() {
135 + epatch "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907
136 + use ipv6 || epatch "${FILESDIR}"/${PN}-3.10.0-no-ipv6.patch #326849
137 +
138 + epatch "${FILESDIR}"/${PN}-3.19.0-musl.patch
139 +
140 + sed -i \
141 + -e '/^CC =/d' \
142 + -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \
143 + -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \
144 + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
145 + -e "/^WFLAGS/s:-Werror::" \
146 + -e "/^DBM_INCLUDE/s:=.*:=${T}:" \
147 + Makefile || die
148 +
149 + # Use /run instead of /var/run.
150 + sed -i \
151 + -e 's:/var/run:/run:g' \
152 + ip/ipnetns.c \
153 + man/man8/ip-netns.8 || die
154 +
155 + # build against system headers
156 + rm -r include/netinet #include/linux include/ip{,6}tables{,_common}.h include/libiptc
157 + sed -i 's:TCPI_OPT_ECN_SEEN:16:' misc/ss.c || die
158 +
159 + # don't build arpd if USE=-berkdb #81660
160 + use berkdb || sed -i '/^TARGETS=/s: arpd : :' misc/Makefile
161 +
162 + use minimal && sed -i -e '/^SUBDIRS=/s:=.*:=lib tc:' Makefile
163 +}
164 +
165 +src_configure() {
166 + tc-export AR CC PKG_CONFIG
167 +
168 + # This sure is ugly. Should probably move into toolchain-funcs at some point.
169 + local setns
170 + pushd "${T}" >/dev/null
171 + echo 'main(){return setns();};' > test.c
172 + ${CC} ${CFLAGS} ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n
173 + echo 'main(){};' > test.c
174 + ${CC} ${CFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i '/^LDLIBS/s:-lresolv::' "${S}"/Makefile
175 + popd >/dev/null
176 +
177 + cat <<-EOF > Config
178 + TC_CONFIG_ATM := $(usex atm y n)
179 + TC_CONFIG_XT := $(usex iptables y n)
180 + HAVE_SELINUX := $(usex selinux y n)
181 + IP_CONFIG_SETNS := ${setns}
182 + # Use correct iptables dir, #144265 #293709
183 + IPT_LIB_DIR := $(use iptables && ${PKG_CONFIG} xtables --variable=xtlibdir)
184 + EOF
185 +}
186 +
187 +src_install() {
188 + if use minimal ; then
189 + into /
190 + dosbin tc/tc
191 + return 0
192 + fi
193 +
194 + emake \
195 + DESTDIR="${D}" \
196 + LIBDIR="${EPREFIX}"/$(get_libdir) \
197 + SBINDIR="${EPREFIX}"/sbin \
198 + CONFDIR="${EPREFIX}"/etc/iproute2 \
199 + DOCDIR="${EPREFIX}"/usr/share/doc/${PF} \
200 + MANDIR="${EPREFIX}"/usr/share/man \
201 + ARPDDIR="${EPREFIX}"/var/lib/arpd \
202 + install
203 +
204 + rm "${ED}"/usr/share/doc/${PF}/*.{sgml,tex} || die #455988
205 +
206 + dodir /bin
207 + mv "${ED}"/{s,}bin/ip || die #330115
208 +
209 + dolib.a lib/libnetlink.a
210 + insinto /usr/include
211 + doins include/libnetlink.h
212 + # This local header pulls in a lot of linux headers it
213 + # doesn't directly need. Delete this header that requires
214 + # linux-headers-3.8 until that goes stable. #467716
215 + sed -i '/linux\/netconf.h/d' "${ED}"/usr/include/libnetlink.h || die
216 +
217 + if use berkdb ; then
218 + dodir /var/lib/arpd
219 + # bug 47482, arpd doesn't need to be in /sbin
220 + dodir /usr/bin
221 + mv "${ED}"/sbin/arpd "${ED}"/usr/bin/ || die
222 + fi
223 +}