Initial commit
This commit is contained in:
195
package/network/utils/iproute2/Makefile
Normal file
195
package/network/utils/iproute2/Makefile
Normal file
@@ -0,0 +1,195 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iproute2
|
||||
PKG_VERSION:=4.16.0
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
||||
PKG_HASH:=0c5c24020fd7349fe25728c5edee9fb6a1bc8a38f08e23be5c57a6301e55ee0a
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=iptables
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iproute2/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
|
||||
SUBMENU:=Routing and Redirection
|
||||
MAINTAINER:=Russell Senior <russell@personaltelco.net>
|
||||
endef
|
||||
|
||||
define Package/ip-tiny
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Routing control utility (Minimal)
|
||||
VARIANT:=tiny
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=200:/sbin/ip:/sbin/ip-tiny
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ip-full
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Routing control utility (Full)
|
||||
VARIANT:=full
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=300:/sbin/ip:/sbin/ip-full
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/tc
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Traffic control utility
|
||||
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/genl
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=General netlink utility frontend
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ip-bridge
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Bridge configuration utility from iproute2
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ss
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Socket statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/nstat
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/devlink
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network devlink utility
|
||||
DEPENDS:=+libmnl
|
||||
endef
|
||||
|
||||
define Package/rdma
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network rdma utility
|
||||
DEPENDS:=+libmnl
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tiny)
|
||||
IP_CONFIG_TINY:=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_devlink
|
||||
HAVE_MNL:=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_rdma
|
||||
HAVE_MNL:=y
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
$(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
|
||||
$(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
|
||||
$(PKG_BUILD_DIR)/Makefile
|
||||
$(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
|
||||
$(PKG_BUILD_DIR)/Makefile
|
||||
echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
|
||||
> $(PKG_BUILD_DIR)/include/SNAPSHOT.h
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections
|
||||
|
||||
MAKE_FLAGS += \
|
||||
EXTRA_CCOPTS="-I$(STAGING_DIR)/usr/include/libnl-tiny" \
|
||||
KERNEL_INCLUDE="$(LINUX_DIR)/include" \
|
||||
SHARED_LIBS="" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
|
||||
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
|
||||
HAVE_MNL=$(HAVE_MNL) \
|
||||
IPT_LIB_DIR=/usr/lib/iptables \
|
||||
FPIC="$(FPIC)"
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/ip-tiny/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-tiny
|
||||
endef
|
||||
|
||||
define Package/ip-full/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-full
|
||||
endef
|
||||
|
||||
define Package/tc/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
|
||||
endef
|
||||
|
||||
define Package/genl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ip-bridge/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ss/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/nstat/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/devlink/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/rdma/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ip-tiny))
|
||||
$(eval $(call BuildPackage,ip-full))
|
||||
$(eval $(call BuildPackage,tc))
|
||||
$(eval $(call BuildPackage,genl))
|
||||
$(eval $(call BuildPackage,ip-bridge))
|
||||
$(eval $(call BuildPackage,ss))
|
||||
$(eval $(call BuildPackage,nstat))
|
||||
$(eval $(call BuildPackage,devlink))
|
||||
$(eval $(call BuildPackage,rdma))
|
||||
23
package/network/utils/iproute2/files/15-teql
Normal file
23
package/network/utils/iproute2/files/15-teql
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
config_load network
|
||||
|
||||
config_get teql $INTERFACE teql
|
||||
|
||||
if [ "$teql" != "" ]; then
|
||||
logger Adding device $DEVICE to TEQL master $teql
|
||||
insmod sch_teql
|
||||
tc qdisc add dev $DEVICE root $teql
|
||||
|
||||
# The kernel doesn't let us bring it up until it has at least one
|
||||
# slave. So bring it up now, if it isn't already.
|
||||
if ! cat /sys/class/net/$teql/carrier &>/dev/null; then
|
||||
ifup $teql &
|
||||
fi
|
||||
fi
|
||||
7
package/network/utils/iproute2/patches/001-config.patch
Normal file
7
package/network/utils/iproute2/patches/001-config.patch
Normal file
@@ -0,0 +1,7 @@
|
||||
--- /dev/null
|
||||
+++ b/Config
|
||||
@@ -0,0 +1,4 @@
|
||||
+# Fixed config to disable ATM support even if present on host system
|
||||
+IP_CONFIG_SETNS:=y
|
||||
+TC_CONFIG_ATM:=n
|
||||
+TC_CONFIG_XT:=y
|
||||
@@ -0,0 +1,288 @@
|
||||
From 8de9593bb9dc05cb1be593a237682e8707e41aa9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
|
||||
Date: Wed, 25 Apr 2018 16:19:35 +0200
|
||||
Subject: [PATCH] json_print: Fix hidden 64-bit type promotion
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
print_uint() will silently promote its variable type to uint64_t, but there
|
||||
is nothing that ensures that the format string specifier passed along with
|
||||
it fits (and the function name suggest to pass "%u").
|
||||
|
||||
Fix this by changing print_uint() to use a native 'unsigned int' type, and
|
||||
introduce a separate print_u64() function for printing 64-bit values. All
|
||||
call sites that were actually printing 64-bit values using print_uint() are
|
||||
converted to use print_u64() instead.
|
||||
|
||||
Since print_int() was already using native int types, just add a
|
||||
print_s64() to match, but don't convert any call sites.
|
||||
|
||||
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
include/json_print.h | 4 +++-
|
||||
include/json_writer.h | 12 ++++++----
|
||||
ip/ipaddress.c | 62 +++++++++++++++++++++++++--------------------------
|
||||
ip/ipmacsec.c | 8 +++----
|
||||
ip/ipmroute.c | 6 ++---
|
||||
lib/json_print.c | 4 +++-
|
||||
lib/json_writer.c | 30 +++++++++++++++++++++----
|
||||
7 files changed, 78 insertions(+), 48 deletions(-)
|
||||
|
||||
--- a/include/json_print.h
|
||||
+++ b/include/json_print.h
|
||||
@@ -56,10 +56,12 @@ void close_json_array(enum output_type t
|
||||
print_color_##type_name(t, COLOR_NONE, key, fmt, value); \
|
||||
}
|
||||
_PRINT_FUNC(int, int);
|
||||
+_PRINT_FUNC(s64, int64_t);
|
||||
_PRINT_FUNC(bool, bool);
|
||||
_PRINT_FUNC(null, const char*);
|
||||
_PRINT_FUNC(string, const char*);
|
||||
-_PRINT_FUNC(uint, uint64_t);
|
||||
+_PRINT_FUNC(uint, unsigned int);
|
||||
+_PRINT_FUNC(u64, uint64_t);
|
||||
_PRINT_FUNC(hu, unsigned short);
|
||||
_PRINT_FUNC(hex, unsigned int);
|
||||
_PRINT_FUNC(0xhex, unsigned int);
|
||||
--- a/include/json_writer.h
|
||||
+++ b/include/json_writer.h
|
||||
@@ -34,9 +34,11 @@ void jsonw_string(json_writer_t *self, c
|
||||
void jsonw_bool(json_writer_t *self, bool value);
|
||||
void jsonw_float(json_writer_t *self, double number);
|
||||
void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num);
|
||||
-void jsonw_uint(json_writer_t *self, uint64_t number);
|
||||
+void jsonw_uint(json_writer_t *self, unsigned int number);
|
||||
+void jsonw_u64(json_writer_t *self, uint64_t number);
|
||||
void jsonw_hu(json_writer_t *self, unsigned short number);
|
||||
-void jsonw_int(json_writer_t *self, int64_t number);
|
||||
+void jsonw_int(json_writer_t *self, int number);
|
||||
+void jsonw_s64(json_writer_t *self, int64_t number);
|
||||
void jsonw_null(json_writer_t *self);
|
||||
void jsonw_lluint(json_writer_t *self, unsigned long long int num);
|
||||
|
||||
@@ -44,9 +46,11 @@ void jsonw_lluint(json_writer_t *self, u
|
||||
void jsonw_string_field(json_writer_t *self, const char *prop, const char *val);
|
||||
void jsonw_bool_field(json_writer_t *self, const char *prop, bool value);
|
||||
void jsonw_float_field(json_writer_t *self, const char *prop, double num);
|
||||
-void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num);
|
||||
+void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num);
|
||||
+void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num);
|
||||
void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num);
|
||||
-void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num);
|
||||
+void jsonw_int_field(json_writer_t *self, const char *prop, int num);
|
||||
+void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num);
|
||||
void jsonw_null_field(json_writer_t *self, const char *prop);
|
||||
void jsonw_lluint_field(json_writer_t *self, const char *prop,
|
||||
unsigned long long int num);
|
||||
--- a/ip/ipaddress.c
|
||||
+++ b/ip/ipaddress.c
|
||||
@@ -555,21 +555,21 @@ static void print_vf_stats64(FILE *fp, s
|
||||
|
||||
/* RX stats */
|
||||
open_json_object("rx");
|
||||
- print_uint(PRINT_JSON, "bytes", NULL,
|
||||
+ print_u64(PRINT_JSON, "bytes", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES]));
|
||||
- print_uint(PRINT_JSON, "packets", NULL,
|
||||
+ print_u64(PRINT_JSON, "packets", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS]));
|
||||
- print_uint(PRINT_JSON, "multicast", NULL,
|
||||
+ print_u64(PRINT_JSON, "multicast", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST]));
|
||||
- print_uint(PRINT_JSON, "broadcast", NULL,
|
||||
+ print_u64(PRINT_JSON, "broadcast", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST]));
|
||||
close_json_object();
|
||||
|
||||
/* TX stats */
|
||||
open_json_object("tx");
|
||||
- print_uint(PRINT_JSON, "tx_bytes", NULL,
|
||||
+ print_u64(PRINT_JSON, "tx_bytes", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES]));
|
||||
- print_uint(PRINT_JSON, "tx_packets", NULL,
|
||||
+ print_u64(PRINT_JSON, "tx_packets", NULL,
|
||||
rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS]));
|
||||
close_json_object();
|
||||
close_json_object();
|
||||
@@ -602,50 +602,50 @@ static void print_link_stats64(FILE *fp,
|
||||
|
||||
/* RX stats */
|
||||
open_json_object("rx");
|
||||
- print_uint(PRINT_JSON, "bytes", NULL, s->rx_bytes);
|
||||
- print_uint(PRINT_JSON, "packets", NULL, s->rx_packets);
|
||||
- print_uint(PRINT_JSON, "errors", NULL, s->rx_errors);
|
||||
- print_uint(PRINT_JSON, "dropped", NULL, s->rx_dropped);
|
||||
- print_uint(PRINT_JSON, "over_errors", NULL, s->rx_over_errors);
|
||||
- print_uint(PRINT_JSON, "multicast", NULL, s->multicast);
|
||||
+ print_u64(PRINT_JSON, "bytes", NULL, s->rx_bytes);
|
||||
+ print_u64(PRINT_JSON, "packets", NULL, s->rx_packets);
|
||||
+ print_u64(PRINT_JSON, "errors", NULL, s->rx_errors);
|
||||
+ print_u64(PRINT_JSON, "dropped", NULL, s->rx_dropped);
|
||||
+ print_u64(PRINT_JSON, "over_errors", NULL, s->rx_over_errors);
|
||||
+ print_u64(PRINT_JSON, "multicast", NULL, s->multicast);
|
||||
if (s->rx_compressed)
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"compressed",
|
||||
NULL, s->rx_compressed);
|
||||
|
||||
/* RX error stats */
|
||||
if (show_stats > 1) {
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"length_errors",
|
||||
NULL, s->rx_length_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"crc_errors",
|
||||
NULL, s->rx_crc_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"frame_errors",
|
||||
NULL, s->rx_frame_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"fifo_errors",
|
||||
NULL, s->rx_fifo_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"missed_errors",
|
||||
NULL, s->rx_missed_errors);
|
||||
if (s->rx_nohandler)
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"nohandler", NULL, s->rx_nohandler);
|
||||
}
|
||||
close_json_object();
|
||||
|
||||
/* TX stats */
|
||||
open_json_object("tx");
|
||||
- print_uint(PRINT_JSON, "bytes", NULL, s->tx_bytes);
|
||||
- print_uint(PRINT_JSON, "packets", NULL, s->tx_packets);
|
||||
- print_uint(PRINT_JSON, "errors", NULL, s->tx_errors);
|
||||
- print_uint(PRINT_JSON, "dropped", NULL, s->tx_dropped);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON, "bytes", NULL, s->tx_bytes);
|
||||
+ print_u64(PRINT_JSON, "packets", NULL, s->tx_packets);
|
||||
+ print_u64(PRINT_JSON, "errors", NULL, s->tx_errors);
|
||||
+ print_u64(PRINT_JSON, "dropped", NULL, s->tx_dropped);
|
||||
+ print_u64(PRINT_JSON,
|
||||
"carrier_errors",
|
||||
NULL, s->tx_carrier_errors);
|
||||
- print_uint(PRINT_JSON, "collisions", NULL, s->collisions);
|
||||
+ print_u64(PRINT_JSON, "collisions", NULL, s->collisions);
|
||||
if (s->tx_compressed)
|
||||
print_uint(PRINT_JSON,
|
||||
"compressed",
|
||||
@@ -653,20 +653,20 @@ static void print_link_stats64(FILE *fp,
|
||||
|
||||
/* TX error stats */
|
||||
if (show_stats > 1) {
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"aborted_errors",
|
||||
NULL, s->tx_aborted_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"fifo_errors",
|
||||
NULL, s->tx_fifo_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"window_errors",
|
||||
NULL, s->tx_window_errors);
|
||||
- print_uint(PRINT_JSON,
|
||||
+ print_u64(PRINT_JSON,
|
||||
"heartbeat_errors",
|
||||
NULL, s->tx_heartbeat_errors);
|
||||
if (carrier_changes)
|
||||
- print_uint(PRINT_JSON, "carrier_changes", NULL,
|
||||
+ print_u64(PRINT_JSON, "carrier_changes", NULL,
|
||||
rta_getattr_u32(carrier_changes));
|
||||
}
|
||||
close_json_object();
|
||||
--- a/lib/json_print.c
|
||||
+++ b/lib/json_print.c
|
||||
@@ -117,8 +117,10 @@ void close_json_array(enum output_type t
|
||||
} \
|
||||
}
|
||||
_PRINT_FUNC(int, int);
|
||||
+_PRINT_FUNC(s64, int64_t);
|
||||
_PRINT_FUNC(hu, unsigned short);
|
||||
-_PRINT_FUNC(uint, uint64_t);
|
||||
+_PRINT_FUNC(uint, unsigned int);
|
||||
+_PRINT_FUNC(u64, uint64_t);
|
||||
_PRINT_FUNC(lluint, unsigned long long int);
|
||||
_PRINT_FUNC(float, double);
|
||||
#undef _PRINT_FUNC
|
||||
--- a/lib/json_writer.c
|
||||
+++ b/lib/json_writer.c
|
||||
@@ -215,7 +215,12 @@ void jsonw_hu(json_writer_t *self, unsig
|
||||
jsonw_printf(self, "%hu", num);
|
||||
}
|
||||
|
||||
-void jsonw_uint(json_writer_t *self, uint64_t num)
|
||||
+void jsonw_uint(json_writer_t *self, unsigned int num)
|
||||
+{
|
||||
+ jsonw_printf(self, "%u", num);
|
||||
+}
|
||||
+
|
||||
+void jsonw_u64(json_writer_t *self, uint64_t num)
|
||||
{
|
||||
jsonw_printf(self, "%"PRIu64, num);
|
||||
}
|
||||
@@ -225,7 +230,12 @@ void jsonw_lluint(json_writer_t *self, u
|
||||
jsonw_printf(self, "%llu", num);
|
||||
}
|
||||
|
||||
-void jsonw_int(json_writer_t *self, int64_t num)
|
||||
+void jsonw_int(json_writer_t *self, int num)
|
||||
+{
|
||||
+ jsonw_printf(self, "%d", num);
|
||||
+}
|
||||
+
|
||||
+void jsonw_s64(json_writer_t *self, int64_t num)
|
||||
{
|
||||
jsonw_printf(self, "%"PRId64, num);
|
||||
}
|
||||
@@ -258,12 +268,18 @@ void jsonw_float_field_fmt(json_writer_t
|
||||
jsonw_float_fmt(self, fmt, val);
|
||||
}
|
||||
|
||||
-void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num)
|
||||
+void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num)
|
||||
{
|
||||
jsonw_name(self, prop);
|
||||
jsonw_uint(self, num);
|
||||
}
|
||||
|
||||
+void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num)
|
||||
+{
|
||||
+ jsonw_name(self, prop);
|
||||
+ jsonw_u64(self, num);
|
||||
+}
|
||||
+
|
||||
void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num)
|
||||
{
|
||||
jsonw_name(self, prop);
|
||||
@@ -278,12 +294,18 @@ void jsonw_lluint_field(json_writer_t *s
|
||||
jsonw_lluint(self, num);
|
||||
}
|
||||
|
||||
-void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num)
|
||||
+void jsonw_int_field(json_writer_t *self, const char *prop, int num)
|
||||
{
|
||||
jsonw_name(self, prop);
|
||||
jsonw_int(self, num);
|
||||
}
|
||||
|
||||
+void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num)
|
||||
+{
|
||||
+ jsonw_name(self, prop);
|
||||
+ jsonw_s64(self, num);
|
||||
+}
|
||||
+
|
||||
void jsonw_null_field(json_writer_t *self, const char *prop)
|
||||
{
|
||||
jsonw_name(self, prop);
|
||||
@@ -0,0 +1,59 @@
|
||||
--- a/netem/maketable.c
|
||||
+++ b/netem/maketable.c
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
+#endif
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
--- a/netem/normal.c
|
||||
+++ b/netem/normal.c
|
||||
@@ -8,8 +8,12 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
#define TABLESIZE 16384
|
||||
#define TABLEFACTOR NETEM_DIST_SCALE
|
||||
--- a/netem/pareto.c
|
||||
+++ b/netem/pareto.c
|
||||
@@ -7,8 +7,12 @@
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
static const double a=3.0;
|
||||
#define TABLESIZE 16384
|
||||
--- a/netem/paretonormal.c
|
||||
+++ b/netem/paretonormal.c
|
||||
@@ -14,10 +14,13 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
-
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
#define TABLESIZE 16384
|
||||
#define TABLEFACTOR NETEM_DIST_SCALE
|
||||
15
package/network/utils/iproute2/patches/007-no_arpd.patch
Normal file
15
package/network/utils/iproute2/patches/007-no_arpd.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
--- a/misc/Makefile
|
||||
+++ b/misc/Makefile
|
||||
@@ -6,9 +6,9 @@ TARGETS=ss nstat ifstat rtacct lnstat
|
||||
|
||||
include ../config.mk
|
||||
|
||||
-ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
- TARGETS += arpd
|
||||
-endif
|
||||
+#ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
+# TARGETS += arpd
|
||||
+#endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
11
package/network/utils/iproute2/patches/008-no_netem.patch
Normal file
11
package/network/utils/iproute2/patches/008-no_netem.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -57,7 +57,7 @@ WFLAGS += -Wmissing-declarations -Wold-s
|
||||
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
|
||||
YACCFLAGS = -d -t -v
|
||||
|
||||
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
|
||||
+SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma man
|
||||
|
||||
LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
|
||||
LDLIBS += $(LIBNETLINK)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -281,7 +281,7 @@ check_selinux()
|
||||
|
||||
check_mnl()
|
||||
{
|
||||
- if ${PKG_CONFIG} libmnl --exists
|
||||
+ if [ "${HAVE_MNL}" = "y" ] && ${PKG_CONFIG} libmnl --exists
|
||||
then
|
||||
echo "HAVE_MNL:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
@@ -0,0 +1,9 @@
|
||||
--- a/tc/q_fifo.c
|
||||
+++ b/tc/q_fifo.c
|
||||
@@ -97,5 +97,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
|
||||
extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
|
||||
struct qdisc_util pfifo_fast_qdisc_util = {
|
||||
.id = "pfifo_fast",
|
||||
+ .parse_qopt = fifo_parse_opt,
|
||||
.print_qopt = prio_print_opt,
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -50,7 +50,7 @@ HOSTCC ?= $(CC)
|
||||
DEFINES += -D_GNU_SOURCE
|
||||
# Turn on transparent support for LFS
|
||||
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
||||
-CCOPTS = -O2
|
||||
+CCOPTS = -O2 $(EXTRA_CCOPTS)
|
||||
WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
|
||||
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
include ../config.mk
|
||||
|
||||
-CFLAGS += -fPIC
|
||||
+CFLAGS += $(FPIC)
|
||||
|
||||
UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \
|
||||
inet_proto.o namespace.o json_writer.o json_print.o \
|
||||
120
package/network/utils/iproute2/patches/300-ip_tiny.patch
Normal file
120
package/network/utils/iproute2/patches/300-ip_tiny.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
--- a/ip/Makefile
|
||||
+++ b/ip/Makefile
|
||||
@@ -16,6 +16,13 @@ RTMONOBJ=rtmon.o
|
||||
|
||||
include ../config.mk
|
||||
|
||||
+STATIC_SYM_FILTER:=
|
||||
+ifeq ($(IP_CONFIG_TINY),y)
|
||||
+ STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
|
||||
+ CFLAGS += -DIPROUTE2_TINY
|
||||
+endif
|
||||
+STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
|
||||
+
|
||||
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
||||
SCRIPTS=ifcfg rtpr routel routef
|
||||
TARGETS=ip rtmon
|
||||
@@ -45,7 +52,7 @@ else
|
||||
|
||||
ip: static-syms.o
|
||||
static-syms.o: static-syms.h
|
||||
-static-syms.h: $(wildcard *.c)
|
||||
+static-syms.h: $(STATIC_SYM_SOURCES)
|
||||
files="$^" ; \
|
||||
for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
|
||||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
||||
--- a/ip/ip.c
|
||||
+++ b/ip/ip.c
|
||||
@@ -48,10 +48,16 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
+#ifndef IPROUTE2_TINY
|
||||
"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
|
||||
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
|
||||
" netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
|
||||
" vrf | sr }\n"
|
||||
+#else
|
||||
+"where OBJECT := { link | address | route | rule | neigh | tunnel | maddress |\n"
|
||||
+" mroute | mrule | monitor | netns | macsec | token | ila |\n"
|
||||
+" vrf | sr }\n"
|
||||
+#endif
|
||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
||||
" -h[uman-readable] | -iec |\n"
|
||||
" -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |\n"
|
||||
@@ -73,32 +79,44 @@ static const struct cmd {
|
||||
int (*func)(int argc, char **argv);
|
||||
} cmds[] = {
|
||||
{ "address", do_ipaddr },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "addrlabel", do_ipaddrlabel },
|
||||
+#endif
|
||||
{ "maddress", do_multiaddr },
|
||||
{ "route", do_iproute },
|
||||
{ "rule", do_iprule },
|
||||
{ "neighbor", do_ipneigh },
|
||||
{ "neighbour", do_ipneigh },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "ntable", do_ipntable },
|
||||
{ "ntbl", do_ipntable },
|
||||
+#endif
|
||||
{ "link", do_iplink },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "l2tp", do_ipl2tp },
|
||||
{ "fou", do_ipfou },
|
||||
+#endif
|
||||
{ "ila", do_ipila },
|
||||
{ "macsec", do_ipmacsec },
|
||||
{ "tunnel", do_iptunnel },
|
||||
{ "tunl", do_iptunnel },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "tuntap", do_iptuntap },
|
||||
{ "tap", do_iptuntap },
|
||||
{ "token", do_iptoken },
|
||||
{ "tcpmetrics", do_tcp_metrics },
|
||||
{ "tcp_metrics", do_tcp_metrics },
|
||||
+#endif
|
||||
{ "monitor", do_ipmonitor },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "xfrm", do_xfrm },
|
||||
+#endif
|
||||
{ "mroute", do_multiroute },
|
||||
{ "mrule", do_multirule },
|
||||
{ "netns", do_netns },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "netconf", do_ipnetconf },
|
||||
+#endif
|
||||
{ "vrf", do_ipvrf},
|
||||
{ "sr", do_seg6 },
|
||||
{ "help", do_help },
|
||||
--- a/lib/utils.c
|
||||
+++ b/lib/utils.c
|
||||
@@ -983,6 +983,7 @@ const char *rt_addr_n2a_r(int af, int le
|
||||
return inet_ntop(af, addr, buf, buflen);
|
||||
case AF_MPLS:
|
||||
return mpls_ntop(af, addr, buf, buflen);
|
||||
+#ifndef IPROUTE2_TINY
|
||||
case AF_IPX:
|
||||
return ipx_ntop(af, addr, buf, buflen);
|
||||
case AF_DECnet:
|
||||
@@ -992,6 +993,7 @@ const char *rt_addr_n2a_r(int af, int le
|
||||
memcpy(dna.a_addr, addr, 2);
|
||||
return dnet_ntop(af, &dna, buf, buflen);
|
||||
}
|
||||
+#endif
|
||||
case AF_PACKET:
|
||||
return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen);
|
||||
case AF_BRIDGE:
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -3,6 +3,10 @@ include ../config.mk
|
||||
|
||||
CFLAGS += $(FPIC)
|
||||
|
||||
+ifeq ($(IP_CONFIG_TINY),y)
|
||||
+ CFLAGS += -DIPROUTE2_TINY
|
||||
+endif
|
||||
+
|
||||
UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \
|
||||
inet_proto.o namespace.o json_writer.o json_print.o \
|
||||
names.o color.o bpf.o exec.o fs.o
|
||||
@@ -0,0 +1,41 @@
|
||||
From 4e7dbf76227e8c7be7897dc81def3011f637864d Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Thu, 30 May 2013 11:54:04 +0200
|
||||
Subject: [PATCH] add support for dropping with FAILED_POLICY
|
||||
|
||||
---
|
||||
include/linux/fib_rules.h | 4 ++++
|
||||
include/linux/rtnetlink.h | 1 +
|
||||
ip/rtm_map.c | 4 ++++
|
||||
3 files changed, 9 insertions(+)
|
||||
|
||||
--- a/ip/rtm_map.c
|
||||
+++ b/ip/rtm_map.c
|
||||
@@ -48,6 +48,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
|
||||
return "nat";
|
||||
case RTN_XRESOLVE:
|
||||
return "xresolve";
|
||||
+ case RTN_FAILED_POLICY:
|
||||
+ return "failed_policy";
|
||||
default:
|
||||
snprintf(buf, len, "%d", id);
|
||||
return buf;
|
||||
@@ -83,6 +85,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
|
||||
res = RTN_UNICAST;
|
||||
else if (strcmp(arg, "throw") == 0)
|
||||
res = RTN_THROW;
|
||||
+ else if (strcmp(arg, "failed_policy") == 0)
|
||||
+ res = RTN_FAILED_POLICY;
|
||||
else {
|
||||
res = strtoul(arg, &end, 0);
|
||||
if (!end || end == arg || *end || res > 255)
|
||||
--- a/include/uapi/linux/rtnetlink.h
|
||||
+++ b/include/uapi/linux/rtnetlink.h
|
||||
@@ -221,6 +221,7 @@ enum {
|
||||
RTN_THROW, /* Not in this table */
|
||||
RTN_NAT, /* Translate this address */
|
||||
RTN_XRESOLVE, /* Use external resolver */
|
||||
+ RTN_FAILED_POLICY, /* Source address failed policy */
|
||||
__RTN_MAX
|
||||
};
|
||||
|
||||
1673
package/network/utils/iproute2/patches/950-add-cake-to-tc.patch
Normal file
1673
package/network/utils/iproute2/patches/950-add-cake-to-tc.patch
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user