On 2021-11-20 18:41 +01, Florian Obser <flor...@openbsd.org> wrote: > On 2021-11-20 18:19 +01, Florian Obser <flor...@openbsd.org> wrote: > >> +/* >> + * Clear AD flag in the answer. >> + */ >> +static void >> +clear_ad(struct asr_result *ar) >> +{ >> + struct asr_dns_header *h; >> + uint16_t flags; >> + >> + h = (struct asr_dns_header *)ar->ar_data; >> + flags = ntohs(h->flags); >> + flags &= ~(AD_MASK); >> + h->flags = htons(flags); >> +} >> + > > btw. is it possible that this is not alligned correctly on sparc64? > > should be do something like (not even compile tested) > > static void > clear_ad(struct asr_result *ar) > { > struct asr_dns_header h; > > memmove(&h, ar->ar_data, sizeof(h)); > h.flags = ntohs(h.flags); > h.flags &= ~(AD_MASK); > h.flags = htons(h.flags); > memmove(ar->ar_data, &h, sizeof(h)); > } >
memcpy obviously, I was distracted by the copious amount of memmove in asr code... -- I'm not entirely sure you are real.