]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pppoe: remove kernel-mode relay support
authorQingfang Deng <dqfext@gmail.com>
Tue, 24 Feb 2026 01:50:52 +0000 (09:50 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 26 Feb 2026 10:41:00 +0000 (11:41 +0100)
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/

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20260224015053.42472-1-dqfext@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ppp/pppoe.c
drivers/net/ppp/pppox.c
include/linux/if_pppox.h
include/uapi/linux/if_pppox.h

index 7900cc3212a58bc7d34adc0def62ee531d789b31..1ac61c273b283dae2f8a620a4197348200213d34 100644 (file)
@@ -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;
        }
index 08364f10a43fae46642f57225121bec00b70a0e0..5861a2f6ce3e69701e5052c0531824bedb7cc85d 100644 (file)
@@ -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));
 }
 
index db45d6f1c4f49c0ff5c0da09b71fc3bbe7e4ff5e..8bbf676c2a851e2b835c7d1a95321343418517a6 100644 (file)
@@ -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.relay
 
 static 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!*/
 };
 
index 29b804aa74745af949d2505536fbda43d79034e4..7ae044d71fb725de2266a6de395717d5ec962b70 100644 (file)
@@ -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