From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none 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=edeSxwxM; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 41BCD5A061F for ; Tue, 14 Jan 2025 20:33:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736883185; 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=4DxJ4x/nL4YYZVTYk3YTVZdmfH1e11LM4fiE/Ta+a0c=; b=edeSxwxMo+FTdb5KiqDLTvalGQ3LNgZmMd4nXYQKoyhxFRrMvMHQJCTIUdPFBcImTVTyGf vi4xB9CwNoAysDEnsRr74uzu222fKQ5DFVnA6v3rCogCW2s4l4Tdw374pu8YHH9oj6Aw8r sxFSQ5TnS1O7gOvYZ7yPzem8C1IsAXE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-dMPoH3oCPj-0KLCC3yrfqw-1; Tue, 14 Jan 2025 14:33:03 -0500 X-MC-Unique: dMPoH3oCPj-0KLCC3yrfqw-1 X-Mimecast-MFC-AGG-ID: dMPoH3oCPj-0KLCC3yrfqw Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4361ac607b6so44891135e9.0 for ; Tue, 14 Jan 2025 11:33:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736883182; x=1737487982; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KHJixPYHNy6na9zMKXHNp27xHaQwPtXCUGljvWKUpGo=; b=So5972YLwLXa5MBZb0ApXtmqdrKonC5D/HQi34pyVmOhzbi5Tz7cAV248ovWn4SUrI xVMDcFEEVZSnBkZ4KaFjc9z2SvGUXRo4aLk3+D38th2iF9RjOoz4nLad+SDJNUlC7m6P t3x8CUxu0OijRFg+b/8qrprMHPqT/d7jd7q0DSp7+PkoOpFgEHJMUCTX53t2ooHN0hU+ MUaIN8X0p+5WlQaM92hQNHQcuS1CpukCsVO+zxocc553m0uGEaYhblqB4yV/lqoWnTch VAufFhsl1YPuEM4bxvs6/tZlB6ILr949Yh47MXRQ15UjSrRdZtc4hAQ/CtWnTNxF8C0A z5mQ== X-Gm-Message-State: AOJu0YxPgD2jbs26Z6TbpYH6jbuSCiFtrdJ+qkKw4XmI3Hd97kpWQ89G lG4Fa1+kzlyg5Sclet8qAGh5JZSIyPYxfrF0pBO9wWF7CyqspOcaP1/1Six4rJJorp9XM93AHJS adI1cTUDVZVw0cgIlYAXl19eFM5TJhnuer3uAKw1FpR6iHVrzhNB6p0dUQg+546uju8AdLUzze/ /iLbc5kIlCPkDS6pJers74WnMgSn68VdG7 X-Gm-Gg: ASbGnctGFJQtVbmqXtEhO3qKSPC5YgAeGrLFxLfVZH7l0RCa53sRTkRbXOQdOCnHvTJ gYMQ0g9UR2brHIrRXG8H3yKcZcXDSlNNHerJP42QZhKSYj7IGOqhTsacJAO96PHPt+USEtj8u8q cOgz7gAT4nVHbGHimGk3Ac1smFAqCjoG1/2LacYTdcIIOeWqrVu0cmDRc2337DayXuXsWLDDirI s26PCRaufx5UTp1HFF+Cnm5rISTunKhcBetXhfDOnAscBTbr8QOpuiSzw7psY3zdQV+FU/bQ+w9 RZM3SUtdYA== X-Received: by 2002:a05:600c:a07:b0:434:a815:2b57 with SMTP id 5b1f17b1804b1-436e27082e1mr216868635e9.20.1736883181829; Tue, 14 Jan 2025 11:33:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtvZSLRB+0dmnEhz7rxsJ259Z9SEBTn7afd9CdWAq3ctQWJsCnZ18cNAU1QXhBkQcqAL6Yww== X-Received: by 2002:a05:600c:a07:b0:434:a815:2b57 with SMTP id 5b1f17b1804b1-436e27082e1mr216868425e9.20.1736883181409; Tue, 14 Jan 2025 11:33:01 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38c697sm15982644f8f.52.2025.01.14.11.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:33:00 -0800 (PST) Date: Tue, 14 Jan 2025 20:32:59 +0100 From: Stefano Brivio To: Enrique Llorente Pastora Subject: Re: [PATCH v8] dhcp, dhcpv6: Add hostname and client fqdn ops Message-ID: <20250114203259.3cd0a190@elisabeth> In-Reply-To: References: <20250110102626.620430-1-ellorent@redhat.com> <20250111005249.34dfb995@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Vm5S2Nt0Ef2PvKvIvaUwXY7Ed2NVAmWTlVKfnlXA1lQ_1736883182 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LP2BSXBK6LJAS44XH65FR3FJFFZFA5VT X-Message-ID-Hash: LP2BSXBK6LJAS44XH65FR3FJFFZFA5VT 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: passt-dev@passt.top 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, 14 Jan 2025 15:01:33 +0100 Enrique Llorente Pastora wrote: > On Sat, Jan 11, 2025 at 12:53=E2=80=AFAM Stefano Brivio wrote: > > > > On Fri, 10 Jan 2025 11:26:26 +0100 > > Enrique Llorente wrote: > > =20 > > > @@ -162,17 +180,20 @@ static int fill(struct msg *m) > > > * Put it there explicitly, unless requested via option 55. > > > */ > > > if (opts[55].clen > 0 && !memchr(opts[55].c, 53, opts[55].clen)= ) > > > - fill_one(m, 53, &offset); > > > + offset =3D fill_one(m, 53, offset); =20 > > > > Now suppose that somebody adds a "long" option before this block, or... > > =20 > > > > > > for (i =3D 0; i < opts[55].clen; i++) { > > > o =3D opts[55].c[i]; > > > if (opts[o].slen !=3D -1) > > > - fill_one(m, o, &offset); > > > + offset =3D fill_one(m, o, offset); > > > } =20 > > > > before this one, and fill_one() returns -1. Then... > > =20 > > > for (o =3D 0; o < 255; o++) { > > > - if (opts[o].slen !=3D -1 && !opts[o].sent) > > > - fill_one(m, o, &offset); > > > + if (opts[o].slen !=3D -1 && !opts[o].sent) { > > > + offset =3D fill_one(m, o, offset); =20 > > > > you use offset as -1 here, and boom. If not, see directly below). > > =20 > > > + if (offset =3D=3D -1) =20 > > > > Or maybe the domain name is actually too long, and offset is -1 here... > > =20 > > > + debug("DHCP: skipping option %i", o); > > > + } > > > } > > > > > > m->o[offset++] =3D 255; =20 > > > > ...and boom. This sets the last byte of "magic" (depending on the > > architecture) to 0xff, making the whole message invalid. >=20 > well, I was expecting the only problematic options being at > 55 > (didn't check the standard) > but I agree that we have to be consistent on handling the fill_in result. Sure, that's the (reasonable) expectation, but note that you would have the same problem even with a domain name that's too long for fill_one(). --=20 Stefano