pppoe: remove kernel-mode relay support
PATCH 1/1 pppoe: remove kernel-mode relay support
The kernel-mode PPPoE relay feature and its two associated ioctls (PPPOEIOCSFWD and PPPOEIOCDFWD) are not used by any existing userspace PPPoE implementations. The most commonly-used package, RP-PPPoE [1], handles the relaying entirely in userspace.
This legacy code has remained in the driver since its introduction in kernel 2.3.99-pre7 for over two decades, but has served no practical purpose.
Remove the unused relay code.
[1] https://dianne.skoll.ca/projects/rp-pppoe/
---
Repost as non-RFC:
- https://lore.kernel.org/netdev/[email protected]/
drivers/net/ppp/pppoe.c | 79 ----------------------------------- drivers/net/ppp/pppox.c | 3 -- include/linux/if_pppox.h | 6 --- include/uapi/linux/if_pppox.h | 10 ----- 4 files changed, 98 deletions(-)
drivers/net/ppp/pppoe.c +0 -79
@@ -237,25 +237,6 @@ static inline struct pppox_sock *get_item(struct pppoe_net *pn, __be16 sid,return po; } -static inline struct pppox_sock *__get_item_by_addr (struct net *net, -struct sockaddr_pppox *sp) -{ -struct net_device *dev; -struct pppoe_net *pn; -struct pppox_sock *pppox_sock =NULL ; - -int ifindex; - - dev =dev_get_by_name_rcu (net, sp->sa_addr.pppoe.dev); -if (dev) { - ifindex = dev->ifindex; - pn =pppoe_pernet (net); - pppox_sock =__get_item (pn, sp->sa_addr.pppoe.sid, - sp->sa_addr.pppoe.remote, ifindex); - } -return pppox_sock; -} -static inline void delete_item (struct pppoe_net *pn,__be16 sid,char *addr,int ifindex) {
@@ -369,7 +350,6 @@ static struct notifier_block pppoe_notifier = {static int pppoe_rcv_core (struct sock *sk,struct sk_buff *skb) {struct pppox_sock *po =pppox_sk (sk); -struct pppox_sock *relay_po;/* Backlog receive. Semantics of backlog rcv preclude any code from * executing in lock_sock()/release_sock() bounds; meaning sk->sk_state
@@ -378,17 +358,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)if (sk->sk_state &PPPOX_BOUND ) {ppp_input (&po->chan, skb); - }else if (sk->sk_state &PPPOX_RELAY ) { - relay_po =__get_item_by_addr (sock_net (sk), - &po->pppoe_relay); -if (relay_po ==NULL ) - goto abort_kfree; - -if ((sk_pppox (relay_po)->sk_state &PPPOX_CONNECTED ) ==0 ) - goto abort_kfree; - -if (!__pppoe_xmit (sk_pppox (relay_po), skb)) - goto abort_kfree; }else {if (sock_queue_rcv_skb (sk, skb)) goto abort_kfree;
@@ -656,7 +625,6 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddr po->pppoe_ifindex =0 ;memset (&po->pppoe_pa,0 ,sizeof (po->pppoe_pa)); -memset (&po->pppoe_relay,0 ,sizeof (po->pppoe_relay));memset (&po->chan,0 ,sizeof (po->chan)); po->next =NULL ; po->num =0 ;
@@ -783,53 +751,6 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, err =0 ;break ; -case PPPOEIOCSFWD : - { -struct pppox_sock *relay_po; - - err = -EBUSY ; -if (sk->sk_state & (PPPOX_BOUND |PPPOX_DEAD )) -break ; - - err = -ENOTCONN ; -if (!(sk->sk_state &PPPOX_CONNECTED )) -break ; - -/* PPPoE address from the user specifies an outbound -PPPoE address which frames are forwarded to */ - err = -EFAULT ; -if (copy_from_user (&po->pppoe_relay, - (void __user *)arg, -sizeof (struct sockaddr_pppox ))) -break ; - - err = -EINVAL ; -if (po->pppoe_relay.sa_family !=AF_PPPOX || - po->pppoe_relay.sa_protocol !=PX_PROTO_OE ) -break ; - -/* Check that the socket referenced by the address -actually exists. */ -rcu_read_lock (); - relay_po =__get_item_by_addr (sock_net (sk), &po->pppoe_relay); -rcu_read_unlock (); -if (!relay_po) -break ; - - sk->sk_state |=PPPOX_RELAY ; - err =0 ; -break ; - } - -case PPPOEIOCDFWD : - err = -EALREADY ; -if (!(sk->sk_state &PPPOX_RELAY )) -break ; - - sk->sk_state &= ~PPPOX_RELAY ; - err =0 ; -break ; -default : err = -ENOTTY ; }
drivers/net/ppp/pppox.c +0 -3
@@ -102,9 +102,6 @@ EXPORT_SYMBOL(pppox_ioctl);#ifdef CONFIG_COMPAT int pppox_compat_ioctl (struct socket *sock,unsigned int cmd,unsigned long arg) { -if (cmd ==PPPOEIOCSFWD32 ) - cmd =PPPOEIOCSFWD ; -return pppox_ioctl (sock, cmd, (unsigned long )compat_ptr (arg)); }
include/linux/if_pppox.h +0 -6
@@ -25,8 +25,6 @@ struct pppoe_opt {struct net_device *dev;/* device associated with socket*/ int ifindex;/* ifindex of device associated with socket */ struct pppoe_addr pa;/* what this socket is bound to*/ -struct sockaddr_pppox relay;/* what socket data will be -relayed to (PPPoE relaying) */ struct work_struct padt_work;/* Work item for handling PADT */ };
@@ -53,7 +51,6 @@ struct pppox_sock {#define pppoe_dev proto.pppoe.dev#define pppoe_ifindex proto.pppoe.ifindex#define pppoe_pa proto.pppoe.pa -#define pppoe_relay proto.pppoe.relaystatic inline struct pppox_sock *pppox_sk (struct sock *sk) {
@@ -80,14 +77,11 @@ extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */extern int pppox_ioctl (struct socket *sock,unsigned int cmd,unsigned long arg);extern int pppox_compat_ioctl (struct socket *sock,unsigned int cmd,unsigned long arg); -#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t) -/* PPPoX socket states */ enum {PPPOX_NONE =0 ,/* initial state */ PPPOX_CONNECTED =1 ,/* connection established ==TCP_ESTABLISHED */ PPPOX_BOUND =2 ,/* bound to ppp device */ -PPPOX_RELAY =4 ,/* forwarding is enabled */ PPPOX_DEAD =16 /* dead, useless, please clean me up!*/ };
include/uapi/linux/if_pppox.h +0 -10
@@ -103,16 +103,6 @@ struct sockaddr_pppol2tpv3in6 {struct pppol2tpv3in6_addr pppol2tp; } __packed; -/********************************************************************* -* -* ioctl interface for defining forwarding of connections -* -********************************************************************/ - -#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) -#define PPPOEIOCDFWD _IO(0xB1 ,1) -/*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ -/* Codes to identify message types */ #define PADI_CODE 0x09#define PADO_CODE 0x07
Signature · 1 line
2.43.0
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Tue, 24 Feb 2026 09:50:52 +0800 you wrote:
The kernel-mode PPPoE relay feature and its two associated ioctls (PPPOEIOCSFWD and PPPOEIOCDFWD) are not used by any existing userspace PPPoE implementations. The most commonly-used package, RP-PPPoE [1], handles the relaying entirely in userspace.
This legacy code has remained in the driver since its introduction in kernel 2.3.99-pre7 for over two decades, but has served no practical purpose.
[...]
Here is the summary with links:
- [net-next] pppoe: remove kernel-mode relay support
https://git.kernel.org/netdev/net-next/c/15c9ed1d8286
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html