Skip to content

Commit

Permalink
iproute2: re-apply BCM/Asus patches from iproute2-4.3.0 on top of 5.1…
Browse files Browse the repository at this point in the history
…1.0; disable building unused components
  • Loading branch information
RMerl committed Mar 4, 2021
1 parent d77c21f commit 2311706
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 27 deletions.
18 changes: 11 additions & 7 deletions release/src/router/iproute2-4.3/iproute2-5.11.0/Makefile
Expand Up @@ -14,16 +14,18 @@ endif

PREFIX?=/usr
LIBDIR?=$(PREFIX)/lib
SBINDIR?=/sbin
CONFDIR?=/etc/iproute2
SBINDIR=$(INSTALL_DIR)/bin
CONFDIR=$(INSTALL_DIR)/etc/iproute2
NETNS_RUN_DIR?=/var/run/netns
NETNS_ETC_DIR?=/etc/netns
DATADIR?=$(PREFIX)/share
HDRDIR?=$(PREFIX)/include/iproute2
DOCDIR?=$(DATADIR)/doc/iproute2
MANDIR?=$(DATADIR)/man
ARPDDIR?=/var/lib/arpd
KERNEL_INCLUDE?=/usr/include
# brcm: modify the KERNEL_INCLUDES and add LIBC_INCLUDE
KERNEL_INCLUDES:=$(KERNEL_DIR)/include $(KERNEL_DIR)/arch/$(ARCH)/include
LIBC_INCLUDE=$(KERNEL_DIR)/include/linux
BASH_COMPDIR?=$(DATADIR)/bash-completion/completions

# Path to db_185.h include
Expand All @@ -41,7 +43,8 @@ DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \
-DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\"

#options for mpls
ADDLIB+=mpls_ntop.o mpls_pton.o
# brcm: not support mpls
#ADDLIB+=mpls_ntop.o mpls_pton.o

CC := gcc
HOSTCC ?= $(CC)
Expand All @@ -52,12 +55,13 @@ CCOPTS = -O2 -pipe
WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2

CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES)
YACCFLAGS = -d -t -v

SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
#bcm
SUBDIRS=lib ip tc #bridge misc netem genl tipc devlink rdma dcb man vdpa

LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LIBNETLINK=../lib/libipr2util.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)

all: config.mk
Expand Down
24 changes: 12 additions & 12 deletions release/src/router/iproute2-4.3/iproute2-5.11.0/configure
Expand Up @@ -492,26 +492,26 @@ fi
echo -n "libc has setns: "
check_setns

echo -n "SELinux support: "
check_selinux
#echo -n "SELinux support: "
#check_selinux

echo -n "libbpf support: "
check_libbpf
#echo -n "libbpf support: "
#check_libbpf

echo -n "ELF support: "
check_elf
#echo -n "ELF support: "
#check_elf

echo -n "libmnl support: "
check_mnl
#echo -n "libmnl support: "
#check_mnl

echo -n "Berkeley DB: "
check_berkeley_db
#echo -n "Berkeley DB: "
#check_berkeley_db

echo -n "need for strlcpy: "
check_strlcpy

echo -n "libcap support: "
check_cap
#echo -n "libcap support: "
#check_cap

echo >> $CONFIG
echo "%.o: %.c" >> $CONFIG
Expand Down
Expand Up @@ -112,6 +112,7 @@ struct ip_tunnel_6rd {
__be32 relay_prefix;
__u16 prefixlen;
__u16 relay_prefixlen;
__be32 br_addr; // brcm
};

enum {
Expand Down
Expand Up @@ -123,7 +123,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
if (get_u32(&bt.bitrate, *argv, 0))
invarg("invalid \"bitrate\" value\n", *argv);
} else if (matches(*argv, "sample-point") == 0) {
float sp;
float sp=0.0f; // brcm

NEXT_ARG();
if (get_float(&sp, *argv))
Expand Down
8 changes: 8 additions & 0 deletions release/src/router/iproute2-4.3/iproute2-5.11.0/ip/iptunnel.c
Expand Up @@ -502,6 +502,14 @@ static int do_6rd(int argc, char **argv)
cmd = SIOCADD6RD;
memcpy(&ip6rd.relay_prefix, prefix.data, 4);
ip6rd.relay_prefixlen = prefix.bitlen;
// brcm: start
} else if (strcmp(*argv, "6rd-br_addr") == 0) {
NEXT_ARG();
if (get_prefix(&prefix, *argv, AF_INET))
invarg("invalid 6rd-br_addr\n", *argv);
cmd = SIOCADD6RD;
memcpy(&ip6rd.br_addr, prefix.data, 4);
// brcm: end
} else if (strcmp(*argv, "6rd-reset") == 0) {
cmd = SIOCDEL6RD;
} else if (strcmp(*argv, "dev") == 0) {
Expand Down
9 changes: 5 additions & 4 deletions release/src/router/iproute2-4.3/iproute2-5.11.0/lib/Makefile
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
include ../config.mk

CFLAGS += -fPIC
# brcm: comment out.
# CFLAGS += -fPIC

UTILOBJ = utils.o utils_math.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \
inet_proto.o namespace.o json_writer.o json_print.o json_print_math.o \
Expand All @@ -18,15 +19,15 @@ ifeq ($(HAVE_MNL),y)
NLOBJ += mnl_utils.o
endif

all: libnetlink.a libutil.a
all: libnetlink.a libipr2util.a

libnetlink.a: $(NLOBJ)
$(QUIET_AR)$(AR) rcs $@ $^

libutil.a: $(UTILOBJ) $(ADDLIB)
libipr2util.a: $(UTILOBJ) $(ADDLIB)
$(QUIET_AR)$(AR) rcs $@ $^

install:

clean:
rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libipr2util.a
15 changes: 14 additions & 1 deletion release/src/router/iproute2-4.3/iproute2-5.11.0/lib/utils.c
Expand Up @@ -559,6 +559,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
return 0;
}

