/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Copyright Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) * Copyright Alan Cox GW4PTS (alan@lxorguk.ukuu.org.uk) * Copyright Darryl Miles G7LED (dlm@g7led.demon.co.uk) */#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/capability.h>#include <linux/errno.h>#include <linux/types.h>#include <linux/socket.h>#include <linux/in.h>#include <linux/slab.h>#include <linux/kernel.h>#include <linux/sched.h>#include <linux/timer.h>#include <linux/string.h>#include <linux/sockios.h>#include <linux/net.h>#include <linux/stat.h>#include <net/ax25.h>#include <linux/inet.h>#include <linux/netdevice.h>#include <linux/if_arp.h>#include <linux/skbuff.h>#include <net/net_namespace.h>#include <net/sock.h>#include <asm/uaccess.h>#include <linux/fcntl.h>#include <linux/termios.h>/* For TIOCINQ/OUTQ */#include <linux/mm.h>#include <linux/interrupt.h>#include <linux/notifier.h>#include <net/netrom.h>#include <linux/proc_fs.h>#include <linux/seq_file.h>#include <net/ip.h>#include <net/tcp_states.h>#include <net/arp.h>#include <linux/init.h>static int nr_ndevs =4;int sysctl_netrom_default_path_quality = NR_DEFAULT_QUAL;int sysctl_netrom_obsolescence_count_initialiser = NR_DEFAULT_OBS;int sysctl_netrom_network_ttl_initialiser = NR_DEFAULT_TTL;int sysctl_netrom_transport_timeout = NR_DEFAULT_T1;int sysctl_netrom_transport_maximum_tries = NR_DEFAULT_N2;int sysctl_netrom_transport_acknowledge_delay = NR_DEFAULT_T2;int sysctl_netrom_transport_busy_delay = NR_DEFAULT_T4;int sysctl_netrom_transport_requested_window_size = NR_DEFAULT_WINDOW;int sysctl_netrom_transport_no_activity_timeout = NR_DEFAULT_IDLE;int sysctl_netrom_routing_control = NR_DEFAULT_ROUTING;int sysctl_netrom_link_fails_count = NR_DEFAULT_FAILS;int sysctl_netrom_reset_circuit = NR_DEFAULT_RESET;static unsigned short circuit =0x101;staticHLIST_HEAD(nr_list);staticDEFINE_SPINLOCK(nr_list_lock);static const struct proto_ops nr_proto_ops;/* * NETROM network devices are virtual network devices encapsulating NETROM * frames into AX.25 which will be sent through an AX.25 device, so form a * special "super class" of normal net devices; split their locks off into a * separate class since they always nest. */static struct lock_class_key nr_netdev_xmit_lock_key;static struct lock_class_key nr_netdev_addr_lock_key;static voidnr_set_lockdep_one(struct net_device *dev,struct netdev_queue *txq,void*_unused){lockdep_set_class(&txq->_xmit_lock, &nr_netdev_xmit_lock_key);}static voidnr_set_lockdep_key(struct net_device *dev){lockdep_set_class(&dev->addr_list_lock, &nr_netdev_addr_lock_key);netdev_for_each_tx_queue(dev, nr_set_lockdep_one, NULL);}/* * Socket removal during an interrupt is now safe. */static voidnr_remove_socket(struct sock *sk){spin_lock_bh(&nr_list_lock);sk_del_node_init(sk);spin_unlock_bh(&nr_list_lock);}/* * Kill all bound sockets on a dropped device. */static voidnr_kill_by_device(struct net