LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ppp: Add rtnl attribute IFLA_PPP_UNIT_ID for specifying ppp unit id
Date: Thu, 12 Aug 2021 11:19:41 +0200	[thread overview]
Message-ID: <20210812091941.GA3525@pc-23.home> (raw)
In-Reply-To: <20210811175449.5hrwoevw7xv2jxxn@pali>

On Wed, Aug 11, 2021 at 07:54:49PM +0200, Pali Rohár wrote:
> On Wednesday 11 August 2021 19:19:18 Guillaume Nault wrote:
> > On Tue, Aug 10, 2021 at 06:04:50PM +0200, Pali Rohár wrote:
> > > On Tuesday 10 August 2021 17:39:41 Guillaume Nault wrote:
> > > > On Mon, Aug 09, 2021 at 09:31:09PM +0200, Pali Rohár wrote:
> > > > > Better to wait. I would like hear some comments / review on this patch
> > > > > if this is the correct approach as it adds a new API/ABI for userspace.
> > > > 
> > > > Personally I don't understand the use case for setting the ppp unit at
> > > > creation time.
> > > 
> > > I know about two use cases:
> > > 
> > > * ppp unit id is used for generating network interface name. So if you
> > >   want interface name ppp10 then you request for unit id 10. It is
> > >   somehow common that when ppp interface has prefix "ppp" in its name
> > >   then it is followed by unit id. Seems that existing ppp applications
> > >   which use "ppp<num>" naming expects this. But of course you do not
> > >   have to use this convention and rename interfaces as you want.
> > 
> > Really, with the netlink API, the interface name has to be set with
> > IFLA_IFNAME. There's no point in adding a new attribute just to have a
> > side effect on the device name.
> 
> Yes, if you set IFLA_IFNAME then interface has name which you set. But
> if IFLA_IFNAME is not set then there is already API/ABI behavior how
> this interface name is generated. And all existing ppp software depends
> on it.

They depend on the ioctl api, which is not going to change.
The netlink api on the other hand is free to avoid propagating mistakes
from the past.

> > > * Some of ppp ioctls use unit id. So you may want to use some specific
> > >   number for some network interface. So e.g. unit id 1 will be always
> > >   for /dev/ttyUSB1.
> > 
> > But what's the point of forcing unit id 1 for a particular interface?
> > One can easily get the assigned unit id with ioctl(PPPIOCGUNIT).
> 
> Same point as ability to assign any other id to objects. It is
> identifier and you may want to use specific identifier for specific
> objects.

Again, what's the use case? Unit ids are kernel internal identifiers.
The only purpose of setting them from user space was to influence the
name of the ppp device for legacy systems that couldn't do that in a
clean way. But any system with the netlink interface won't need this
work around.

> Old ioctl API provides a way how to set this custom unit id. Why should
> somebody use new rtnl API if it provides only half of features?

You still haven't provided any use case for setting the unit id in user
space, appart for influencing the interface name. Netlink also allows
to set the interface name and provides much more features (like
creating the device in a different netns).

> Existing
> software already use this feature to allow users / administrators to
> specify ids as they want.

And that was a mistake, as you realised when working on
https://lore.kernel.org/netdev/20210807160050.17687-1-pali@kernel.org/t/#u.

> > > And with unit id there also another issue:
> > > https://lore.kernel.org/netdev/20210807160050.17687-1-pali@kernel.org/t/#u
> > 
> > This patch shows why linking unit id and interface name are a bad idea.
> 
> Yea... It is not a good idea, but it is how ppp is implemented in
> kernel since beginning. And it affects both ioctl and rtnl APIs. So we
> cannot do anything with it due to backward compatibility :-(

Sorry, but I still hardly see the problem with the netlink api.
I shouldn't have accepted to let the unit id influence the interface
name, true. But that doesn't seem to be what you're complaining about.
Also, it could be useful to add the unit id in netlink dumps. But we
already agreed on that.

> > Instead of adding more complexity with unit id, I'd prefer to have a
> > new netlink attribute that says "don't generate the interface name
> > based on the unit id". That's how the original implementation worked by
> > the way and I'm really sad I accepted to change it...
> 
> Main issue there is that kernel currently does not provide any way how
> to retrieve interface which was created by rtnl call. So matching
> interface name by string "ppp" followed by unit id is currently the only
> option.

Yes, that's an old limitation of rtnl. But it's a much more general
problem. A work around is to set the interface name in the netlink
request. I can't see how forcing the unit id could ever help.

> I must admit that ppp rtnl API was designed incorrectly. If it was able
> to solve this issue since beginning then this unit id <--> interface
> mapping did not have to been implemented in rtnl code path.

As I already proposed, we can add an attribute to make the interface
name independant from the unit id.

> But it is too late now, if rtnl API has to be backward compatible then
> its behavior needs to be as it is currently.

Adding a new attribute is always possible.

> > > But due to how it is used we probably have to deal with it how ppp unit
> > > id are defined and assigned...
> > > 
> > 
> 


  reply	other threads:[~2021-08-12  9:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 16:37 Pali Rohár
2021-08-09 19:25 ` Jakub Kicinski
2021-08-09 19:31   ` Pali Rohár
2021-08-10 15:39     ` Guillaume Nault
2021-08-10 16:04       ` Pali Rohár
2021-08-11 17:19         ` Guillaume Nault
2021-08-11 17:54           ` Pali Rohár
2021-08-12  9:19             ` Guillaume Nault [this message]
2021-08-12 14:09               ` Pali Rohár
2021-08-12 19:12                 ` Guillaume Nault
     [not found]       ` <BN0P223MB0327A247724B7AE211D2E84EA7F79@BN0P223MB0327.NAMP223.PROD.OUTLOOK.COM>
2021-08-10 17:16         ` Pali Rohár
2021-08-10 18:11           ` James Carlson
2021-08-11 17:38             ` Guillaume Nault
2021-08-11 18:04               ` Pali Rohár
2021-08-12  9:28                 ` Guillaume Nault
2021-08-12 13:48                   ` Pali Rohár
2021-08-12 18:26                     ` Guillaume Nault
2021-08-12 19:04                       ` Pali Rohár
2021-08-16 16:11                         ` Guillaume Nault
2021-08-16 16:23                           ` Pali Rohár
2021-08-17 16:05                             ` Guillaume Nault
2021-08-17 16:21                               ` Pali Rohár
2022-07-09 12:09                                 ` Pali Rohár
2022-07-12 17:34                                   ` Guillaume Nault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210812091941.GA3525@pc-23.home \
    --to=gnault@redhat.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=paulus@samba.org \
    --subject='Re: [PATCH] ppp: Add rtnl attribute IFLA_PPP_UNIT_ID for specifying ppp unit id' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).