#if 0 // brcm: not support
if (family == AF_PACKET) {
int len;

Expand All @@ -572,7 +573,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
addr->bitlen = len * 8;
return 0;
}

#endif
if (strchr(name, ':')) {
addr->family = AF_INET6;
if (family != AF_UNSPEC && family != AF_INET6)
Expand All @@ -584,6 +585,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
return 0;
}

#if 0 // brcm: not support
if (family == AF_MPLS) {
unsigned int maxlabels;
int i;
Expand All @@ -604,6 +606,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
}
return 0;
}
#endif

addr->family = AF_INET;
if (family != AF_UNSPEC && family != AF_INET)
Expand Down Expand Up @@ -636,12 +639,14 @@ int af_bit_len(int af)
return 128;
case AF_INET:
return 32;
#if 0 // brcm: not support
case AF_DECnet:
return 16;
case AF_IPX:
return 80;
case AF_MPLS:
return 20;
#endif
}

return 0;
Expand Down Expand Up @@ -729,6 +734,7 @@ int get_addr_rta(inet_prefix *dst, const struct rtattr *rta, int family)
dst->bytelen = 16;
memcpy(dst->data, data, 16);
break;
#if 0 // brcm: not support
case 2:
dst->family = AF_DECnet;
dst->bytelen = 2;
Expand All @@ -739,6 +745,7 @@ int get_addr_rta(inet_prefix *dst, const struct rtattr *rta, int family)
dst->bytelen = 10;
memcpy(dst->data, data, 10);
break;
#endif
default:
return -1;
}
Expand Down Expand Up @@ -984,6 +991,7 @@ const char *rt_addr_n2a_r(int af, int len,
case AF_INET:
case AF_INET6:
return inet_ntop(af, addr, buf, buflen);
#if 0 // brcm: not support
case AF_MPLS:
return mpls_ntop(af, addr, buf, buflen);
case AF_PACKET:
Expand All @@ -1007,6 +1015,7 @@ const char *rt_addr_n2a_r(int af, int len,

/* fallthrough */
}
#endif
default:
return "???";
}
Expand All @@ -1029,10 +1038,12 @@ int read_family(const char *name)
family = AF_INET6;
else if (strcmp(name, "link") == 0)
family = AF_PACKET;
#if 0 // brcm: not support
else if (strcmp(name, "ipx") == 0)
family = AF_IPX;
else if (strcmp(name, "mpls") == 0)
family = AF_MPLS;
#endif
else if (strcmp(name, "bridge") == 0)
family = AF_BRIDGE;
return family;
Expand All @@ -1046,10 +1057,12 @@ const char *family_name(int family)
return "inet6";
if (family == AF_PACKET)
return "link";
#if 0 // brcm: not support
if (family == AF_IPX)
return "ipx";
if (family == AF_MPLS)
return "mpls";
#endif
if (family == AF_BRIDGE)
return "bridge";
return "???";
Expand Down
4 changes: 2 additions & 2 deletions release/src/router/iproute2-4.3/iproute2-5.11.0/tc/q_cake.c
Expand Up @@ -675,7 +675,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,

/* class stats */
if (st[TCA_CAKE_STATS_DEFICIT])
print_int(PRINT_ANY, "deficit", " deficit %d",
print_int(PRINT_ANY, "deficit", " deficit %u",
GET_STAT_S32(DEFICIT));
if (st[TCA_CAKE_STATS_COBALT_COUNT])
print_uint(PRINT_ANY, "count", " count %u",
Expand All @@ -688,7 +688,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,

if (drop_next < 0) {
print_string(PRINT_FP, NULL, " drop_next -%s",
sprint_time(-drop_next, b1));
sprint_time(drop_next, b1));
} else {
print_uint(PRINT_JSON, "drop_next", NULL,
drop_next);
Expand Down

0 comments on commit 2311706

Please sign in to comment.