summaryrefslogtreecommitdiff
path: root/configure
AgeCommit message (Collapse)Author
2022-12-29configure: Remove include <sys/stat.h>Hauke Mehrtens
The check_name_to_handle_at() function in the configure script is including sys/stat.h. This include fails with glibc 2.36 like this: ```` In file included from /linux-5.15.84/include/uapi/linux/stat.h:5, from /toolchain-x86_64_gcc-12.2.0_glibc/include/bits/statx.h:31, from /toolchain-x86_64_gcc-12.2.0_glibc/include/sys/stat.h:465, from config.YExfMc/name_to_handle_at_test.c:3: /linux-5.15.84/include/uapi/linux/types.h:10:2: warning: #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" [-Wcpp] 10 | #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" | ^~~~~~~ In file included from /linux-5.15.84/include/uapi/linux/posix_types.h:5, from /linux-5.15.84/include/uapi/linux/types.h:14: /linux-5.15.84/include/uapi/linux/stddef.h:5:10: fatal error: linux/compiler_types.h: No such file or directory 5 | #include <linux/compiler_types.h> | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. ```` Just removing the include works, the manpage of name_to_handle_at() says only fcntl.h is needed. Fixes: c5b72cc56bf8 ("lib/fs: fix issue when {name,open}_to_handle_at() is not implemented") Tested-by: Heiko Thiery <heiko.thiery@gmail.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2022-08-12configure: Define _GNU_SOURCE when checking for setnsKhem Raj
glibc defines this function only as gnu extention Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2022-03-23configure: add check_libtirpc()Andrea Claudi
This patch adds a configure function to check if libtirpc is installed on the build system. If this is the case, it makes iproute2 to compile with libtirpc support. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
2022-03-08Revert "configure: Allow command line override of toolchain"David Ahern
This reverts commit 386ae64c8312dd27b09508993a7c8386aff8b1d3. Ido reported compile breakage on Fedora with this patch, so reverting. Signed-off-by: David Ahern <dsahern@kernel.org>
2022-02-28configure: Allow command line override of toolchainDavid Ahern
Easy way to build for both gcc and clang. Signed-off-by: David Ahern <dsahern@kernel.org> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2021-10-15configure: add the --libdir optionAndrea Claudi
This commit allows users/packagers to choose a lib directory to store iproute2 lib files. At the moment iproute2 ship lib files in /usr/lib and offers no way to modify this setting. However, according to the FHS, distros may choose "one or more variants of the /lib directory on systems which support more than one binary format" (e.g. /usr/lib64 on Fedora). As Luca states in commit a3272b93725a ("configure: restore backward compatibility"), packaging systems may assume that 'configure' is from autotools, and try to pass it some parameters. Allowing the '--libdir=/path/to/libdir' syntax, we can use this to our advantage, and let the lib directory to be chosen by the distro packaging system. Note that LIBDIR uses "\${prefix}/lib" as default value because autoconf allows this to be expanded to the --prefix value at configure runtime. "\${prefix}" is replaced with the PREFIX value in check_lib_dir(). Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: add the --prefix optionAndrea Claudi
This commit add the '--prefix' option to the iproute2 configure script. This mimics the '--prefix' option that autotools configure provides, and will be used later to allow users or packagers to set the lib directory. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: support --param=value styleAndrea Claudi
This commit makes it possible to specify values for configure params using the common autotools configure syntax '--param=value'. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: simplify options parsingAndrea Claudi
This commit simplifies options parsing moving all the code not related to parsing out of the case statement. - The conditional shift after the assignments is moved right after the case, reducing code duplication. - The semantic checks on the LIBBPF_FORCE value is moved after the loop like we already did for INCLUDE and LIBBPF_DIR. - Finally, the loop condition is changed to check remaining arguments, thus making it possible to get rid of the null string case break. As a bonus, now the help message states that on or off should follow --libbpf_force Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: fix parsing issue with more than one value per optionAndrea Claudi
With commit a9c3d70d902a ("configure: add options ability") users are no more able to provide wrong command lines like: $ ./configure --include_dir foo bar The script simply bails out when user provides more than one value for a single option. However, in doing so, it breaks backward compatibility with some packaging system, which expects unknown options to be ignored. Commit a3272b93725a ("configure: restore backward compatibility") fix this issue, but makes it possible again for users to provide wrong command lines such as the one above. This fixes the issue simply ignoring autoconf-like options such as '--opt=value'. Fixes: a3272b93725a ("configure: restore backward compatibility") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: fix parsing issue on libbpf_dir optionAndrea Claudi
configure is stuck in an endless loop if '--libbpf_dir' option is used without a value: $ ./configure --libbpf_dir ./configure: line 515: shift: 2: shift count out of range ./configure: line 515: shift: 2: shift count out of range [...] Fix it splitting 'shift 2' into two consecutive shifts, and making the second one conditional to the number of remaining arguments. A check is also provided after the while loop to verify the libbpf dir exists; also, as LIBBPF_DIR does not have a default value, configure bails out if the user does not specify a value after --libbpf_dir, thus avoiding to produce an erroneous configuration. Fixes: 7ae2585b865a ("configure: convert LIBBPF environment variables to command-line options") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-10-15configure: fix parsing issue on include_dir optionAndrea Claudi
configure is stuck in an endless loop if '--include_dir' option is used without a value: $ ./configure --include_dir ./configure: line 506: shift: 2: shift count out of range ./configure: line 506: shift: 2: shift count out of range [...] Fix it splitting 'shift 2' into two consecutive shifts, and making the second one conditional to the number of remaining arguments. A check is also provided after the while loop to verify the include dir exists; this avoid to produce an erroneous configuration. Fixes: a9c3d70d902a ("configure: add options ability") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-09-02configure: restore backward compatibilityLuca Boccassi
Commit a9c3d70d902a0473ee5c13336317006a52ce8242 broke backward compatibility by making 'configure' error out if parameters are passed, instead of ignoring them. Sometimes packaging systems detect 'configure' and assume it's from autotools, and pass a bunch of options. Eg: dh_auto_configure ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking Ignore unknown options again instead of erroring out. Fixes: a9c3d70d902a ("configure: add options ability") Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2021-06-03configure: convert LIBBPF environment variables to command-line optionsHangbin Liu
Signed-off-by: Hangbin Liu <haliu@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-06-03configure: add options abilityHangbin Liu
There are more and more global environment variables that land everywhere in configure, which is making user hard to know which one does what. Using command-line options would make it easier for users to learn or remember the config options. This patch converts the INCLUDE variable to command option first. Check if the first variable has '-' to compile with the old INCLUDE path setting method. Signed-off-by: Hangbin Liu <haliu@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
2021-05-17lib/fs: fix issue when {name,open}_to_handle_at() is not implementedHeiko Thiery
With commit d5e6ee0dac64 the usage of functions name_to_handle_at() and open_by_handle_at() are introduced. But these function are not available e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the availability in the configure script and in case of absence do a direct syscall. Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions") Cc: Dmitry Yakunin <zeil@yandex-team.ru> Cc: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: David Ahern <dsahern@kernel.org>
2020-11-24iproute2: add check_libbpf() and get_libbpf_version()Hangbin Liu
This patch aim to add basic checking functions for later iproute2 libbpf support. First we add check_libbpf() in configure to see if we have bpf library support. By default the system libbpf will be used, but static linking against a custom libbpf version can be achieved by passing libbpf DESTDIR to variable LIBBPF_DIR for configure. Another variable LIBBPF_FORCE is used to control whether to build iproute2 with libbpf. If set to on, then force to build with libbpf and exit if not available. If set to off, then force to not build with libbpf. When dynamically linking against libbpf, we can't be sure that the version we discovered at compile time is actually the one we are using at runtime. This can lead to hard-to-debug errors. So we add a new file lib/bpf_glue.c and a helper function get_libbpf_version() to get correct libbpf version at runtime. Signed-off-by: Hangbin Liu <haliu@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-07-08configure: support ipset version 7 with kernel version 5Tony Ambardar
The configure script checks for ipset v6 availability but doesn't test for v7, which is backward compatible and used on kernel v5.x systems. Update the script to test for both ipset versions. Without this change, the tc ematch function em_ipset will be disabled. Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-20make yacc usage POSIX compatibleEthan Sommer
config: put YACC in config.mk and use environmental variable if present ss: use YACC variable instead of hardcoding bison place options before source file argument use -b to specify file prefix instead of output file, as -o isn't POSIX compatible, this generates ssfilter.tab.c instead of ssfilter.c replace any references to ssfilter.c with references to ssfilter.tab.c tc: use -p flag to set name prefix instead of bison-specific api.prefix directive remove unneeded bison-specific directives use -b instead of -o, replace references to previously generated emp_ematch.yacc.[ch] with references to newly generated emp_ematch.tab.[ch] Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-01-07configure: fix typo in check_xt_old_internal_hDmitry V. Levin
Fixes: 377a09902a57 ("configure: Minor code cleanup") Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-12-18configure: Minor code cleanupPetr Vorel
Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-12-18configure: Remove non-posix shell expansionPetr Vorel
+ change shebang to /bin/sh Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-12-18configure: Remove unused function check_prog()Petr Vorel
Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-11-09Pass CPPFLAGS to the compilerLuca Boccassi
When building Debian packages pre-processor flags are passed via CPPFLAGS, as the convention indicates. Specifically, the hardening -D_FORTIFY_SOURCE=2 flag is used. Pass CPPFLAGS to all calls of QUIET_CC together with CFLAGS. Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-01Use libbsd for strlcpy if availableLuca Boccassi
If libc does not provide strlcpy check for libbsd with pkg-config to avoid relying on inline version. Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-18config: spelling fixesStephen Hemminger
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-03-27Drop capabilities if not running ip exec vrf with libcapLuca Boccassi
ip vrf exec requires root or CAP_NET_ADMIN, CAP_SYS_ADMIN and CAP_DAC_OVERRIDE. It is not possible to run unprivileged commands like ping as non-root or non-cap-enabled due to this requirement. To allow users and administrators to safely add the required capabilities to the binary, drop all capabilities on start if not invoked with "vrf exec". Update the manpage with the requirements. Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-13Remove leftovers from removed Latex documentationPhil Sutter
Since there is no documentation in Latex format left, there is no need to check for commands to build it. Also there is no need to ignore any of the temporary files which were created by them. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-11-24SPDX license identifiersStephen Hemminger
For all files in iproute2 which do not have an obvious license identification, mark them with SPDK GPL-2 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-10-11lib: fix multiple strlcpy definitionBaruch Siach
Some C libraries, like uClibc and musl, provide BSD compatible strlcpy(). Add check_strlcpy() to configure, and avoid defining strlcpy and strlcat when the C library provides them. This fixes the following static link error with uClibc-ng: .../sysroot/usr/lib/libc.a(strlcpy.os): In function `strlcpy': strlcpy.c:(.text+0x0): multiple definition of `strlcpy' ../lib/libutil.a(utils.o):utils.c:(.text+0x1ddc): first defined here collect2: error: ld returned 1 exit status Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
2017-08-23config: put CFLAGS/LDLIBS in config.mkStephen Hemminger
This renames Config to config.mk and includes more Make input. Now configure generates all the required CFLAGS and LDLIBS for the optional libraries. Also, use pkg-config to test for libelf, rather than using a test program. This makes it consistent with other libraries. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2016-12-14configure: fix elftest when warnings enabledStephen Hemminger
If compile testing with -W then elftest.c would fail because of unused variables. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2016-11-29bpf: make tc's bpf loader generic and move into libDaniel Borkmann
This work moves the bpf loader into the iproute2 library and reworks the tc specific parts into generic code. It's useful as we can then more easily support new program types by just having the same ELF loader backend. Joint work with Thomas Graf. I hacked a rough start of a test suite to make sure nothing breaks [1] and looks all good. [1] https://github.com/borkmann/clsact/blob/master/test_bpf.sh Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2016-10-26tc, ipt: don't enforce iproute2 dependency on iptables-develDaniel Borkmann
Since 5cd1adba79d3 ("Update to current iptables headers") compilation of iproute2 broke for systems without iptables-devel package [1]. Reason is that even though we fall back to build m_ipt.c, the include depends on a xtables-version.h header, which only ships with iptables-devel. Machines not having this package fail compilation with: [...] CC m_ipt.o In file included from ../include/iptables.h:5:0, from m_ipt.c:17: ../include/xtables.h:34:29: fatal error: xtables-version.h: No such file or directory compilation terminated. ../Config:31: recipe for target 'm_ipt.o' failed make[1]: *** [m_ipt.o] Error 1 The configure script only barks that package xtables was not found in the pkg-config search path. The generated Config then only contains f.e. TC_CONFIG_IPSET. In tc's Makefile we thus fall back to adding m_ipt.o to TCMODULES. m_ipt.c then includes the local include/iptables.h header copy, which includes the include/xtables.h copy. Latter then includes xtables-version.h, which only ships with iptables-devel. One way to resolve this is to skip this whole mess when pkg-config has no xtables config available. I've carried something along these lines locally for a while now, but it's just too annyoing. :/ Build works fine now also when xtables.pc is not available. [1] http://www.spinics.net/lists/netdev/msg366162.html Fixes: 5cd1adba79d3 ("Update to current iptables headers") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2016-05-31Make builds default to quiet modeDavid Ahern
Similar to the Linux kernel and perf add infrastructure to reduce the amount of output tossed to a user during a build. Full build output can be obtained with 'make V=1' Builds go from: make[1]: Leaving directory `/home/dsa/iproute2.git/lib' make[1]: Entering directory `/home/dsa/iproute2.git/ip' gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c -o ip.o ip.c gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c -o ipaddress.o ipaddress.c to: ... AR libutil.a ip CC ip.o CC ipaddress.o ... Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
2015-09-21configure: Check for Berkeley DB for arpd compilationVadim Kochan
Add check for Berkeley DB header & lib before compile arpd util. Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
2015-06-25configure: cleanupStephen Hemminger
Don't echo "-e" when using builtin echo in bash.
2015-06-24configure: Check for libmnlVadim Kochan
Indicate existence of libmnl which is required by tipc. Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
2015-04-13Merge branch 'master' into net-nextStephen Hemminger
2015-04-13fix whitespaceStephen Hemminger
2015-04-13Revert "ip netns: Fix rtnl error while print netns list"Nicolas Dichtel
This reverts commit d116ff34145b00db54a37e2a6282dccd8bc08225. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2015-04-13Revert "configure: add missing INCLUDE to netnsid detection"Nicolas Dichtel
This reverts commit d059de70cafb470f77fc19a42d95f6dc442cf6a3. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2015-04-10Merge branch 'master' into net-nextStephen Hemminger
2015-04-10configure: add missing INCLUDE to netnsid detectionJiri Benc
Fixes: d116ff34145b0 ("ip netns: Fix rtnl error while print netns list") Signed-off-by: Jiri Benc <jbenc@redhat.com>
2015-03-24tc: add eBPF support to f_bpfDaniel Borkmann
This work adds the tc frontend for kernel commit e2e9b6541dd4 ("cls_bpf: add initial eBPF support for programmable classifiers"). A C-like classifier program (f.e. see e2e9b6541dd4) is being compiled via LLVM's eBPF backend into an ELF file, that is then being passed to tc. tc then loads, if any, eBPF maps and eBPF opcodes (with fixed-up eBPF map file descriptors) out of its dedicated sections, and via bpf(2) into the kernel and then the resulting fd via netlink down to cls_bpf. cls_bpf allows for annotations, currently, I've used the file name for that, so that the user can easily identify his filter when dumping configurations back. Example usage: clang -O2 -emit-llvm -c cls.c -o - | llc -march=bpf -filetype=obj -o cls.o tc filter add dev em1 parent 1: bpf run object-file cls.o classid x:y tc filter show dev em1 [...] filter parent 1: protocol all pref 49152 bpf handle 0x1 flowid x:y cls.o I placed the parser bits derived from Alexei's kernel sample, into tc_bpf.c as my next step is to also add the same support for BPF action, so we can have a fully fledged eBPF classifier and action in tc. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@plumgrid.com>
2015-03-15ip netns: Fix rtnl error while print netns listVadim Kochan
Observed on the Linux 3.18: # ip netns RTNETLINK answers: Operation not supported net0 CC: Nicolas Dichtel <nicolas.dichtel@6wind.com> Fixes: d182ee1307c7 ("ipnetns: allow to get and set netns ids") Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
2014-11-30configure: Add check for the doc toolsvadimk
Added checking existence of the doc files converters. If the XXX tool exists then HAVE_XXX:=y will be written to the Config file. Example of the configure script output: TC schedulers ATM no IPT using xtables IPSET yes iptables modules directory: /usr/lib/iptables libc has setns: yes SELinux support: no Docs latex: no WARNING: no docs can be built from LaTeX files sgml2html: yes Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
2014-03-10ss: Add support for retrieving SELinux contextsRichard Haines
The process SELinux contexts can be added to the output using the -Z option. Using the -z option will show the process and socket contexts (see the man page for details). For netlink sockets: if valid process show process context, if pid = 0 show kernel initial context, if unknown show "unavailable". Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
2012-12-19configure: restore old behaviourStephen Hemminger
Previous change wasn't needed, since merge of configure: move toolchain init to a function
2012-12-18build: indent shell functions in configureStephen Hemminger
Script has lots of shell functions but never indented properly.