Index | Thread | Search

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

Download raw body.

Thread
> On 19 Oct 2024, at 15:39, Claudio Jeker <cjeker@diehard.n-r-g.com> wrote:
> 
> 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.
> 

You have SIOCAIFADDR for that, SIOCSIFDSTADDR is deprecated. netintro(4)
say about that:

     SIOCSIFDSTADDR struct ifreq *
             Set the point-to-point address for a protocol family and
             interface.

             This call has been deprecated and superseded by the SIOCAIFADDR
             call, described below.