Index | Thread | Search

From:
David Gwynne <david@gwynne.id.au>
Subject:
Re: diff for vxlan(4): duplicate m_inithdr()
To:
Denis Fondras <denis@openbsd.org>
Cc:
tech@openbsd.org
Date:
Mon, 16 Jun 2025 07:19:47 +1000

Download raw body.

Thread
On Sun, Jun 15, 2025 at 03:47:13PM +0200, Denis Fondras wrote:
> m_inithdr() is already called a few lines above.
> From my understanding, this is a duplicate and the second call can be removed.
> 
> Did I understand correctly ?

the code here is building data payloads to pass to a series of sosetopt()
calls. this second m_inithdr call is resetting it after the first
sosetopt() so it can be used again for the second sosetop().

it's possible we don't need the extra m_inithdr, but that would require
a lot of reading to follow the sosetopt calls and see how they change
the mbuf. it seems more robust to just keep the reset with m_inithdr.

cheers,
dlg

> 
> Index: if_vxlan.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_vxlan.c,v
> diff -u -p -r1.100 if_vxlan.c
> --- if_vxlan.c	31 Oct 2024 11:41:31 -0000	1.100
> +++ if_vxlan.c	15 Jun 2025 13:45:51 -0000
> @@ -944,7 +944,6 @@ vxlan_tep_add_addr(struct vxlan_softc *s
>  	if (error != 0)
>  		goto close;
>  
> -	m_inithdr(&m);
>  	switch (vt->vt_af) {
>  	case AF_INET:
>  		sin = mtod(&m, struct sockaddr_in *);
>