Commit 8549ccb7 authored by David S. Miller's avatar David S. Miller

Manual content merge with Rusty's ISO struct initializers patch.

parents eb1f4c38 1d086a5d
...@@ -66,17 +66,29 @@ int sysctl_aarp_retransmit_limit = AARP_RETRANSMIT_LIMIT; ...@@ -66,17 +66,29 @@ int sysctl_aarp_retransmit_limit = AARP_RETRANSMIT_LIMIT;
int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME; int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME;
/* Lists of aarp entries */ /* Lists of aarp entries */
/**
* struct aarp_entry - AARP entry
* @last_sent - Last time we xmitted the aarp request
* @packet_queue - Queue of frames wait for resolution
* @status - Used for proxy AARP
* expires_at - Entry expiry time
* target_addr - DDP Address
* dev - Device to use
* hwaddr - Physical i/f address of target/router
* xmit_count - When this hits 10 we give up
* next - Next entry in chain
*/
struct aarp_entry { struct aarp_entry {
/* These first two are only used for unresolved entries */ /* These first two are only used for unresolved entries */
unsigned long last_sent; /* Last time we xmitted the aarp request */ unsigned long last_sent;
struct sk_buff_head packet_queue; /* Queue of frames wait for resolution */ struct sk_buff_head packet_queue;
int status; /* Used for proxy AARP */ int status;
unsigned long expires_at; /* Entry expiry time */ unsigned long expires_at;
struct at_addr target_addr; /* DDP Address */ struct at_addr target_addr;
struct net_device *dev; /* Device to use */ struct net_device *dev;
char hwaddr[6]; /* Physical i/f address of target/router */ char hwaddr[6];
unsigned short xmit_count; /* When this hits 10 we give up */ unsigned short xmit_count;
struct aarp_entry *next; /* Next entry in chain */ struct aarp_entry *next;
}; };
/* Hashed list of resolved, unresolved and proxy entries */ /* Hashed list of resolved, unresolved and proxy entries */
...@@ -371,7 +383,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event, ...@@ -371,7 +383,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
static struct aarp_entry *aarp_alloc(void) static struct aarp_entry *aarp_alloc(void)
{ {
struct aarp_entry *a = kmalloc(sizeof(struct aarp_entry), GFP_ATOMIC); struct aarp_entry *a = kmalloc(sizeof(*a), GFP_ATOMIC);
if (a) if (a)
skb_queue_head_init(&a->packet_queue); skb_queue_head_init(&a->packet_queue);
...@@ -462,7 +474,7 @@ void aarp_probe_network(struct atalk_iface *atif) ...@@ -462,7 +474,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;
...@@ -472,7 +484,7 @@ void aarp_probe_network(struct atalk_iface *atif) ...@@ -472,7 +484,7 @@ void aarp_probe_network(struct atalk_iface *atif)
int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
{ {
int hash, retval = 1; int hash, retval = -EPROTONOSUPPORT;
struct aarp_entry *entry; struct aarp_entry *entry;
unsigned int count; unsigned int count;
...@@ -480,19 +492,18 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) ...@@ -480,19 +492,18 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
* 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
*/ */
if (atif->dev->type == ARPHRD_LOCALTLK) if (atif->dev->type == ARPHRD_LOCALTLK ||
return -EPROTONOSUPPORT; atif->dev->type == ARPHRD_PPP)
goto out;
if (atif->dev->type == ARPHRD_PPP)
return -EPROTONOSUPPORT;
/* /*
* 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;
if (!entry) if (!entry)
return -ENOMEM; goto out;
entry->expires_at = -1; entry->expires_at = -1;
entry->status = ATIF_PROBE; entry->status = ATIF_PROBE;
...@@ -512,7 +523,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) ...@@ -512,7 +523,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
/* Defer 1/10th */ /* Defer 1/10th */
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
spin_unlock_bh(&aarp_lock); spin_unlock_bh(&aarp_lock);
schedule_timeout(HZ/10); schedule_timeout(HZ / 10);
spin_lock_bh(&aarp_lock); spin_lock_bh(&aarp_lock);
if (entry->status & ATIF_PROBE_FAIL) if (entry->status & ATIF_PROBE_FAIL)
...@@ -522,10 +533,13 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) ...@@ -522,10 +533,13 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
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 */
} else /* clear the probing flag */ } else { /* clear the probing flag */
entry->status &= ~ATIF_PROBE; entry->status &= ~ATIF_PROBE;
retval = 1;
}
spin_unlock_bh(&aarp_lock); spin_unlock_bh(&aarp_lock);
out:
return retval; return retval;
} }
...@@ -613,8 +627,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -613,8 +627,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
a = __aarp_find_entry(unresolved[hash], dev, sa); a = __aarp_find_entry(unresolved[hash], dev, sa);
if (a) { /* Queue onto the unresolved queue */ if (a) { /* Queue onto the unresolved queue */
skb_queue_tail(&a->packet_queue, skb); skb_queue_tail(&a->packet_queue, skb);
spin_unlock_bh(&aarp_lock); goto out_unlock;
return 0;
} }
/* Allocate a new entry */ /* Allocate a new entry */
...@@ -647,12 +660,14 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -647,12 +660,14 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
mod_timer(&aarp_timer, jiffies + sysctl_aarp_tick_time); mod_timer(&aarp_timer, jiffies + sysctl_aarp_tick_time);
/* Now finally, it is safe to drop the lock. */ /* Now finally, it is safe to drop the lock. */
out_unlock:
spin_unlock_bh(&aarp_lock); spin_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;
sendit: if (skb->sk) sendit:
if (skb->sk)
skb->priority = skb->sk->priority; skb->priority = skb->sk->priority;
dev_queue_xmit(skb); dev_queue_xmit(skb);
return 1; return 1;
...@@ -834,9 +849,12 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -834,9 +849,12 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
break; break;
} }
unlock: spin_unlock_bh(&aarp_lock); unlock:
out1: ret = 1; spin_unlock_bh(&aarp_lock);
out0: kfree_skb(skb); out1:
ret = 1;
out0:
kfree_skb(skb);
return ret; return ret;
} }
...@@ -880,81 +898,84 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -880,81 +898,84 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length)
{ {
/* we should dump all our AARP entries */ /* we should dump all our AARP entries */
struct aarp_entry *entry; struct aarp_entry *entry;
int len, ct; int ct, len = sprintf(buffer,
"%-10.10s %-10.10s%-18.18s%12.12s%12.12s "
len = sprintf(buffer, "xmit_count status\n",
"%-10.10s %-10.10s%-18.18s%12.12s%12.12s xmit_count status\n", "address", "device", "hw addr", "last_sent",
"address", "device", "hw addr", "last_sent", "expires"); "expires");
spin_lock_bh(&aarp_lock); spin_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) {
len+= sprintf(buffer+len,"%6u:%-3u ", len += sprintf(buffer + len, "%6u:%-3u ",
(unsigned int)ntohs(entry->target_addr.s_net), (unsigned int)ntohs(entry->target_addr.s_net),
(unsigned int)(entry->target_addr.s_node)); (unsigned int)(entry->target_addr.s_node));
len+= sprintf(buffer+len,"%-10.10s", len += sprintf(buffer + len, "%-10.10s",
entry->dev->name); entry->dev->name);
len+= sprintf(buffer+len,"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", len += sprintf(buffer + len,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
(int)(entry->hwaddr[0] & 0x000000FF), (int)(entry->hwaddr[0] & 0x000000FF),
(int)(entry->hwaddr[1] & 0x000000FF), (int)(entry->hwaddr[1] & 0x000000FF),
(int)(entry->hwaddr[2] & 0x000000FF), (int)(entry->hwaddr[2] & 0x000000FF),
(int)(entry->hwaddr[3] & 0x000000FF), (int)(entry->hwaddr[3] & 0x000000FF),
(int)(entry->hwaddr[4] & 0x000000FF), (int)(entry->hwaddr[4] & 0x000000FF),
(int)(entry->hwaddr[5] & 0x000000FF)); (int)(entry->hwaddr[5] & 0x000000FF));
len+= sprintf(buffer+len,"%12lu ""%12lu ", len += sprintf(buffer + len, "%12lu ""%12lu ",
(unsigned long)entry->last_sent, (unsigned long)entry->last_sent,
(unsigned long)entry->expires_at); (unsigned long)entry->expires_at);
len+=sprintf(buffer+len,"%10u", len += sprintf(buffer + len, "%10u",
(unsigned int)entry->xmit_count); (unsigned int)entry->xmit_count);
len+=sprintf(buffer+len," resolved\n"); len += sprintf(buffer + len, " resolved\n");
} }
} }
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
for (entry = unresolved[ct]; entry; entry = entry->next) { for (entry = unresolved[ct]; entry; entry = entry->next) {
len+= sprintf(buffer+len,"%6u:%-3u ", len += sprintf(buffer + len, "%6u:%-3u ",
(unsigned int)ntohs(entry->target_addr.s_net), (unsigned int)ntohs(entry->target_addr.s_net),
(unsigned int)(entry->target_addr.s_node)); (unsigned int)(entry->target_addr.s_node));
len+= sprintf(buffer+len,"%-10.10s", len += sprintf(buffer + len, "%-10.10s",
entry->dev->name); entry->dev->name);
len+= sprintf(buffer+len,"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", len += sprintf(buffer + len,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
(int)(entry->hwaddr[0] & 0x000000FF), (int)(entry->hwaddr[0] & 0x000000FF),
(int)(entry->hwaddr[1] & 0x000000FF), (int)(entry->hwaddr[1] & 0x000000FF),
(int)(entry->hwaddr[2] & 0x000000FF), (int)(entry->hwaddr[2] & 0x000000FF),
(int)(entry->hwaddr[3] & 0x000000FF), (int)(entry->hwaddr[3] & 0x000000FF),
(int)(entry->hwaddr[4] & 0x000000FF), (int)(entry->hwaddr[4] & 0x000000FF),
(int)(entry->hwaddr[5] & 0x000000FF)); (int)(entry->hwaddr[5] & 0x000000FF));
len+= sprintf(buffer+len,"%12lu ""%12lu ", len += sprintf(buffer + len, "%12lu ""%12lu ",
(unsigned long)entry->last_sent, (unsigned long)entry->last_sent,
(unsigned long)entry->expires_at); (unsigned long)entry->expires_at);
len+=sprintf(buffer+len,"%10u", len += sprintf(buffer + len, "%10u",
(unsigned int)entry->xmit_count); (unsigned int)entry->xmit_count);
len+=sprintf(buffer+len," unresolved\n"); len += sprintf(buffer + len, " unresolved\n");
} }
} }
for (ct = 0; ct < AARP_HASH_SIZE; ct++) { for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
for (entry = proxies[ct]; entry; entry = entry->next) { for (entry = proxies[ct]; entry; entry = entry->next) {
len+= sprintf(buffer+len,"%6u:%-3u ", len += sprintf(buffer + len, "%6u:%-3u ",
(unsigned int)ntohs(entry->target_addr.s_net), (unsigned int)ntohs(entry->target_addr.s_net),
(unsigned int)(entry->target_addr.s_node)); (unsigned int)(entry->target_addr.s_node));
len+= sprintf(buffer+len,"%-10.10s", len += sprintf(buffer + len, "%-10.10s",
entry->dev->name); entry->dev->name);
len+= sprintf(buffer+len,"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", len += sprintf(buffer + len,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
(int)(entry->hwaddr[0] & 0x000000FF), (int)(entry->hwaddr[0] & 0x000000FF),
(int)(entry->hwaddr[1] & 0x000000FF), (int)(entry->hwaddr[1] & 0x000000FF),
(int)(entry->hwaddr[2] & 0x000000FF), (int)(entry->hwaddr[2] & 0x000000FF),
(int)(entry->hwaddr[3] & 0x000000FF), (int)(entry->hwaddr[3] & 0x000000FF),
(int)(entry->hwaddr[4] & 0x000000FF), (int)(entry->hwaddr[4] & 0x000000FF),
(int)(entry->hwaddr[5] & 0x000000FF)); (int)(entry->hwaddr[5] & 0x000000FF));
len+= sprintf(buffer+len,"%12lu ""%12lu ", len += sprintf(buffer + len, "%12lu ""%12lu ",
(unsigned long)entry->last_sent, (unsigned long)entry->last_sent,
(unsigned long)entry->expires_at); (unsigned long)entry->expires_at);
len+=sprintf(buffer+len,"%10u", len += sprintf(buffer + len, "%10u",
(unsigned int)entry->xmit_count); (unsigned int)entry->xmit_count);
len+=sprintf(buffer+len," proxy\n"); len += sprintf(buffer + len, " proxy\n");
} }
} }
......
This diff is collapsed.
/* -*- linux-c -*- /*
* sysctl_net_atalk.c: sysctl interface to net AppleTalk subsystem. * sysctl_net_atalk.c: sysctl interface to net AppleTalk subsystem.
* *
* Begun April 1, 1996, Mike Shaver. * Begun April 1, 1996, Mike Shaver.
...@@ -17,25 +17,59 @@ extern int sysctl_aarp_resolve_time; ...@@ -17,25 +17,59 @@ extern int sysctl_aarp_resolve_time;
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
static ctl_table atalk_table[] = { static ctl_table atalk_table[] = {
{NET_ATALK_AARP_EXPIRY_TIME, "aarp-expiry-time", {
&sysctl_aarp_expiry_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies}, .ctl_name = NET_ATALK_AARP_EXPIRY_TIME,
{NET_ATALK_AARP_TICK_TIME, "aarp-tick-time", .procname = "aarp-expiry-time",
&sysctl_aarp_tick_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies}, .data = &sysctl_aarp_expiry_time,
{NET_ATALK_AARP_RETRANSMIT_LIMIT, "aarp-retransmit-limit", .maxlen = sizeof(int),
&sysctl_aarp_retransmit_limit, sizeof(int), 0644, NULL, &proc_dointvec}, .mode = 0644,
{NET_ATALK_AARP_RESOLVE_TIME, "aarp-resolve-time", .proc_handler = &proc_dointvec_jiffies,
&sysctl_aarp_resolve_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies}, },
{0} {
.ctl_name = NET_ATALK_AARP_TICK_TIME,
.procname = "aarp-tick-time",
.data = &sysctl_aarp_tick_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
.ctl_name = NET_ATALK_AARP_RETRANSMIT_LIMIT,
.procname = "aarp-retransmit-limit",
.data = &sysctl_aarp_retransmit_limit,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{
.ctl_name = NET_ATALK_AARP_RESOLVE_TIME,
.procname = "aarp-resolve-time",
.data = &sysctl_aarp_resolve_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{ 0 },
}; };
static ctl_table atalk_dir_table[] = { static ctl_table atalk_dir_table[] = {
{NET_ATALK, "appletalk", NULL, 0, 0555, atalk_table}, {
{0} .ctl_name = NET_ATALK,
.procname = "appletalk",
.mode = 0555,
.child = atalk_table,
},
{ 0 },
}; };
static ctl_table atalk_root_table[] = { static ctl_table atalk_root_table[] = {
{CTL_NET, "net", NULL, 0, 0555, atalk_dir_table}, {
{0} .ctl_name = CTL_NET,
.procname = "net",
.mode = 0555,
.child = atalk_dir_table,
},
{ 0 },
}; };
static struct ctl_table_header *atalk_table_header; static struct ctl_table_header *atalk_table_header;
......
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