diff options
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/atm_sysfs.c | 2 | ||||
-rw-r--r-- | net/atm/br2684.c | 7 | ||||
-rw-r--r-- | net/atm/clip.c | 4 | ||||
-rw-r--r-- | net/atm/common.h | 1 | ||||
-rw-r--r-- | net/atm/ioctl.c | 49 | ||||
-rw-r--r-- | net/atm/lec.c | 60 | ||||
-rw-r--r-- | net/atm/mpc.c | 36 | ||||
-rw-r--r-- | net/atm/mpoa_caches.c | 18 | ||||
-rw-r--r-- | net/atm/pvc.c | 3 | ||||
-rw-r--r-- | net/atm/resources.c | 88 | ||||
-rw-r--r-- | net/atm/resources.h | 2 | ||||
-rw-r--r-- | net/atm/svc.c | 19 |
12 files changed, 194 insertions, 95 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 1b88311f2130..b5674dc2083d 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -149,7 +149,7 @@ int atm_register_sysfs(struct atm_dev *adev) | |||
149 | cdev->class = &atm_class; | 149 | cdev->class = &atm_class; |
150 | dev_set_drvdata(cdev, adev); | 150 | dev_set_drvdata(cdev, adev); |
151 | 151 | ||
152 | snprintf(cdev->bus_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); | 152 | dev_set_name(cdev, "%s%d", adev->type, adev->number); |
153 | err = device_register(cdev); | 153 | err = device_register(cdev); |
154 | if (err < 0) | 154 | if (err < 0) |
155 | return err; | 155 | return err; |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 280de481edc7..ea9438fc6855 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -101,7 +101,7 @@ static LIST_HEAD(br2684_devs); | |||
101 | 101 | ||
102 | static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev) | 102 | static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev) |
103 | { | 103 | { |
104 | return (struct br2684_dev *)net_dev->priv; | 104 | return (struct br2684_dev *)netdev_priv(net_dev); |
105 | } | 105 | } |
106 | 106 | ||
107 | static inline struct net_device *list_entry_brdev(const struct list_head *le) | 107 | static inline struct net_device *list_entry_brdev(const struct list_head *le) |
@@ -698,12 +698,11 @@ static int br2684_seq_show(struct seq_file *seq, void *v) | |||
698 | br2684_devs); | 698 | br2684_devs); |
699 | const struct net_device *net_dev = brdev->net_dev; | 699 | const struct net_device *net_dev = brdev->net_dev; |
700 | const struct br2684_vcc *brvcc; | 700 | const struct br2684_vcc *brvcc; |
701 | DECLARE_MAC_BUF(mac); | ||
702 | 701 | ||
703 | seq_printf(seq, "dev %.16s: num=%d, mac=%s (%s)\n", | 702 | seq_printf(seq, "dev %.16s: num=%d, mac=%pM (%s)\n", |
704 | net_dev->name, | 703 | net_dev->name, |
705 | brdev->number, | 704 | brdev->number, |
706 | print_mac(mac, net_dev->dev_addr), | 705 | net_dev->dev_addr, |
707 | brdev->mac_was_set ? "set" : "auto"); | 706 | brdev->mac_was_set ? "set" : "auto"); |
708 | 707 | ||
709 | list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { | 708 | list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { |
diff --git a/net/atm/clip.c b/net/atm/clip.c index 5b5b96344ce6..2d33a83be799 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -822,8 +822,8 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev, | |||
822 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", | 822 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", |
823 | dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp); | 823 | dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp); |
824 | 824 | ||
825 | off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", | 825 | off = scnprintf(buf, sizeof(buf) - 1, "%pI4", |
826 | NIPQUAD(entry->ip)); | 826 | &entry->ip); |
827 | while (off < 16) | 827 | while (off < 16) |
828 | buf[off++] = ' '; | 828 | buf[off++] = ' '; |
829 | buf[off] = '\0'; | 829 | buf[off] = '\0'; |
diff --git a/net/atm/common.h b/net/atm/common.h index 16f32c1fa1c9..92e2981f479f 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -19,6 +19,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, | |||
19 | size_t total_len); | 19 | size_t total_len); |
20 | unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait); | 20 | unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait); |
21 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 21 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
22 | int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | ||
22 | int vcc_setsockopt(struct socket *sock, int level, int optname, | 23 | int vcc_setsockopt(struct socket *sock, int level, int optname, |
23 | char __user *optval, int optlen); | 24 | char __user *optval, int optlen); |
24 | int vcc_getsockopt(struct socket *sock, int level, int optname, | 25 | int vcc_getsockopt(struct socket *sock, int level, int optname, |
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c index 7afd8e7754fd..76ed3c8d26e6 100644 --- a/net/atm/ioctl.c +++ b/net/atm/ioctl.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/atmlec.h> | 19 | #include <linux/atmlec.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <asm/ioctls.h> | 21 | #include <asm/ioctls.h> |
22 | #include <net/compat.h> | ||
22 | 23 | ||
23 | #include "resources.h" | 24 | #include "resources.h" |
24 | #include "signaling.h" /* for WAITING and sigd_attach */ | 25 | #include "signaling.h" /* for WAITING and sigd_attach */ |
@@ -46,7 +47,7 @@ void deregister_atm_ioctl(struct atm_ioctl *ioctl) | |||
46 | EXPORT_SYMBOL(register_atm_ioctl); | 47 | EXPORT_SYMBOL(register_atm_ioctl); |
47 | EXPORT_SYMBOL(deregister_atm_ioctl); | 48 | EXPORT_SYMBOL(deregister_atm_ioctl); |
48 | 49 | ||
49 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 50 | static int do_vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg, int compat) |
50 | { | 51 | { |
51 | struct sock *sk = sock->sk; | 52 | struct sock *sk = sock->sk; |
52 | struct atm_vcc *vcc; | 53 | struct atm_vcc *vcc; |
@@ -80,13 +81,25 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
80 | goto done; | 81 | goto done; |
81 | } | 82 | } |
82 | case SIOCGSTAMP: /* borrowed from IP */ | 83 | case SIOCGSTAMP: /* borrowed from IP */ |
83 | error = sock_get_timestamp(sk, argp); | 84 | #ifdef CONFIG_COMPAT |
85 | if (compat) | ||
86 | error = compat_sock_get_timestamp(sk, argp); | ||
87 | else | ||
88 | #endif | ||
89 | error = sock_get_timestamp(sk, argp); | ||
84 | goto done; | 90 | goto done; |
85 | case SIOCGSTAMPNS: /* borrowed from IP */ | 91 | case SIOCGSTAMPNS: /* borrowed from IP */ |
86 | error = sock_get_timestampns(sk, argp); | 92 | #ifdef CONFIG_COMPAT |
93 | if (compat) | ||
94 | error = compat_sock_get_timestampns(sk, argp); | ||
95 | else | ||
96 | #endif | ||
97 | error = sock_get_timestampns(sk, argp); | ||
87 | goto done; | 98 | goto done; |
88 | case ATM_SETSC: | 99 | case ATM_SETSC: |
89 | printk(KERN_WARNING "ATM_SETSC is obsolete\n"); | 100 | if (net_ratelimit()) |
101 | printk(KERN_WARNING "ATM_SETSC is obsolete; used by %s:%d\n", | ||
102 | current->comm, task_pid_nr(current)); | ||
90 | error = 0; | 103 | error = 0; |
91 | goto done; | 104 | goto done; |
92 | case ATMSIGD_CTRL: | 105 | case ATMSIGD_CTRL: |
@@ -99,12 +112,23 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
99 | * info uses kernel pointers as opaque references, | 112 | * info uses kernel pointers as opaque references, |
100 | * so the holder of the file descriptor can scribble | 113 | * so the holder of the file descriptor can scribble |
101 | * on the kernel... so we should make sure that we | 114 | * on the kernel... so we should make sure that we |
102 | * have the same privledges that /proc/kcore needs | 115 | * have the same privileges that /proc/kcore needs |
103 | */ | 116 | */ |
104 | if (!capable(CAP_SYS_RAWIO)) { | 117 | if (!capable(CAP_SYS_RAWIO)) { |
105 | error = -EPERM; | 118 | error = -EPERM; |
106 | goto done; | 119 | goto done; |
107 | } | 120 | } |
121 | #ifdef CONFIG_COMPAT | ||
122 | /* WTF? I don't even want to _think_ about making this | ||
123 | work for 32-bit userspace. TBH I don't really want | ||
124 | to think about it at all. dwmw2. */ | ||
125 | if (compat) { | ||
126 | if (net_ratelimit()) | ||
127 | printk(KERN_WARNING "32-bit task cannot be atmsigd\n"); | ||
128 | error = -EINVAL; | ||
129 | goto done; | ||
130 | } | ||
131 | #endif | ||
108 | error = sigd_attach(vcc); | 132 | error = sigd_attach(vcc); |
109 | if (!error) | 133 | if (!error) |
110 | sock->state = SS_CONNECTED; | 134 | sock->state = SS_CONNECTED; |
@@ -155,8 +179,21 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
155 | if (error != -ENOIOCTLCMD) | 179 | if (error != -ENOIOCTLCMD) |
156 | goto done; | 180 | goto done; |
157 | 181 | ||
158 | error = atm_dev_ioctl(cmd, argp); | 182 | error = atm_dev_ioctl(cmd, argp, compat); |
159 | 183 | ||
160 | done: | 184 | done: |
161 | return error; | 185 | return error; |
162 | } | 186 | } |
187 | |||
188 | |||
189 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
190 | { | ||
191 | return do_vcc_ioctl(sock, cmd, arg, 0); | ||
192 | } | ||
193 | |||
194 | #ifdef CONFIG_COMPAT | ||
195 | int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
196 | { | ||
197 | return do_vcc_ioctl(sock, cmd, arg, 1); | ||
198 | } | ||
199 | #endif | ||
diff --git a/net/atm/lec.c b/net/atm/lec.c index 8f701cde5945..e5e301550e8a 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -152,7 +152,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev) | |||
152 | buff += 4; | 152 | buff += 4; |
153 | mesg->content.normal.flag = *buff & 0x01; /* 0x01 is topology change */ | 153 | mesg->content.normal.flag = *buff & 0x01; /* 0x01 is topology change */ |
154 | 154 | ||
155 | priv = (struct lec_priv *)dev->priv; | 155 | priv = netdev_priv(dev); |
156 | atm_force_charge(priv->lecd, skb2->truesize); | 156 | atm_force_charge(priv->lecd, skb2->truesize); |
157 | sk = sk_atm(priv->lecd); | 157 | sk = sk_atm(priv->lecd); |
158 | skb_queue_tail(&sk->sk_receive_queue, skb2); | 158 | skb_queue_tail(&sk->sk_receive_queue, skb2); |
@@ -218,7 +218,7 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc) | |||
218 | 218 | ||
219 | static int lec_open(struct net_device *dev) | 219 | static int lec_open(struct net_device *dev) |
220 | { | 220 | { |
221 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 221 | struct lec_priv *priv = netdev_priv(dev); |
222 | 222 | ||
223 | netif_start_queue(dev); | 223 | netif_start_queue(dev); |
224 | memset(&priv->stats, 0, sizeof(struct net_device_stats)); | 224 | memset(&priv->stats, 0, sizeof(struct net_device_stats)); |
@@ -252,7 +252,7 @@ static void lec_tx_timeout(struct net_device *dev) | |||
252 | static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | 252 | static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) |
253 | { | 253 | { |
254 | struct sk_buff *skb2; | 254 | struct sk_buff *skb2; |
255 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 255 | struct lec_priv *priv = netdev_priv(dev); |
256 | struct lecdatahdr_8023 *lec_h; | 256 | struct lecdatahdr_8023 *lec_h; |
257 | struct atm_vcc *vcc; | 257 | struct atm_vcc *vcc; |
258 | struct lec_arp_table *entry; | 258 | struct lec_arp_table *entry; |
@@ -373,19 +373,13 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
373 | if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { | 373 | if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { |
374 | pr_debug("%s:lec_start_xmit: queuing packet, ", | 374 | pr_debug("%s:lec_start_xmit: queuing packet, ", |
375 | dev->name); | 375 | dev->name); |
376 | pr_debug("MAC address " MAC_FMT "\n", | 376 | pr_debug("MAC address %pM\n", lec_h->h_dest); |
377 | lec_h->h_dest[0], lec_h->h_dest[1], | ||
378 | lec_h->h_dest[2], lec_h->h_dest[3], | ||
379 | lec_h->h_dest[4], lec_h->h_dest[5]); | ||
380 | skb_queue_tail(&entry->tx_wait, skb); | 377 | skb_queue_tail(&entry->tx_wait, skb); |
381 | } else { | 378 | } else { |
382 | pr_debug | 379 | pr_debug |
383 | ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", | 380 | ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", |
384 | dev->name); | 381 | dev->name); |
385 | pr_debug("MAC address " MAC_FMT "\n", | 382 | pr_debug("MAC address %pM\n", lec_h->h_dest); |
386 | lec_h->h_dest[0], lec_h->h_dest[1], | ||
387 | lec_h->h_dest[2], lec_h->h_dest[3], | ||
388 | lec_h->h_dest[4], lec_h->h_dest[5]); | ||
389 | priv->stats.tx_dropped++; | 383 | priv->stats.tx_dropped++; |
390 | dev_kfree_skb(skb); | 384 | dev_kfree_skb(skb); |
391 | } | 385 | } |
@@ -397,10 +391,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
397 | 391 | ||
398 | while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { | 392 | while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { |
399 | pr_debug("lec.c: emptying tx queue, "); | 393 | pr_debug("lec.c: emptying tx queue, "); |
400 | pr_debug("MAC address " MAC_FMT "\n", | 394 | pr_debug("MAC address %pM\n", lec_h->h_dest); |
401 | lec_h->h_dest[0], lec_h->h_dest[1], | ||
402 | lec_h->h_dest[2], lec_h->h_dest[3], | ||
403 | lec_h->h_dest[4], lec_h->h_dest[5]); | ||
404 | lec_send(vcc, skb2, priv); | 395 | lec_send(vcc, skb2, priv); |
405 | } | 396 | } |
406 | 397 | ||
@@ -442,14 +433,14 @@ static int lec_close(struct net_device *dev) | |||
442 | */ | 433 | */ |
443 | static struct net_device_stats *lec_get_stats(struct net_device *dev) | 434 | static struct net_device_stats *lec_get_stats(struct net_device *dev) |
444 | { | 435 | { |
445 | return &((struct lec_priv *)dev->priv)->stats; | 436 | return &((struct lec_priv *)netdev_priv(dev))->stats; |
446 | } | 437 | } |
447 | 438 | ||
448 | static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | 439 | static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) |
449 | { | 440 | { |
450 | unsigned long flags; | 441 | unsigned long flags; |
451 | struct net_device *dev = (struct net_device *)vcc->proto_data; | 442 | struct net_device *dev = (struct net_device *)vcc->proto_data; |
452 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 443 | struct lec_priv *priv = netdev_priv(dev); |
453 | struct atmlec_msg *mesg; | 444 | struct atmlec_msg *mesg; |
454 | struct lec_arp_table *entry; | 445 | struct lec_arp_table *entry; |
455 | int i; | 446 | int i; |
@@ -539,15 +530,8 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
539 | { | 530 | { |
540 | struct net_bridge_fdb_entry *f; | 531 | struct net_bridge_fdb_entry *f; |
541 | 532 | ||
542 | pr_debug | 533 | pr_debug("%s: bridge zeppelin asks about %pM\n", |
543 | ("%s: bridge zeppelin asks about " MAC_FMT "\n", | 534 | dev->name, mesg->content.proxy.mac_addr); |
544 | dev->name, | ||
545 | mesg->content.proxy.mac_addr[0], | ||
546 | mesg->content.proxy.mac_addr[1], | ||
547 | mesg->content.proxy.mac_addr[2], | ||
548 | mesg->content.proxy.mac_addr[3], | ||
549 | mesg->content.proxy.mac_addr[4], | ||
550 | mesg->content.proxy.mac_addr[5]); | ||
551 | 535 | ||
552 | if (br_fdb_get_hook == NULL || dev->br_port == NULL) | 536 | if (br_fdb_get_hook == NULL || dev->br_port == NULL) |
553 | break; | 537 | break; |
@@ -596,7 +580,7 @@ static void lec_atm_close(struct atm_vcc *vcc) | |||
596 | { | 580 | { |
597 | struct sk_buff *skb; | 581 | struct sk_buff *skb; |
598 | struct net_device *dev = (struct net_device *)vcc->proto_data; | 582 | struct net_device *dev = (struct net_device *)vcc->proto_data; |
599 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 583 | struct lec_priv *priv = netdev_priv(dev); |
600 | 584 | ||
601 | priv->lecd = NULL; | 585 | priv->lecd = NULL; |
602 | /* Do something needful? */ | 586 | /* Do something needful? */ |
@@ -727,7 +711,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
727 | { | 711 | { |
728 | unsigned long flags; | 712 | unsigned long flags; |
729 | struct net_device *dev = (struct net_device *)vcc->proto_data; | 713 | struct net_device *dev = (struct net_device *)vcc->proto_data; |
730 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 714 | struct lec_priv *priv = netdev_priv(dev); |
731 | 715 | ||
732 | #if DUMP_PACKETS >0 | 716 | #if DUMP_PACKETS >0 |
733 | int i = 0; | 717 | int i = 0; |
@@ -874,7 +858,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
874 | vpriv->old_pop = vcc->pop; | 858 | vpriv->old_pop = vcc->pop; |
875 | vcc->user_back = vpriv; | 859 | vcc->user_back = vpriv; |
876 | vcc->pop = lec_pop; | 860 | vcc->pop = lec_pop; |
877 | lec_vcc_added(dev_lec[ioc_data.dev_num]->priv, | 861 | lec_vcc_added(netdev_priv(dev_lec[ioc_data.dev_num]), |
878 | &ioc_data, vcc, vcc->push); | 862 | &ioc_data, vcc, vcc->push); |
879 | vcc->proto_data = dev_lec[ioc_data.dev_num]; | 863 | vcc->proto_data = dev_lec[ioc_data.dev_num]; |
880 | vcc->push = lec_push; | 864 | vcc->push = lec_push; |
@@ -886,7 +870,8 @@ static int lec_mcast_attach(struct atm_vcc *vcc, int arg) | |||
886 | if (arg < 0 || arg >= MAX_LEC_ITF || !dev_lec[arg]) | 870 | if (arg < 0 || arg >= MAX_LEC_ITF || !dev_lec[arg]) |
887 | return -EINVAL; | 871 | return -EINVAL; |
888 | vcc->proto_data = dev_lec[arg]; | 872 | vcc->proto_data = dev_lec[arg]; |
889 | return (lec_mcast_make((struct lec_priv *)dev_lec[arg]->priv, vcc)); | 873 | return lec_mcast_make((struct lec_priv *)netdev_priv(dev_lec[arg]), |
874 | vcc); | ||
890 | } | 875 | } |
891 | 876 | ||
892 | /* Initialize device. */ | 877 | /* Initialize device. */ |
@@ -928,11 +913,11 @@ static int lecd_attach(struct atm_vcc *vcc, int arg) | |||
928 | return -EINVAL; | 913 | return -EINVAL; |
929 | } | 914 | } |
930 | 915 | ||
931 | priv = dev_lec[i]->priv; | 916 | priv = netdev_priv(dev_lec[i]); |
932 | priv->is_trdev = is_trdev; | 917 | priv->is_trdev = is_trdev; |
933 | lec_init(dev_lec[i]); | 918 | lec_init(dev_lec[i]); |
934 | } else { | 919 | } else { |
935 | priv = dev_lec[i]->priv; | 920 | priv = netdev_priv(dev_lec[i]); |
936 | if (priv->lecd) | 921 | if (priv->lecd) |
937 | return -EADDRINUSE; | 922 | return -EADDRINUSE; |
938 | } | 923 | } |
@@ -1093,7 +1078,8 @@ static void *lec_itf_walk(struct lec_state *state, loff_t *l) | |||
1093 | void *v; | 1078 | void *v; |
1094 | 1079 | ||
1095 | dev = state->dev ? state->dev : dev_lec[state->itf]; | 1080 | dev = state->dev ? state->dev : dev_lec[state->itf]; |
1096 | v = (dev && dev->priv) ? lec_priv_walk(state, l, dev->priv) : NULL; | 1081 | v = (dev && netdev_priv(dev)) ? |
1082 | lec_priv_walk(state, l, netdev_priv(dev)) : NULL; | ||
1097 | if (!v && dev) { | 1083 | if (!v && dev) { |
1098 | dev_put(dev); | 1084 | dev_put(dev); |
1099 | /* Partial state reset for the next time we get called */ | 1085 | /* Partial state reset for the next time we get called */ |
@@ -1255,7 +1241,7 @@ static void __exit lane_module_cleanup(void) | |||
1255 | 1241 | ||
1256 | for (i = 0; i < MAX_LEC_ITF; i++) { | 1242 | for (i = 0; i < MAX_LEC_ITF; i++) { |
1257 | if (dev_lec[i] != NULL) { | 1243 | if (dev_lec[i] != NULL) { |
1258 | priv = (struct lec_priv *)dev_lec[i]->priv; | 1244 | priv = netdev_priv(dev_lec[i]); |
1259 | unregister_netdev(dev_lec[i]); | 1245 | unregister_netdev(dev_lec[i]); |
1260 | free_netdev(dev_lec[i]); | 1246 | free_netdev(dev_lec[i]); |
1261 | dev_lec[i] = NULL; | 1247 | dev_lec[i] = NULL; |
@@ -1279,7 +1265,7 @@ static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, | |||
1279 | u8 **tlvs, u32 *sizeoftlvs) | 1265 | u8 **tlvs, u32 *sizeoftlvs) |
1280 | { | 1266 | { |
1281 | unsigned long flags; | 1267 | unsigned long flags; |
1282 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 1268 | struct lec_priv *priv = netdev_priv(dev); |
1283 | struct lec_arp_table *table; | 1269 | struct lec_arp_table *table; |
1284 | struct sk_buff *skb; | 1270 | struct sk_buff *skb; |
1285 | int retval; | 1271 | int retval; |
@@ -1326,7 +1312,7 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, | |||
1326 | { | 1312 | { |
1327 | int retval; | 1313 | int retval; |
1328 | struct sk_buff *skb; | 1314 | struct sk_buff *skb; |
1329 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 1315 | struct lec_priv *priv = netdev_priv(dev); |
1330 | 1316 | ||
1331 | if (compare_ether_addr(lan_dst, dev->dev_addr)) | 1317 | if (compare_ether_addr(lan_dst, dev->dev_addr)) |
1332 | return (0); /* not our mac address */ | 1318 | return (0); /* not our mac address */ |
@@ -1363,7 +1349,7 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr, | |||
1363 | #if 0 | 1349 | #if 0 |
1364 | int i = 0; | 1350 | int i = 0; |
1365 | #endif | 1351 | #endif |
1366 | struct lec_priv *priv = (struct lec_priv *)dev->priv; | 1352 | struct lec_priv *priv = netdev_priv(dev); |
1367 | #if 0 /* | 1353 | #if 0 /* |
1368 | * Why have the TLVs in LE_ARP entries | 1354 | * Why have the TLVs in LE_ARP entries |
1369 | * since we do not use them? When you | 1355 | * since we do not use them? When you |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 11b16d16661c..12e9ea371db1 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -232,8 +232,8 @@ void atm_mpoa_disp_qos(struct seq_file *m) | |||
232 | seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); | 232 | seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); |
233 | 233 | ||
234 | while (qos != NULL) { | 234 | while (qos != NULL) { |
235 | seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", | 235 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", |
236 | NIPQUAD(qos->ipaddr), | 236 | &qos->ipaddr, |
237 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, | 237 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, |
238 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); | 238 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); |
239 | qos = qos->next; | 239 | qos = qos->next; |
@@ -595,8 +595,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
595 | if (in_entry != NULL) mpc->in_ops->put(in_entry); | 595 | if (in_entry != NULL) mpc->in_ops->put(in_entry); |
596 | return -EINVAL; | 596 | return -EINVAL; |
597 | } | 597 | } |
598 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", | 598 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %pI4\n", |
599 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); | 599 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
600 | in_entry->shortcut = vcc; | 600 | in_entry->shortcut = vcc; |
601 | mpc->in_ops->put(in_entry); | 601 | mpc->in_ops->put(in_entry); |
602 | } else { | 602 | } else { |
@@ -627,8 +627,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
627 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); | 627 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); |
628 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); | 628 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); |
629 | if (in_entry) { | 629 | if (in_entry) { |
630 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", | 630 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n", |
631 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); | 631 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
632 | in_entry->shortcut = NULL; | 632 | in_entry->shortcut = NULL; |
633 | mpc->in_ops->put(in_entry); | 633 | mpc->in_ops->put(in_entry); |
634 | } | 634 | } |
@@ -785,7 +785,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
785 | } | 785 | } |
786 | 786 | ||
787 | if (mpc->dev) { /* check if the lec is LANE2 capable */ | 787 | if (mpc->dev) { /* check if the lec is LANE2 capable */ |
788 | priv = (struct lec_priv *)mpc->dev->priv; | 788 | priv = netdev_priv(mpc->dev); |
789 | if (priv->lane_version < 2) { | 789 | if (priv->lane_version < 2) { |
790 | dev_put(mpc->dev); | 790 | dev_put(mpc->dev); |
791 | mpc->dev = NULL; | 791 | mpc->dev = NULL; |
@@ -845,7 +845,7 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
845 | 845 | ||
846 | mpc->mpoad_vcc = NULL; | 846 | mpc->mpoad_vcc = NULL; |
847 | if (mpc->dev) { | 847 | if (mpc->dev) { |
848 | struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; | 848 | struct lec_priv *priv = netdev_priv(mpc->dev); |
849 | priv->lane2_ops->associate_indicator = NULL; | 849 | priv->lane2_ops->associate_indicator = NULL; |
850 | stop_mpc(mpc); | 850 | stop_mpc(mpc); |
851 | dev_put(mpc->dev); | 851 | dev_put(mpc->dev); |
@@ -976,7 +976,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
976 | 976 | ||
977 | switch (event) { | 977 | switch (event) { |
978 | case NETDEV_REGISTER: /* a new lec device was allocated */ | 978 | case NETDEV_REGISTER: /* a new lec device was allocated */ |
979 | priv = (struct lec_priv *)dev->priv; | 979 | priv = netdev_priv(dev); |
980 | if (priv->lane_version < 2) | 980 | if (priv->lane_version < 2) |
981 | break; | 981 | break; |
982 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; | 982 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; |
@@ -1098,7 +1098,8 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien | |||
1098 | entry->shortcut = eg_entry->shortcut; | 1098 | entry->shortcut = eg_entry->shortcut; |
1099 | } | 1099 | } |
1100 | if(entry->shortcut){ | 1100 | if(entry->shortcut){ |
1101 | dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip)); | 1101 | dprintk("mpoa: (%s) using egress SVC to reach %pI4\n", |
1102 | client->dev->name, &dst_ip); | ||
1102 | client->eg_ops->put(eg_entry); | 1103 | client->eg_ops->put(eg_entry); |
1103 | return; | 1104 | return; |
1104 | } | 1105 | } |
@@ -1123,7 +1124,8 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1123 | __be32 dst_ip = msg->content.in_info.in_dst_ip; | 1124 | __be32 dst_ip = msg->content.in_info.in_dst_ip; |
1124 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); | 1125 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); |
1125 | 1126 | ||
1126 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip)); | 1127 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n", |
1128 | mpc->dev->name, &dst_ip); | ||
1127 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); | 1129 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); |
1128 | if(entry == NULL){ | 1130 | if(entry == NULL){ |
1129 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); | 1131 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); |
@@ -1171,14 +1173,14 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1171 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1173 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
1172 | 1174 | ||
1173 | if(entry == NULL){ | 1175 | if(entry == NULL){ |
1174 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); | 1176 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ip = %pI4\n", |
1175 | printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); | 1177 | mpc->dev->name, &dst_ip); |
1176 | return; | 1178 | return; |
1177 | } | 1179 | } |
1178 | 1180 | ||
1179 | do { | 1181 | do { |
1180 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , | 1182 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %pI4\n", |
1181 | mpc->dev->name, NIPQUAD(dst_ip)); | 1183 | mpc->dev->name, &dst_ip); |
1182 | write_lock_bh(&mpc->ingress_lock); | 1184 | write_lock_bh(&mpc->ingress_lock); |
1183 | mpc->in_ops->remove_entry(entry, mpc); | 1185 | mpc->in_ops->remove_entry(entry, mpc); |
1184 | write_unlock_bh(&mpc->ingress_lock); | 1186 | write_unlock_bh(&mpc->ingress_lock); |
@@ -1322,7 +1324,7 @@ static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *m | |||
1322 | dprintk("\n"); | 1324 | dprintk("\n"); |
1323 | 1325 | ||
1324 | if (mpc->dev) { | 1326 | if (mpc->dev) { |
1325 | priv = (struct lec_priv *)mpc->dev->priv; | 1327 | priv = netdev_priv(mpc->dev); |
1326 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); | 1328 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); |
1327 | if (retval == 0) | 1329 | if (retval == 0) |
1328 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); | 1330 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); |
@@ -1472,7 +1474,7 @@ static void __exit atm_mpoa_cleanup(void) | |||
1472 | tmp = mpc->next; | 1474 | tmp = mpc->next; |
1473 | if (mpc->dev != NULL) { | 1475 | if (mpc->dev != NULL) { |
1474 | stop_mpc(mpc); | 1476 | stop_mpc(mpc); |
1475 | priv = (struct lec_priv *)mpc->dev->priv; | 1477 | priv = netdev_priv(mpc->dev); |
1476 | if (priv->lane2_ops != NULL) | 1478 | if (priv->lane2_ops != NULL) |
1477 | priv->lane2_ops->associate_indicator = NULL; | 1479 | priv->lane2_ops->associate_indicator = NULL; |
1478 | } | 1480 | } |
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 24799e3e78f7..4504a4b339bb 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c | |||
@@ -94,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(__be32 dst_ip, | |||
94 | return NULL; | 94 | return NULL; |
95 | } | 95 | } |
96 | 96 | ||
97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); | 97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %pI4\n", &dst_ip); |
98 | 98 | ||
99 | atomic_set(&entry->use, 1); | 99 | atomic_set(&entry->use, 1); |
100 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); | 100 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); |
@@ -150,7 +150,8 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) | |||
150 | 150 | ||
151 | if( entry->count > mpc->parameters.mpc_p1 && | 151 | if( entry->count > mpc->parameters.mpc_p1 && |
152 | entry->entry_state == INGRESS_INVALID){ | 152 | entry->entry_state == INGRESS_INVALID){ |
153 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip)); | 153 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %pI4, sending MPOA res req\n", |
154 | mpc->dev->name, &entry->ctrl_info.in_dst_ip); | ||
154 | entry->entry_state = INGRESS_RESOLVING; | 155 | entry->entry_state = INGRESS_RESOLVING; |
155 | msg.type = SND_MPOA_RES_RQST; | 156 | msg.type = SND_MPOA_RES_RQST; |
156 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); | 157 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); |
@@ -184,7 +185,8 @@ static void in_cache_remove_entry(in_cache_entry *entry, | |||
184 | struct k_message msg; | 185 | struct k_message msg; |
185 | 186 | ||
186 | vcc = entry->shortcut; | 187 | vcc = entry->shortcut; |
187 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip)); | 188 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %pI4\n", |
189 | &entry->ctrl_info.in_dst_ip); | ||
188 | 190 | ||
189 | if (entry->prev != NULL) | 191 | if (entry->prev != NULL) |
190 | entry->prev->next = entry->next; | 192 | entry->prev->next = entry->next; |
@@ -228,7 +230,8 @@ static void clear_count_and_expired(struct mpoa_client *client) | |||
228 | next_entry = entry->next; | 230 | next_entry = entry->next; |
229 | if((now.tv_sec - entry->tv.tv_sec) | 231 | if((now.tv_sec - entry->tv.tv_sec) |
230 | > entry->ctrl_info.holding_time){ | 232 | > entry->ctrl_info.holding_time){ |
231 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(entry->ctrl_info.in_dst_ip)); | 233 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %pI4\n", |
234 | &entry->ctrl_info.in_dst_ip); | ||
232 | client->in_ops->remove_entry(entry, client); | 235 | client->in_ops->remove_entry(entry, client); |
233 | } | 236 | } |
234 | entry = next_entry; | 237 | entry = next_entry; |
@@ -453,7 +456,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
453 | return NULL; | 456 | return NULL; |
454 | } | 457 | } |
455 | 458 | ||
456 | dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip)); | 459 | dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %pI4, this should be our IP\n", |
460 | &msg->content.eg_info.eg_dst_ip); | ||
457 | 461 | ||
458 | atomic_set(&entry->use, 1); | 462 | atomic_set(&entry->use, 1); |
459 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n"); | 463 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n"); |
@@ -469,8 +473,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
469 | do_gettimeofday(&(entry->tv)); | 473 | do_gettimeofday(&(entry->tv)); |
470 | entry->entry_state = EGRESS_RESOLVED; | 474 | entry->entry_state = EGRESS_RESOLVED; |
471 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); | 475 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); |
472 | dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n", | 476 | dprintk("mpoa: mpoa_caches.c: mps_ip = %pI4\n", |
473 | NIPQUAD(entry->ctrl_info.mps_ip)); | 477 | &entry->ctrl_info.mps_ip); |
474 | atomic_inc(&entry->use); | 478 | atomic_inc(&entry->use); |
475 | 479 | ||
476 | write_unlock_irq(&client->egress_lock); | 480 | write_unlock_irq(&client->egress_lock); |
diff --git a/net/atm/pvc.c b/net/atm/pvc.c index 43e8bf5ed001..e1d22d9430dd 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c | |||
@@ -113,6 +113,9 @@ static const struct proto_ops pvc_proto_ops = { | |||
113 | .getname = pvc_getname, | 113 | .getname = pvc_getname, |
114 | .poll = vcc_poll, | 114 | .poll = vcc_poll, |
115 | .ioctl = vcc_ioctl, | 115 | .ioctl = vcc_ioctl, |
116 | #ifdef CONFIG_COMPAT | ||
117 | .compat_ioctl = vcc_compat_ioctl, | ||
118 | #endif | ||
116 | .listen = sock_no_listen, | 119 | .listen = sock_no_listen, |
117 | .shutdown = pvc_shutdown, | 120 | .shutdown = pvc_shutdown, |
118 | .setsockopt = pvc_setsockopt, | 121 | .setsockopt = pvc_setsockopt, |
diff --git a/net/atm/resources.c b/net/atm/resources.c index a34ba948af96..56b7322ff461 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -195,20 +195,39 @@ static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, in | |||
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | int atm_dev_ioctl(unsigned int cmd, void __user *arg) | 198 | int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) |
199 | { | 199 | { |
200 | void __user *buf; | 200 | void __user *buf; |
201 | int error, len, number, size = 0; | 201 | int error, len, number, size = 0; |
202 | struct atm_dev *dev; | 202 | struct atm_dev *dev; |
203 | struct list_head *p; | 203 | struct list_head *p; |
204 | int *tmp_buf, *tmp_p; | 204 | int *tmp_buf, *tmp_p; |
205 | struct atm_iobuf __user *iobuf = arg; | 205 | int __user *sioc_len; |
206 | struct atmif_sioc __user *sioc = arg; | 206 | int __user *iobuf_len; |
207 | |||
208 | #ifndef CONFIG_COMPAT | ||
209 | compat = 0; /* Just so the compiler _knows_ */ | ||
210 | #endif | ||
211 | |||
207 | switch (cmd) { | 212 | switch (cmd) { |
208 | case ATM_GETNAMES: | 213 | case ATM_GETNAMES: |
209 | if (get_user(buf, &iobuf->buffer)) | 214 | |
210 | return -EFAULT; | 215 | if (compat) { |
211 | if (get_user(len, &iobuf->length)) | 216 | #ifdef CONFIG_COMPAT |
217 | struct compat_atm_iobuf __user *ciobuf = arg; | ||
218 | compat_uptr_t cbuf; | ||
219 | iobuf_len = &ciobuf->length; | ||
220 | if (get_user(cbuf, &ciobuf->buffer)) | ||
221 | return -EFAULT; | ||
222 | buf = compat_ptr(cbuf); | ||
223 | #endif | ||
224 | } else { | ||
225 | struct atm_iobuf __user *iobuf = arg; | ||
226 | iobuf_len = &iobuf->length; | ||
227 | if (get_user(buf, &iobuf->buffer)) | ||
228 | return -EFAULT; | ||
229 | } | ||
230 | if (get_user(len, iobuf_len)) | ||
212 | return -EFAULT; | 231 | return -EFAULT; |
213 | mutex_lock(&atm_dev_mutex); | 232 | mutex_lock(&atm_dev_mutex); |
214 | list_for_each(p, &atm_devs) | 233 | list_for_each(p, &atm_devs) |
@@ -229,7 +248,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
229 | } | 248 | } |
230 | mutex_unlock(&atm_dev_mutex); | 249 | mutex_unlock(&atm_dev_mutex); |
231 | error = ((copy_to_user(buf, tmp_buf, size)) || | 250 | error = ((copy_to_user(buf, tmp_buf, size)) || |
232 | put_user(size, &iobuf->length)) | 251 | put_user(size, iobuf_len)) |
233 | ? -EFAULT : 0; | 252 | ? -EFAULT : 0; |
234 | kfree(tmp_buf); | 253 | kfree(tmp_buf); |
235 | return error; | 254 | return error; |
@@ -237,13 +256,32 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
237 | break; | 256 | break; |
238 | } | 257 | } |
239 | 258 | ||
240 | if (get_user(buf, &sioc->arg)) | 259 | if (compat) { |
241 | return -EFAULT; | 260 | #ifdef CONFIG_COMPAT |
242 | if (get_user(len, &sioc->length)) | 261 | struct compat_atmif_sioc __user *csioc = arg; |
243 | return -EFAULT; | 262 | compat_uptr_t carg; |
244 | if (get_user(number, &sioc->number)) | 263 | |
245 | return -EFAULT; | 264 | sioc_len = &csioc->length; |
246 | 265 | if (get_user(carg, &csioc->arg)) | |
266 | return -EFAULT; | ||
267 | buf = compat_ptr(carg); | ||
268 | |||
269 | if (get_user(len, &csioc->length)) | ||
270 | return -EFAULT; | ||
271 | if (get_user(number, &csioc->number)) | ||
272 | return -EFAULT; | ||
273 | #endif | ||
274 | } else { | ||
275 | struct atmif_sioc __user *sioc = arg; | ||
276 | |||
277 | sioc_len = &sioc->length; | ||
278 | if (get_user(buf, &sioc->arg)) | ||
279 | return -EFAULT; | ||
280 | if (get_user(len, &sioc->length)) | ||
281 | return -EFAULT; | ||
282 | if (get_user(number, &sioc->number)) | ||
283 | return -EFAULT; | ||
284 | } | ||
247 | if (!(dev = try_then_request_module(atm_dev_lookup(number), | 285 | if (!(dev = try_then_request_module(atm_dev_lookup(number), |
248 | "atm-device-%d", number))) | 286 | "atm-device-%d", number))) |
249 | return -ENODEV; | 287 | return -ENODEV; |
@@ -358,7 +396,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
358 | size = error; | 396 | size = error; |
359 | /* may return 0, but later on size == 0 means "don't | 397 | /* may return 0, but later on size == 0 means "don't |
360 | write the length" */ | 398 | write the length" */ |
361 | error = put_user(size, &sioc->length) | 399 | error = put_user(size, sioc_len) |
362 | ? -EFAULT : 0; | 400 | ? -EFAULT : 0; |
363 | goto done; | 401 | goto done; |
364 | case ATM_SETLOOP: | 402 | case ATM_SETLOOP: |
@@ -380,11 +418,21 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
380 | } | 418 | } |
381 | /* fall through */ | 419 | /* fall through */ |
382 | default: | 420 | default: |
383 | if (!dev->ops->ioctl) { | 421 | if (compat) { |
384 | error = -EINVAL; | 422 | #ifdef CONFIG_COMPAT |
385 | goto done; | 423 | if (!dev->ops->compat_ioctl) { |
424 | error = -EINVAL; | ||
425 | goto done; | ||
426 | } | ||
427 | size = dev->ops->compat_ioctl(dev, cmd, buf); | ||
428 | #endif | ||
429 | } else { | ||
430 | if (!dev->ops->ioctl) { | ||
431 | error = -EINVAL; | ||
432 | goto done; | ||
433 | } | ||
434 | size = dev->ops->ioctl(dev, cmd, buf); | ||
386 | } | 435 | } |
387 | size = dev->ops->ioctl(dev, cmd, buf); | ||
388 | if (size < 0) { | 436 | if (size < 0) { |
389 | error = (size == -ENOIOCTLCMD ? -EINVAL : size); | 437 | error = (size == -ENOIOCTLCMD ? -EINVAL : size); |
390 | goto done; | 438 | goto done; |
@@ -392,7 +440,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
392 | } | 440 | } |
393 | 441 | ||
394 | if (size) | 442 | if (size) |
395 | error = put_user(size, &sioc->length) | 443 | error = put_user(size, sioc_len) |
396 | ? -EFAULT : 0; | 444 | ? -EFAULT : 0; |
397 | else | 445 | else |
398 | error = 0; | 446 | error = 0; |
diff --git a/net/atm/resources.h b/net/atm/resources.h index 1d004aaaeec1..126fb1840dfb 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -13,7 +13,7 @@ | |||
13 | extern struct list_head atm_devs; | 13 | extern struct list_head atm_devs; |
14 | extern struct mutex atm_dev_mutex; | 14 | extern struct mutex atm_dev_mutex; |
15 | 15 | ||
16 | int atm_dev_ioctl(unsigned int cmd, void __user *arg); | 16 | int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat); |
17 | 17 | ||
18 | 18 | ||
19 | #ifdef CONFIG_PROC_FS | 19 | #ifdef CONFIG_PROC_FS |
diff --git a/net/atm/svc.c b/net/atm/svc.c index 8fb54dc870b3..7b831b526d0b 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -608,6 +608,22 @@ static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
608 | return error; | 608 | return error; |
609 | } | 609 | } |
610 | 610 | ||
611 | #ifdef CONFIG_COMPAT | ||
612 | static int svc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
613 | { | ||
614 | /* The definition of ATM_ADDPARTY uses the size of struct atm_iobuf. | ||
615 | But actually it takes a struct sockaddr_atmsvc, which doesn't need | ||
616 | compat handling. So all we have to do is fix up cmd... */ | ||
617 | if (cmd == COMPAT_ATM_ADDPARTY) | ||
618 | cmd = ATM_ADDPARTY; | ||
619 | |||
620 | if (cmd == ATM_ADDPARTY || cmd == ATM_DROPPARTY) | ||
621 | return svc_ioctl(sock, cmd, arg); | ||
622 | else | ||
623 | return vcc_compat_ioctl(sock, cmd, arg); | ||
624 | } | ||
625 | #endif /* CONFIG_COMPAT */ | ||
626 | |||
611 | static const struct proto_ops svc_proto_ops = { | 627 | static const struct proto_ops svc_proto_ops = { |
612 | .family = PF_ATMSVC, | 628 | .family = PF_ATMSVC, |
613 | .owner = THIS_MODULE, | 629 | .owner = THIS_MODULE, |
@@ -620,6 +636,9 @@ static const struct proto_ops svc_proto_ops = { | |||
620 | .getname = svc_getname, | 636 | .getname = svc_getname, |
621 | .poll = vcc_poll, | 637 | .poll = vcc_poll, |
622 | .ioctl = svc_ioctl, | 638 | .ioctl = svc_ioctl, |
639 | #ifdef CONFIG_COMPAT | ||
640 | .compat_ioctl = svc_compat_ioctl, | ||
641 | #endif | ||
623 | .listen = svc_listen, | 642 | .listen = svc_listen, |
624 | .shutdown = svc_shutdown, | 643 | .shutdown = svc_shutdown, |
625 | .setsockopt = svc_setsockopt, | 644 | .setsockopt = svc_setsockopt, |