Commit 55abcf9f authored by David S. Miller's avatar David S. Miller

Merge master.kernel.org:/home/acme/BK/llc-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 6f1fc71c 797ef46b
...@@ -199,13 +199,13 @@ extern void aarp_cleanup_module(void); ...@@ -199,13 +199,13 @@ extern void aarp_cleanup_module(void);
#define at_sk(__sk) ((struct atalk_sock *)(__sk)->protinfo) #define at_sk(__sk) ((struct atalk_sock *)(__sk)->protinfo)
extern struct sock *atalk_sockets; extern struct sock *atalk_sockets;
extern spinlock_t atalk_sockets_lock; extern rwlock_t atalk_sockets_lock;
extern struct atalk_route *atalk_routes; extern struct atalk_route *atalk_routes;
extern rwlock_t atalk_routes_lock; extern rwlock_t atalk_routes_lock;
extern struct atalk_iface *atalk_interfaces; extern struct atalk_iface *atalk_interfaces;
extern spinlock_t atalk_interfaces_lock; extern rwlock_t atalk_interfaces_lock;
extern struct atalk_route atrtr_default; extern struct atalk_route atrtr_default;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* the generic neighbour discovery code to clean this up. * the generic neighbour discovery code to clean this up.
* *
* FIXME: * FIXME:
* We ought to handle the retransmits with a single list and a * We ought to handle the retransmits with a single list and a
* separate fast timer for when it is needed. * separate fast timer for when it is needed.
* Use neighbour discovery code. * Use neighbour discovery code.
* Token Ring Support. * Token Ring Support.
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* Inside AppleTalk (2nd Ed). * Inside AppleTalk (2nd Ed).
* Fixes: * Fixes:
* Jaume Grau - flush caches on AARP_PROBE * Jaume Grau - flush caches on AARP_PROBE
* Rob Newberry - Added proxy AARP and AARP proc fs, * Rob Newberry - Added proxy AARP and AARP proc fs,
* moved probing from DDP module. * moved probing from DDP module.
* Arnaldo C. Melo - don't mangle rx packets * Arnaldo C. Melo - don't mangle rx packets
* *
...@@ -46,7 +46,7 @@ int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME; ...@@ -46,7 +46,7 @@ int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME;
/* Lists of aarp entries */ /* Lists of aarp entries */
/** /**
* struct aarp_entry - AARP entry * struct aarp_entry - AARP entry
* @last_sent - Last time we xmitted the aarp request * @last_sent - Last time we xmitted the aarp request
* @packet_queue - Queue of frames wait for resolution * @packet_queue - Queue of frames wait for resolution
* @status - Used for proxy AARP * @status - Used for proxy AARP
* expires_at - Entry expiry time * expires_at - Entry expiry time
...@@ -76,7 +76,7 @@ static struct aarp_entry *proxies[AARP_HASH_SIZE]; ...@@ -76,7 +76,7 @@ static struct aarp_entry *proxies[AARP_HASH_SIZE];
static int unresolved_count; static int unresolved_count;
/* One lock protects it all. */ /* One lock protects it all. */
static spinlock_t aarp_lock = SPIN_LOCK_UNLOCKED; static rwlock_t aarp_lock = RW_LOCK_UNLOCKED;
/* Used to walk the list and purge/kick entries. */ /* Used to walk the list and purge/kick entries. */
static struct timer_list aarp_timer; static struct timer_list aarp_timer;
...@@ -97,7 +97,6 @@ static void __aarp_expire(struct aarp_entry *a) ...@@ -97,7 +97,6 @@ static void __aarp_expire(struct aarp_entry *a)
* *
* Must run under aarp_lock. * Must run under aarp_lock.
*/ */
static void __aarp_send_query(struct aarp_entry *a) static void __aarp_send_query(struct aarp_entry *a)
{ {
static unsigned char aarp_eth_multicast[ETH_ALEN] = static unsigned char aarp_eth_multicast[ETH_ALEN] =
...@@ -107,7 +106,7 @@ static void __aarp_send_query(struct aarp_entry *a) ...@@ -107,7 +106,7 @@ static void __aarp_send_query(struct aarp_entry *a)
int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length; int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC); struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
struct atalk_addr *sat = atalk_find_dev_addr(dev); struct atalk_addr *sat = atalk_find_dev_addr(dev);
if (!skb) if (!skb)
return; return;
...@@ -115,34 +114,34 @@ static void __aarp_send_query(struct aarp_entry *a) ...@@ -115,34 +114,34 @@ static void __aarp_send_query(struct aarp_entry *a)
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
/* Set up the buffer */ /* Set up the buffer */
skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah)); skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah));
skb->protocol = htons(ETH_P_ATALK); skb->protocol = htons(ETH_P_ATALK);
skb->dev = dev; skb->dev = dev;
eah = aarp_hdr(skb); eah = aarp_hdr(skb);
/* Set up the ARP */ /* Set up the ARP */
eah->hw_type = htons(AARP_HW_TYPE_ETHERNET); eah->hw_type = htons(AARP_HW_TYPE_ETHERNET);
eah->pa_type = htons(ETH_P_ATALK); eah->pa_type = htons(ETH_P_ATALK);
eah->hw_len = ETH_ALEN; eah->hw_len = ETH_ALEN;
eah->pa_len = AARP_PA_ALEN; eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REQUEST); eah->function = htons(AARP_REQUEST);
memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN); memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
eah->pa_src_zero = 0; eah->pa_src_zero = 0;
eah->pa_src_net = sat->s_net; eah->pa_src_net = sat->s_net;
eah->pa_src_node = sat->s_node; eah->pa_src_node = sat->s_node;
memset(eah->hw_dst, '\0', ETH_ALEN); memset(eah->hw_dst, '\0', ETH_ALEN);
eah->pa_dst_zero = 0; eah->pa_dst_zero = 0;
eah->pa_dst_net = a->target_addr.s_net; eah->pa_dst_net = a->target_addr.s_net;
eah->pa_dst_node = a->target_addr.s_node; eah->pa_dst_node = a->target_addr.s_node;
/* Send it */ /* Send it */
aarp_dl->request(aarp_dl, skb, aarp_eth_multicast); aarp_dl->request(aarp_dl, skb, aarp_eth_multicast);
/* Update the sending count */ /* Update the sending count */
a->xmit_count++; a->xmit_count++;
...@@ -156,40 +155,40 @@ static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us, ...@@ -156,40 +155,40 @@ static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us,
struct elapaarp *eah; struct elapaarp *eah;
int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length; int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC); struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
if (!skb) if (!skb)
return; return;
/* Set up the buffer */ /* Set up the buffer */
skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah)); skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah));
skb->protocol = htons(ETH_P_ATALK); skb->protocol = htons(ETH_P_ATALK);
skb->dev = dev; skb->dev = dev;
eah = aarp_hdr(skb); eah = aarp_hdr(skb);
/* Set up the ARP */ /* Set up the ARP */
eah->hw_type = htons(AARP_HW_TYPE_ETHERNET); eah->hw_type = htons(AARP_HW_TYPE_ETHERNET);
eah->pa_type = htons(ETH_P_ATALK); eah->pa_type = htons(ETH_P_ATALK);
eah->hw_len = ETH_ALEN; eah->hw_len = ETH_ALEN;
eah->pa_len = AARP_PA_ALEN; eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REPLY); eah->function = htons(AARP_REPLY);
memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN); memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
eah->pa_src_zero = 0; eah->pa_src_zero = 0;
eah->pa_src_net = us->s_net; eah->pa_src_net = us->s_net;
eah->pa_src_node = us->s_node; eah->pa_src_node = us->s_node;
if (!sha) if (!sha)
memset(eah->hw_dst, '\0', ETH_ALEN); memset(eah->hw_dst, '\0', ETH_ALEN);
else else
memcpy(eah->hw_dst, sha, ETH_ALEN); memcpy(eah->hw_dst, sha, ETH_ALEN);
eah->pa_dst_zero = 0; eah->pa_dst_zero = 0;
eah->pa_dst_net = them->s_net; eah->pa_dst_net = them->s_net;
eah->pa_dst_node = them->s_node; eah->pa_dst_node = them->s_node;
/* Send it */ /* Send it */
aarp_dl->request(aarp_dl, skb, sha); aarp_dl->request(aarp_dl, skb, sha);
} }
...@@ -238,7 +237,7 @@ void aarp_send_probe(struct net_device *dev, struct atalk_addr *us) ...@@ -238,7 +237,7 @@ void aarp_send_probe(struct net_device *dev, struct atalk_addr *us)
/* Send it */ /* Send it */
aarp_dl->request(aarp_dl, skb, aarp_eth_multicast); aarp_dl->request(aarp_dl, skb, aarp_eth_multicast);
} }
/* /*
* Handle an aarp timer expire * Handle an aarp timer expire
* *
...@@ -264,7 +263,6 @@ static void __aarp_expire_timer(struct aarp_entry **n) ...@@ -264,7 +263,6 @@ static void __aarp_expire_timer(struct aarp_entry **n)
* *
* Must run under the aarp_lock. * Must run under the aarp_lock.
*/ */
static void __aarp_kick(struct aarp_entry **n) static void __aarp_kick(struct aarp_entry **n)
{ {
struct aarp_entry *t; struct aarp_entry *t;
...@@ -287,7 +285,6 @@ static void __aarp_kick(struct aarp_entry **n) ...@@ -287,7 +285,6 @@ static void __aarp_kick(struct aarp_entry **n)
* *
* Must run under the aarp_lock. * Must run under the aarp_lock.
*/ */
static void __aarp_expire_device(struct aarp_entry **n, struct net_device *dev) static void __aarp_expire_device(struct aarp_entry **n, struct net_device *dev)
{ {
struct aarp_entry *t; struct aarp_entry *t;
...@@ -300,13 +297,13 @@ static void __aarp_expire_device(struct aarp_entry **n, struct net_device *dev) ...@@ -300,13 +297,13 @@ static void __aarp_expire_device(struct aarp_entry **n, struct net_device *dev)
} else } else
n = &((*n)->next); n = &((*n)->next);
} }
/* Handle the timer event */ /* Handle the timer event */
static void aarp_expire_timeout(unsigned long unused) static void aarp_expire_timeout(unsigned long unused)
{ {
int ct; int ct;
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
__aarp_expire_timer(&resolved[ct]); __aarp_expire_timer(&resolved[ct]);
...@@ -315,20 +312,20 @@ static void aarp_expire_timeout(unsigned long unused) ...@@ -315,20 +312,20 @@ static void aarp_expire_timeout(unsigned long unused)
__aarp_expire_timer(&proxies[ct]); __aarp_expire_timer(&proxies[ct]);
} }
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
mod_timer(&aarp_timer, jiffies + mod_timer(&aarp_timer, jiffies +
(unresolved_count ? sysctl_aarp_tick_time : (unresolved_count ? sysctl_aarp_tick_time :
sysctl_aarp_expiry_time)); sysctl_aarp_expiry_time));
} }
/* Network device notifier chain handler. */ /* Network device notifier chain handler. */
static int aarp_device_event(struct notifier_block *this, unsigned long event, static int aarp_device_event(struct notifier_block *this, unsigned long event,
void *ptr) void *ptr)
{ {
int ct; int ct;
if (event == NETDEV_DOWN) { if (event == NETDEV_DOWN) {
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
__aarp_expire_device(&resolved[ct], ptr); __aarp_expire_device(&resolved[ct], ptr);
...@@ -336,7 +333,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event, ...@@ -336,7 +333,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
__aarp_expire_device(&proxies[ct], ptr); __aarp_expire_device(&proxies[ct], ptr);
} }
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
} }
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -345,7 +342,6 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event, ...@@ -345,7 +342,6 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
* Create a new aarp entry. This must use GFP_ATOMIC because it * Create a new aarp entry. This must use GFP_ATOMIC because it
* runs while holding spinlocks. * runs while holding spinlocks.
*/ */
static struct aarp_entry *aarp_alloc(void) static struct aarp_entry *aarp_alloc(void)
{ {
struct aarp_entry *a = kmalloc(sizeof(*a), GFP_ATOMIC); struct aarp_entry *a = kmalloc(sizeof(*a), GFP_ATOMIC);
...@@ -382,13 +378,13 @@ void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa) ...@@ -382,13 +378,13 @@ void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa)
int hash = sa->s_node % (AARP_HASH_SIZE - 1); int hash = sa->s_node % (AARP_HASH_SIZE - 1);
struct aarp_entry *a; struct aarp_entry *a;
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
a = __aarp_find_entry(proxies[hash], dev, sa); a = __aarp_find_entry(proxies[hash], dev, sa);
if (a) if (a)
a->expires_at = jiffies - 1; a->expires_at = jiffies - 1;
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
} }
/* This must run under aarp_lock. */ /* This must run under aarp_lock. */
...@@ -429,7 +425,7 @@ void aarp_send_probe_phase1(struct atalk_iface *iface) ...@@ -429,7 +425,7 @@ void aarp_send_probe_phase1(struct atalk_iface *iface)
void aarp_probe_network(struct atalk_iface *atif) void aarp_probe_network(struct atalk_iface *atif)
{ {
if (atif->dev->type == ARPHRD_LOCALTLK || if (atif->dev->type == ARPHRD_LOCALTLK ||
atif->dev->type == ARPHRD_PPP) atif->dev->type == ARPHRD_PPP)
aarp_send_probe_phase1(atif); aarp_send_probe_phase1(atif);
else { else {
unsigned int count; unsigned int count;
...@@ -440,7 +436,7 @@ void aarp_probe_network(struct atalk_iface *atif) ...@@ -440,7 +436,7 @@ void aarp_probe_network(struct atalk_iface *atif)
/* Defer 1/10th */ /* Defer 1/10th */
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ / 10); schedule_timeout(HZ / 10);
if (atif->status & ATIF_PROBE_FAIL) if (atif->status & ATIF_PROBE_FAIL)
break; break;
} }
...@@ -452,7 +448,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa) ...@@ -452,7 +448,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa)
int hash, retval = -EPROTONOSUPPORT; int hash, retval = -EPROTONOSUPPORT;
struct aarp_entry *entry; struct aarp_entry *entry;
unsigned int count; unsigned int count;
/* /*
* we don't currently support LocalTalk or PPP for proxy AARP; * we don't currently support LocalTalk or PPP for proxy AARP;
* if someone wants to try and add it, have fun * if someone wants to try and add it, have fun
...@@ -460,41 +456,41 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa) ...@@ -460,41 +456,41 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa)
if (atif->dev->type == ARPHRD_LOCALTLK || if (atif->dev->type == ARPHRD_LOCALTLK ||
atif->dev->type == ARPHRD_PPP) atif->dev->type == ARPHRD_PPP)
goto out; goto out;
/* /*
* create a new AARP entry with the flags set to be published -- * create a new AARP entry with the flags set to be published --
* we need this one to hang around even if it's in use * we need this one to hang around even if it's in use
*/ */
entry = aarp_alloc(); entry = aarp_alloc();
retval = -ENOMEM; retval = -ENOMEM;
if (!entry) if (!entry)
goto out; goto out;
entry->expires_at = -1; entry->expires_at = -1;
entry->status = ATIF_PROBE; entry->status = ATIF_PROBE;
entry->target_addr.s_node = sa->s_node; entry->target_addr.s_node = sa->s_node;
entry->target_addr.s_net = sa->s_net; entry->target_addr.s_net = sa->s_net;
entry->dev = atif->dev; entry->dev = atif->dev;
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
hash = sa->s_node % (AARP_HASH_SIZE - 1); hash = sa->s_node % (AARP_HASH_SIZE - 1);
entry->next = proxies[hash]; entry->next = proxies[hash];
proxies[hash] = entry; proxies[hash] = entry;
for (count = 0; count < AARP_RETRANSMIT_LIMIT; count++) { for (count = 0; count < AARP_RETRANSMIT_LIMIT; count++) {
aarp_send_probe(atif->dev, sa); aarp_send_probe(atif->dev, sa);
/* Defer 1/10th */ /* Defer 1/10th */
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
schedule_timeout(HZ / 10); schedule_timeout(HZ / 10);
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
if (entry->status & ATIF_PROBE_FAIL) if (entry->status & ATIF_PROBE_FAIL)
break; break;
} }
if (entry->status & ATIF_PROBE_FAIL) { if (entry->status & ATIF_PROBE_FAIL) {
entry->expires_at = jiffies - 1; /* free the entry */ entry->expires_at = jiffies - 1; /* free the entry */
retval = -EADDRINUSE; /* return network full */ retval = -EADDRINUSE; /* return network full */
...@@ -503,42 +499,42 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa) ...@@ -503,42 +499,42 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa)
retval = 1; retval = 1;
} }
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
out: out:
return retval; return retval;
} }
/* Send a DDP frame */ /* Send a DDP frame */
int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb,
struct atalk_addr *sa, void *hwaddr) struct atalk_addr *sa, void *hwaddr)
{ {
static char ddp_eth_multicast[ETH_ALEN] = static char ddp_eth_multicast[ETH_ALEN] =
{ 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF }; { 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF };
int hash; int hash;
struct aarp_entry *a; struct aarp_entry *a;
skb->nh.raw = skb->data; skb->nh.raw = skb->data;
/* Check for LocalTalk first */ /* Check for LocalTalk first */
if (dev->type == ARPHRD_LOCALTLK) { if (dev->type == ARPHRD_LOCALTLK) {
struct atalk_addr *at = atalk_find_dev_addr(dev); struct atalk_addr *at = atalk_find_dev_addr(dev);
struct ddpehdr *ddp = (struct ddpehdr *)skb->data; struct ddpehdr *ddp = (struct ddpehdr *)skb->data;
int ft = 2; int ft = 2;
/* /*
* Compressible ? * Compressible ?
* *
* IFF: src_net == dest_net == device_net * IFF: src_net == dest_net == device_net
* (zero matches anything) * (zero matches anything)
*/ */
if ((!ddp->deh_snet || at->s_net == ddp->deh_snet) && if ((!ddp->deh_snet || at->s_net == ddp->deh_snet) &&
(!ddp->deh_dnet || at->s_net == ddp->deh_dnet)) { (!ddp->deh_dnet || at->s_net == ddp->deh_dnet)) {
skb_pull(skb, sizeof(struct ddpehdr) - 4); skb_pull(skb, sizeof(*ddp) - 4);
/* /*
* The upper two remaining bytes are the port * The upper two remaining bytes are the port
* numbers we just happen to need. Now put the * numbers we just happen to need. Now put the
* length in the lower two. * length in the lower two.
*/ */
*((__u16 *)skb->data) = htons(skb->len); *((__u16 *)skb->data) = htons(skb->len);
...@@ -548,14 +544,14 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -548,14 +544,14 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
* Nice and easy. No AARP type protocols occur here so we can * Nice and easy. No AARP type protocols occur here so we can
* just shovel it out with a 3 byte LLAP header * just shovel it out with a 3 byte LLAP header
*/ */
skb_push(skb, 3); skb_push(skb, 3);
skb->data[0] = sa->s_node; skb->data[0] = sa->s_node;
skb->data[1] = at->s_node; skb->data[1] = at->s_node;
skb->data[2] = ft; skb->data[2] = ft;
skb->dev = dev; skb->dev = dev;
goto sendit; goto sendit;
} }
/* On a PPP link we neither compress nor aarp. */ /* On a PPP link we neither compress nor aarp. */
if (dev->type == ARPHRD_PPP) { if (dev->type == ARPHRD_PPP) {
...@@ -563,7 +559,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -563,7 +559,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
skb->dev = dev; skb->dev = dev;
goto sendit; goto sendit;
} }
/* Non ELAP we cannot do. */ /* Non ELAP we cannot do. */
if (dev->type != ARPHRD_ETHER) if (dev->type != ARPHRD_ETHER)
return -1; return -1;
...@@ -571,7 +567,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -571,7 +567,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
skb->dev = dev; skb->dev = dev;
skb->protocol = htons(ETH_P_ATALK); skb->protocol = htons(ETH_P_ATALK);
hash = sa->s_node % (AARP_HASH_SIZE - 1); hash = sa->s_node % (AARP_HASH_SIZE - 1);
/* Do we have a resolved entry? */ /* Do we have a resolved entry? */
if (sa->s_node == ATADDR_BCAST) { if (sa->s_node == ATADDR_BCAST) {
/* Send it */ /* Send it */
...@@ -579,13 +575,13 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -579,13 +575,13 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
goto sent; goto sent;
} }
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
a = __aarp_find_entry(resolved[hash], dev, sa); a = __aarp_find_entry(resolved[hash], dev, sa);
if (a) { /* Return 1 and fill in the address */ if (a) { /* Return 1 and fill in the address */
a->expires_at = jiffies + (sysctl_aarp_expiry_time * 10); a->expires_at = jiffies + (sysctl_aarp_expiry_time * 10);
ddp_dl->request(ddp_dl, skb, a->hwaddr); ddp_dl->request(ddp_dl, skb, a->hwaddr);
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
goto sent; goto sent;
} }
...@@ -600,7 +596,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -600,7 +596,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
a = aarp_alloc(); a = aarp_alloc();
if (!a) { if (!a) {
/* Whoops slipped... good job it's an unreliable protocol 8) */ /* Whoops slipped... good job it's an unreliable protocol 8) */
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
return -1; return -1;
} }
...@@ -627,7 +623,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -627,7 +623,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
/* Now finally, it is safe to drop the lock. */ /* Now finally, it is safe to drop the lock. */
out_unlock: out_unlock:
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
/* Tell the ddp layer we have taken over for this frame. */ /* Tell the ddp layer we have taken over for this frame. */
return 0; return 0;
...@@ -647,7 +643,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -647,7 +643,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
* Must run under aarp_lock. * Must run under aarp_lock.
*/ */
static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a, static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a,
int hash) int hash)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -666,7 +662,7 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a, ...@@ -666,7 +662,7 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a,
sysctl_aarp_expiry_time * 10; sysctl_aarp_expiry_time * 10;
ddp_dl->request(ddp_dl, skb, a->hwaddr); ddp_dl->request(ddp_dl, skb, a->hwaddr);
} }
} else } else
list = &((*list)->next); list = &((*list)->next);
} }
...@@ -723,7 +719,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -723,7 +719,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
da.s_node = ea->pa_dst_node; da.s_node = ea->pa_dst_node;
da.s_net = ea->pa_dst_net; da.s_net = ea->pa_dst_net;
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
a = __aarp_find_entry(proxies[hash], dev, &da); a = __aarp_find_entry(proxies[hash], dev, &da);
if (a && a->status & ATIF_PROBE) { if (a && a->status & ATIF_PROBE) {
...@@ -736,23 +732,23 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -736,23 +732,23 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
} }
switch (function) { switch (function) {
case AARP_REPLY: case AARP_REPLY:
if (!unresolved_count) /* Speed up */ if (!unresolved_count) /* Speed up */
break; break;
/* Find the entry. */ /* Find the entry. */
a = __aarp_find_entry(unresolved[hash],dev,&sa); a = __aarp_find_entry(unresolved[hash], dev, &sa);
if (!a || dev != a->dev) if (!a || dev != a->dev)
break; break;
/* We can fill one in - this is good. */ /* We can fill one in - this is good. */
memcpy(a->hwaddr,ea->hw_src,ETH_ALEN); memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
__aarp_resolved(&unresolved[hash],a,hash); __aarp_resolved(&unresolved[hash], a, hash);
if (!unresolved_count) if (!unresolved_count)
mod_timer(&aarp_timer, mod_timer(&aarp_timer,
jiffies + sysctl_aarp_expiry_time); jiffies + sysctl_aarp_expiry_time);
break; break;
case AARP_REQUEST: case AARP_REQUEST:
case AARP_PROBE: case AARP_PROBE:
...@@ -762,12 +758,12 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -762,12 +758,12 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
* simply means we shouldn't cache the querying host, * simply means we shouldn't cache the querying host,
* as in a probe they are proposing an address not * as in a probe they are proposing an address not
* using one. * using one.
* *
* Support for proxy-AARP added. We check if the * Support for proxy-AARP added. We check if the
* address is one of our proxies before we toss the * address is one of our proxies before we toss the
* packet out. * packet out.
*/ */
sa.s_node = ea->pa_dst_node; sa.s_node = ea->pa_dst_node;
sa.s_net = ea->pa_dst_net; sa.s_net = ea->pa_dst_net;
...@@ -787,10 +783,11 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -787,10 +783,11 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
* address. So as a precaution flush any * address. So as a precaution flush any
* entries we have for this address. * entries we have for this address.
*/ */
struct aarp_entry *a = __aarp_find_entry( struct aarp_entry *a;
resolved[sa.s_node %
(AARP_HASH_SIZE - 1)], a = __aarp_find_entry(resolved[sa.s_node %
skb->dev, &sa); (AARP_HASH_SIZE - 1)],
skb->dev, &sa);
/* /*
* Make it expire next tick - that avoids us * Make it expire next tick - that avoids us
...@@ -813,7 +810,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -813,7 +810,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
sa.s_node = ea->pa_src_node; sa.s_node = ea->pa_src_node;
sa.s_net = ea->pa_src_net; sa.s_net = ea->pa_src_net;
/* aarp_my_address has found the address to use for us. /* aarp_my_address has found the address to use for us.
*/ */
aarp_send_reply(dev, ma, &sa, ea->hw_src); aarp_send_reply(dev, ma, &sa, ea->hw_src);
...@@ -821,7 +818,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -821,7 +818,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
} }
unlock: unlock:
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
out1: out1:
ret = 1; ret = 1;
out0: out0:
...@@ -830,7 +827,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -830,7 +827,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
} }
static struct notifier_block aarp_notifier = { static struct notifier_block aarp_notifier = {
.notifier_call =aarp_device_event, .notifier_call = aarp_device_event,
}; };
static unsigned char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 }; static unsigned char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 };
...@@ -853,7 +850,7 @@ void aarp_device_down(struct net_device *dev) ...@@ -853,7 +850,7 @@ void aarp_device_down(struct net_device *dev)
{ {
int ct; int ct;
spin_lock_bh(&aarp_lock); write_lock_bh(&aarp_lock);
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
__aarp_expire_device(&resolved[ct], dev); __aarp_expire_device(&resolved[ct], dev);
...@@ -861,7 +858,7 @@ void aarp_device_down(struct net_device *dev) ...@@ -861,7 +858,7 @@ void aarp_device_down(struct net_device *dev)
__aarp_expire_device(&proxies[ct], dev); __aarp_expire_device(&proxies[ct], dev);
} }
spin_unlock_bh(&aarp_lock); write_unlock_bh(&aarp_lock);
} }
/* Called from proc fs */ /* Called from proc fs */
...@@ -875,7 +872,7 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -875,7 +872,7 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length)
"address", "device", "hw addr", "last_sent", "address", "device", "hw addr", "last_sent",
"expires"); "expires");
spin_lock_bh(&aarp_lock); read_lock_bh(&aarp_lock);
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
for (entry = resolved[ct]; entry; entry = entry->next) { for (entry = resolved[ct]; entry; entry = entry->next) {
...@@ -950,11 +947,10 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -950,11 +947,10 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length)
} }
} }
spin_unlock_bh(&aarp_lock); read_unlock_bh(&aarp_lock);
return len; return len;
} }
#ifdef MODULE
/* General module cleanup. Called from cleanup_module() in ddp.c. */ /* General module cleanup. Called from cleanup_module() in ddp.c. */
void aarp_cleanup_module(void) void aarp_cleanup_module(void)
{ {
...@@ -962,7 +958,7 @@ void aarp_cleanup_module(void) ...@@ -962,7 +958,7 @@ void aarp_cleanup_module(void)
unregister_netdevice_notifier(&aarp_notifier); unregister_netdevice_notifier(&aarp_notifier);
unregister_snap_client(aarp_dl); unregister_snap_client(aarp_dl);
} }
#endif /* MODULE */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
void aarp_register_proc_fs(void) void aarp_register_proc_fs(void)
{ {
......
...@@ -30,7 +30,7 @@ static void *atalk_seq_interface_start(struct seq_file *seq, loff_t *pos) ...@@ -30,7 +30,7 @@ static void *atalk_seq_interface_start(struct seq_file *seq, loff_t *pos)
{ {
loff_t l = *pos; loff_t l = *pos;
spin_lock_bh(&atalk_interfaces_lock); read_lock_bh(&atalk_interfaces_lock);
return l ? atalk_get_interface_idx(--l) : (void *)1; return l ? atalk_get_interface_idx(--l) : (void *)1;
} }
...@@ -53,7 +53,7 @@ static void *atalk_seq_interface_next(struct seq_file *seq, void *v, loff_t *pos ...@@ -53,7 +53,7 @@ static void *atalk_seq_interface_next(struct seq_file *seq, void *v, loff_t *pos
static void atalk_seq_interface_stop(struct seq_file *seq, void *v) static void atalk_seq_interface_stop(struct seq_file *seq, void *v)
{ {
spin_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
} }
static int atalk_seq_interface_show(struct seq_file *seq, void *v) static int atalk_seq_interface_show(struct seq_file *seq, void *v)
...@@ -154,7 +154,7 @@ static void *atalk_seq_socket_start(struct seq_file *seq, loff_t *pos) ...@@ -154,7 +154,7 @@ static void *atalk_seq_socket_start(struct seq_file *seq, loff_t *pos)
{ {
loff_t l = *pos; loff_t l = *pos;
spin_lock_bh(&atalk_sockets_lock); read_lock_bh(&atalk_sockets_lock);
return l ? atalk_get_socket_idx(--l) : (void *)1; return l ? atalk_get_socket_idx(--l) : (void *)1;
} }
...@@ -177,7 +177,7 @@ static void *atalk_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -177,7 +177,7 @@ static void *atalk_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos)
static void atalk_seq_socket_stop(struct seq_file *seq, void *v) static void atalk_seq_socket_stop(struct seq_file *seq, void *v)
{ {
spin_unlock_bh(&atalk_sockets_lock); read_unlock_bh(&atalk_sockets_lock);
} }
static int atalk_seq_socket_show(struct seq_file *seq, void *v) static int atalk_seq_socket_show(struct seq_file *seq, void *v)
......
...@@ -73,10 +73,8 @@ extern int aarp_proxy_probe_network(struct atalk_iface *atif, ...@@ -73,10 +73,8 @@ extern int aarp_proxy_probe_network(struct atalk_iface *atif,
struct atalk_addr *sa); struct atalk_addr *sa);
extern void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa); extern void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa);
#ifdef CONFIG_SYSCTL extern void atalk_register_sysctl(void);
extern inline void atalk_register_sysctl(void); extern void atalk_unregister_sysctl(void);
extern inline void atalk_unregister_sysctl(void);
#endif /* CONFIG_SYSCTL */
struct datalink_proto *ddp_dl, *aarp_dl; struct datalink_proto *ddp_dl, *aarp_dl;
static struct proto_ops atalk_dgram_ops; static struct proto_ops atalk_dgram_ops;
...@@ -88,29 +86,29 @@ static struct proto_ops atalk_dgram_ops; ...@@ -88,29 +86,29 @@ static struct proto_ops atalk_dgram_ops;
\**************************************************************************/ \**************************************************************************/
struct sock *atalk_sockets; struct sock *atalk_sockets;
spinlock_t atalk_sockets_lock = SPIN_LOCK_UNLOCKED; rwlock_t atalk_sockets_lock = RW_LOCK_UNLOCKED;
extern inline void atalk_insert_socket(struct sock *sk) extern inline void atalk_insert_socket(struct sock *sk)
{ {
spin_lock_bh(&atalk_sockets_lock); write_lock_bh(&atalk_sockets_lock);
sk->next = atalk_sockets; sk->next = atalk_sockets;
if (sk->next) if (sk->next)
atalk_sockets->pprev = &sk->next; atalk_sockets->pprev = &sk->next;
atalk_sockets = sk; atalk_sockets = sk;
sk->pprev = &atalk_sockets; sk->pprev = &atalk_sockets;
spin_unlock_bh(&atalk_sockets_lock); write_unlock_bh(&atalk_sockets_lock);
} }
extern inline void atalk_remove_socket(struct sock *sk) extern inline void atalk_remove_socket(struct sock *sk)
{ {
spin_lock_bh(&atalk_sockets_lock); write_lock_bh(&atalk_sockets_lock);
if (sk->pprev) { if (sk->pprev) {
if (sk->next) if (sk->next)
sk->next->pprev = sk->pprev; sk->next->pprev = sk->pprev;
*sk->pprev = sk->next; *sk->pprev = sk->next;
sk->pprev = NULL; sk->pprev = NULL;
} }
spin_unlock_bh(&atalk_sockets_lock); write_unlock_bh(&atalk_sockets_lock);
} }
static struct sock *atalk_search_socket(struct sockaddr_at *to, static struct sock *atalk_search_socket(struct sockaddr_at *to,
...@@ -118,7 +116,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, ...@@ -118,7 +116,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to,
{ {
struct sock *s; struct sock *s;
spin_lock_bh(&atalk_sockets_lock); read_lock_bh(&atalk_sockets_lock);
for (s = atalk_sockets; s; s = s->next) { for (s = atalk_sockets; s; s = s->next) {
struct atalk_sock *at = at_sk(s); struct atalk_sock *at = at_sk(s);
...@@ -145,7 +143,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, ...@@ -145,7 +143,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to,
break; break;
} }
} }
spin_unlock_bh(&atalk_sockets_lock); read_unlock_bh(&atalk_sockets_lock);
return s; return s;
} }
...@@ -164,7 +162,7 @@ static struct sock *atalk_find_or_insert_socket(struct sock *sk, ...@@ -164,7 +162,7 @@ static struct sock *atalk_find_or_insert_socket(struct sock *sk,
{ {
struct sock *s; struct sock *s;
spin_lock_bh(&atalk_sockets_lock); write_lock_bh(&atalk_sockets_lock);
for (s = atalk_sockets; s; s = s->next) { for (s = atalk_sockets; s; s = s->next) {
struct atalk_sock *at = at_sk(s); struct atalk_sock *at = at_sk(s);
...@@ -183,7 +181,7 @@ static struct sock *atalk_find_or_insert_socket(struct sock *sk, ...@@ -183,7 +181,7 @@ static struct sock *atalk_find_or_insert_socket(struct sock *sk,
sk->pprev = &atalk_sockets; sk->pprev = &atalk_sockets;
} }
spin_unlock_bh(&atalk_sockets_lock); write_unlock_bh(&atalk_sockets_lock);
return s; return s;
} }
...@@ -225,12 +223,12 @@ extern inline void atalk_destroy_socket(struct sock *sk) ...@@ -225,12 +223,12 @@ extern inline void atalk_destroy_socket(struct sock *sk)
* * * *
\**************************************************************************/ \**************************************************************************/
/* Anti-deadlock ordering is router_lock --> iface_lock -DaveM */ /* Anti-deadlock ordering is atalk_routes_lock --> iface_lock -DaveM */
struct atalk_route *atalk_routes; struct atalk_route *atalk_routes;
rwlock_t atalk_routes_lock = RW_LOCK_UNLOCKED; rwlock_t atalk_routes_lock = RW_LOCK_UNLOCKED;
struct atalk_iface *atalk_interfaces; struct atalk_iface *atalk_interfaces;
spinlock_t atalk_interfaces_lock = SPIN_LOCK_UNLOCKED; rwlock_t atalk_interfaces_lock = RW_LOCK_UNLOCKED;
/* For probing devices or in a routerless network */ /* For probing devices or in a routerless network */
struct atalk_route atrtr_default; struct atalk_route atrtr_default;
...@@ -245,7 +243,7 @@ static void atif_drop_device(struct net_device *dev) ...@@ -245,7 +243,7 @@ static void atif_drop_device(struct net_device *dev)
struct atalk_iface **iface = &atalk_interfaces; struct atalk_iface **iface = &atalk_interfaces;
struct atalk_iface *tmp; struct atalk_iface *tmp;
spin_lock_bh(&atalk_interfaces_lock); write_lock_bh(&atalk_interfaces_lock);
while ((tmp = *iface) != NULL) { while ((tmp = *iface) != NULL) {
if (tmp->dev == dev) { if (tmp->dev == dev) {
*iface = tmp->next; *iface = tmp->next;
...@@ -255,7 +253,7 @@ static void atif_drop_device(struct net_device *dev) ...@@ -255,7 +253,7 @@ static void atif_drop_device(struct net_device *dev)
} else } else
iface = &tmp->next; iface = &tmp->next;
} }
spin_unlock_bh(&atalk_interfaces_lock); write_unlock_bh(&atalk_interfaces_lock);
} }
static struct atalk_iface *atif_add_device(struct net_device *dev, static struct atalk_iface *atif_add_device(struct net_device *dev,
...@@ -274,10 +272,10 @@ static struct atalk_iface *atif_add_device(struct net_device *dev, ...@@ -274,10 +272,10 @@ static struct atalk_iface *atif_add_device(struct net_device *dev,
iface->address = *sa; iface->address = *sa;
iface->status = 0; iface->status = 0;
spin_lock_bh(&atalk_interfaces_lock); write_lock_bh(&atalk_interfaces_lock);
iface->next = atalk_interfaces; iface->next = atalk_interfaces;
atalk_interfaces = iface; atalk_interfaces = iface;
spin_unlock_bh(&atalk_interfaces_lock); write_unlock_bh(&atalk_interfaces_lock);
out: out:
return iface; return iface;
out_mem: out_mem:
...@@ -394,7 +392,7 @@ static struct atalk_addr *atalk_find_primary(void) ...@@ -394,7 +392,7 @@ static struct atalk_addr *atalk_find_primary(void)
* Return a point-to-point interface only if * Return a point-to-point interface only if
* there is no non-ptp interface available. * there is no non-ptp interface available.
*/ */
spin_lock_bh(&atalk_interfaces_lock); read_lock_bh(&atalk_interfaces_lock);
for (iface = atalk_interfaces; iface; iface = iface->next) { for (iface = atalk_interfaces; iface; iface = iface->next) {
if (!fiface && !(iface->dev->flags & IFF_LOOPBACK)) if (!fiface && !(iface->dev->flags & IFF_LOOPBACK))
fiface = iface; fiface = iface;
...@@ -411,7 +409,7 @@ static struct atalk_addr *atalk_find_primary(void) ...@@ -411,7 +409,7 @@ static struct atalk_addr *atalk_find_primary(void)
else else
retval = NULL; retval = NULL;
out: out:
spin_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
return retval; return retval;
} }
...@@ -442,7 +440,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node) ...@@ -442,7 +440,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node)
{ {
struct atalk_iface *iface; struct atalk_iface *iface;
spin_lock_bh(&atalk_interfaces_lock); read_lock_bh(&atalk_interfaces_lock);
for (iface = atalk_interfaces; iface; iface = iface->next) { for (iface = atalk_interfaces; iface; iface = iface->next) {
if ((node == ATADDR_BCAST || if ((node == ATADDR_BCAST ||
node == ATADDR_ANYNODE || node == ATADDR_ANYNODE ||
...@@ -457,7 +455,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node) ...@@ -457,7 +455,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node)
ntohs(net) <= ntohs(iface->nets.nr_lastnet)) ntohs(net) <= ntohs(iface->nets.nr_lastnet))
break; break;
} }
spin_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
return iface; return iface;
} }
...@@ -574,7 +572,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint) ...@@ -574,7 +572,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
if (!devhint) { if (!devhint) {
riface = NULL; riface = NULL;
spin_lock_bh(&atalk_interfaces_lock); read_lock_bh(&atalk_interfaces_lock);
for (iface = atalk_interfaces; iface; iface = iface->next) { for (iface = atalk_interfaces; iface; iface = iface->next) {
if (!riface && if (!riface &&
ntohs(ga->sat_addr.s_net) >= ntohs(ga->sat_addr.s_net) >=
...@@ -587,7 +585,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint) ...@@ -587,7 +585,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
ga->sat_addr.s_node == iface->address.s_node) ga->sat_addr.s_node == iface->address.s_node)
riface = iface; riface = iface;
} }
spin_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
retval = -ENETUNREACH; retval = -ENETUNREACH;
if (!riface) if (!riface)
...@@ -1042,7 +1040,7 @@ static int atalk_pick_and_bind_port(struct sock *sk, struct sockaddr_at *sat) ...@@ -1042,7 +1040,7 @@ static int atalk_pick_and_bind_port(struct sock *sk, struct sockaddr_at *sat)
struct sock *s; struct sock *s;
int retval; int retval;
spin_lock_bh(&atalk_sockets_lock); write_lock_bh(&atalk_sockets_lock);
for (sat->sat_port = ATPORT_RESERVED; for (sat->sat_port = ATPORT_RESERVED;
sat->sat_port < ATPORT_LAST; sat->sat_port < ATPORT_LAST;
...@@ -1071,7 +1069,7 @@ try_next_port:; ...@@ -1071,7 +1069,7 @@ try_next_port:;
retval = -EBUSY; retval = -EBUSY;
out: out:
spin_unlock_bh(&atalk_sockets_lock); write_unlock_bh(&atalk_sockets_lock);
return retval; return retval;
} }
...@@ -1831,13 +1829,18 @@ EXPORT_SYMBOL(aarp_send_ddp); ...@@ -1831,13 +1829,18 @@ EXPORT_SYMBOL(aarp_send_ddp);
EXPORT_SYMBOL(atrtr_get_dev); EXPORT_SYMBOL(atrtr_get_dev);
EXPORT_SYMBOL(atalk_find_dev_addr); EXPORT_SYMBOL(atalk_find_dev_addr);
static char atalk_banner[] __initdata =
KERN_INFO "NET4: AppleTalk 0.20 for Linux NET4.0\n";
static char atalk_err_snap[] __initdata =
KERN_CRIT "Unable to register DDP with SNAP.\n";
/* Called by proto.c on kernel start up */ /* Called by proto.c on kernel start up */
static int __init atalk_init(void) static int __init atalk_init(void)
{ {
(void)sock_register(&atalk_family_ops); (void)sock_register(&atalk_family_ops);
ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv); ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv);
if (!ddp_dl) if (!ddp_dl)
printk(KERN_CRIT "Unable to register DDP with SNAP.\n"); printk(atalk_err_snap);
dev_add_pack(&ltalk_packet_type); dev_add_pack(&ltalk_packet_type);
dev_add_pack(&ppptalk_packet_type); dev_add_pack(&ppptalk_packet_type);
...@@ -1848,15 +1851,12 @@ static int __init atalk_init(void) ...@@ -1848,15 +1851,12 @@ static int __init atalk_init(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
aarp_register_proc_fs(); aarp_register_proc_fs();
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
#ifdef CONFIG_SYSCTL
atalk_register_sysctl(); atalk_register_sysctl();
#endif /* CONFIG_SYSCTL */ printk(atalk_banner);
printk(KERN_INFO "NET4: AppleTalk 0.20 for Linux NET4.0\n");
return 0; return 0;
} }
module_init(atalk_init); module_init(atalk_init);
#ifdef MODULE
/* /*
* Note on MOD_{INC,DEC}_USE_COUNT: * Note on MOD_{INC,DEC}_USE_COUNT:
* *
...@@ -1886,7 +1886,6 @@ static void __exit atalk_exit(void) ...@@ -1886,7 +1886,6 @@ static void __exit atalk_exit(void)
sock_unregister(PF_APPLETALK); sock_unregister(PF_APPLETALK);
} }
module_exit(atalk_exit); module_exit(atalk_exit);
#endif /* MODULE */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alan Cox <Alan.Cox@linux.org>"); MODULE_AUTHOR("Alan Cox <Alan.Cox@linux.org>");
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/sysctl.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
extern int sysctl_aarp_expiry_time; extern int sysctl_aarp_expiry_time;
extern int sysctl_aarp_tick_time; extern int sysctl_aarp_tick_time;
extern int sysctl_aarp_retransmit_limit; extern int sysctl_aarp_retransmit_limit;
extern int sysctl_aarp_resolve_time; extern int sysctl_aarp_resolve_time;
#ifdef CONFIG_SYSCTL
static struct ctl_table atalk_table[] = { static struct ctl_table atalk_table[] = {
{ {
.ctl_name = NET_ATALK_AARP_EXPIRY_TIME, .ctl_name = NET_ATALK_AARP_EXPIRY_TIME,
...@@ -83,7 +83,7 @@ void atalk_unregister_sysctl(void) ...@@ -83,7 +83,7 @@ void atalk_unregister_sysctl(void)
unregister_sysctl_table(atalk_table_header); unregister_sysctl_table(atalk_table_header);
} }
#else #else /* CONFIG_PROC_FS */
void atalk_register_sysctl(void) void atalk_register_sysctl(void)
{ {
} }
...@@ -91,4 +91,4 @@ void atalk_register_sysctl(void) ...@@ -91,4 +91,4 @@ void atalk_register_sysctl(void)
void atalk_unregister_sysctl(void) void atalk_unregister_sysctl(void)
{ {
} }
#endif #endif /* CONFIG_PROC_FS */
...@@ -315,15 +315,6 @@ static struct file_operations ipx_seq_socket_fops = { ...@@ -315,15 +315,6 @@ static struct file_operations ipx_seq_socket_fops = {
.release = seq_release, .release = seq_release,
}; };
static int ipx_proc_perms(struct inode* inode, int op)
{
return 0;
}
static struct inode_operations ipx_seq_inode = {
.permission = ipx_proc_perms,
};
static struct proc_dir_entry *ipx_proc_dir; static struct proc_dir_entry *ipx_proc_dir;
int __init ipx_proc_init(void) int __init ipx_proc_init(void)
...@@ -335,24 +326,21 @@ int __init ipx_proc_init(void) ...@@ -335,24 +326,21 @@ int __init ipx_proc_init(void)
if (!ipx_proc_dir) if (!ipx_proc_dir)
goto out; goto out;
p = create_proc_entry("interface", 0, ipx_proc_dir); p = create_proc_entry("interface", S_IRUGO, ipx_proc_dir);
if (!p) if (!p)
goto out_interface; goto out_interface;
p->proc_fops = &ipx_seq_interface_fops; p->proc_fops = &ipx_seq_interface_fops;
p->proc_iops = &ipx_seq_inode; p = create_proc_entry("route", S_IRUGO, ipx_proc_dir);
p = create_proc_entry("route", 0, ipx_proc_dir);
if (!p) if (!p)
goto out_route; goto out_route;
p->proc_fops = &ipx_seq_route_fops; p->proc_fops = &ipx_seq_route_fops;
p->proc_iops = &ipx_seq_inode; p = create_proc_entry("socket", S_IRUGO, ipx_proc_dir);
p = create_proc_entry("socket", 0, ipx_proc_dir);
if (!p) if (!p)
goto out_socket; goto out_socket;
p->proc_fops = &ipx_seq_socket_fops; p->proc_fops = &ipx_seq_socket_fops;
p->proc_iops = &ipx_seq_inode;
rc = 0; rc = 0;
out: out:
......
...@@ -211,11 +211,6 @@ static int llc_seq_core_open(struct inode *inode, struct file *file) ...@@ -211,11 +211,6 @@ static int llc_seq_core_open(struct inode *inode, struct file *file)
return seq_open(file, &llc_seq_core_ops); return seq_open(file, &llc_seq_core_ops);
} }
static int llc_proc_perms(struct inode* inode, int op)
{
return 0;
}
static struct file_operations llc_seq_socket_fops = { static struct file_operations llc_seq_socket_fops = {
.open = llc_seq_socket_open, .open = llc_seq_socket_open,
.read = seq_read, .read = seq_read,
...@@ -230,10 +225,6 @@ static struct file_operations llc_seq_core_fops = { ...@@ -230,10 +225,6 @@ static struct file_operations llc_seq_core_fops = {
.release = seq_release, .release = seq_release,
}; };
static struct inode_operations llc_seq_inode = {
.permission = llc_proc_perms,
};
static struct proc_dir_entry *llc_proc_dir; static struct proc_dir_entry *llc_proc_dir;
int __init llc_proc_init(void) int __init llc_proc_init(void)
...@@ -245,19 +236,17 @@ int __init llc_proc_init(void) ...@@ -245,19 +236,17 @@ int __init llc_proc_init(void)
if (!llc_proc_dir) if (!llc_proc_dir)
goto out; goto out;
p = create_proc_entry("socket", 0, llc_proc_dir); p = create_proc_entry("socket", S_IRUGO, llc_proc_dir);
if (!p) if (!p)
goto out_socket; goto out_socket;
p->proc_fops = &llc_seq_socket_fops; p->proc_fops = &llc_seq_socket_fops;
p->proc_iops = &llc_seq_inode;
p = create_proc_entry("core", 0, llc_proc_dir); p = create_proc_entry("core", S_IRUGO, llc_proc_dir);
if (!p) if (!p)
goto out_core; goto out_core;
p->proc_fops = &llc_seq_core_fops; p->proc_fops = &llc_seq_core_fops;
p->proc_iops = &llc_seq_inode;
rc = 0; rc = 0;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment