]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
atm: remove the local ATM (NSAP) address registry
authorJakub Kicinski <kuba@kernel.org>
Mon, 15 Jun 2026 19:44:11 +0000 (12:44 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 16 Jun 2026 15:53:52 +0000 (08:53 -0700)
net/atm/addr.c maintained the per-device lists of local NSAP addresses
(dev->local) and ILMI-learned LECS addresses (dev->lecs). These exist
solely to serve SVC signaling: the lists are populated through the
ATM_{ADD,DEL,RST}ADDR / ATM_{ADD,DEL,GET}LECSADDR ioctls used by the
atmsigd / ILMI daemons, and consumed when registering addresses with the
signaling daemon. The LECS list belonged to LAN Emulation, which has
been removed.

With no SVC users in a DSL-only configuration these lists are always
empty, so drop the registry entirely:

 - remove the ADDR/LECSADDR/RSTADDR ioctls
 - drop the now-always-empty "atmaddress" sysfs attribute
 - remove the dev->local / dev->lecs lists, structs and enums
 - delete net/atm/addr.c and net/atm/addr.h

The device ESI ("MAC" address) and its ATM_{G,S}ETESI ioctls and
"address" sysfs attribute are retained - the USB DSL modems populate
the ESI.

Link: https://patch.msgid.link/20260615194416.752559-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/atmdev.h
net/atm/Makefile
net/atm/addr.c [deleted file]
net/atm/addr.h [deleted file]
net/atm/atm_sysfs.c
net/atm/common.c
net/atm/ioctl.c
net/atm/resources.c
net/atm/svc.c

index 71c5bf6950e3d5ae07217ed16875dfbfadcccaed..7abbd23fada638e16482306c09a5fa1793fc710d 100644 (file)
@@ -136,13 +136,6 @@ static inline struct sock *sk_atm(struct atm_vcc *vcc)
        return (struct sock *)vcc;
 }
 
