From patchwork Wed Sep 9 03:33:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ted Elhourani X-Patchwork-Id: 1360317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=B9ljulnY; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmSKZ6G66z9sRK for ; Wed, 9 Sep 2020 13:33:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4328A86C4B; Wed, 9 Sep 2020 03:33:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uigdUiu85TGm; Wed, 9 Sep 2020 03:33:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6DA4A86C1E; Wed, 9 Sep 2020 03:33:33 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 55E80C0051; Wed, 9 Sep 2020 03:33:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A85CEC0052 for ; Wed, 9 Sep 2020 03:33:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9ABFD20400 for ; Wed, 9 Sep 2020 03:33:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RZrTfowvYgSk for ; Wed, 9 Sep 2020 03:33:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by silver.osuosl.org (Postfix) with ESMTPS id B59D22014A for ; Wed, 9 Sep 2020 03:33:29 +0000 (UTC) Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0893TAer019270 for ; Tue, 8 Sep 2020 20:33:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=3D1DnIimS+L+bOIhiDiR27NdIE11sIBQC4SvEXemTVY=; b=B9ljulnYAUFRQ+IeXIBFo8S6nhAtr2GIXatkpG4eP2NrKYDVEWovzA0JDyH6mPcfF35S KyLHdJy4aETl/pG966GbECqDHij0WzmuF5Y/y/ZJt5IznlT8lfIRxTHUcsCsUv9Te8b5 GeKHbdoVZrdSrWVyxMkHhNBF2LRbeqkQov61iIVRhnxsnRbfvF6Dp8eRbVgst02BI7Rq 1u2g708zn+H1wm0VMWkFWkcvuONfYW2vGtzILeuORGXtGiugy7jh/wWprqqXyxPuXLS1 Mx9IUMpEH6uKVK8EIVxibr9wrgFGQeaImzxsJwhTw9LZHeNAvCI6a6X6byIFsl0/hF5z Kw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2103.outbound.protection.outlook.com [104.47.55.103]) by mx0a-002c1b01.pphosted.com with ESMTP id 33c9rh7m31-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 Sep 2020 20:33:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nlY8rdPWUWRy9J46PciZemhLAlGzf5ebXPwFDyjQphDXWZVah2DD88pNGS0Do0HRmIXPHzWvlB3B3F5gKn0XtjTBuMAneDeHSuzfDLK3cnk2Gb31xub+S2MhU1ltYLr2aLXOwvmgdPYV2KLwUxARdtFV7GsROKUQy3XXM7kGJlmbsFtcZvMG8i/2RFzJWsUTwcxp0I8Xq6ax4A604TioFvpwTnOI3p97PXmeBUQTlyy0jORfXTW3RlrKN7E8ReSMUBKwuMxzHq0YYmjXmJJ6zfxkiKps2iMaGA9Q47TiWL2grQoq578Vr+Q+FB0qFAtixSKAU5fKpf9CHiAqqrg/qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3D1DnIimS+L+bOIhiDiR27NdIE11sIBQC4SvEXemTVY=; b=ogJFOps5gR7pTHsSkAxzYFIVdzkH0yLb61AnQ67GuS7mmEhztoA+A3+3tJO8RgyVhMyq5kV5uHzafO3ZVBRshcXCV1AVQtdvHstii1Tj1/dSdhjclK/as9vVLR/ajvZTUVHXpHBE6aTHWoD+y6t4e61LKmLseuga910Omm47aH3XP1BLDpOpOjeuTrAIoT9KwxwiHGgVBgWa162gemsQmBc7OBdKFtERbkJGbQKE/EaSCEfZrJkbdLAkELz8EKDLU2dz7KEMoTpqln3bGwLHi2hjirWD1jijf68mNeGGvPcX5C8HhrQPe/Ls0IxW1CsW/eyHjLZuJrWY5dTo+8K7og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Authentication-Results: openvswitch.org; dkim=none (message not signed) header.d=none;openvswitch.org; dmarc=none action=none header.from=nutanix.com; Received: from BYAPR02MB3958.namprd02.prod.outlook.com (2603:10b6:a02:fc::21) by BY5PR02MB6977.namprd02.prod.outlook.com (2603:10b6:a03:231::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Wed, 9 Sep 2020 03:33:24 +0000 Received: from BYAPR02MB3958.namprd02.prod.outlook.com ([fe80::a1e2:236f:77aa:a3ff]) by BYAPR02MB3958.namprd02.prod.outlook.com ([fe80::a1e2:236f:77aa:a3ff%5]) with mapi id 15.20.3348.019; Wed, 9 Sep 2020 03:33:24 +0000 From: Ted Elhourani To: dev@openvswitch.org, ted.elhourani@nutanix.com Date: Wed, 9 Sep 2020 03:33:20 +0000 Message-Id: <20200909033320.118879-2-ted.elhourani@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20200909033320.118879-1-ted.elhourani@nutanix.com> References: <20200909033320.118879-1-ted.elhourani@nutanix.com> X-ClientProxiedBy: BYAPR07CA0097.namprd07.prod.outlook.com (2603:10b6:a03:12b::38) To BYAPR02MB3958.namprd02.prod.outlook.com (2603:10b6:a02:fc::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ted-elhourani.ubvm.nutanix.com (192.146.154.246) by BYAPR07CA0097.namprd07.prod.outlook.com (2603:10b6:a03:12b::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16 via Frontend Transport; Wed, 9 Sep 2020 03:33:23 +0000 X-Mailer: git-send-email 2.22.3 X-Originating-IP: [192.146.154.246] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f58c7f16-08d6-44d3-04d4-08d854711b44 X-MS-TrafficTypeDiagnostic: BY5PR02MB6977: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-proofpoint-crosstenant: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vL3XwqONLeIdEogDt6htlFrEp60OLolqyX/pWmWRZ9+3W4kO9RLtf6OlhEpxgPK9SaEtAJ2SAU/k9THbqKTYBy9c3sQHQ8Kh1Y4b5/ZtsWiVYrRbortLSmen7Sik612B8+7xR/PnwjTfb3MfnBVuZ5szmiRlt59FZGpy51xbpTymqW/hqJQClFUrTFQxNt2QnesGm0j+rkoKegT3WsniDZFGbxExRiAMgGLuCWL2z/apQ3aNKJW9m8QoC1RU6RxXpiDPKn1Bo0uqsYzjz+48GrWcEA8RsOCCfYoCRLQ08dcvkU+m8a4U7YL7JXZafFwVMuswfxqTzFCjVPuDvIV5kg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB3958.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(376002)(346002)(366004)(39850400004)(396003)(478600001)(1076003)(5660300002)(8676002)(52116002)(8936002)(316002)(66476007)(66946007)(66556008)(86362001)(7696005)(36756003)(6486002)(44832011)(16526019)(26005)(2906002)(186003)(2616005)(83380400001)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: GORFFWOvE7JMpuEvaffgmU/avW3f4XxYwcLFI2DX8ZW74sp4oKvtfEek3SX6JGbe+CviObmdrvvYF/uhV264UldZHQGlP+o9/EWasLxWDwOHw7mP+GKPuYi7LI3DVbd1GOLzuDQyQ+ybgoflamdZ4QvrPZqFE4Ug3PCldgavNIQp45SddneoFdrF/Pe9PIfVRc6CC5awzqmHacNc1B/WUCyVxDy5aqU5VefbTGzz35ApN37S8bj+jD8JXYNPLBI2lMtcSySjXRGIoFEeNP3uablCQHZL4p2JTTT9xyCrB8qCIczh+M+nfm6t6ykFqQ4ZYij/0tAhyh6lWJmymKtYOAK/kPrH/9HWrY0VGU6Na1u/WKtwZFD/zAHPp5tHibJMAkSmndJN4dzh1p+D0hItc6u9MdHB5YXqQRVNgu/4t2CWV9TNdrkdXO6dItEn3GgoAIwfMMEWyEOG7tc4prW2e8lQMo0t/nSzZWQ3aHGZNsJStA1M1Y81FXOKVj6zNXbmmzrELPfzkxDUM8AJqnsvyabgicw9MZeZVhfN2VmR/4YSNClxtlHKQ2XJad8dutQp1mkU+nAdLw6Asy+q9uP1h8c1TGQseKD2ruUZzTRQyQPc8Q6nutKmgfNLalOiGSJVaXdEgz+RbrT+Fej9IpXvcw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f58c7f16-08d6-44d3-04d4-08d854711b44 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB3958.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2020 03:33:24.0174 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mxXZVi+UQUj2QCaAEKUG+/htdlzI/rlWiTthcszhErgYC7PoM+Tx+9noAs4YAUGGKzcf7I2nlpfFFQz8HDUF0iRSM8vRHKgQjdN6IqTNN2c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6977 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-09_02:2020-09-08, 2020-09-09 signatures=0 X-Proofpoint-Spam-Reason: safe Subject: [ovs-dev] [PATCH v1 1/1] dns-resolve: Allow unbound's config file to be set through an env var. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When an unbound context is created, check whether OVS_UNBOUND_CONF has been set. If a valid config file is supplied then use it to configure the context. The procedure returns if the config file is invalid. If no config file is found then the default unbound config is used. Signed-off-by: Ted Elhourani --- Documentation/intro/install/general.rst | 4 +++- lib/dns-resolve.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst index 09f2c13f1..c4300cd53 100644 --- a/Documentation/intro/install/general.rst +++ b/Documentation/intro/install/general.rst @@ -97,7 +97,9 @@ need the following software: specifying OpenFlow and OVSDB remotes. If unbound library is already installed, then Open vSwitch will automatically build with support for it. The environment variable OVS_RESOLV_CONF can be used to specify DNS server - configuration file (the default file on Linux is /etc/resolv.conf). + configuration file (the default file on Linux is /etc/resolv.conf), and + environment variable OVS_UNBOUND_CONF can be used to specify the + configuration file for unbound. On Linux, you may choose to compile the kernel module that comes with the Open vSwitch distribution or to use the kernel module built into the Linux kernel diff --git a/lib/dns-resolve.c b/lib/dns-resolve.c index 1ff58960f..9b5928e0b 100644 --- a/lib/dns-resolve.c +++ b/lib/dns-resolve.c @@ -82,6 +82,18 @@ dns_resolve_init(bool is_daemon) return; } + const char *ub_conf_filename = getenv("OVS_UNBOUND_CONF"); + if (ub_conf_filename != NULL) { + int retval = ub_ctx_config(ub_ctx__, ub_conf_filename); + if (retval != 0) { + VLOG_WARN_RL(&rl, "Failed to set libunbound context config: %s", + ub_strerror(retval)); + ub_ctx_delete(ub_ctx__); + ub_ctx__ = NULL; + return; + } + } + const char *filename = getenv("OVS_RESOLV_CONF"); if (!filename) { #ifdef _WIN32