Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: tun(4): SIOCSIFDSTADDR is deprecated, so stop handling it
To:
Vitaliy Makkoveev <otto@bsdbox.dev>
Cc:
David Gwynne <david@gwynne.id.au>, tech@openbsd.org
Date:
Sat, 19 Oct 2024 14:39:47 +0200

Download raw body.

Thread
On Sat, Oct 19, 2024 at 12:45:30PM +0300, Vitaliy Makkoveev wrote:
> > On 19 Oct 2024, at 11:45, Claudio Jeker <cjeker@diehard.n-r-g.com> wrote:
> > 
> > On Tue, Oct 15, 2024 at 01:33:46PM +1000, David Gwynne wrote:
> >> according to netintro, SIOCSIFDSTADDR is deprecated. only a handful of
> >> old drivers still have code to handle it, so i'd like to clean them up.
> >> tun(4) can go first.
> >> 
> >> ok?
> >> 
> >> Index: if_tun.c
> >> ===================================================================
> >> RCS file: /cvs/src/sys/net/if_tun.c,v
> >> diff -u -p -r1.241 if_tun.c
> >> --- if_tun.c	10 Oct 2024 06:50:58 -0000	1.241
> >> +++ if_tun.c	15 Oct 2024 03:29:35 -0000
> >> @@ -599,10 +543,6 @@ tun_ioctl(struct ifnet *ifp, u_long cmd,
> >> 			CLR(ifp->if_flags, IFF_RUNNING);
> >> 		break;
> >> 
> >> -	case SIOCSIFDSTADDR:
> >> -		tun_init(sc);
> >> -		TUNDEBUG(("%s: destination address set\n", ifp->if_xname));
> >> -		break;
> >> 	case SIOCSIFMTU:
> >> 		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > TUNMRU)
> >> 			error = EINVAL;
> >> 
> > 
> > I think this is not correct. You still want to be able to use the
> > SIOCSIFDSTADDR ioctl. An example for this is
> > regress/sbin/ifconfig/ifaddr.c.
> > I think this should just do:
> > 
> > 	case SIOCSIFDSTADDR:
> > 		break;
> > 
> > This way there is no error when SIOCSIFDSTADDR is used.
> > 
> > -- 
> > :wq Claudio
> > 
> 
> Isn’t it better to adjust regress test? SIOCSIFDSTADDR is not appropriate
> for tun(4) interfaces.

Why is it not? tun(4) is a point-to-point interface and therefor setting
the destination address is absolutly in scope.

-- 
:wq Claudio