-struct atm_dev_addr {
-       struct sockaddr_atmsvc addr;    /* ATM address */
-       struct list_head entry;         /* next address */
-};
-
-enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS };
-
 struct atm_dev {
        const struct atmdev_ops *ops;   /* device operations; NULL if unused */
        const struct atmphy_ops *phy;   /* PHY operations, may be undefined */
@@ -152,8 +145,6 @@ struct atm_dev {
        void            *dev_data;      /* per-device data */
        void            *phy_data;      /* private PHY data */
        unsigned long   flags;          /* device flags (ATM_DF_*) */
-       struct list_head local;         /* local ATM addresses */
-       struct list_head lecs;          /* LECS ATM addresses learned via ILMI */
        unsigned char   esi[ESI_LEN];   /* ESI ("MAC" addr) */
        struct atm_cirange ci_range;    /* VPI/VCI range */
        struct k_atm_dev_stats stats;   /* statistics */
index 484a1b1552cc771092fe0f5300d47e6ceb68c147..5ed48d50df359a88737ac82b395727c41be0819d 100644 (file)
@@ -3,7 +3,7 @@
 # Makefile for the ATM Protocol Families.
 #
 
-atm-y          := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o atm_sysfs.o
+atm-y          := pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o atm_sysfs.o
 
 obj-$(CONFIG_ATM) += atm.o
 obj-$(CONFIG_ATM_BR2684) += br2684.o
diff --git a/net/atm/addr.c b/net/atm/addr.c
deleted file mode 100644 (file)
index 938f360..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/* net/atm/addr.c - Local ATM address registry */
-
-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
-
-#include <linux/atm.h>
-#include <linux/atmdev.h>
-#include <linux/slab.h>
-#include <linux/uaccess.h>
-
-#include "signaling.h"
-#include "addr.h"
-
-static int check_addr(const struct sockaddr_atmsvc *addr)
-{
-       int i;
-
-       if (addr->sas_family != AF_ATMSVC)
-               return -EAFNOSUPPORT;
-       if (!*addr->sas_addr.pub)
-               return *addr->sas_addr.prv ? 0 : -EINVAL;
-       for (i = 1; i < ATM_E164_LEN + 1; i++)  /* make sure it's \0-terminated */
-               if (!addr->sas_addr.pub[i])
-                       return 0;
-       return -EINVAL;
-}
-
-static int identical(const struct sockaddr_atmsvc *a, const struct sockaddr_atmsvc *b)
-{
-       if (*a->sas_addr.prv)
-               if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN))
-                       return 0;
-       if (!*a->sas_addr.pub)
-               return !*b->sas_addr.pub;
-       if (!*b->sas_addr.pub)
-               return 0;
-       return !strcmp(a->sas_addr.pub, b->sas_addr.pub);
-}
-
-static void notify_sigd(const struct atm_dev *dev)
-{
-       struct sockaddr_atmpvc pvc;
-
-       pvc.sap_addr.itf = dev->number;
-       sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL);
-}
-
-void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype)
-{
-       unsigned long flags;
-       struct atm_dev_addr *this, *p;
-       struct list_head *head;
-
-       spin_lock_irqsave(&dev->lock, flags);
-       if (atype == ATM_ADDR_LECS)
-               head = &dev->lecs;
-       else
-               head = &dev->local;
-       list_for_each_entry_safe(this, p, head, entry) {
-               list_del(&this->entry);
-               kfree(this);
-       }
-       spin_unlock_irqrestore(&dev->lock, flags);
-       if (head == &dev->local)
-               notify_sigd(dev);
-}
-
-int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
-                enum atm_addr_type_t atype)
-{
-       unsigned long flags;
-       struct atm_dev_addr *this;
-       struct list_head *head;
-       int error;
-
-       error = check_addr(addr);
-       if (error)
-               return error;
-       spin_lock_irqsave(&dev->lock, flags);
-       if (atype == ATM_ADDR_LECS)
-               head = &dev->lecs;
-       else
-               head = &dev->local;
-       list_for_each_entry(this, head, entry) {
-               if (identical(&this->addr, addr)) {
-                       spin_unlock_irqrestore(&dev->lock, flags);
-                       return -EEXIST;
-               }
-       }
-       this = kmalloc_obj(struct atm_dev_addr, GFP_ATOMIC);
-       if (!this) {
-               spin_unlock_irqrestore(&dev->lock, flags);
-               return -ENOMEM;
-       }
-       this->addr = *addr;
-       list_add(&this->entry, head);
-       spin_unlock_irqrestore(&dev->lock, flags);
-       if (head == &dev->local)
-               notify_sigd(dev);
-       return 0;
-}
-
-int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
-                enum atm_addr_type_t atype)
-{
-       unsigned long flags;
-       struct atm_dev_addr *this;
-       struct list_head *head;
-       int error;
-
-       error = check_addr(addr);
-       if (error)
-               return error;
-       spin_lock_irqsave(&dev->lock, flags);
-       if (atype == ATM_ADDR_LECS)
-               head = &dev->lecs;
-       else
-               head = &dev->local;
-       list_for_each_entry(this, head, entry) {
-               if (identical(&this->addr, addr)) {
-                       list_del(&this->entry);
-                       spin_unlock_irqrestore(&dev->lock, flags);
-                       kfree(this);
-                       if (head == &dev->local)
-                               notify_sigd(dev);
-                       return 0;
-               }
-       }
-       spin_unlock_irqrestore(&dev->lock, flags);
-       return -ENOENT;
-}
-
-int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf,
-                size_t size, enum atm_addr_type_t atype)
-{
-       unsigned long flags;
-       struct atm_dev_addr *this;
-       struct list_head *head;
-       int total = 0, error;
-       struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
-
-       spin_lock_irqsave(&dev->lock, flags);
-       if (atype == ATM_ADDR_LECS)
-               head = &dev->lecs;
-       else
-               head = &dev->local;
-       list_for_each_entry(this, head, entry)
-           total += sizeof(struct sockaddr_atmsvc);
-       tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
-       if (!tmp_buf) {
-               spin_unlock_irqrestore(&dev->lock, flags);
-               return -ENOMEM;
-       }
-       list_for_each_entry(this, head, entry)
-           memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc));
-       spin_unlock_irqrestore(&dev->lock, flags);
-       error = total > size ? -E2BIG : total;
-       if (copy_to_user(buf, tmp_buf, total < size ? total : size))
-               error = -EFAULT;
-       kfree(tmp_buf);
-       return error;
-}
diff --git a/net/atm/addr.h b/net/atm/addr.h
deleted file mode 100644 (file)
index da3f848..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* net/atm/addr.h - Local ATM address registry */
-
-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
-
-
-#ifndef NET_ATM_ADDR_H
-#define NET_ATM_ADDR_H
-
-#include <linux/atm.h>
-#include <linux/atmdev.h>
-
-void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type);
-int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
-                enum atm_addr_type_t type);
-int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
-                enum atm_addr_type_t type);
-int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf,
-                size_t size, enum atm_addr_type_t type);
-
-#endif
index 54e7fb1a4ee5001962b5a5cbd35178a0614e8c84..0676a9c333ffe9e1c412e2e2d8bfa781055dd710 100644 (file)
@@ -27,29 +27,6 @@ static ssize_t address_show(struct device *cdev,
        return scnprintf(buf, PAGE_SIZE, "%pM\n", adev->esi);
 }
 
