aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
authorJakub Kicinski <kuba@kernel.org>2026-06-15 12:44:11 -0700
committerJakub Kicinski <kuba@kernel.org>2026-06-16 08:53:52 -0700
commita5a12d76d2cb23b3f2150ed3a5d674b0eba6a8b7 (patch)
treeb484a65d33e97bc1717540025d1344cabd7a9cb1 /net
parent277fb497d1011d3a195610047e7ad9ce94a03410 (diff)
downloadath-a5a12d76d2cb23b3f2150ed3a5d674b0eba6a8b7.tar.gz
atm: remove the local ATM (NSAP) address registry
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>
Diffstat (limited to 'net')
-rw-r--r--net/atm/Makefile2
-rw-r--r--net/atm/addr.c162
-rw-r--r--net/atm/addr.h21
-rw-r--r--net/atm/atm_sysfs.c25
-rw-r--r--net/atm/common.c1
-rw-r--r--net/atm/ioctl.c12
-rw-r--r--net/atm/resources.c53
-rw-r--r--net/atm/svc.c1
8 files changed, 2 insertions, 275 deletions
diff --git a/net/atm/Makefile b/net/atm/Makefile
index 484a1b1552cc7..5ed48d50df359 100644
--- a/net/atm/Makefile
+++ b/net/atm/Makefile
@@ -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
index 938f360ae2305..0000000000000
--- a/net/atm/addr.c
+++ /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
index da3f848411a04..0000000000000
--- a/net/atm/addr.h
+++ /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
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 54e7fb1a4ee50..0676a9c333ffe 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -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,
diff --git a/net/atm/common.c b/net/atm/common.c
index c6e87fc9bbfc2..7d5b7c39b80b0 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -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];
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index 4f2d185bf2f08..97f20cd051ed6 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -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:
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 7aac25e917b4b..12aef55422634 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -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) >
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 7c5559f50a99e..270e95154a2bc 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -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 */