* [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
@ 2026-03-14 1:14 Martin Olivier
2026-03-17 23:14 ` Jakub Kicinski
2026-03-18 1:59 ` Qingfang Deng
0 siblings, 2 replies; 6+ messages in thread
From: Martin Olivier @ 2026-03-14 1:14 UTC (permalink / raw)
To: netdev, linux-ppp
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, linux-kernel,
dqfext, Martin Olivier
Currently, the PPP rtnetlink API allows creating a new network interface
with a custom ifname, but it lacks the ability to specify a custom PPP
unit id.
Setting a specific unit id is currently only possible with the
PPPIOCNEWUNIT ioctl. If a user-space program also requires a custom
interface name, it must create the interface first with PPPIOCNEWUNIT
and then rename it.
Resolve this by introducing the IFLA_PPP_UNIT netlink attribute. This
allows user-space programs to atomically request both a custom ifname
and a specific PPP unit id during the RTM_NEWLINK creation process,
eliminating the post-creation renaming for this use case.
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
---
Changes in v2:
- use nl policy to set IFLA_PPP_UNIT min allowed value instead of a manual check in ppp_nl_validate()
- use of nla_get_s32_default() to collect IFLA_PPP_UNIT value
Link to v1: https://lore.kernel.org/netdev/PAWP192MB2411A5E7D3BE1B55E155A92F9747A@PAWP192MB2411.EURP192.PROD.OUTLOOK.COM/
---
drivers/net/ppp/ppp_generic.c | 3 ++-
include/uapi/linux/if_link.h | 1 +
tools/include/uapi/linux/if_link.h | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e9b41777be80..3d5d5fe8bad3 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1292,6 +1292,7 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev,
static const struct nla_policy ppp_nl_policy[IFLA_PPP_MAX + 1] = {
[IFLA_PPP_DEV_FD] = { .type = NLA_S32 },
+ [IFLA_PPP_UNIT] = NLA_POLICY_MIN(NLA_S32, 0),
};
static int ppp_nl_validate(struct nlattr *tb[], struct nlattr *data[],
@@ -1316,7 +1317,6 @@ static int ppp_nl_newlink(struct net_device *dev,
struct nlattr **data = params->data;
struct nlattr **tb = params->tb;
struct ppp_config conf = {
- .unit = -1,
.ifname_is_set = true,
};
struct file *file;
@@ -1342,6 +1342,7 @@ static int ppp_nl_newlink(struct net_device *dev,
}
conf.file = file;
+ conf.unit = nla_get_s32_default(data[IFLA_PPP_UNIT], -1);
/* Don't use device name generated by the rtnetlink layer when ifname
* isn't specified. Let ppp_dev_configure() set the device name using
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index e9b5f79e1ee1..40523cd01a8b 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1477,6 +1477,7 @@ enum {
enum {
IFLA_PPP_UNSPEC,
IFLA_PPP_DEV_FD,
+ IFLA_PPP_UNIT,
__IFLA_PPP_MAX
};
#define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1)
diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h
index 7e46ca4cd31b..150a582ae498 100644
--- a/tools/include/uapi/linux/if_link.h
+++ b/tools/include/uapi/linux/if_link.h
@@ -1465,6 +1465,7 @@ enum {
enum {
IFLA_PPP_UNSPEC,
IFLA_PPP_DEV_FD,
+ IFLA_PPP_UNIT,
__IFLA_PPP_MAX
};
#define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1)
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
2026-03-14 1:14 [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute Martin Olivier
@ 2026-03-17 23:14 ` Jakub Kicinski
2026-03-18 1:59 ` Qingfang Deng
1 sibling, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2026-03-17 23:14 UTC (permalink / raw)
To: dqfext
Cc: Martin Olivier, netdev, linux-ppp, andrew+netdev, davem, edumazet,
pabeni, linux-kernel
On Sat, 14 Mar 2026 02:14:29 +0100 Martin Olivier wrote:
> Currently, the PPP rtnetlink API allows creating a new network interface
> with a custom ifname, but it lacks the ability to specify a custom PPP
> unit id.
>
> Setting a specific unit id is currently only possible with the
> PPPIOCNEWUNIT ioctl. If a user-space program also requires a custom
> interface name, it must create the interface first with PPPIOCNEWUNIT
> and then rename it.
>
> Resolve this by introducing the IFLA_PPP_UNIT netlink attribute. This
> allows user-space programs to atomically request both a custom ifname
> and a specific PPP unit id during the RTM_NEWLINK creation process,
> eliminating the post-creation renaming for this use case.
Qingfang Deng, you work on PPP, could you review this patch, please?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
2026-03-14 1:14 [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute Martin Olivier
2026-03-17 23:14 ` Jakub Kicinski
@ 2026-03-18 1:59 ` Qingfang Deng
2026-03-18 9:49 ` Guillaume Nault
2026-03-18 10:07 ` Pali Rohár
1 sibling, 2 replies; 6+ messages in thread
From: Qingfang Deng @ 2026-03-18 1:59 UTC (permalink / raw)
To: Martin Olivier
Cc: netdev, linux-ppp, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-kernel, Pali Rohár, Paul Mackerras, Guillaume Nault
On Sat, 14 Mar 2026 02:14:29 +0100, Martin Olivier wrote:
> Currently, the PPP rtnetlink API allows creating a new network interface
> with a custom ifname, but it lacks the ability to specify a custom PPP
> unit id.
>
> Setting a specific unit id is currently only possible with the
> PPPIOCNEWUNIT ioctl. If a user-space program also requires a custom
> interface name, it must create the interface first with PPPIOCNEWUNIT
> and then rename it.
>
> Resolve this by introducing the IFLA_PPP_UNIT netlink attribute. This
> allows user-space programs to atomically request both a custom ifname
> and a specific PPP unit id during the RTM_NEWLINK creation process,
> eliminating the post-creation renaming for this use case.
>
> Signed-off-by: Martin Olivier <martin.olivier@live.fr>
> ---
> Changes in v2:
> - use nl policy to set IFLA_PPP_UNIT min allowed value instead of a manual check in ppp_nl_validate()
> - use of nla_get_s32_default() to collect IFLA_PPP_UNIT value
> Link to v1: https://lore.kernel.org/netdev/PAWP192MB2411A5E7D3BE1B55E155A92F9747A@PAWP192MB2411.EURP192.PROD.OUTLOOK.COM/
The patch itself looks good to me, but I would like to check the
userspace changes too. Please create a pull request at
https://github.com/ppp-project/ppp/pulls
+Cc: Paul Mackerras, Guillaume Nault, Pali Rohár
Regards,
Qingfang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
2026-03-18 1:59 ` Qingfang Deng
@ 2026-03-18 9:49 ` Guillaume Nault
2026-03-18 10:07 ` Pali Rohár
1 sibling, 0 replies; 6+ messages in thread
From: Guillaume Nault @ 2026-03-18 9:49 UTC (permalink / raw)
To: Qingfang Deng
Cc: Martin Olivier, netdev, linux-ppp, andrew+netdev, davem, edumazet,
kuba, pabeni, linux-kernel, Pali Rohár, Paul Mackerras
On Wed, Mar 18, 2026 at 09:59:29AM +0800, Qingfang Deng wrote:
> On Sat, 14 Mar 2026 02:14:29 +0100, Martin Olivier wrote:
> > Currently, the PPP rtnetlink API allows creating a new network interface
> > with a custom ifname, but it lacks the ability to specify a custom PPP
> > unit id.
> >
> > Setting a specific unit id is currently only possible with the
> > PPPIOCNEWUNIT ioctl. If a user-space program also requires a custom
> > interface name, it must create the interface first with PPPIOCNEWUNIT
> > and then rename it.
> >
> > Resolve this by introducing the IFLA_PPP_UNIT netlink attribute. This
> > allows user-space programs to atomically request both a custom ifname
> > and a specific PPP unit id during the RTM_NEWLINK creation process,
> > eliminating the post-creation renaming for this use case.
> >
> > Signed-off-by: Martin Olivier <martin.olivier@live.fr>
> > ---
> > Changes in v2:
> > - use nl policy to set IFLA_PPP_UNIT min allowed value instead of a manual check in ppp_nl_validate()
> > - use of nla_get_s32_default() to collect IFLA_PPP_UNIT value
> > Link to v1: https://lore.kernel.org/netdev/PAWP192MB2411A5E7D3BE1B55E155A92F9747A@PAWP192MB2411.EURP192.PROD.OUTLOOK.COM/
>
> The patch itself looks good to me, but I would like to check the
> userspace changes too. Please create a pull request at
> https://github.com/ppp-project/ppp/pulls
>
> +Cc: Paul Mackerras, Guillaume Nault, Pali Rohár
As far as I understand, the original ioctl API allowed setting the unit
id for only one reason: to allow userspace to influence the name of the
ppp device to be created.
The netlink interface on the other hand already allows to set the
device name, without needing to play with the unit id. So what's the
use case for setting the unit id with netlink?
> Regards,
> Qingfang
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
2026-03-18 1:59 ` Qingfang Deng
2026-03-18 9:49 ` Guillaume Nault
@ 2026-03-18 10:07 ` Pali Rohár
2026-03-18 10:11 ` Pali Rohár
1 sibling, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2026-03-18 10:07 UTC (permalink / raw)
To: Martin Olivier, Qingfang Deng
Cc: netdev, linux-ppp, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-kernel, Paul Mackerras, Guillaume Nault
On Wednesday 18 March 2026 09:59:29 Qingfang Deng wrote:
> On Sat, 14 Mar 2026 02:14:29 +0100, Martin Olivier wrote:
> > Currently, the PPP rtnetlink API allows creating a new network interface
> > with a custom ifname, but it lacks the ability to specify a custom PPP
> > unit id.
> >
> > Setting a specific unit id is currently only possible with the
> > PPPIOCNEWUNIT ioctl. If a user-space program also requires a custom
> > interface name, it must create the interface first with PPPIOCNEWUNIT
> > and then rename it.
> >
> > Resolve this by introducing the IFLA_PPP_UNIT netlink attribute. This
> > allows user-space programs to atomically request both a custom ifname
> > and a specific PPP unit id during the RTM_NEWLINK creation process,
> > eliminating the post-creation renaming for this use case.
> >
> > Signed-off-by: Martin Olivier <martin.olivier@live.fr>
> > ---
> > Changes in v2:
> > - use nl policy to set IFLA_PPP_UNIT min allowed value instead of a manual check in ppp_nl_validate()
> > - use of nla_get_s32_default() to collect IFLA_PPP_UNIT value
> > Link to v1: https://lore.kernel.org/netdev/PAWP192MB2411A5E7D3BE1B55E155A92F9747A@PAWP192MB2411.EURP192.PROD.OUTLOOK.COM/
>
> The patch itself looks good to me, but I would like to check the
> userspace changes too. Please create a pull request at
> https://github.com/ppp-project/ppp/pulls
>
> +Cc: Paul Mackerras, Guillaume Nault, Pali Rohár
>
> Regards,
> Qingfang
Hello Martin, in past I have sent similar change:
https://lore.kernel.org/linux-ppp/20210807163749.18316-1-pali@kernel.org/T/#u
Look at the discussion, it can be useful to understand why the change
was not accepted.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute
2026-03-18 10:07 ` Pali Rohár
@ 2026-03-18 10:11 ` Pali Rohár
0 siblings, 0 replies; 6+ messages in thread
From: Pali Rohár @ 2026-03-18 10:11 UTC (permalink / raw)
To: Martin Olivier, Qingfang Deng
Cc: netdev, linux-ppp, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-kernel, Paul Mackerras, Guillaume Nault
Hello, I was not able to send my previous message to Martin. It failed on error:
<martin.olivier@live.fr>: host eur.olc.protection.outlook.com[52.101.68.24]
said: 550 5.7.1 Unfortunately, messages from [172.105.4.254] weren't sent.
Please contact your Internet service provider since part of their network
is on our block list (S3140). You can also refer your provider to
http://mail.live.com/mail/troubleshooting.aspx#errors. [Name=Protocol
Filter Agent][AGT=PFA][MxId=11BD098F3639132A]
[DB3PEPF0000885E.eurprd02.prod.outlook.com 2026-03-18T10:07:44.206Z
08DE84C79B425097] (in reply to MAIL FROM command)
Can somebody forward my previous email message to Martin and ideally
mention that error?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-18 10:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14 1:14 [PATCH net-next v2] ppp: add IFLA_PPP_UNIT netlink attribute Martin Olivier
2026-03-17 23:14 ` Jakub Kicinski
2026-03-18 1:59 ` Qingfang Deng
2026-03-18 9:49 ` Guillaume Nault
2026-03-18 10:07 ` Pali Rohár
2026-03-18 10:11 ` Pali Rohár
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox