Index | Thread | Search

From:
Martijn van Duren <openbsd+tech@list.imperialat.at>
Subject:
Re: snmpd: move engineid into a struct
To:
Jonathan Matthew <jonathan@d14n.org>
Cc:
tech@openbsd.org
Date:
Wed, 24 Dec 2025 14:41:36 +0100

Download raw body.

Thread
On 12/23/25 04:36, Jonathan Matthew wrote:
> On Mon, Dec 22, 2025 at 12:16:43PM +0100, Martijn van Duren wrote:
>> On 11/9/25 12:51, Martijn van Duren wrote:
>>> This diff is a bit of preparation for the next diff.
>>> Initially I went a bit too simplistic and simply put the engineid value
>>> and length in two separate variables inside the requiring structs. This
>>> diff bundles the 2 variables into a struct engineid. This also helps with the
>>> parse.y stuff.
>>>
>>> This diff is on top of the "move smi_getticks to appl_sysuptime" diff.
>>> It might apply without it, but not tested.
>>>
>>> OK?
>>>
>>> martijn@
>>>
>> Updated diff. jmatthew@ found that the pen vanished from the engineid.
>> Simplified the problem boils down to this:
>> foo: bar {
>> 	$$[0] = 1;
>> } baz {
>> 	$$[1] = 2
>> }
>> Where I expected the result to be {1, 2}, but I got {0, 2}. I merged
>> the two bodies, which gives a cleaner result anyway, but I'm still
>> curious how this is supposed to work. If anyone has an idea, feel free
>> to speak up.
> 
> That's beyond my understanding of yacc, but this version of the diff
> produces the right engine IDs and otherwise makes sense.
> ok jmatthew@
> 
Committed, thanks.
For completeness regarding the problem; The correct way to do this
would be:
foo: bar {
	$$[0] = 1;
} baz {
	$$ = $2;
	$$[1] = 2;
}