xref: /OK3568_Linux_fs/kernel/net/atm/ioctl.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /* ATM ioctl handling */
3*4882a593Smuzhiyun 
4*4882a593Smuzhiyun /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
5*4882a593Smuzhiyun /* 2003 John Levon  <levon@movementarian.org> */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/module.h>
10*4882a593Smuzhiyun #include <linux/kmod.h>
11*4882a593Smuzhiyun #include <linux/net.h>		/* struct socket, struct proto_ops */
12*4882a593Smuzhiyun #include <linux/atm.h>		/* ATM stuff */
13*4882a593Smuzhiyun #include <linux/atmdev.h>
14*4882a593Smuzhiyun #include <linux/atmclip.h>	/* CLIP_*ENCAP */
15*4882a593Smuzhiyun #include <linux/atmarp.h>	/* manifest constants */
16*4882a593Smuzhiyun #include <linux/capability.h>
17*4882a593Smuzhiyun #include <linux/sonet.h>	/* for ioctls */
18*4882a593Smuzhiyun #include <linux/atmsvc.h>
19*4882a593Smuzhiyun #include <linux/atmmpc.h>
20*4882a593Smuzhiyun #include <net/atmclip.h>
21*4882a593Smuzhiyun #include <linux/atmlec.h>
22*4882a593Smuzhiyun #include <linux/mutex.h>
23*4882a593Smuzhiyun #include <asm/ioctls.h>
24*4882a593Smuzhiyun #include <net/compat.h>
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include "resources.h"
27*4882a593Smuzhiyun #include "signaling.h"		/* for WAITING and sigd_attach */
28*4882a593Smuzhiyun #include "common.h"
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun static DEFINE_MUTEX(ioctl_mutex);
32*4882a593Smuzhiyun static LIST_HEAD(ioctl_list);
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun 
register_atm_ioctl(struct atm_ioctl * ioctl)35*4882a593Smuzhiyun void register_atm_ioctl(struct atm_ioctl *ioctl)
36*4882a593Smuzhiyun {
37*4882a593Smuzhiyun 	mutex_lock(&ioctl_mutex);
38*4882a593Smuzhiyun 	list_add_tail(&ioctl->list, &ioctl_list);
39*4882a593Smuzhiyun 	mutex_unlock(&ioctl_mutex);
40*4882a593Smuzhiyun }
41*4882a593Smuzhiyun EXPORT_SYMBOL(register_atm_ioctl);
42*4882a593Smuzhiyun 
deregister_atm_ioctl(struct atm_ioctl * ioctl)43*4882a593Smuzhiyun void deregister_atm_ioctl(struct atm_ioctl *ioctl)
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun 	mutex_lock(&ioctl_mutex);
46*4882a593Smuzhiyun 	list_del(&ioctl->list);
47*4882a593Smuzhiyun 	mutex_unlock(&ioctl_mutex);
48*4882a593Smuzhiyun }
49*4882a593Smuzhiyun EXPORT_SYMBOL(deregister_atm_ioctl);
50*4882a593Smuzhiyun 
do_vcc_ioctl(struct socket * sock,unsigned int cmd,unsigned long arg,int compat)51*4882a593Smuzhiyun static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
52*4882a593Smuzhiyun 			unsigned long arg, int compat)
53*4882a593Smuzhiyun {
54*4882a593Smuzhiyun 	struct sock *sk = sock->sk;
55*4882a593Smuzhiyun 	struct atm_vcc *vcc;
56*4882a593Smuzhiyun 	int error;
57*4882a593Smuzhiyun 	struct list_head *pos;
58*4882a593Smuzhiyun 	void __user *argp = (void __user *)arg;
59*4882a593Smuzhiyun 	void __user *buf;
60*4882a593Smuzhiyun 	int __user *len;
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 	vcc = ATM_SD(sock);
63*4882a593Smuzhiyun 	switch (cmd) {
64*4882a593Smuzhiyun 	case SIOCOUTQ:
65*4882a593Smuzhiyun 		if (sock->state != SS_CONNECTED ||
66*4882a593Smuzhiyun 		    !test_bit(ATM_VF_READY, &vcc->flags)) {
67*4882a593Smuzhiyun 			error =  -EINVAL;
68*4882a593Smuzhiyun 			goto done;
69*4882a593Smuzhiyun 		}
70*4882a593Smuzhiyun 		error = put_user(sk->sk_sndbuf - sk_wmem_alloc_get(sk),
71*4882a593Smuzhiyun 				 (int __user *)argp) ? -EFAULT : 0;
72*4882a593Smuzhiyun 		goto done;
73*4882a593Smuzhiyun 	case SIOCINQ:
74*4882a593Smuzhiyun 	{
75*4882a593Smuzhiyun 		struct sk_buff *skb;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun 		if (sock->state != SS_CONNECTED) {
78*4882a593Smuzhiyun 			error = -EINVAL;
79*4882a593Smuzhiyun 			goto done;
80*4882a593Smuzhiyun 		}
81*4882a593Smuzhiyun 		skb = skb_peek(&sk->sk_receive_queue);
82*4882a593Smuzhiyun 		error = put_user(skb ? skb->len : 0,
83*4882a593Smuzhiyun 				 (int __user *)argp) ? -EFAULT : 0;
84*4882a593Smuzhiyun 		goto done;
85*4882a593Smuzhiyun 	}
86*4882a593Smuzhiyun 	case ATM_SETSC:
87*4882a593Smuzhiyun 		net_warn_ratelimited("ATM_SETSC is obsolete; used by %s:%d\n",
88*4882a593Smuzhiyun 				     current->comm, task_pid_nr(current));
89*4882a593Smuzhiyun 		error = 0;
90*4882a593Smuzhiyun 		goto done;
91*4882a593Smuzhiyun 	case ATMSIGD_CTRL:
92*4882a593Smuzhiyun 		if (!capable(CAP_NET_ADMIN)) {
93*4882a593Smuzhiyun 			error = -EPERM;
94*4882a593Smuzhiyun 			goto done;
95*4882a593Smuzhiyun 		}
96*4882a593Smuzhiyun 		/*
97*4882a593Smuzhiyun 		 * The user/kernel protocol for exchanging signalling
98*4882a593Smuzhiyun 		 * info uses kernel pointers as opaque references,
99*4882a593Smuzhiyun 		 * so the holder of the file descriptor can scribble
100*4882a593Smuzhiyun 		 * on the kernel... so we should make sure that we
101*4882a593Smuzhiyun 		 * have the same privileges that /proc/kcore needs
102*4882a593Smuzhiyun 		 */
103*4882a593Smuzhiyun 		if (!capable(CAP_SYS_RAWIO)) {
104*4882a593Smuzhiyun 			error = -EPERM;
105*4882a593Smuzhiyun 			goto done;
106*4882a593Smuzhiyun 		}
107*4882a593Smuzhiyun #ifdef CONFIG_COMPAT
108*4882a593Smuzhiyun 		/* WTF? I don't even want to _think_ about making this
109*4882a593Smuzhiyun 		   work for 32-bit userspace. TBH I don't really want
110*4882a593Smuzhiyun 		   to think about it at all. dwmw2. */
111*4882a593Smuzhiyun 		if (compat) {
112*4882a593Smuzhiyun 			net_warn_ratelimited("32-bit task cannot be atmsigd\n");
113*4882a593Smuzhiyun 			error = -EINVAL;
114*4882a593Smuzhiyun 			goto done;
115*4882a593Smuzhiyun 		}
116*4882a593Smuzhiyun #endif
117*4882a593Smuzhiyun 		error = sigd_attach(vcc);
118*4882a593Smuzhiyun 		if (!error)
119*4882a593Smuzhiyun 			sock->state = SS_CONNECTED;
120*4882a593Smuzhiyun 		goto done;
121*4882a593Smuzhiyun 	case ATM_SETBACKEND:
122*4882a593Smuzhiyun 	case ATM_NEWBACKENDIF:
123*4882a593Smuzhiyun 	{
124*4882a593Smuzhiyun 		atm_backend_t backend;
125*4882a593Smuzhiyun 		error = get_user(backend, (atm_backend_t __user *)argp);
126*4882a593Smuzhiyun 		if (error)
127*4882a593Smuzhiyun 			goto done;
128*4882a593Smuzhiyun 		switch (backend) {
129*4882a593Smuzhiyun 		case ATM_BACKEND_PPP:
130*4882a593Smuzhiyun 			request_module("pppoatm");
131*4882a593Smuzhiyun 			break;
132*4882a593Smuzhiyun 		case ATM_BACKEND_BR2684:
133*4882a593Smuzhiyun 			request_module("br2684");
134*4882a593Smuzhiyun 			break;
135*4882a593Smuzhiyun 		}
136*4882a593Smuzhiyun 		break;
137*4882a593Smuzhiyun 	}
138*4882a593Smuzhiyun 	case ATMMPC_CTRL:
139*4882a593Smuzhiyun 	case ATMMPC_DATA:
140*4882a593Smuzhiyun 		request_module("mpoa");
141*4882a593Smuzhiyun 		break;
142*4882a593Smuzhiyun 	case ATMARPD_CTRL:
143*4882a593Smuzhiyun 		request_module("clip");
144*4882a593Smuzhiyun 		break;
145*4882a593Smuzhiyun 	case ATMLEC_CTRL:
146*4882a593Smuzhiyun 		request_module("lec");
147*4882a593Smuzhiyun 		break;
148*4882a593Smuzhiyun 	}
149*4882a593Smuzhiyun 
150*4882a593Smuzhiyun 	error = -ENOIOCTLCMD;
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun 	mutex_lock(&ioctl_mutex);
153*4882a593Smuzhiyun 	list_for_each(pos, &ioctl_list) {
154*4882a593Smuzhiyun 		struct atm_ioctl *ic = list_entry(pos, struct atm_ioctl, list);
155*4882a593Smuzhiyun 		if (try_module_get(ic->owner)) {
156*4882a593Smuzhiyun 			error = ic->ioctl(sock, cmd, arg);
157*4882a593Smuzhiyun 			module_put(ic->owner);
158*4882a593Smuzhiyun 			if (error != -ENOIOCTLCMD)
159*4882a593Smuzhiyun 				break;
160*4882a593Smuzhiyun 		}
161*4882a593Smuzhiyun 	}
162*4882a593Smuzhiyun 	mutex_unlock(&ioctl_mutex);
163*4882a593Smuzhiyun 
164*4882a593Smuzhiyun 	if (error != -ENOIOCTLCMD)
165*4882a593Smuzhiyun 		goto done;
166*4882a593Smuzhiyun 
167*4882a593Smuzhiyun 	if (cmd == ATM_GETNAMES) {
168*4882a593Smuzhiyun 		if (IS_ENABLED(CONFIG_COMPAT) && compat) {
169*4882a593Smuzhiyun #ifdef CONFIG_COMPAT
170*4882a593Smuzhiyun 			struct compat_atm_iobuf __user *ciobuf = argp;
171*4882a593Smuzhiyun 			compat_uptr_t cbuf;
172*4882a593Smuzhiyun 			len = &ciobuf->length;
173*4882a593Smuzhiyun 			if (get_user(cbuf, &ciobuf->buffer))
174*4882a593Smuzhiyun 				return -EFAULT;
175*4882a593Smuzhiyun 			buf = compat_ptr(cbuf);
176*4882a593Smuzhiyun #endif
177*4882a593Smuzhiyun 		} else {
178*4882a593Smuzhiyun 			struct atm_iobuf __user *iobuf = argp;
179*4882a593Smuzhiyun 			len = &iobuf->length;
180*4882a593Smuzhiyun 			if (get_user(buf, &iobuf->buffer))
181*4882a593Smuzhiyun 				return -EFAULT;
182*4882a593Smuzhiyun 		}
183*4882a593Smuzhiyun 		error = atm_getnames(buf, len);
184*4882a593Smuzhiyun 	} else {
185*4882a593Smuzhiyun 		int number;
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun 		if (IS_ENABLED(CONFIG_COMPAT) && compat) {
188*4882a593Smuzhiyun #ifdef CONFIG_COMPAT
189*4882a593Smuzhiyun 			struct compat_atmif_sioc __user *csioc = argp;
190*4882a593Smuzhiyun 			compat_uptr_t carg;
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun 			len = &csioc->length;
193*4882a593Smuzhiyun 			if (get_user(carg, &csioc->arg))
194*4882a593Smuzhiyun 				return -EFAULT;
195*4882a593Smuzhiyun 			buf = compat_ptr(carg);
196*4882a593Smuzhiyun 			if (get_user(number, &csioc->number))
197*4882a593Smuzhiyun 				return -EFAULT;
198*4882a593Smuzhiyun #endif
199*4882a593Smuzhiyun 		} else {
200*4882a593Smuzhiyun 			struct atmif_sioc __user *sioc = argp;
201*4882a593Smuzhiyun 
202*4882a593Smuzhiyun 			len = &sioc->length;
203*4882a593Smuzhiyun 			if (get_user(buf, &sioc->arg))
204*4882a593Smuzhiyun 				return -EFAULT;
205*4882a593Smuzhiyun 			if (get_user(number, &sioc->number))
206*4882a593Smuzhiyun 				return -EFAULT;
207*4882a593Smuzhiyun 		}
208*4882a593Smuzhiyun 		error = atm_dev_ioctl(cmd, buf, len, number, compat);
209*4882a593Smuzhiyun 	}
210*4882a593Smuzhiyun 
211*4882a593Smuzhiyun done:
212*4882a593Smuzhiyun 	return error;
213*4882a593Smuzhiyun }
214*4882a593Smuzhiyun 
vcc_ioctl(struct socket * sock,unsigned int cmd,unsigned long arg)215*4882a593Smuzhiyun int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
216*4882a593Smuzhiyun {
217*4882a593Smuzhiyun 	return do_vcc_ioctl(sock, cmd, arg, 0);
218*4882a593Smuzhiyun }
219*4882a593Smuzhiyun 
220*4882a593Smuzhiyun #ifdef CONFIG_COMPAT
221*4882a593Smuzhiyun /*
222*4882a593Smuzhiyun  * FIXME:
223*4882a593Smuzhiyun  * The compat_ioctl handling is duplicated, using both these conversion
224*4882a593Smuzhiyun  * routines and the compat argument to the actual handlers. Both
225*4882a593Smuzhiyun  * versions are somewhat incomplete and should be merged, e.g. by
226*4882a593Smuzhiyun  * moving the ioctl number translation into the actual handlers and
227*4882a593Smuzhiyun  * killing the conversion code.
228*4882a593Smuzhiyun  *
229*4882a593Smuzhiyun  * -arnd, November 2009
230*4882a593Smuzhiyun  */
231*4882a593Smuzhiyun #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct compat_atmif_sioc)
232*4882a593Smuzhiyun #define ATM_GETNAMES32    _IOW('a', ATMIOC_ITF+3, struct compat_atm_iobuf)
233*4882a593Smuzhiyun #define ATM_GETTYPE32     _IOW('a', ATMIOC_ITF+4, struct compat_atmif_sioc)
234*4882a593Smuzhiyun #define ATM_GETESI32	  _IOW('a', ATMIOC_ITF+5, struct compat_atmif_sioc)
235*4882a593Smuzhiyun #define ATM_GETADDR32	  _IOW('a', ATMIOC_ITF+6, struct compat_atmif_sioc)
236*4882a593Smuzhiyun #define ATM_RSTADDR32	  _IOW('a', ATMIOC_ITF+7, struct compat_atmif_sioc)
237*4882a593Smuzhiyun #define ATM_ADDADDR32	  _IOW('a', ATMIOC_ITF+8, struct compat_atmif_sioc)
238*4882a593Smuzhiyun #define ATM_DELADDR32	  _IOW('a', ATMIOC_ITF+9, struct compat_atmif_sioc)
239*4882a593Smuzhiyun #define ATM_GETCIRANGE32  _IOW('a', ATMIOC_ITF+10, struct compat_atmif_sioc)
240*4882a593Smuzhiyun #define ATM_SETCIRANGE32  _IOW('a', ATMIOC_ITF+11, struct compat_atmif_sioc)
241*4882a593Smuzhiyun #define ATM_SETESI32      _IOW('a', ATMIOC_ITF+12, struct compat_atmif_sioc)
242*4882a593Smuzhiyun #define ATM_SETESIF32     _IOW('a', ATMIOC_ITF+13, struct compat_atmif_sioc)
243*4882a593Smuzhiyun #define ATM_GETSTAT32     _IOW('a', ATMIOC_SARCOM+0, struct compat_atmif_sioc)
244*4882a593Smuzhiyun #define ATM_GETSTATZ32    _IOW('a', ATMIOC_SARCOM+1, struct compat_atmif_sioc)
245*4882a593Smuzhiyun #define ATM_GETLOOP32	  _IOW('a', ATMIOC_SARCOM+2, struct compat_atmif_sioc)
246*4882a593Smuzhiyun #define ATM_SETLOOP32	  _IOW('a', ATMIOC_SARCOM+3, struct compat_atmif_sioc)
247*4882a593Smuzhiyun #define ATM_QUERYLOOP32	  _IOW('a', ATMIOC_SARCOM+4, struct compat_atmif_sioc)
248*4882a593Smuzhiyun 
249*4882a593Smuzhiyun static struct {
250*4882a593Smuzhiyun 	unsigned int cmd32;
251*4882a593Smuzhiyun 	unsigned int cmd;
252*4882a593Smuzhiyun } atm_ioctl_map[] = {
253*4882a593Smuzhiyun 	{ ATM_GETLINKRATE32, ATM_GETLINKRATE },
254*4882a593Smuzhiyun 	{ ATM_GETNAMES32,    ATM_GETNAMES },
255*4882a593Smuzhiyun 	{ ATM_GETTYPE32,     ATM_GETTYPE },
256*4882a593Smuzhiyun 	{ ATM_GETESI32,	     ATM_GETESI },
257*4882a593Smuzhiyun 	{ ATM_GETADDR32,     ATM_GETADDR },
258*4882a593Smuzhiyun 	{ ATM_RSTADDR32,     ATM_RSTADDR },
259*4882a593Smuzhiyun 	{ ATM_ADDADDR32,     ATM_ADDADDR },
260*4882a593Smuzhiyun 	{ ATM_DELADDR32,     ATM_DELADDR },
261*4882a593Smuzhiyun 	{ ATM_GETCIRANGE32,  ATM_GETCIRANGE },
262*4882a593Smuzhiyun 	{ ATM_SETCIRANGE32,  ATM_SETCIRANGE },
263*4882a593Smuzhiyun 	{ ATM_SETESI32,	     ATM_SETESI },
264*4882a593Smuzhiyun 	{ ATM_SETESIF32,     ATM_SETESIF },
265*4882a593Smuzhiyun 	{ ATM_GETSTAT32,     ATM_GETSTAT },
266*4882a593Smuzhiyun 	{ ATM_GETSTATZ32,    ATM_GETSTATZ },
267*4882a593Smuzhiyun 	{ ATM_GETLOOP32,     ATM_GETLOOP },
268*4882a593Smuzhiyun 	{ ATM_SETLOOP32,     ATM_SETLOOP },
269*4882a593Smuzhiyun 	{ ATM_QUERYLOOP32,   ATM_QUERYLOOP },
270*4882a593Smuzhiyun };
271*4882a593Smuzhiyun 
272*4882a593Smuzhiyun #define NR_ATM_IOCTL ARRAY_SIZE(atm_ioctl_map)
273*4882a593Smuzhiyun 
do_atm_iobuf(struct socket * sock,unsigned int cmd,unsigned long arg)274*4882a593Smuzhiyun static int do_atm_iobuf(struct socket *sock, unsigned int cmd,
275*4882a593Smuzhiyun 			unsigned long arg)
276*4882a593Smuzhiyun {
277*4882a593Smuzhiyun 	struct compat_atm_iobuf __user *iobuf32 = compat_ptr(arg);
278*4882a593Smuzhiyun 	u32 data;
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun 	if (get_user(data, &iobuf32->buffer))
281*4882a593Smuzhiyun 		return -EFAULT;
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun 	return atm_getnames(&iobuf32->length, compat_ptr(data));
284*4882a593Smuzhiyun }
285*4882a593Smuzhiyun 
do_atmif_sioc(struct socket * sock,unsigned int cmd,unsigned long arg)286*4882a593Smuzhiyun static int do_atmif_sioc(struct socket *sock, unsigned int cmd,
287*4882a593Smuzhiyun 			 unsigned long arg)
288*4882a593Smuzhiyun {
289*4882a593Smuzhiyun 	struct compat_atmif_sioc __user *sioc32 = compat_ptr(arg);
290*4882a593Smuzhiyun 	int number;
291*4882a593Smuzhiyun 	u32 data;
292*4882a593Smuzhiyun 
293*4882a593Smuzhiyun 	if (get_user(data, &sioc32->arg) || get_user(number, &sioc32->number))
294*4882a593Smuzhiyun 		return -EFAULT;
295*4882a593Smuzhiyun 	return atm_dev_ioctl(cmd, compat_ptr(data), &sioc32->length, number, 0);
296*4882a593Smuzhiyun }
297*4882a593Smuzhiyun 
do_atm_ioctl(struct socket * sock,unsigned int cmd32,unsigned long arg)298*4882a593Smuzhiyun static int do_atm_ioctl(struct socket *sock, unsigned int cmd32,
299*4882a593Smuzhiyun 			unsigned long arg)
300*4882a593Smuzhiyun {
301*4882a593Smuzhiyun 	int i;
302*4882a593Smuzhiyun 	unsigned int cmd = 0;
303*4882a593Smuzhiyun 
304*4882a593Smuzhiyun 	switch (cmd32) {
305*4882a593Smuzhiyun 	case SONET_GETSTAT:
306*4882a593Smuzhiyun 	case SONET_GETSTATZ:
307*4882a593Smuzhiyun 	case SONET_GETDIAG:
308*4882a593Smuzhiyun 	case SONET_SETDIAG:
309*4882a593Smuzhiyun 	case SONET_CLRDIAG:
310*4882a593Smuzhiyun 	case SONET_SETFRAMING:
311*4882a593Smuzhiyun 	case SONET_GETFRAMING:
312*4882a593Smuzhiyun 	case SONET_GETFRSENSE:
313*4882a593Smuzhiyun 		return do_atmif_sioc(sock, cmd32, arg);
314*4882a593Smuzhiyun 	}
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun 	for (i = 0; i < NR_ATM_IOCTL; i++) {
317*4882a593Smuzhiyun 		if (cmd32 == atm_ioctl_map[i].cmd32) {
318*4882a593Smuzhiyun 			cmd = atm_ioctl_map[i].cmd;
319*4882a593Smuzhiyun 			break;
320*4882a593Smuzhiyun 		}
321*4882a593Smuzhiyun 	}
322*4882a593Smuzhiyun 	if (i == NR_ATM_IOCTL)
323*4882a593Smuzhiyun 		return -EINVAL;
324*4882a593Smuzhiyun 
325*4882a593Smuzhiyun 	switch (cmd) {
326*4882a593Smuzhiyun 	case ATM_GETNAMES:
327*4882a593Smuzhiyun 		return do_atm_iobuf(sock, cmd, arg);
328*4882a593Smuzhiyun 
329*4882a593Smuzhiyun 	case ATM_GETLINKRATE:
330*4882a593Smuzhiyun 	case ATM_GETTYPE:
331*4882a593Smuzhiyun 	case ATM_GETESI:
332*4882a593Smuzhiyun 	case ATM_GETADDR:
333*4882a593Smuzhiyun 	case ATM_RSTADDR:
334*4882a593Smuzhiyun 	case ATM_ADDADDR:
335*4882a593Smuzhiyun 	case ATM_DELADDR:
336*4882a593Smuzhiyun 	case ATM_GETCIRANGE:
337*4882a593Smuzhiyun 	case ATM_SETCIRANGE:
338*4882a593Smuzhiyun 	case ATM_SETESI:
339*4882a593Smuzhiyun 	case ATM_SETESIF:
340*4882a593Smuzhiyun 	case ATM_GETSTAT:
341*4882a593Smuzhiyun 	case ATM_GETSTATZ:
342*4882a593Smuzhiyun 	case ATM_GETLOOP:
343*4882a593Smuzhiyun 	case ATM_SETLOOP:
344*4882a593Smuzhiyun 	case ATM_QUERYLOOP:
345*4882a593Smuzhiyun 		return do_atmif_sioc(sock, cmd, arg);
346*4882a593Smuzhiyun 	}
347*4882a593Smuzhiyun 
348*4882a593Smuzhiyun 	return -EINVAL;
349*4882a593Smuzhiyun }
350*4882a593Smuzhiyun 
vcc_compat_ioctl(struct socket * sock,unsigned int cmd,unsigned long arg)351*4882a593Smuzhiyun int vcc_compat_ioctl(struct socket *sock, unsigned int cmd,
352*4882a593Smuzhiyun 		     unsigned long arg)
353*4882a593Smuzhiyun {
354*4882a593Smuzhiyun 	int ret;
355*4882a593Smuzhiyun 
356*4882a593Smuzhiyun 	ret = do_vcc_ioctl(sock, cmd, arg, 1);
357*4882a593Smuzhiyun 	if (ret != -ENOIOCTLCMD)
358*4882a593Smuzhiyun 		return ret;
359*4882a593Smuzhiyun 
360*4882a593Smuzhiyun 	return do_atm_ioctl(sock, cmd, arg);
361*4882a593Smuzhiyun }
362*4882a593Smuzhiyun #endif
363