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/netrom | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'net/netrom')
-rw-r--r-- | net/netrom/.cvsignore | 2 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 42 | ||||
-rw-r--r-- | net/netrom/nr_dev.c | 18 | ||||
-rw-r--r-- | net/netrom/nr_loopback.c | 2 | ||||
-rw-r--r-- | net/netrom/nr_route.c | 43 | ||||
-rw-r--r-- | net/netrom/sysctl_net_netrom.c | 2 |
6 files changed, 48 insertions, 61 deletions
diff --git a/net/netrom/.cvsignore b/net/netrom/.cvsignore deleted file mode 100644 index 857dd22e9..000000000 --- a/net/netrom/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.depend -.*.flags diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 1cff39fa1..c6b3a84c9 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -147,7 +147,7 @@ static void nr_remove_socket(struct sock *sk) /* * Kill all bound sockets on a dropped device. */ -static void nr_kill_by_device(struct device *dev) +static void nr_kill_by_device(struct net_device *dev) { struct sock *s; @@ -162,7 +162,7 @@ static void nr_kill_by_device(struct device *dev) */ static int nr_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 (event != NETDEV_DOWN) return NOTIFY_DONE; @@ -545,7 +545,7 @@ static struct sock *nr_make_new(struct sock *osk) return sk; } -static int nr_release(struct socket *sock, struct socket *peer) +static int nr_release(struct socket *sock) { struct sock *sk = sock->sk; @@ -591,7 +591,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk = sock->sk; struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; - struct device *dev; + struct net_device *dev; ax25_address *user, *source; if (sk->zapped == 0) @@ -647,7 +647,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr, struct sock *sk = sock->sk; struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr; ax25_address *user, *source = NULL; - struct device *dev; + struct net_device *dev; if (sk->state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { sock->state = SS_CONNECTED; @@ -747,11 +747,6 @@ static int nr_accept(struct socket *sock, struct socket *newsock, int flags) struct sock *newsk; struct sk_buff *skb; - if (newsock->sk != NULL) - nr_destroy_socket(newsock->sk); - - newsock->sk = NULL; - if ((sk = sock->sk) == NULL) return -EINVAL; @@ -818,7 +813,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr, return 0; } -int nr_rx_frame(struct sk_buff *skb, struct device *dev) +int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) { struct sock *sk; struct sock *make; @@ -1105,10 +1100,6 @@ static int nr_recvmsg(struct socket *sock, struct msghdr *msg, int size, return copied; } -static int nr_shutdown(struct socket *sk, int how) -{ - return -EOPNOTSUPP; -} static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { @@ -1175,7 +1166,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) static int nr_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; @@ -1248,10 +1239,9 @@ static struct net_proto_family nr_family_ops = nr_create }; -static struct proto_ops nr_proto_ops = { +static struct proto_ops SOCKOPS_WRAPPED(nr_proto_ops) = { PF_NETROM, - sock_no_dup, nr_release, nr_bind, nr_connect, @@ -1261,14 +1251,18 @@ static struct proto_ops nr_proto_ops = { datagram_poll, nr_ioctl, nr_listen, - nr_shutdown, + sock_no_shutdown, nr_setsockopt, nr_getsockopt, sock_no_fcntl, nr_sendmsg, - nr_recvmsg + nr_recvmsg, + sock_no_mmap }; +#include <linux/smp_lock.h> +SOCKOPS_WRAP(nr_proto, PF_NETROM); + static struct notifier_block nr_dev_notifier = { nr_device_event, 0 @@ -1295,18 +1289,18 @@ static struct proc_dir_entry proc_net_nr_nodes = { }; #endif -static struct device *dev_nr; +static struct net_device *dev_nr; -__initfunc(void nr_proto_init(struct net_proto *pro)) +void __init nr_proto_init(struct net_proto *pro) { int i; - if ((dev_nr = kmalloc(nr_ndevs * sizeof(struct device), GFP_KERNEL)) == NULL) { + if ((dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device), GFP_KERNEL)) == NULL) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); return; } - memset(dev_nr, 0x00, nr_ndevs * sizeof(struct device)); + memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device)); for (i = 0; i < nr_ndevs; i++) { dev_nr[i].name = kmalloc(20, GFP_KERNEL); diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index f5985e751..0e93f6d26 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -58,7 +58,7 @@ * Only allow IP over NET/ROM frames through if the netrom device is up. */ -int nr_rx_ip(struct sk_buff *skb, struct device *dev) +int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) { struct net_device_stats *stats = (struct net_device_stats *)dev->priv; @@ -86,7 +86,7 @@ int nr_rx_ip(struct sk_buff *skb, struct device *dev) static int nr_rebuild_header(struct sk_buff *skb) { - struct device *dev = skb->dev; + struct net_device *dev = skb->dev; struct net_device_stats *stats = (struct net_device_stats *)dev->priv; struct sk_buff *skbn; unsigned char *bp = skb->data; @@ -134,7 +134,7 @@ static int nr_rebuild_header(struct sk_buff *skb) #endif -static int nr_header(struct sk_buff *skb, struct device *dev, unsigned short type, +static int nr_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) { unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); @@ -166,7 +166,7 @@ static int nr_header(struct sk_buff *skb, struct device *dev, unsigned short typ return -37; } -static int nr_set_mac_address(struct device *dev, void *addr) +static int nr_set_mac_address(struct net_device *dev, void *addr) { struct sockaddr *sa = addr; @@ -179,7 +179,7 @@ static int nr_set_mac_address(struct device *dev, void *addr) return 0; } -static int nr_open(struct device *dev) +static int nr_open(struct net_device *dev) { dev->tbusy = 0; dev->start = 1; @@ -191,7 +191,7 @@ static int nr_open(struct device *dev) return 0; } -static int nr_close(struct device *dev) +static int nr_close(struct net_device *dev) { dev->tbusy = 1; dev->start = 0; @@ -203,7 +203,7 @@ static int nr_close(struct device *dev) return 0; } -static int nr_xmit(struct sk_buff *skb, struct device *dev) +static int nr_xmit(struct sk_buff *skb, struct net_device *dev) { struct net_device_stats *stats = (struct net_device_stats *)dev->priv; @@ -238,12 +238,12 @@ static int nr_xmit(struct sk_buff *skb, struct device *dev) return 0; } -static struct net_device_stats *nr_get_stats(struct device *dev) +static struct net_device_stats *nr_get_stats(struct net_device *dev) { return (struct net_device_stats *)dev->priv; } -int nr_init(struct device *dev) +int nr_init(struct net_device *dev) { dev->mtu = NR_MAX_PACKET_SIZE; dev->tbusy = 0; diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c index 007cb8738..9cf919ee6 100644 --- a/net/netrom/nr_loopback.c +++ b/net/netrom/nr_loopback.c @@ -75,7 +75,7 @@ static void nr_loopback_timer(unsigned long param) { struct sk_buff *skb; ax25_address *nr_dest; - struct device *dev; + struct net_device *dev; if ((skb = skb_dequeue(&loopback_queue)) != NULL) { nr_dest = (ax25_address *)(skb->data + 7); diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index fa2167a46..0a3f3a1f3 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -47,7 +47,7 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/notifier.h> -#include <linux/firewall.h> +#include <linux/netfilter.h> #include <net/netrom.h> static unsigned int nr_neigh_no = 1; @@ -62,7 +62,7 @@ static void nr_remove_neigh(struct nr_neigh *); * neighbour if it is new. */ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax25, - ax25_digi *ax25_digi, struct device *dev, int quality, int obs_count) + ax25_digi *ax25_digi, struct net_device *dev, int quality, int obs_count) { struct nr_node *nr_node; struct nr_neigh *nr_neigh; @@ -321,7 +321,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh) * "Delete" a node. Strictly speaking remove a route to a node. The node * is only deleted if no routes are left to it. */ -static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct device *dev) +static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct net_device *dev) { struct nr_node *nr_node; struct nr_neigh *nr_neigh; @@ -371,7 +371,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct d /* * Lock a neighbour with a quality. */ -static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct device *dev, unsigned int quality) +static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) { struct nr_neigh *nr_neigh; unsigned long flags; @@ -420,7 +420,7 @@ static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct dev * "Delete" a neighbour. The neighbour is only removed if the number * of nodes that may use it is zero. */ -static int nr_del_neigh(ax25_address *callsign, struct device *dev, unsigned int quality) +static int nr_del_neigh(ax25_address *callsign, struct net_device *dev, unsigned int quality) { struct nr_neigh *nr_neigh; @@ -499,7 +499,7 @@ static int nr_dec_obs(void) /* * A device has been removed. Remove its routes and neighbours. */ -void nr_rt_device_down(struct device *dev) +void nr_rt_device_down(struct net_device *dev) { struct nr_neigh *s, *nr_neigh = nr_neigh_list; struct nr_node *t, *nr_node; @@ -544,25 +544,26 @@ void nr_rt_device_down(struct device *dev) * Check that the device given is a valid AX.25 interface that is "up". * Or a valid ethernet interface with an AX.25 callsign binding. */ -static struct device *nr_ax25_dev_get(char *devname) +static struct net_device *nr_ax25_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_AX25) return dev; + dev_put(dev); return NULL; } /* * Find the first active NET/ROM device, usually "nr0". */ -struct device *nr_dev_first(void) +struct net_device *nr_dev_first(void) { - struct device *dev, *first = NULL; + struct net_device *dev, *first = NULL; read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { @@ -578,14 +579,16 @@ struct device *nr_dev_first(void) /* * Find the NET/ROM device for the given callsign. */ -struct device *nr_dev_get(ax25_address *addr) +struct net_device *nr_dev_get(ax25_address *addr) { - struct device *dev; + struct net_device *dev; read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { - if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0) + if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0) { + dev_hold(dev); goto out; + } } out: read_unlock(&dev_base_lock); @@ -617,7 +620,7 @@ static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) int nr_rt_ioctl(unsigned int cmd, void *arg) { struct nr_route_struct nr_route; - struct device *dev; + struct net_device *dev; switch (cmd) { @@ -703,14 +706,9 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) ax25_address *nr_src, *nr_dest; struct nr_neigh *nr_neigh; struct nr_node *nr_node; - struct device *dev; + struct net_device *dev; unsigned char *dptr; - if (ax25 != NULL && call_in_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; - - if (ax25 == NULL && call_out_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; nr_src = (ax25_address *)(skb->data + 0); nr_dest = (ax25_address *)(skb->data + 7); @@ -745,9 +743,6 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) if ((dev = nr_dev_first()) == NULL) return 0; - if (ax25 != NULL && call_fw_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; - dptr = skb_push(skb, 1); *dptr = AX25_P_NETROM; diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c index 3ce3e71f2..bf8006236 100644 --- a/net/netrom/sysctl_net_netrom.c +++ b/net/netrom/sysctl_net_netrom.c @@ -79,7 +79,7 @@ static ctl_table nr_root_table[] = { {0} }; -__initfunc(void nr_register_sysctl(void)) +void __init nr_register_sysctl(void) { nr_table_header = register_sysctl_table(nr_root_table, 1); } |