ooops, sorry not trondd, it was jhuldtgren who spotted it!
On 2021/10/24 22:26, Stuart Henderson wrote:
> trondd noticed a startup problem with snmpd on mips64 but didn't see
> them on amd64 and wondered if it was arch-specific, I had a go at
> reproducing and see it very often on aarch64 and also sometimes on
> amd64.
>
> Any setting of "trap receiver $ip snmpv2c community $community"
> triggers the problem:
>
> # for i in `jot 20`; do snmpd -nvf /etc/snmpd.conf; done
> trap receiver: missing community
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> trap receiver: missing community
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> configuration ok
> trap receiver: missing community
>
> Additionally even when configuration is accepted, the community is set
> to junk
>
> 822 tr->ta_oid = $2;
> 823 tr->ta_version = $3.type;
>
> with snmpv2c ta_version is set to 1
>
> 824 if ($3.type == ADDRESS_FLAG_SNMPV2) {
>
> so this branch isn't taken
>
> 825 (void)strlcpy(tr->ta_community, $3.data,
> 826 sizeof(tr->ta_community));
> 827 free($3.data);
> 828 } else {
> 829 tr->ta_usmusername = $3.data;
> 830 tr->ta_seclevel = $3.value;
> 831 }
>
> at this point ta_usmusername is set to the community and ta_community
> is junk.
>
> 810 if ($4 != NULL) {
> (gdb)
> 823 tr->ta_version = $3.type;
> (gdb)
> 824 if ($3.type == ADDRESS_FLAG_SNMPV2) {
> (gdb) p *tr
> $3 = {ta_ss = {ss_len = 16 '\020', ss_family = 2 '\002', __ss_pad1 =
> "\000\242\303_\273T", __ss_pad2 = 0,
> __ss_pad3 = "\002\000\000\000\001\000\000\000\001\000\000\000\a", '\000'
> <repeats 226 times>}, ta_sslocal = {
> ss_len = 0 '\000', ss_family = 0 '\000', __ss_pad1 =
> "\000\000\000\000\000", __ss_pad2 = 0,
> __ss_pad3 = '\000' <repeats 239 times>}, ta_version = 1, {ta_community =
> '\000' <repeats 483 times>, {
> ta_usmusername = 0x0, ta_usmuser = 0x0, ta_seclevel = 0}}, ta_oid =
> 0x0, entry = {tqe_next = 0x0,
> tqe_prev = 0x0}}
> (gdb) n
> 829 tr->ta_usmusername = $3.data;
> (gdb)
> 830 tr->ta_seclevel = $3.value;
> (gdb)
> 832 TAILQ_INSERT_TAIL(&(conf->sc_trapreceivers),
> tr, entry);
> (gdb) p *tr
> $4 = {ta_ss = {ss_len = 16 '\020', ss_family = 2 '\002', __ss_pad1 =
> "\000\242\303_\273T", __ss_pad2 = 0,
> __ss_pad3 = "\002\000\000\000\001\000\000\000\001\000\000\000\a", '\000'
> <repeats 226 times>}, ta_sslocal = {
> ss_len = 0 '\000', ss_family = 0 '\000', __ss_pad1 =
> "\000\000\000\000\000", __ss_pad2 = 0,
> __ss_pad3 = '\000' <repeats 239 times>}, ta_version = 1, {
> ta_community = "\340\035a\250O\005", '\000' <repeats 477 times>, {
> ta_usmusername = 0x54fa8611de0 "zzzzzzzzzzzzzzzzzz", ta_usmuser = 0x0,
> ta_seclevel = 0}}, ta_oid = 0x0,
> entry = {tqe_next = 0x0, tqe_prev = 0x0}}
>
>
>