From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XQQlHIp6; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 613D35A0265 for ; Fri, 12 Jun 2026 01:04:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781219081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yjOkcMq7QE1UNyscYkBokfsrqbqSNMx3326TGIeXhvs=; b=XQQlHIp63LFs2i/O0rzPqi1YfIHHP3nW4vFWo05/WP3nLnsem8LGJnDVzcK58jfzwTndky p7sTcFU/psnHcm+JBlUbqieOnuixepOh0D/1fPrKt60btPSJltO6dnek+HNoyfKkf6vdpv xSOvlyPQV9sbgfq1VVEHxERhkbxEfVw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-nVQLhLysPSK82qJH960goA-1; Thu, 11 Jun 2026 19:04:39 -0400 X-MC-Unique: nVQLhLysPSK82qJH960goA-1 X-Mimecast-MFC-AGG-ID: nVQLhLysPSK82qJH960goA_1781219079 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-490dad70f95so2612745e9.3 for ; Thu, 11 Jun 2026 16:04:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781219078; x=1781823878; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yjOkcMq7QE1UNyscYkBokfsrqbqSNMx3326TGIeXhvs=; b=muGGHn2qNl9pqNS2AHgPx0fm/bpIa0SAaHeJeAA8HVn8SXl0J5zud72QD/sTYaNtkZ C9otqLrGdWfkA8P962HnCitwJ3jzaeknN2p03VAT3nZ/U2MZxKg9HjSGzWjoo+V/CSYO dc8HxsSlaKjdLfvnD9DZOMlOd8k7rPmWXAO05mttRQ7sg8jc8jCLv27M/FICSmF0/p8k I0lcJgpCYHfLPjux8nT2aKmZDVjokpjBotOpUR3XTyb5g+YzVgKdZ6HB9JhApjQP05WL bixHVRMKL3jEyvi21+kjfELGcJtjedaMxThHp1q2ReyGlDJFM/Fm1tIpkRp2eEajAfyB 0PVQ== X-Forwarded-Encrypted: i=1; AFNElJ9FI7gD1NKb53Q1zxZqqMxYEWcSEUUTSE+5b7vBeEL0bfopMbvuHDVGFFHPQB2TtEbteXtbQxRELIQ=@passt.top X-Gm-Message-State: AOJu0YxL06Wv3DqUCpymd9Crcsd4Xd13PCklazITZ6ESgbszAo73Gyul 9zjMGWiPmkrhqmt/6CdP8u9glrksvjIaHn3eylHy/PdCnI5/tgmVCedZboJTV+im+9z4W+ZQbZ1 TpU+0oGRL/tM/Gag625qc8D8vdDvNSgBIrQQ6fGJtgGwXFZOgcebhAg== X-Gm-Gg: Acq92OE18yKb1ftu5NV1GbgCCclBH0KhfjfLpgT+Yw5yxY5LNO3zz1KoibRwbMLjBHC ZlDg4lSrk0+SnIzzH5x1cPRKKrNmHjYyzemCCo7Cc2nurSEw3SDOQoVSpw1C/r2pRwo6G8PaKgM lIgMPZ9nLKE115R8DyyvHY2T8Mi2fxiZaTcTEVxYQuREZlKMFLVSPvOTWYAR7vPzd7uu6yqndtH RqrSL/jMh9kMt4jC/aapcqdVnMFnVCQsBgpDnDTy2OHQB4FvFvJu1qgh4fA/SMhpf/VFHtZYQ+1 Lsd4YfHQWxIeDoYcDAjsWeDLBcpRa19+Di1FlGslGTowJfBdLpOei2lJ15Kbd9Fnewf21rzLIjQ Vr0cd0kjAAjBfWvj4tjHJ+nrA+n8g4X8z30+VCu+b+MU+JgujFA== X-Received: by 2002:a05:600c:c16f:b0:490:6e11:c303 with SMTP id 5b1f17b1804b1-490ec4e6f22mr716255e9.13.1781219078660; Thu, 11 Jun 2026 16:04:38 -0700 (PDT) X-Received: by 2002:a05:600c:c16f:b0:490:6e11:c303 with SMTP id 5b1f17b1804b1-490ec4e6f22mr716055e9.13.1781219078180; Thu, 11 Jun 2026 16:04:38 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea95c512sm8548675e9.2.2026.06.11.16.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 16:04:37 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 3/6] dhcp: Add option type table and value parser Message-ID: <20260612010436.6b25300f@elisabeth> In-Reply-To: References: <20260601073758.1571317-1-anskuma@redhat.com> <20260601073758.1571317-4-anskuma@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Fri, 12 Jun 2026 01:04:37 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JXSFwIe4dPyFdrxA73vnOQjf88BJQw35loxQKziQnUs_1781219079 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: QLRWXTEN3LDU7LX4EI44BHJZASMEVG3S X-Message-ID-Hash: QLRWXTEN3LDU7LX4EI44BHJZASMEVG3S X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Anshu Kumari , passt-dev@passt.top, jmaloy@redhat.com, lvivier@redhat.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 2 Jun 2026 12:23:47 +1000 David Gibson wrote: > On Mon, Jun 01, 2026 at 01:07:53PM +0530, Anshu Kumari wrote: > > > [...] > > > > +/** > > + * dhcp_opt_types - Maps option code to RFC 2132 value type, indexed by code > > + */ > > +static const enum dhcp_opt_type dhcp_opt_types[256] = { > > + [1] = DHCP_OPT_IPV4, /* Subnet Mask */ > > + [2] = DHCP_OPT_INT32, /* Time Offset */ > > + [3] = DHCP_OPT_IPV4_LIST, /* Router */ > > I'm still a bit unsure if we want to allow user modification of the > options, like this one, which we already manage ourselves. I think we don't lose any functionality if we allow users to overwrite them, and we might gain some: for example one might want to directly set a specific default route in the target network namespace, in pasta, but change it as a DHCP client runs. Not that I see any point in doing that, but it's harmless, so why not. Maybe even just for testing, go figure. > > [...] > > > > @@ -61,7 +227,15 @@ int dhcp_add_option(struct ctx *c, uint8_t code, const char *val_str) > > c->custom_opts_count++; > > } > > > > + ret = dhcp_opt_parse(code, val_str, > > + c->custom_opts[idx].val, > > + sizeof(c->custom_opts[0].val)); > > Now that this parsing and adding code is all in dhcp.c, could we parse > the options directly into the existing opts[] global, rather than > requiring both the string and parsed forms in c->custom_opts? I see one downside with that: the day we add the possibility for pesto(1) to set and read out options, we would need to add an implementation to decode them back, which could be rather complicated if you think of stuff such as "compressed" (yes, that madness) domain names. -- Stefano