From patchwork Thu Oct 14 08:50:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558077 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D57C433F5 for ; Thu, 14 Oct 2021 08:51:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A7EB610D2 for ; Thu, 14 Oct 2021 08:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbhJNIxc (ORCPT ); Thu, 14 Oct 2021 04:53:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59324 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhJNIxc (ORCPT ); Thu, 14 Oct 2021 04:53:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NLzB9se0APyAwBwQOCVmwwlYxv7R5/0WKt09vjyarSI=; b=PNbwIma1M78KT7D4uZv7/a/SOWyg3RsoASSAaum9ej8ZePOVJ51PxYsPLt8n7GovT9A5Ss 9/lRNToHgGme0TdXt4XQPmKyFjvRzJQmOlfApQpQ74gkZetzW73cKpdPPVzULR1r50nkpc GkeWS1Bp08GwyVhZxJ+jkrg5Cvwzc0Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-ReCkr1MWPKejCSSt2s7oMw-1; Thu, 14 Oct 2021 04:51:24 -0400 X-MC-Unique: ReCkr1MWPKejCSSt2s7oMw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47E158042F4; Thu, 14 Oct 2021 08:51:23 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 094712B0B2; Thu, 14 Oct 2021 08:51:20 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 1/7] configure: fix parsing issue on include_dir option Date: Thu, 14 Oct 2021 10:50:49 +0200 Message-Id: <92f2f5590ada5fb1b73004516f8a2b3a1d19ebf2.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 --- configure | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 7f4f3bd9..ea9051ab 100755 --- a/configure +++ b/configure @@ -485,7 +485,7 @@ usage() { cat < Path to iproute2 include dir --libbpf_dir Path to libbpf DESTDIR --libbpf_force Enable/disable libbpf by force. Available options: on: require link against libbpf, quit config if no libbpf support @@ -502,8 +502,9 @@ else while true; do case "$1" in --include_dir) - INCLUDE=$2 - shift 2 ;; + shift + INCLUDE="$1" + [ "$#" -gt 0 ] && shift ;; --libbpf_dir) LIBBPF_DIR="$2" shift 2 ;; @@ -523,6 +524,8 @@ else done fi +[ -d "$INCLUDE" ] || usage 1 + echo "# Generated config based on" $INCLUDE >$CONFIG quiet_config >> $CONFIG From patchwork Thu Oct 14 08:50:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558079 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D0E4C433F5 for ; Thu, 14 Oct 2021 08:51:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1287960FF2 for ; Thu, 14 Oct 2021 08:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbhJNIxf (ORCPT ); Thu, 14 Oct 2021 04:53:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58633 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhJNIxe (ORCPT ); Thu, 14 Oct 2021 04:53:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qK4B9vLbE6QWrdX5HVna32If6nst1oYK4++jPMxmBXE=; b=iPO0VyymkzrdG1NolsnPKUETgHFuah80sl6/rgV8OQsXhARQeLUOpuOk3hI9i9dZQTM2U/ R0YRuHn/UOFefWhiAUG/nqvDehTnfLBeC+WPNfY9wcU0G8qTQUjEHoy+QzUopoXiBOQz32 0DAagKXRns9bRKP/Jpx+6wEtGN7LyGs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-kgS0Kgp4ONK2Oj63_DOSNQ-1; Thu, 14 Oct 2021 04:51:27 -0400 X-MC-Unique: kgS0Kgp4ONK2Oj63_DOSNQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC2E35074B; Thu, 14 Oct 2021 08:51:25 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8D007092B; Thu, 14 Oct 2021 08:51:23 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 2/7] configure: fix parsing issue on libbpf_dir option Date: Thu, 14 Oct 2021 10:50:50 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 --- configure | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure b/configure index ea9051ab..0f304206 100755 --- a/configure +++ b/configure @@ -486,7 +486,7 @@ usage() cat < Path to iproute2 include dir - --libbpf_dir Path to libbpf DESTDIR + --libbpf_dir Path to libbpf DESTDIR --libbpf_force Enable/disable libbpf by force. Available options: on: require link against libbpf, quit config if no libbpf support off: disable libbpf probing @@ -506,8 +506,9 @@ else INCLUDE="$1" [ "$#" -gt 0 ] && shift ;; --libbpf_dir) - LIBBPF_DIR="$2" - shift 2 ;; + shift + LIBBPF_DIR="$1" + [ "$#" -gt 0 ] && shift ;; --libbpf_force) if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then usage 1 @@ -525,6 +526,9 @@ else fi [ -d "$INCLUDE" ] || usage 1 +if [ "${LIBBPF_DIR-unused}" != "unused" ]; then + [ -d "$LIBBPF_DIR" ] || usage 1 +fi echo "# Generated config based on" $INCLUDE >$CONFIG quiet_config >> $CONFIG From patchwork Thu Oct 14 08:50:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558081 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCBCC433EF for ; Thu, 14 Oct 2021 08:51:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2520610EA for ; Thu, 14 Oct 2021 08:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbhJNIxi (ORCPT ); Thu, 14 Oct 2021 04:53:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26776 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbhJNIxh (ORCPT ); Thu, 14 Oct 2021 04:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=srTbVX9mwHLeJTPcJh7YEQWzCJSRjkZL38WldLHRC4E=; b=HupvDKvM3Pfu/ceBLeO8DzZVpM0MtnZsgDSIHakSPJK89kVjuwKo8KZxKeE227a5BQ30UB HuYGM2SvcHABTVAEbItk6UR3Zxnv/+B1/sX5eEUyFgY7hKsg7cedq5X603y+JxWUDjCKmj dJzlxUij/gu0GSggXKEjFf7jBCsg1vc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-suO_VLz8O0y2o0i338cmrQ-1; Thu, 14 Oct 2021 04:51:29 -0400 X-MC-Unique: suO_VLz8O0y2o0i338cmrQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06DA5802C94; Thu, 14 Oct 2021 08:51:28 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E19F1B42C; Thu, 14 Oct 2021 08:51:25 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 3/7] configure: fix parsing issue with more than one value per option Date: Thu, 14 Oct 2021 10:50:51 +0200 Message-Id: <59c4edf70811ab7589d453f8652eb206e1aac5aa.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 0f304206..9ec19a5b 100755 --- a/configure +++ b/configure @@ -517,10 +517,12 @@ else shift 2 ;; -h | --help) usage 0 ;; + --*) + shift ;; "") break ;; *) - shift 1 ;; + usage 1 ;; esac done fi From patchwork Thu Oct 14 08:50:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558083 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 903EDC433EF for ; Thu, 14 Oct 2021 08:51:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B34A60FF2 for ; Thu, 14 Oct 2021 08:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbhJNIxj (ORCPT ); Thu, 14 Oct 2021 04:53:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41601 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhJNIxj (ORCPT ); Thu, 14 Oct 2021 04:53:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FLZ7Ij3NqbATBxy/KiQWc7hvqxuolcXOo/ULfFaaS6s=; b=CHQvWT1a/BSGbIkHa8m+qgvXAfgiuMw3gp+IFdaFtyvNfmkMGkN9MHWNzl8Sc8D1CBBNL1 N+GP70ZEvjzcbdpupS4akwqESALphHhSVgaAYTsGrjiezLRil2xBPRVDimM3yXv/MDfs/k GhDCfDmMEMvfKlMQnqz2AH3Kh9zf78s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-119-pIcxSXs5PLSki4Wd_C0a7w-1; Thu, 14 Oct 2021 04:51:31 -0400 X-MC-Unique: pIcxSXs5PLSki4Wd_C0a7w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BD3119200C0; Thu, 14 Oct 2021 08:51:30 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DEF45BAF8; Thu, 14 Oct 2021 08:51:28 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 4/7] configure: simplify options parsing Date: Thu, 14 Oct 2021 10:50:52 +0200 Message-Id: <3be488a28f2df84264890b030052c6cafc8700ec.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 --- configure | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/configure b/configure index 9ec19a5b..26e06eb8 100755 --- a/configure +++ b/configure @@ -485,12 +485,12 @@ usage() { cat < Path to iproute2 include dir - --libbpf_dir Path to libbpf DESTDIR - --libbpf_force Enable/disable libbpf by force. Available options: - on: require link against libbpf, quit config if no libbpf support - off: disable libbpf probing - -h | --help Show this usage info + --include_dir Path to iproute2 include dir + --libbpf_dir Path to libbpf DESTDIR + --libbpf_force Enable/disable libbpf by force. Available options: + on: require link against libbpf, quit config if no libbpf support + off: disable libbpf probing + -h | --help Show this usage info EOF exit $1 } @@ -499,31 +499,25 @@ EOF if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then INCLUDE="$1" else - while true; do + while [ "$#" -gt 0 ]; do case "$1" in --include_dir) shift - INCLUDE="$1" - [ "$#" -gt 0 ] && shift ;; + INCLUDE="$1" ;; --libbpf_dir) shift - LIBBPF_DIR="$1" - [ "$#" -gt 0 ] && shift ;; + LIBBPF_DIR="$1" ;; --libbpf_force) - if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then - usage 1 - fi - LIBBPF_FORCE=$2 - shift 2 ;; + shift + LIBBPF_FORCE="$1" ;; -h | --help) usage 0 ;; --*) - shift ;; - "") - break ;; + ;; *) usage 1 ;; esac + [ "$#" -gt 0 ] && shift done fi @@ -531,6 +525,11 @@ fi if [ "${LIBBPF_DIR-unused}" != "unused" ]; then [ -d "$LIBBPF_DIR" ] || usage 1 fi +if [ "${LIBBPF_FORCE-unused}" != "unused" ]; then + if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then + usage 1 + fi +fi echo "# Generated config based on" $INCLUDE >$CONFIG quiet_config >> $CONFIG From patchwork Thu Oct 14 08:50:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558085 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45395C433F5 for ; Thu, 14 Oct 2021 08:51:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 201F260FF2 for ; Thu, 14 Oct 2021 08:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhJNIxo (ORCPT ); Thu, 14 Oct 2021 04:53:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49062 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbhJNIxm (ORCPT ); Thu, 14 Oct 2021 04:53:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BVxKVD8rNAzc9BEQjgKBWH125v4czXDZxBhtnZPFuTc=; b=OSGMT6cjz2jlJS36xpNTzBJSq4KdkNi1Tgcn47PUsk49WXNatIwk6C1oe5q2gBaHXjJY5X oqq2BcC/2RHMZ3xmrMG4IS8CGd3kPrhwd98M8nVwzv3GQXbSVX3r62WdJpT0pO6D6hl0r9 5KhZZH4pwxwZbbgWlB4NJL1iJfsugxM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-KFqmEjpSM3SVwDp-_I2ykQ-1; Thu, 14 Oct 2021 04:51:34 -0400 X-MC-Unique: KFqmEjpSM3SVwDp-_I2ykQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E28B19200C0; Thu, 14 Oct 2021 08:51:33 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF5A71B42C; Thu, 14 Oct 2021 08:51:30 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 5/7] configure: support --param=value style Date: Thu, 14 Oct 2021 10:50:53 +0200 Message-Id: <7db73d1995abf4f91ff6f6d7ab6bea24df7591dc.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com This commit makes it possible to specify values for configure params using the common autotools configure syntax '--param=value'. Signed-off-by: Andrea Claudi --- configure | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure b/configure index 26e06eb8..9a2645d9 100755 --- a/configure +++ b/configure @@ -504,12 +504,18 @@ else --include_dir) shift INCLUDE="$1" ;; + --include_dir=*) + INCLUDE="${1#*=}" ;; --libbpf_dir) shift LIBBPF_DIR="$1" ;; + --libbpf_dir=*) + LIBBPF_DIR="${1#*=}" ;; --libbpf_force) shift LIBBPF_FORCE="$1" ;; + --libbpf_force=*) + LIBBPF_FORCE="${1#*=}" ;; -h | --help) usage 0 ;; --*) From patchwork Thu Oct 14 08:50:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558087 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE89C433EF for ; Thu, 14 Oct 2021 08:51:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 818BC60FF2 for ; Thu, 14 Oct 2021 08:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbhJNIxp (ORCPT ); Thu, 14 Oct 2021 04:53:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33876 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbhJNIxn (ORCPT ); Thu, 14 Oct 2021 04:53:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KR8utXZyJAs2hDWoOk7IsG2TlNMunC/PZNndVTs1EAU=; b=cBG+YRNxiOSLa5yNO/Wx1N0LzjYqQysqiMN9WUA5cKO40AEyNK63suQj/Ilw5wShSxtdaf BjFlJIfcDLC28JOQmm4UzkUFHum/cewkOOfvP2Ddx9LvmC49fDOdr4p1S6zgQarJcWw7nc joGmna4h/rB2j/NAFsljbJWb98PFJWk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-UIqNYDGwM8m13kWhxWtJcA-1; Thu, 14 Oct 2021 04:51:37 -0400 X-MC-Unique: UIqNYDGwM8m13kWhxWtJcA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43EBA1006AA3; Thu, 14 Oct 2021 08:51:36 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id C267C1B42C; Thu, 14 Oct 2021 08:51:33 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 6/7] configure: add the --prefix option Date: Thu, 14 Oct 2021 10:50:54 +0200 Message-Id: <88b3ba75872cc2850e13b2e76db680551ec8e672.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 --- configure | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure b/configure index 9a2645d9..05e23eff 100755 --- a/configure +++ b/configure @@ -3,6 +3,7 @@ # This is not an autoconf generated configure INCLUDE="$PWD/include" +PREFIX="/usr" # Output file which is input to Makefile CONFIG=config.mk @@ -490,6 +491,7 @@ Usage: $0 [OPTIONS] --libbpf_force Enable/disable libbpf by force. Available options: on: require link against libbpf, quit config if no libbpf support off: disable libbpf probing + --prefix Path prefix of the lib files to install -h | --help Show this usage info EOF exit $1 @@ -516,6 +518,11 @@ else LIBBPF_FORCE="$1" ;; --libbpf_force=*) LIBBPF_FORCE="${1#*=}" ;; + --prefix) + shift + PREFIX="$1" ;; + --prefix=*) + PREFIX="${1#*=}" ;; -h | --help) usage 0 ;; --*) @@ -536,6 +543,7 @@ if [ "${LIBBPF_FORCE-unused}" != "unused" ]; then usage 1 fi fi +[ -z "$PREFIX" ] && usage 1 echo "# Generated config based on" $INCLUDE >$CONFIG quiet_config >> $CONFIG From patchwork Thu Oct 14 08:50:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12558089 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E904C433F5 for ; Thu, 14 Oct 2021 08:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44BAE610D2 for ; Thu, 14 Oct 2021 08:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbhJNIxu (ORCPT ); Thu, 14 Oct 2021 04:53:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36607 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhJNIxs (ORCPT ); Thu, 14 Oct 2021 04:53:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634201504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g3Orayc/Iv7lzdsjDE4ghLwsLXr/CCGk7wf2HS16D2o=; b=BvJ7/hqs/Pb6x3TcBwpXilJDfW+UaPL9TjrYSz4kn5lAK1v/G4hkVG0PrhuoK/wyZ3GpE1 ATMk2oCwId5j5DmfGTNZznzC6nguO+MCCfAIKbOLIo99ceSPvOe9c91QO/BVSexeR+puqK M2+5XQkvVQKDIRagVzIjMB20f168TtU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-141-lkf9urf0Ox285yF42XtQcA-1; Thu, 14 Oct 2021 04:51:40 -0400 X-MC-Unique: lkf9urf0Ox285yF42XtQcA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DE988042BD; Thu, 14 Oct 2021 08:51:39 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.194.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01E441B42C; Thu, 14 Oct 2021 08:51:36 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v5 7/7] configure: add the --libdir option Date: Thu, 14 Oct 2021 10:50:55 +0200 Message-Id: <62f6968cc2647685a0ef8074687ecf12c8c1f3c0.1634199240.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 Acked-by: Phil Sutter --- Makefile | 7 ++++--- configure | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5eddd504..f6214534 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Top level Makefile for iproute2 +-include config.mk + ifeq ("$(origin V)", "command line") VERBOSE = $(V) endif @@ -13,7 +15,6 @@ MAKEFLAGS += --no-print-directory endif PREFIX?=/usr -LIBDIR?=$(PREFIX)/lib SBINDIR?=/sbin CONFDIR?=/etc/iproute2 NETNS_RUN_DIR?=/var/run/netns @@ -69,7 +70,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a LDLIBS += $(LIBNETLINK) -all: config +all: config.mk @set -e; \ for i in $(SUBDIRS); \ do echo; echo $$i; $(MAKE) -C $$i; done @@ -89,7 +90,7 @@ help: @echo "Make Arguments:" @echo " V=[0|1] - set build verbosity level" -config: +config.mk: @if [ ! -f config.mk -o configure -nt config.mk ]; then \ sh configure $(KERNEL_INCLUDE); \ fi diff --git a/configure b/configure index 05e23eff..8ddff43c 100755 --- a/configure +++ b/configure @@ -4,6 +4,7 @@ INCLUDE="$PWD/include" PREFIX="/usr" +LIBDIR="\${prefix}/lib" # Output file which is input to Makefile CONFIG=config.mk @@ -149,6 +150,15 @@ EOF rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest } +check_lib_dir() +{ + LIBDIR=$(echo $LIBDIR | sed "s|\${prefix}|$PREFIX|") + + echo -n "lib directory: " + echo "$LIBDIR" + echo "LIBDIR:=$LIBDIR" >> $CONFIG +} + check_ipt() { if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then @@ -487,6 +497,7 @@ usage() cat < Path to iproute2 include dir + --libdir Path to iproute2 lib dir --libbpf_dir Path to libbpf DESTDIR --libbpf_force Enable/disable libbpf by force. Available options: on: require link against libbpf, quit config if no libbpf support @@ -508,6 +519,11 @@ else INCLUDE="$1" ;; --include_dir=*) INCLUDE="${1#*=}" ;; + --libdir) + shift + LIBDIR="$1" ;; + --libdir=*) + LIBDIR="${1#*=}" ;; --libbpf_dir) shift LIBBPF_DIR="$1" ;; @@ -544,6 +560,7 @@ if [ "${LIBBPF_FORCE-unused}" != "unused" ]; then fi fi [ -z "$PREFIX" ] && usage 1 +[ -z "$LIBDIR" ] && usage 1 echo "# Generated config based on" $INCLUDE >$CONFIG quiet_config >> $CONFIG @@ -568,6 +585,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then fi echo +check_lib_dir if ! grep -q TC_CONFIG_NO_XT $CONFIG; then echo -n "iptables modules directory: " check_ipt_lib_dir