From patchwork Tue Oct 6 17:10:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ted Elhourani X-Patchwork-Id: 1377570 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=BRNfgUYr; 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 4C5P9T4Fr0z9sRk for ; Wed, 7 Oct 2020 04:10:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3F30F85D50; Tue, 6 Oct 2020 17:10:19 +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 5Xap7U2FmNy8; Tue, 6 Oct 2020 17:10:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 84E0E85D2B; Tue, 6 Oct 2020 17:10:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7BA08C016F; Tue, 6 Oct 2020 17:10:18 +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 94ADEC0890 for ; Tue, 6 Oct 2020 17:10:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 38DE320500 for ; Tue, 6 Oct 2020 17:10:16 +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 r8oUTHuhIYH0 for ; Tue, 6 Oct 2020 17:10:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by silver.osuosl.org (Postfix) with ESMTPS id 67C7D20477 for ; Tue, 6 Oct 2020 17:10:14 +0000 (UTC) Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 096H8FCg019823 for ; Tue, 6 Oct 2020 10:10:13 -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=rcAfgzrTnnbmOnv1VtJ/h7i77MRUG+39xTX5eEW9Gnc=; b=BRNfgUYrzTZfKs5Vvem3azll5MAnVWZqIX1japNNgmCZ9Q7NFghNYFcMaARx2wyhLsM/ sqy4kYKDljrYPGPGy/Cvx/0siNzlOtE/ZDhffw1Av45HH5OQNkmO6hp/1nLpCEzGW35K Bdz5Ark55Xgzz+XHS1ViLWWsLa/V09zHVCGfQnhyBHLpjrK8Di7Je/6BJd4D1Oo4cpnm +d7pkCyAuVuWNgAdgDHi1POvZe9OEMUvirMym8HpCJFoNlUjIuGILUESiSW6w4IdAmJs sciBkJmQfM/9hIlSpI1Upilb+vLBcGh/Wqn3eNpr6Hd2NxLFR9WRdeYHnfdWxdeEK/OB AQ== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx0b-002c1b01.pphosted.com with ESMTP id 3405e6b3ak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Oct 2020 10:10:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C2AjJeSm3UGmh7Fu7gLby/tp2Oik2U3SeBD6MMParJLNmF/zHkO4FKYA3/0iyBTMT8df/kSsGu8BlmGba5qQQg/CB+MT3N7fbxwK+Gim5EFjLKnVx59H5vBvWyaCh7PQtoDXcQrQ3AGsYUeTjhx9uEjgu6N1A9ArHkrctGpb0DmtN/+SxGZsDLT+yZAQvIjp5IfmASlolohsdqgeUkR7EGBVY226jhwNg9XJiA/Hh9NlzIX9lRQm2WviEJxCA75jhfO1iE8ZHNkxNRexamaaZByok9+lpjtbDEr9jae5jnnH2Ey3ftSFIDuWS3TzoA+sBjqoKijS7E2JXDDJgtYEhQ== 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=rcAfgzrTnnbmOnv1VtJ/h7i77MRUG+39xTX5eEW9Gnc=; b=AEp/3S9zWp03S6H17nlcR6miLMJbK+8C4Jfg2M6tKBTconsDQbWXv+fw9CvRBenvrJstmrRu+/dfHE6mnTB7ye5aCPmv8goiwqMdNGIIsi6iBYJhYeJevl0gheWXGRLnhfrMFG7QnBY2XEjmah9o7MBLtGfttrop+zxaQLLMyIRLrgpxbTrhM7xkLgiuH9zObf/2kkLBeHdIx/dzloMbouBMIzkoGLd+qItSuWgeHH72V49rm5PRISASt/Jy6LBRZiv4bnv5XM9ovZQPMGolzfaKzBoK3Mwo6vooWH63vJUxHcOPN0pVoP9oeCchu8S5D2j6Zqz5erd6JfUiCgwlgA== 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 BYAPR02MB4373.namprd02.prod.outlook.com (2603:10b6:a03:12::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.38; Tue, 6 Oct 2020 17:10:10 +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.3433.045; Tue, 6 Oct 2020 17:10:10 +0000 From: Ted Elhourani To: dev@openvswitch.org, ted.elhourani@nutanix.com Date: Tue, 6 Oct 2020 17:10:06 +0000 Message-Id: <20201006171006.172922-2-ted.elhourani@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20201006171006.172922-1-ted.elhourani@nutanix.com> References: <20201006171006.172922-1-ted.elhourani@nutanix.com> X-Originating-IP: [192.146.154.246] X-ClientProxiedBy: BYAPR01CA0047.prod.exchangelabs.com (2603:10b6:a03:94::24) 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 BYAPR01CA0047.prod.exchangelabs.com (2603:10b6:a03:94::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21 via Frontend Transport; Tue, 6 Oct 2020 17:10:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1e38b56-8bc8-4697-7828-08d86a1aae46 X-MS-TrafficTypeDiagnostic: BYAPR02MB4373: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-proofpoint-crosstenant: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ISvfvEgY2D5F+AlwESRgepC1BaaNXFDxVbsxqFkjRuRxDqtm80z0H5q1zHsu7EFJ+0qtwsiA2yHdDXsOtyBRx3g7BVnd33y+nITj2m+wN9EQk8wkpfuP/AF46Mumw/XsJ1lVsa+NV2h+1ivCAoYve5cPUvj1h4EfhfRMM866/3X3iyDsqWeOLiQlZByuJGImzEZlVtkBdzwaMWD/SnuZ3YGY9qI8hshf993T86q+8kEVkUoKffdJTMv0DmFxSzWI1VdM6N7E9l1ky4CCutKWt60iSgSy7ap8JNmMH1Jpqe702jLeisfA5bE1O3MqEb5RKrem4zlkNLWbeyGapaMR3w== 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:(39860400002)(396003)(136003)(366004)(376002)(346002)(66556008)(6486002)(1076003)(6666004)(66946007)(478600001)(2616005)(16526019)(186003)(7696005)(956004)(52116002)(66476007)(26005)(83380400001)(2906002)(316002)(8676002)(86362001)(44832011)(5660300002)(8936002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 3J9fUEM8fd87ProHZJnREEoAt9xGlPqTGTVOX+iTD9gQsnLQUd5ZwKr6129z2du2AgAAahX7acT2AuPlmxjqRGjAaf2zMmYhrAS75lgMB0m2Qen6rQgJQLS4fLMNxGa2pjQouvwON/F1mfhTmXKWx0wu4orLhRaStpbkXxE+mB2kUDnrZi4LO487U2ZvghqQeB00vmXtqUWHUcOvk6VSrOAr0xOKJzn7VSR82uarMhZsKka7s1Beq44loZMYobCzkbRudxpogfB65OMYemanWLg9dyEX2zXZgMA6S2B8UEDYt8Lw8G5Jna7sdHtU+KSsNGBWEK7SKvmHLlj4iFkFnpgXRlR8PlGOptUws9NMaf301jeKuiklMfUE+LFf1geSQ6gan49Es/Pk5hsFzlWINiwv/cCF8A4QxDPL/+v0UvP+rr9tOdWIHnyHzsWk/mJFNlvTm0rSIVSAG1oX/cUdYKCWcOmVi7qD79KZORXUas3TdpQXBixpzT6/FposVSX55W564aASY3uokgRn5GuwywBc+6rROXhNlRJeUiOig/OpSqFhRdEvR+POSGRVUBYCUvfRtYebfX69VjlbExgUUypTCdt9wjFAzQJu2eVdM4ZOt5PnEqi4H8iTzLRo5ImXt59BJEcRcY2gWUM7Q1Es9A== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1e38b56-8bc8-4697-7828-08d86a1aae46 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB3958.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2020 17:10:10.1471 (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: VOVnG731mIhVtCVbOpfTwLLY530Szizfm3JGm0BJydAPq486u2kqFcOpNDxCb/ZpRHqGeY65C7paMDhI2usQ5PzDG+Ikwgw2SNk05jGDPS4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4373 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-06_09:2020-10-06, 2020-10-06 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 +++- NEWS | 2 ++ lib/dns-resolve.c | 12 ++++++++++++ 3 files changed, 17 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/NEWS b/NEWS index 2f67d5047..31099f155 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Post-v2.14.0 --------------------- + - The environment variable OVS_UNBOUND_CONF, if set, is now used + as the DNS resolver's (unbound) configuration file. v2.14.0 - 17 Aug 2020 diff --git a/lib/dns-resolve.c b/lib/dns-resolve.c index 1ff58960f..d34451434 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