diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /net/x25 | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'net/x25')
-rw-r--r-- | net/x25/.cvsignore | 2 | ||||
-rw-r--r-- | net/x25/af_x25.c | 43 | ||||
-rw-r--r-- | net/x25/sysctl_net_x25.c | 2 | ||||
-rw-r--r-- | net/x25/x25_dev.c | 12 | ||||
-rw-r--r-- | net/x25/x25_link.c | 24 | ||||
-rw-r--r-- | net/x25/x25_route.c | 28 |
6 files changed, 52 insertions, 59 deletions
diff --git a/net/x25/.cvsignore b/net/x25/.cvsignore deleted file mode 100644 index 857dd22e9..000000000 --- a/net/x25/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.depend -.*.flags diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index e65c1e86f..ae5d6c2d4 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -168,7 +168,7 @@ static void x25_remove_socket(struct sock *sk) /* * Kill all bound sockets on a dropped device. */ -static void x25_kill_by_device(struct device *dev) +static void x25_kill_by_device(struct net_device *dev) { struct sock *s; @@ -183,7 +183,7 @@ static void x25_kill_by_device(struct device *dev) */ static int x25_device_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct device *dev = (struct device *)ptr; + struct net_device *dev = (struct net_device *)ptr; if (dev->type == ARPHRD_X25 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) @@ -522,7 +522,7 @@ static struct sock *x25_make_new(struct sock *osk) return sk; } -static int x25_release(struct socket *sock, struct socket *peer) +static int x25_release(struct socket *sock) { struct sock *sk = sock->sk; @@ -589,7 +589,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len { struct sock *sk = sock->sk; struct sockaddr_x25 *addr = (struct sockaddr_x25 *)uaddr; - struct device *dev; + struct net_device *dev; if (sk->state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { sock->state = SS_CONNECTED; @@ -680,11 +680,6 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags) struct sock *newsk; struct sk_buff *skb; - if (newsock->sk != NULL) - x25_destroy_socket(newsock->sk); - - newsock->sk = NULL; - if ((sk = sock->sk) == NULL) return -EINVAL; @@ -1049,10 +1044,6 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int fl return copied; } -static int x25_shutdown(struct socket *sk, int how) -{ - return -EOPNOTSUPP; -} static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { @@ -1060,22 +1051,22 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) switch (cmd) { case TIOCOUTQ: { - long amount; + int amount; amount = sk->sndbuf - atomic_read(&sk->wmem_alloc); if (amount < 0) amount = 0; - if (put_user(amount, (unsigned long *)arg)) + if (put_user(amount, (unsigned int *)arg)) return -EFAULT; return 0; } case TIOCINQ: { struct sk_buff *skb; - long amount = 0L; + int amount = 0; /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->receive_queue)) != NULL) amount = skb->len; - if (put_user(amount, (unsigned long *)arg)) + if (put_user(amount, (unsigned int *)arg)) return -EFAULT; return 0; } @@ -1179,7 +1170,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) static int x25_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { struct sock *s; - struct device *dev; + struct net_device *dev; const char *devname; int len = 0; off_t pos = 0; @@ -1239,10 +1230,9 @@ struct net_proto_family x25_family_ops = { x25_create }; -static struct proto_ops x25_proto_ops = { +static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = { AF_X25, - sock_no_dup, x25_release, x25_bind, x25_connect, @@ -1252,14 +1242,19 @@ static struct proto_ops x25_proto_ops = { datagram_poll, x25_ioctl, x25_listen, - x25_shutdown, + sock_no_shutdown, x25_setsockopt, x25_getsockopt, sock_no_fcntl, x25_sendmsg, - x25_recvmsg + x25_recvmsg, + sock_no_mmap }; +#include <linux/smp_lock.h> +SOCKOPS_WRAP(x25_proto, AF_X25); + + static struct packet_type x25_packet_type = { 0, /* MUTTER ntohs(ETH_P_X25),*/ @@ -1299,7 +1294,7 @@ static struct proc_dir_entry proc_net_x25_routes = { }; #endif -__initfunc(void x25_proto_init(struct net_proto *pro)) +void __init x25_proto_init(struct net_proto *pro) { sock_register(&x25_family_ops); @@ -1328,7 +1323,7 @@ MODULE_DESCRIPTION("The X.25 Packet Layer network layer protocol"); int init_module(void) { - struct device *dev; + struct net_device *dev; x25_proto_init(NULL); diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c index 42893df32..92b3b8f8f 100644 --- a/net/x25/sysctl_net_x25.c +++ b/net/x25/sysctl_net_x25.c @@ -47,7 +47,7 @@ static ctl_table x25_root_table[] = { {0} }; -__initfunc(void x25_register_sysctl(void)) +void __init x25_register_sysctl(void) { x25_table_header = register_sysctl_table(x25_root_table, 1); } diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index 5db6a58a5..1808361a6 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c @@ -31,7 +31,6 @@ #include <linux/stat.h> #include <linux/inet.h> #include <linux/netdevice.h> -#include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> #include <asm/segment.h> @@ -43,7 +42,7 @@ #include <linux/interrupt.h> #include <linux/notifier.h> #include <linux/proc_fs.h> -#include <linux/firewall.h> +#include <linux/if_arp.h> #include <net/x25.h> static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *neigh) @@ -52,11 +51,6 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *neigh) unsigned short frametype; unsigned int lci; - if (call_in_firewall(PF_X25, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) { - kfree_skb(skb); - return 0; - } - frametype = skb->data[2]; lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); @@ -94,7 +88,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *neigh) return 0; } -int x25_lapb_receive_frame(struct sk_buff *skb, struct device *dev, struct packet_type *ptype) +int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype) { struct x25_neigh *neigh; int queued; @@ -141,7 +135,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct device *dev, struct packe } } -int x25_llc_receive_frame(struct sk_buff *skb, struct device *dev, struct packet_type *ptype) +int x25_llc_receive_frame(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype) { struct x25_neigh *neigh; diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 961682702..be9f7edd3 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -39,7 +39,6 @@ #include <linux/fcntl.h> #include <linux/mm.h> #include <linux/interrupt.h> -#include <linux/firewall.h> #include <net/x25.h> static struct x25_neigh *x25_neigh_list = NULL; @@ -224,11 +223,6 @@ void x25_transmit_clear_request(struct x25_neigh *neigh, unsigned int lci, unsig void x25_transmit_link(struct sk_buff *skb, struct x25_neigh *neigh) { - if (call_fw_firewall(PF_X25, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) { - kfree_skb(skb); - return; - } - switch (neigh->state) { case X25_LINK_STATE_0: skb_queue_tail(&neigh->queue, skb); @@ -277,7 +271,7 @@ void x25_link_terminated(struct x25_neigh *neigh) /* * Add a new device. */ -void x25_link_device_up(struct device *dev) +void x25_link_device_up(struct net_device *dev) { struct x25_neigh *x25_neigh; unsigned long flags; @@ -337,7 +331,7 @@ static void x25_remove_neigh(struct x25_neigh *x25_neigh) /* * A device has been removed, remove its links. */ -void x25_link_device_down(struct device *dev) +void x25_link_device_down(struct net_device *dev) { struct x25_neigh *neigh, *x25_neigh = x25_neigh_list; @@ -353,7 +347,7 @@ void x25_link_device_down(struct device *dev) /* * Given a device, return the neighbour address. */ -struct x25_neigh *x25_get_neigh(struct device *dev) +struct x25_neigh *x25_get_neigh(struct net_device *dev) { struct x25_neigh *x25_neigh; @@ -371,15 +365,18 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) { struct x25_subscrip_struct x25_subscr; struct x25_neigh *x25_neigh; - struct device *dev; + struct net_device *dev; switch (cmd) { case SIOCX25GSUBSCRIP: if ((dev = x25_dev_get(x25_subscr.device)) == NULL) return -EINVAL; - if ((x25_neigh = x25_get_neigh(dev)) == NULL) + if ((x25_neigh = x25_get_neigh(dev)) == NULL) { + dev_put(dev); return -EINVAL; + } + dev_put(dev); x25_subscr.extended = x25_neigh->extended; if (copy_to_user(arg, &x25_subscr, sizeof(struct x25_subscrip_struct))) return -EFAULT; @@ -390,8 +387,11 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) return -EFAULT; if ((dev = x25_dev_get(x25_subscr.device)) == NULL) return -EINVAL; - if ((x25_neigh = x25_get_neigh(dev)) == NULL) + if ((x25_neigh = x25_get_neigh(dev)) == NULL) { + dev_put(dev); return -EINVAL; + } + dev_put(dev); if (x25_subscr.extended != 0 && x25_subscr.extended != 1) return -EINVAL; x25_neigh->extended = x25_subscr.extended; diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 9c3204537..383855135 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -42,7 +42,6 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/notifier.h> -#include <linux/firewall.h> #include <net/x25.h> static struct x25_route *x25_route_list = NULL; @@ -50,7 +49,7 @@ static struct x25_route *x25_route_list = NULL; /* * Add a new route. */ -static int x25_add_route(x25_address *address, unsigned int sigdigits, struct device *dev) +static int x25_add_route(x25_address *address, unsigned int sigdigits, struct net_device *dev) { struct x25_route *x25_route; unsigned long flags; @@ -105,7 +104,7 @@ static void x25_remove_route(struct x25_route *x25_route) restore_flags(flags); } -static int x25_del_route(x25_address *address, unsigned int sigdigits, struct device *dev) +static int x25_del_route(x25_address *address, unsigned int sigdigits, struct net_device *dev) { struct x25_route *x25_route; @@ -122,7 +121,7 @@ static int x25_del_route(x25_address *address, unsigned int sigdigits, struct de /* * A device has been removed, remove its routes. */ -void x25_route_device_down(struct device *dev) +void x25_route_device_down(struct net_device *dev) { struct x25_route *route, *x25_route = x25_route_list; @@ -138,11 +137,11 @@ void x25_route_device_down(struct device *dev) /* * Check that the device given is a valid X.25 interface that is "up". */ -struct device *x25_dev_get(char *devname) +struct net_device *x25_dev_get(char *devname) { - struct device *dev; + struct net_device *dev; - if ((dev = dev_get(devname)) == NULL) + if ((dev = dev_get_by_name(devname)) == NULL) return NULL; if ((dev->flags & IFF_UP) && (dev->type == ARPHRD_X25 @@ -152,13 +151,15 @@ struct device *x25_dev_get(char *devname) )) return dev; + dev_put(dev); + return NULL; } /* * Find a device given an X.25 address. */ -struct device *x25_get_route(x25_address *addr) +struct net_device *x25_get_route(x25_address *addr) { struct x25_route *route, *use = NULL; @@ -182,7 +183,8 @@ struct device *x25_get_route(x25_address *addr) int x25_route_ioctl(unsigned int cmd, void *arg) { struct x25_route_struct x25_route; - struct device *dev; + struct net_device *dev; + int err; switch (cmd) { @@ -193,7 +195,9 @@ int x25_route_ioctl(unsigned int cmd, void *arg) return -EINVAL; if ((dev = x25_dev_get(x25_route.device)) == NULL) return -EINVAL; - return x25_add_route(&x25_route.address, x25_route.sigdigits, dev); + err = x25_add_route(&x25_route.address, x25_route.sigdigits, dev); + dev_put(dev); + return err; case SIOCDELRT: if (copy_from_user(&x25_route, arg, sizeof(struct x25_route_struct))) @@ -202,7 +206,9 @@ int x25_route_ioctl(unsigned int cmd, void *arg) return -EINVAL; if ((dev = x25_dev_get(x25_route.device)) == NULL) return -EINVAL; - return x25_del_route(&x25_route.address, x25_route.sigdigits, dev); + err = x25_del_route(&x25_route.address, x25_route.sigdigits, dev); + dev_put(dev); + return err; default: return -EINVAL; |