2 # Copyright (C) 2006-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.xz
15 PKG_SOURCE_URL
:=@KERNEL
/linux
/utils
/net
/iproute2
16 PKG_HASH
:=8738c804afd09f0bf756937f0c3de23117832a98d8cbbf50386cf5005cd613ce
18 PKG_BUILD_DEPENDS
:=iptables
20 PKG_CPE_ID
:=cpe
:/a
:iproute2_project
:iproute2
22 PKG_BUILD_FLAGS
:=gc-sections lto
24 include $(INCLUDE_DIR
)/kernel.mk
25 include $(INCLUDE_DIR
)/package.mk
26 include $(INCLUDE_DIR
)/nls.mk
28 define Package
/iproute2
/Default
31 URL
:=http
://www.linuxfoundation.org
/collaborate
/workgroups
/networking
/iproute2
32 SUBMENU
:=Routing and Redirection
33 MAINTAINER
:=Russell Senior
<russell@personaltelco.net
>
36 define Package
/ip-tiny
37 $(call Package
/iproute2
/Default
)
38 TITLE
:=Routing control utility
(minimal
)
42 ALTERNATIVES
:=200:/sbin
/ip
:/usr
/libexec
/ip-tiny
43 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
46 define Package
/ip-full
47 $(call Package
/iproute2
/Default
)
48 TITLE
:=Routing control utility
(full
)
51 ALTERNATIVES
:=300:/sbin
/ip
:/usr
/libexec
/ip-full
52 DEPENDS
:=+libnl-tiny
+libbpf
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
55 define Package
/tc-tiny
56 $(call Package
/iproute2
/Default
)
57 TITLE
:=Traffic control utility
(minimal
)
61 ALTERNATIVES
:=200:/sbin
/tc
:/usr
/libexec
/tc-tiny
62 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
66 $(call Package
/iproute2
/Default
)
67 TITLE
:=Traffic control utility
(bpf
)
70 ALTERNATIVES
:=300:/sbin
/tc
:/usr
/libexec
/tc-bpf
71 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+libbpf
74 define Package
/tc-full
75 $(call Package
/iproute2
/Default
)
76 TITLE
:=Traffic control utility
(full
)
79 ALTERNATIVES
:=400:/sbin
/tc
:/usr
/libexec
/tc-full
80 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+libbpf
+libxtables
+tc-mod-iptables
83 define Package
/tc-mod-iptables
84 $(call Package
/iproute2
/Default
)
85 TITLE
:=Traffic control module
- iptables action
87 DEPENDS
:=+libxtables
+libbpf
91 $(call Package
/iproute2
/Default
)
92 TITLE
:=General netlink utility frontend
93 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
96 define Package
/ip-bridge
97 $(call Package
/iproute2
/Default
)
98 TITLE
:=Bridge configuration utility from iproute2
99 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
103 $(call Package
/iproute2
/Default
)
104 TITLE
:=Socket statistics utility
105 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+kmod-netlink-diag
109 $(call Package
/iproute2
/Default
)
110 TITLE
:=Network statistics utility
111 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
114 define Package
/devlink
115 $(call Package
/iproute2
/Default
)
116 TITLE
:=Network devlink utility
121 $(call Package
/iproute2
/Default
)
122 TITLE
:=Network rdma utility
126 ifeq ($(BUILD_VARIANT
),iptiny
)
131 ifeq ($(BUILD_VARIANT
),ipfull
)
136 ifeq ($(BUILD_VARIANT
),tctiny
)
140 ifeq ($(BUILD_VARIANT
),tcbpf
)
146 ifeq ($(BUILD_VARIANT
),tcfull
)
147 #enable iptables/xtables requirement only if tciptables variant is selected
150 TC_CONFIG_XT_OLD_H
:=y
156 #disable iptables requirement by default
159 TC_CONFIG_XT_OLD_H
:=n
163 ifdef CONFIG_PACKAGE_devlink
167 ifdef CONFIG_PACKAGE_rdma
171 define Build
/Configure
172 echo
"static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
173 > $(PKG_BUILD_DIR
)/include/SNAPSHOT.h
176 TARGET_LDFLAGS
+= -Wl
,--as-needed
177 TARGET_CPPFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
180 KERNEL_INCLUDE
="$(LINUX_DIR)/include/uapi" \
181 SHARED_LIBS
=$(SHARED_LIBS
) \
182 IP_CONFIG_TINY
=$(IP_CONFIG_TINY
) \
183 BUILD_VARIANT
=$(BUILD_VARIANT
) \
184 LIBBPF_FORCE
=$(LIBBPF_FORCE
) \
185 HAVE_ELF
=$(HAVE_ELF
) \
186 HAVE_MNL
=$(HAVE_MNL
) \
187 HAVE_CAP
=$(HAVE_CAP
) \
189 IPT_LIB_DIR
=/usr
/lib
/iptables \
190 XT_LIB_DIR
=/usr
/lib
/iptables \
191 TC_CONFIG_XT
=$(TC_CONFIG_XT
) \
192 TC_CONFIG_XT_OLD
=$(TC_CONFIG_XT_OLD
) \
193 TC_CONFIG_XT_OLD_H
=$(TC_CONFIG_XT_OLD_H
) \
194 TC_CONFIG_IPSET
=$(TC_CONFIG_IPSET
) \
196 $(if
$(findstring c
,$(OPENWRT_VERBOSE
)),V
=1,V
='')
199 +$(MAKE_VARS
) $(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) $(MAKE_FLAGS
)
202 define Build
/InstallDev
203 $(INSTALL_DIR
) $(1)/usr
/include/iproute2
204 $(CP
) $(PKG_BUILD_DIR
)/include/bpf_elf.h
$(1)/usr
/include/iproute2
205 $(CP
) $(PKG_BUILD_DIR
)/include/{libgenl
,libnetlink
}.h
$(1)/usr
/include/
206 $(INSTALL_DIR
) $(1)/usr
/lib
207 $(CP
) $(PKG_BUILD_DIR
)/lib
/libnetlink.a
$(1)/usr
/lib
/
210 define Package
/ip-tiny
/install
211 $(INSTALL_DIR
) $(1)/usr
/libexec
212 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/ip
/ip
$(1)/usr
/libexec
/ip-tiny
215 define Package
/ip-full
/install
216 $(INSTALL_DIR
) $(1)/usr
/libexec
217 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/ip
/ip
$(1)/usr
/libexec
/ip-full
220 define Package
/tc-tiny
/install
221 $(INSTALL_DIR
) $(1)/usr
/libexec
222 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-tiny
225 define Package
/tc-bpf
/install
226 $(INSTALL_DIR
) $(1)/usr
/libexec
227 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-bpf
230 define Package
/tc-full
/install
231 $(INSTALL_DIR
) $(1)/usr
/libexec
232 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-full
235 define Package
/tc-mod-iptables
/install
236 $(INSTALL_DIR
) $(1)/usr
/lib
/tc
237 $(CP
) $(PKG_BUILD_DIR
)/tc
/m_xt.so
$(1)/usr
/lib
/tc
240 define Package
/genl
/install
241 $(INSTALL_DIR
) $(1)/usr
/sbin
242 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/genl
/genl
$(1)/usr
/sbin
/
245 define Package
/ip-bridge
/install
246 $(INSTALL_DIR
) $(1)/usr
/sbin
247 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/bridge
/bridge
$(1)/usr
/sbin
/
250 define Package
/ss
/install
251 $(INSTALL_DIR
) $(1)/usr
/sbin
252 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/misc
/ss
$(1)/usr
/sbin
/
255 define Package
/nstat
/install
256 $(INSTALL_DIR
) $(1)/usr
/sbin
257 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/misc
/nstat
$(1)/usr
/sbin
/
260 define Package
/devlink
/install
261 $(INSTALL_DIR
) $(1)/usr
/sbin
262 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/devlink
/devlink
$(1)/usr
/sbin
/
265 define Package
/rdma
/install
266 $(INSTALL_DIR
) $(1)/usr
/sbin
267 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/rdma
/rdma
$(1)/usr
/sbin
/
270 $(eval
$(call BuildPackage
,ip-tiny
))
271 $(eval
$(call BuildPackage
,ip-full
))
272 # build tc-mod-iptables before its dependents, to avoid
273 # spurious rebuilds when building multiple variants.
274 $(eval
$(call BuildPackage
,tc-mod-iptables
))
275 $(eval
$(call BuildPackage
,tc-tiny
))
276 $(eval
$(call BuildPackage
,tc-bpf
))
277 $(eval
$(call BuildPackage
,tc-full
))
278 $(eval
$(call BuildPackage
,genl
))
279 $(eval
$(call BuildPackage
,ip-bridge
))
280 $(eval
$(call BuildPackage
,ss
))
281 $(eval
$(call BuildPackage
,nstat
))
282 $(eval
$(call BuildPackage
,devlink
))
283 $(eval
$(call BuildPackage
,rdma
))