-static ssize_t atmaddress_show(struct device *cdev,
-                              struct device_attribute *attr, char *buf)
-{
-       unsigned long flags;
-       struct atm_dev *adev = to_atm_dev(cdev);
-       struct atm_dev_addr *aaddr;
-       int count = 0;
-
-       spin_lock_irqsave(&adev->lock, flags);
-       list_for_each_entry(aaddr, &adev->local, entry) {
-               count += scnprintf(buf + count, PAGE_SIZE - count,
-                                  "%1phN.%2phN.%10phN.%6phN.%1phN\n",
-                                  &aaddr->addr.sas_addr.prv[0],
-                                  &aaddr->addr.sas_addr.prv[1],
-                                  &aaddr->addr.sas_addr.prv[3],
-                                  &aaddr->addr.sas_addr.prv[13],
-                                  &aaddr->addr.sas_addr.prv[19]);
-       }
-       spin_unlock_irqrestore(&adev->lock, flags);
-
-       return count;
-}
-
 static ssize_t atmindex_show(struct device *cdev,
                             struct device_attribute *attr, char *buf)
 {
@@ -91,14 +68,12 @@ static ssize_t link_rate_show(struct device *cdev,
 }
 
 static DEVICE_ATTR_RO(address);
-static DEVICE_ATTR_RO(atmaddress);
 static DEVICE_ATTR_RO(atmindex);
 static DEVICE_ATTR_RO(carrier);
 static DEVICE_ATTR_RO(type);
 static DEVICE_ATTR_RO(link_rate);
 
 static struct device_attribute *atm_attrs[] = {
-       &dev_attr_atmaddress,
        &dev_attr_address,
        &dev_attr_atmindex,
        &dev_attr_carrier,
index c6e87fc9bbfc2ecc10287eafd2b1271a4fd4f5b8..7d5b7c39b80b0dd0c047aacae1fc6c05987cdd54 100644 (file)
@@ -30,7 +30,6 @@
 #include "resources.h"         /* atm_find_dev */
 #include "common.h"            /* prototypes */
 #include "protocols.h"         /* atm_init_<transport> */
-#include "addr.h"              /* address registry */
 #include "signaling.h"         /* for WAITING and sigd_attach */
 
 struct hlist_head vcc_hash[VCC_HTABLE_SIZE];
index 4f2d185bf2f08695e3f95b8c3822be11dbd2081e..97f20cd051ed6a113958de62530ae341b5e529b3 100644 (file)
@@ -220,10 +220,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 #define ATM_GETNAMES32    _IOW('a', ATMIOC_ITF+3, struct compat_atm_iobuf)
 #define ATM_GETTYPE32     _IOW('a', ATMIOC_ITF+4, struct compat_atmif_sioc)
 #define ATM_GETESI32     _IOW('a', ATMIOC_ITF+5, struct compat_atmif_sioc)
-#define ATM_GETADDR32    _IOW('a', ATMIOC_ITF+6, struct compat_atmif_sioc)
-#define ATM_RSTADDR32    _IOW('a', ATMIOC_ITF+7, struct compat_atmif_sioc)
-#define ATM_ADDADDR32    _IOW('a', ATMIOC_ITF+8, struct compat_atmif_sioc)
-#define ATM_DELADDR32    _IOW('a', ATMIOC_ITF+9, struct compat_atmif_sioc)
 #define ATM_GETCIRANGE32  _IOW('a', ATMIOC_ITF+10, struct compat_atmif_sioc)
 #define ATM_SETCIRANGE32  _IOW('a', ATMIOC_ITF+11, struct compat_atmif_sioc)
 #define ATM_SETESI32      _IOW('a', ATMIOC_ITF+12, struct compat_atmif_sioc)
@@ -242,10 +238,6 @@ static struct {
        { ATM_GETNAMES32,    ATM_GETNAMES },
        { ATM_GETTYPE32,     ATM_GETTYPE },
        { ATM_GETESI32,      ATM_GETESI },
-       { ATM_GETADDR32,     ATM_GETADDR },
-       { ATM_RSTADDR32,     ATM_RSTADDR },
-       { ATM_ADDADDR32,     ATM_ADDADDR },
-       { ATM_DELADDR32,     ATM_DELADDR },
        { ATM_GETCIRANGE32,  ATM_GETCIRANGE },
        { ATM_SETCIRANGE32,  ATM_SETCIRANGE },
        { ATM_SETESI32,      ATM_SETESI },
@@ -305,10 +297,6 @@ static int do_atm_ioctl(struct socket *sock, unsigned int cmd32,
        case ATM_GETLINKRATE:
        case ATM_GETTYPE:
        case ATM_GETESI:
-       case ATM_GETADDR:
-       case ATM_RSTADDR:
-       case ATM_ADDADDR:
-       case ATM_DELADDR:
        case ATM_GETCIRANGE:
        case ATM_SETCIRANGE:
        case ATM_SETESI:
index 7aac25e917b4b9605c78b9742d757d3ca2d53eb6..12aef5542263441358c3c3eb61b7179d7f378bda 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "common.h"
 #include "resources.h"
-#include "addr.h"
 
 
 LIST_HEAD(atm_devs);
@@ -42,8 +41,6 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
        dev->signal = ATM_PHY_SIG_UNKNOWN;
        dev->link_rate = ATM_OC3_PCR;
        spin_lock_init(&dev->lock);
-       INIT_LIST_HEAD(&dev->local);
-       INIT_LIST_HEAD(&dev->lecs);
 
        return dev;
 }
@@ -227,11 +224,8 @@ int atm_getnames(void __user *buf, int __user *iobuf_len)
 int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                  int number, int compat)
 {
-       int error, len, size = 0;
        struct atm_dev *dev;
-
-       if (get_user(len, sioc_len))
-               return -EFAULT;
+       int error, size = 0;
 
        dev = try_then_request_module(atm_dev_lookup(number), "atm-device-%d",
                                      number);
@@ -306,51 +300,6 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        goto done;
                }
                break;
-       case ATM_RSTADDR:
-               if (!capable(CAP_NET_ADMIN)) {
-                       error = -EPERM;
-                       goto done;
-               }
-               atm_reset_addr(dev, ATM_ADDR_LOCAL);
-               break;
-       case ATM_ADDADDR:
-       case ATM_DELADDR:
-       case ATM_ADDLECSADDR:
-       case ATM_DELLECSADDR:
-       {
-               struct sockaddr_atmsvc addr;
-
-               if (!capable(CAP_NET_ADMIN)) {
-                       error = -EPERM;
-                       goto done;
-               }
-
-               if (copy_from_user(&addr, buf, sizeof(addr))) {
-                       error = -EFAULT;
-                       goto done;
-               }
-               if (cmd == ATM_ADDADDR || cmd == ATM_ADDLECSADDR)
-                       error = atm_add_addr(dev, &addr,
-                                            (cmd == ATM_ADDADDR ?
-                                             ATM_ADDR_LOCAL : ATM_ADDR_LECS));
-               else
-                       error = atm_del_addr(dev, &addr,
-                                            (cmd == ATM_DELADDR ?
-                                             ATM_ADDR_LOCAL : ATM_ADDR_LECS));
-               goto done;
-       }
-       case ATM_GETADDR:
-       case ATM_GETLECSADDR:
-               error = atm_get_addr(dev, buf, len,
-                                    (cmd == ATM_GETADDR ?
-                                     ATM_ADDR_LOCAL : ATM_ADDR_LECS));
-               if (error < 0)
-                       goto done;
-               size = error;
-               /* may return 0, but later on size == 0 means "don't
-                  write the length" */
-               error = put_user(size, sioc_len) ? -EFAULT : 0;
-               goto done;
        case ATM_SETLOOP:
                if (__ATM_LM_XTRMT((int) (unsigned long) buf) &&
                    __ATM_LM_XTLOC((int) (unsigned long) buf) >
index 7c5559f50a99e385a7eb33e35b9f6edd84cf990b..270e95154a2bcc939b5fd8f771a3e10cf8c75749 100644 (file)
@@ -27,7 +27,6 @@
 #include "resources.h"
 #include "common.h"            /* common for PVCs and SVCs */
 #include "signaling.h"
-#include "addr.h"
 
 #ifdef CONFIG_COMPAT
 /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */