diff --git a/sys-apps/iproute2/Manifest b/sys-apps/iproute2/Manifest new file mode 100644 index 0000000..4e2a8a2 --- /dev/null +++ b/sys-apps/iproute2/Manifest @@ -0,0 +1,5 @@ +AUX iproute2-3.1.0-mtu.patch 1649 SHA256 d8d1d3b81a3fd5674e6c9e202bce9e84f41b579ba2c6a554df3346f4642715af SHA512 5479c2085b4aca958a89d3e265ebc3763c9e7cb273bd4046d7b7585209739f75ff04cc9b84d8eb9e3afae821ff788f0f0c7ab443260ab07943b6fad6946403e1 WHIRLPOOL b813f1d9dcdbfb525fb07a462f7faf1c13117dd3e9e584b1a033cb69f3dad9d4b8e5120f8512185f24769e6be0aabd6635ad3996342dc210ff513866e7638502 +AUX iproute2-4.11.0-no-ipv6.patch 1360 SHA256 4fd3e61e00805a83a9874586738af1eed617c2845dd49254c7886e44c432de11 SHA512 8e548f19079eea1d3a5a91bb657bba961c9e9206147e0e0aea1aaf04d74b46e2687c906b78561d939f53f4a33ecb9e08ad8237f401068076df5842c78bc3b577 WHIRLPOOL 46864c98b8cb79dd0f811d75271937c4cef9eb5eb4ddd9996a8ca510b030fc59fe2e39ce6666bc584f097a81c1d146af3550d20767bcf347e9315fa22e890667 +AUX iproute2-4.14.1-fix-tc-actions.patch 6665 SHA256 4086178e9853ee4aed44b3fce4de23f0544388ff08a5982ccd36509b7215d115 SHA512 cdde7bb5a0cb49471472a8412758023529976dcafefc6a759ce758fba1b0420c046ca6faf084df81ac11e7153ac820909b1b9ec41c04f643208b9db456cfda28 WHIRLPOOL 2cb34c5a1da81bdb62a5292e81ce1e3def497ae269d72b15ba0ce073aba00ab4872b6945f750e3fda7f26f6661c88f936d63a0edf41842e831f1c8234b01600b +DIST iproute2-4.14.1.tar.xz 636876 SHA256 d43ac068afcc350a448f4581b6e292331ef7e4e7aa746e34981582d5fdb10067 SHA512 e593b68c46ef5f98bd6911ee7beb38388a14935a29fefabdeccc96aa012593b6f3a49b3bb1baed7d77e54f1f4a857172e058b73407f4070f158b8713f44f5d2c WHIRLPOOL 42ee7611f3fb1ceb922c606bf11cd4d72cf71020a73f96f5130f07a9cab08f1dbc973cb5924f6a15cf4613dac5b60a3a97583c0e801db960f5039d6d8c0ef095 +EBUILD iproute2-4.14.1-r2.ebuild 4104 SHA256 ea549a1bf8a4c1683d6be0fc5348fca27a02859909301239df8581bc04700fd1 SHA512 da060462bf193df61f8c1d7fc79d1ce4a70331e5baf33c3e4fdf2a8fc34c82adcd63daef19caff568d3ea3ac8f1a6b40b0ba09947ebeadb0d6c7b1dfa631dc16 WHIRLPOOL 90d2c1ce471ee309b472e6106301f55ac3c92dd6eed0877d93c77c6e8fd6ee5783e5ccb57b5db5c9b33de511511b844e7770fb4caaa01c0784a0b2586cd6b73a diff --git a/sys-apps/iproute2/files/iproute2-3.1.0-mtu.patch b/sys-apps/iproute2/files/iproute2-3.1.0-mtu.patch new file mode 100644 index 0000000..fa12dad --- /dev/null +++ b/sys-apps/iproute2/files/iproute2-3.1.0-mtu.patch @@ -0,0 +1,48 @@ +http://bugs.gentoo.org/291907 + +This patch was merged from two patches extracted from this thread: +http://markmail.org/thread/qkd76gpdgefpjlfn + +tc_stab.c: small fixes to commandline help + + +tc_core.c: +As kernel part of things relies on cell align which is always set to -1, +I also added it to userspace computation stage. This way if someone +specified e.g. 2048 and 512 for mtu and tsize respectively, one wouldn't +end with tsize supporting mtu 4096 suddenly, New default mtu is also set +to 2048 (disregarding weirdness of setting mtu to such values). + + +Unless I missed something, this is harmless and feels cleaner, but if it's +not allowed, documentation will have to be changed back to 2047 + extra +explanation as well. + +--- iproute2/tc/tc_core.c ++++ iproute2/tc/tc_core.c +@@ -155,12 +155,12 @@ + } + + if (s->mtu == 0) +- s->mtu = 2047; ++ s->mtu = 2048; + if (s->tsize == 0) + s->tsize = 512; + + s->cell_log = 0; +- while ((s->mtu >> s->cell_log) > s->tsize - 1) ++ while ((s->mtu - 1 >> s->cell_log) > s->tsize - 1) + s->cell_log++; + + *stab = malloc(s->tsize * sizeof(__u16)); +--- iproute2/tc/tc_stab.c ++++ iproute2/tc/tc_stab.c +@@ -32,7 +32,7 @@ + fprintf(stderr, + "Usage: ... stab [ mtu BYTES ] [ tsize SLOTS ] [ mpu BYTES ] \n" + " [ overhead BYTES ] [ linklayer TYPE ] ...\n" +- " mtu : max packet size we create rate map for {2047}\n" ++ " mtu : max packet size we create size table for {2048}\n" + " tsize : how many slots should size table have {512}\n" + " mpu : minimum packet size used in rate computations\n" + " overhead : per-packet size overhead used in rate computations\n" diff --git a/sys-apps/iproute2/files/iproute2-4.11.0-no-ipv6.patch b/sys-apps/iproute2/files/iproute2-4.11.0-no-ipv6.patch new file mode 100644 index 0000000..fc855dc --- /dev/null +++ b/sys-apps/iproute2/files/iproute2-4.11.0-no-ipv6.patch @@ -0,0 +1,37 @@ +--- iproute2-4.11.0/ip/ipmonitor.c ++++ iproute2-4.11.0/ip/ipmonitor.c +@@ -114,7 +114,6 @@ + } + if (n->nlmsg_type == RTM_NEWPREFIX) { + print_headers(fp, "[PREFIX]", ctrl); +- print_prefix(who, n, arg); + return 0; + } + if (n->nlmsg_type == RTM_NEWRULE || n->nlmsg_type == RTM_DELRULE) { +--- iproute2-4.11.0/ip/iptunnel.c ++++ iproute2-4.11.0/ip/iptunnel.c +@@ -589,13 +589,6 @@ + break; + case AF_INET: + break; +- /* +- * This is silly enough but we have no easy way to make it +- * protocol-independent because of unarranged structure between +- * IPv4 and IPv6. +- */ +- case AF_INET6: +- return do_ip6tunnel(argc, argv); + default: + fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family); + exit(-1); +--- iproute2-4.11.0/ip/Makefile ++++ iproute2-4.11.0/ip/Makefile +@@ -1,6 +1,6 @@ + IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ +- rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \ +- ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \ ++ rtm_map.o iptunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \ ++ ipmaddr.o ipmonitor.o ipmroute.o iptuntap.o iptoken.o \ + ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o iplink_dummy.o \ + iplink_ifb.o iplink_nlmon.o iplink_team.o iplink_vcan.o \ + iplink_vlan.o link_veth.o link_gre.o iplink_can.o iplink_xdp.o \ diff --git a/sys-apps/iproute2/files/iproute2-4.14.1-fix-tc-actions.patch b/sys-apps/iproute2/files/iproute2-4.14.1-fix-tc-actions.patch new file mode 100644 index 0000000..a8b7aaa --- /dev/null +++ b/sys-apps/iproute2/files/iproute2-4.14.1-fix-tc-actions.patch @@ -0,0 +1,222 @@ +From 3572e01a090a298e2f4c4f796bad6639b652e031 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Fri, 8 Dec 2017 11:18:07 +0100 +Subject: tc: util: Don't call NEXT_ARG_FWD() in __parse_action_control() + +Not all callers want parse_action_control*() to advance the +arguments. For instance act_parse_police() does the argument +advancing itself. + +Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions") +Signed-off-by: Michal Privoznik +--- + tc/m_bpf.c | 1 + + tc/m_connmark.c | 1 + + tc/m_csum.c | 1 + + tc/m_gact.c | 10 +++++----- + tc/m_ife.c | 1 + + tc/m_mirred.c | 4 +++- + tc/m_nat.c | 1 + + tc/m_pedit.c | 1 + + tc/m_sample.c | 1 + + tc/m_skbedit.c | 1 + + tc/m_skbmod.c | 1 + + tc/m_tunnel_key.c | 1 + + tc/m_vlan.c | 1 + + tc/tc_util.c | 1 - + 14 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/tc/m_bpf.c b/tc/m_bpf.c +index 1c1f71c..576f69c 100644 +--- a/tc/m_bpf.c ++++ b/tc/m_bpf.c +@@ -129,6 +129,7 @@ opt_bpf: + + parse_action_control_dflt(&argc, &argv, &parm.action, + false, TC_ACT_PIPE); ++ NEXT_ARG_FWD(); + + if (argc) { + if (matches(*argv, "index") == 0) { +diff --git a/tc/m_connmark.c b/tc/m_connmark.c +index 37d7185..47c7a8c 100644 +--- a/tc/m_connmark.c ++++ b/tc/m_connmark.c +@@ -82,6 +82,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, + } + + parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_PIPE); ++ NEXT_ARG_FWD(); + + if (argc) { + if (matches(*argv, "index") == 0) { +diff --git a/tc/m_csum.c b/tc/m_csum.c +index 7b15673..e1352c0 100644 +--- a/tc/m_csum.c ++++ b/tc/m_csum.c +@@ -124,6 +124,7 @@ parse_csum(struct action_util *a, int *argc_p, + } + + parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_OK); ++ NEXT_ARG_FWD(); + + if (argc) { + if (matches(*argv, "index") == 0) { +diff --git a/tc/m_gact.c b/tc/m_gact.c +index e7d91da..b30b042 100644 +--- a/tc/m_gact.c ++++ b/tc/m_gact.c +@@ -87,14 +87,13 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, + if (argc < 0) + return -1; + +- +- if (matches(*argv, "gact") == 0) { +- argc--; +- argv++; +- } else if (parse_action_control(&argc, &argv, &p.action, false) == -1) { ++ if (matches(*argv, "gact") != 0 && ++ parse_action_control(&argc, &argv, &p.action, false) == -1) { + usage(); /* does not return */ + } + ++ NEXT_ARG_FWD(); ++ + #ifdef CONFIG_GACT_PROB + if (argc > 0) { + if (matches(*argv, "random") == 0) { +@@ -114,6 +113,7 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, + if (parse_action_control(&argc, &argv, + &pp.paction, false) == -1) + usage(); ++ NEXT_ARG_FWD(); + if (get_u16(&pp.pval, *argv, 10)) { + fprintf(stderr, + "Illegal probability val 0x%x\n", +diff --git a/tc/m_ife.c b/tc/m_ife.c +index 205efc9..4647f6a 100644 +--- a/tc/m_ife.c ++++ b/tc/m_ife.c +@@ -159,6 +159,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, + + parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_mirred.c b/tc/m_mirred.c +index 3870d3a..aa7ce6d 100644 +--- a/tc/m_mirred.c ++++ b/tc/m_mirred.c +@@ -202,8 +202,10 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p, + } + + +- if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR) ++ if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR) { + parse_action_control(&argc, &argv, &p.action, false); ++ NEXT_ARG_FWD(); ++ } + + if (argc) { + if (iok && matches(*argv, "index") == 0) { +diff --git a/tc/m_nat.c b/tc/m_nat.c +index 1e4ff51..f5de4d4 100644 +--- a/tc/m_nat.c ++++ b/tc/m_nat.c +@@ -116,6 +116,7 @@ parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct + + parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_OK); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_pedit.c b/tc/m_pedit.c +index 26549ee..dc57f14 100644 +--- a/tc/m_pedit.c ++++ b/tc/m_pedit.c +@@ -672,6 +672,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, + + parse_action_control_dflt(&argc, &argv, &sel.sel.action, false, TC_ACT_OK); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_sample.c b/tc/m_sample.c +index ff5ee6b..31774c0 100644 +--- a/tc/m_sample.c ++++ b/tc/m_sample.c +@@ -100,6 +100,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p, + + parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c +index aa374fc..c41a7bb 100644 +--- a/tc/m_skbedit.c ++++ b/tc/m_skbedit.c +@@ -123,6 +123,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, + parse_action_control_dflt(&argc, &argv, &sel.action, + false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c +index 561b73f..bc268df 100644 +--- a/tc/m_skbmod.c ++++ b/tc/m_skbmod.c +@@ -124,6 +124,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p, + + parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c +index 1cdd035..2dc9187 100644 +--- a/tc/m_tunnel_key.c ++++ b/tc/m_tunnel_key.c +@@ -175,6 +175,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, + parse_action_control_dflt(&argc, &argv, &parm.action, + false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/m_vlan.c b/tc/m_vlan.c +index 161759f..edae0d1 100644 +--- a/tc/m_vlan.c ++++ b/tc/m_vlan.c +@@ -131,6 +131,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, + parse_action_control_dflt(&argc, &argv, &parm.action, + false, TC_ACT_PIPE); + ++ NEXT_ARG_FWD(); + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); +diff --git a/tc/tc_util.c b/tc/tc_util.c +index 1887905..ee9a70a 100644 +--- a/tc/tc_util.c ++++ b/tc/tc_util.c +@@ -586,7 +586,6 @@ static int __parse_action_control(int *argc_p, char ***argv_p, int *result_p, + } + result |= jump_cnt; + } +- NEXT_ARG_FWD(); + *argc_p = argc; + *argv_p = argv; + *result_p = result; +-- +cgit v1.1 + diff --git a/sys-apps/iproute2/iproute2-4.14.1-r2.ebuild b/sys-apps/iproute2/iproute2-4.14.1-r2.ebuild new file mode 100644 index 0000000..1b9bf2d --- /dev/null +++ b/sys-apps/iproute2/iproute2-4.14.1-r2.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit toolchain-funcs flag-o-matic multilib + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git" + inherit git-r3 +else + SRC_URI="mirror://kernel/linux/utils/net/${PN}/${P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86" +fi + +DESCRIPTION="kernel routing and traffic control utilities" +HOMEPAGE="https://wiki.linuxfoundation.org/networking/iproute2" + +LICENSE="GPL-2" +SLOT="0" +IUSE="atm berkdb +iptables ipv6 minimal selinux" + +# We could make libmnl optional, but it's tiny, so eh +RDEPEND=" + !net-misc/arpd + !minimal? ( net-libs/libmnl virtual/libelf ) + iptables? ( >=net-firewall/iptables-1.4.20:= ) + berkdb? ( sys-libs/db:= ) + atm? ( net-dialup/linux-atm ) + selinux? ( sys-libs/libselinux ) +" +# We require newer linux-headers for ipset support #549948 and some defines #553876 +DEPEND=" + ${RDEPEND} + app-arch/xz-utils + iptables? ( virtual/pkgconfig ) + >=sys-devel/bison-2.4 + sys-devel/flex + >=sys-kernel/linux-headers-3.16 + elibc_glibc? ( >=sys-libs/glibc-2.7 ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907 + "${FILESDIR}"/${P}-fix-tc-actions.patch +) + +src_prepare() { + if ! use ipv6 ; then + PATCHES+=( + "${FILESDIR}"/${PN}-4.11.0-no-ipv6.patch #326849 + ) + fi + + default + + sed -i \ + -e '/^CC :\?=/d' \ + -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \ + -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \ + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \ + -e "/^WFLAGS/s:-Werror::" \ + -e "/^DBM_INCLUDE/s:=.*:=${T}:" \ + Makefile || die + + # Use /run instead of /var/run. + sed -i \ + -e 's:/var/run:/run:g' \ + include/namespace.h \ + man/man8/ip-netns.8 || die + + # build against system headers + rm -r include/netinet #include/linux include/ip{,6}tables{,_common}.h include/libiptc + sed -i 's:TCPI_OPT_ECN_SEEN:16:' misc/ss.c || die + + use minimal && sed -i -e '/^SUBDIRS=/s:=.*:=lib tc ip:' Makefile +} + +src_configure() { + tc-export AR CC PKG_CONFIG + + # This sure is ugly. Should probably move into toolchain-funcs at some point. + local setns + pushd "${T}" >/dev/null + printf '#include \nint main(){return setns(0, 0);}\n' > test.c + ${CC} ${CFLAGS} ${CPPFLAGS} -D_GNU_SOURCE ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n + echo 'int main(){return 0;}' > test.c + ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i '/^LDLIBS/s:-lresolv::' "${S}"/Makefile + popd >/dev/null + + # run "configure" script first which will create "config.mk"... + default + + # ...now switch on/off requested features via USE flags + cat <<-EOF >> config.mk + TC_CONFIG_ATM := $(usex atm y n) + TC_CONFIG_XT := $(usex iptables y n) + TC_CONFIG_NO_XT := $(usex iptables n y) + # We've locked in recent enough kernel headers #549948 + TC_CONFIG_IPSET := y + HAVE_BERKELEY_DB := $(usex berkdb y n) + HAVE_MNL := $(usex minimal n y) + HAVE_ELF := $(usex minimal n y) + HAVE_SELINUX := $(usex selinux y n) + IP_CONFIG_SETNS := ${setns} + # Use correct iptables dir, #144265 #293709 + IPT_LIB_DIR := $(use iptables && ${PKG_CONFIG} xtables --variable=xtlibdir) + EOF +} + +src_install() { + if use minimal ; then + into / + dosbin tc/tc + dobin ip/ip + return 0 + fi + + emake \ + DESTDIR="${D}" \ + LIBDIR="${EPREFIX%/}"/$(get_libdir) \ + SBINDIR="${EPREFIX%/}"/sbin \ + CONFDIR="${EPREFIX%/}"/etc/iproute2 \ + DOCDIR="${EPREFIX%/}"/usr/share/doc/${PF} \ + MANDIR="${EPREFIX%/}"/usr/share/man \ + ARPDDIR="${EPREFIX%/}"/var/lib/arpd \ + install + + dodir /bin + mv "${ED%/}"/{s,}bin/ip || die #330115 + + dolib.a lib/libnetlink.a + insinto /usr/include + doins include/libnetlink.h + # This local header pulls in a lot of linux headers it + # doesn't directly need. Delete this header that requires + # linux-headers-3.8 until that goes stable. #467716 + sed -i '/linux\/netconf.h/d' "${ED%/}"/usr/include/libnetlink.h || die + + if use berkdb ; then + dodir /var/lib/arpd + # bug 47482, arpd doesn't need to be in /sbin + dodir /usr/bin + mv "${ED%/}"/sbin/arpd "${ED%/}"/usr/bin/ || die + fi +}