summaryrefslogtreecommitdiffstats
path: root/net/appletalk
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-06-17 13:20:30 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-06-17 13:20:30 +0000
commit7acb77a6e7bddd4c4c5aa975bbf976927c013798 (patch)
tree4139829ec6edb85f73774bb95cdec376758bfc73 /net/appletalk
parent64d58d4c8cd6a89ee218301ec0dc0ebfec91a4db (diff)
Merge with 2.1.43.
Diffstat (limited to 'net/appletalk')
-rw-r--r--net/appletalk/aarp.c39
-rw-r--r--net/appletalk/ddp.c44
-rw-r--r--net/appletalk/sysctl_net_atalk.c46
3 files changed, 115 insertions, 14 deletions
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 9ad9b8e93..f8a510e62 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -49,6 +49,12 @@
#include <linux/atalk.h>
#include <linux/init.h>
+
+int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME;
+int sysctl_aarp_tick_time = AARP_TICK_TIME;
+int sysctl_aarp_retransmit_limit = AARP_RETRANSMIT_LIMIT;
+int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME;
+
/*
* Lists of aarp entries
*/
@@ -309,7 +315,7 @@ static void aarp_kick(struct aarp_entry **n)
{
/* Expired - if this will be the 11th transmit, we delete
instead */
- if((*n)->xmit_count>=AARP_RETRANSMIT_LIMIT)
+ if((*n)->xmit_count>=sysctl_aarp_retransmit_limit)
{
t= *n;
*n=(*n)->next;
@@ -359,9 +365,9 @@ static void aarp_expire_timeout(unsigned long unused)
}
del_timer(&aarp_timer);
if(unresolved_count==0)
- aarp_timer.expires=jiffies+AARP_EXPIRY_TIME;
+ aarp_timer.expires=jiffies+sysctl_aarp_expiry_time;
else
- aarp_timer.expires=jiffies+AARP_TICK_TIME;
+ aarp_timer.expires=jiffies+sysctl_aarp_tick_time;
add_timer(&aarp_timer);
}
@@ -475,6 +481,21 @@ int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, vo
dev_queue_xmit(skb);
return 1;
}
+
+ /*
+ * On a PPP link we neither compress nor aarp.
+ */
+ if(dev->type==ARPHRD_PPP)
+ {
+ skb->protocol = htons(ETH_P_PPPTALK);
+ if(skb->sk==NULL)
+ skb->priority = SOPRI_NORMAL;
+ else
+ skb->priority = skb->sk->priority;
+ skb->dev = dev;
+ dev_queue_xmit(skb);
+ return 1;
+ }
/*
* Non ELAP we cannot do.
@@ -514,7 +535,7 @@ int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, vo
* Return 1 and fill in the address
*/
- a->expires_at=jiffies+AARP_EXPIRY_TIME*10;
+ a->expires_at=jiffies+sysctl_aarp_expiry_time*10;
ddp_dl->datalink_header(ddp_dl, skb, a->hwaddr);
if(skb->sk==NULL)
skb->priority = SOPRI_NORMAL;
@@ -561,7 +582,7 @@ int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, vo
*/
skb_queue_tail(&a->packet_queue, skb);
- a->expires_at=jiffies+AARP_RESOLVE_TIME;
+ a->expires_at=jiffies+sysctl_aarp_resolve_time;
a->dev=dev;
a->next=unresolved[hash];
a->target_addr= *sa;
@@ -584,7 +605,7 @@ int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, vo
if(unresolved_count==1)
{
del_timer(&aarp_timer);
- aarp_timer.expires=jiffies+AARP_TICK_TIME;
+ aarp_timer.expires=jiffies+sysctl_aarp_tick_time;
add_timer(&aarp_timer);
}
@@ -623,7 +644,7 @@ static void aarp_resolved(struct aarp_entry **list, struct aarp_entry *a, int ha
while((skb=skb_dequeue(&a->packet_queue))!=NULL)
{
- a->expires_at=jiffies+AARP_EXPIRY_TIME*10;
+ a->expires_at=jiffies+sysctl_aarp_expiry_time*10;
ddp_dl->datalink_header(ddp_dl,skb,a->hwaddr);
if(skb->sk==NULL)
skb->priority = SOPRI_NORMAL;
@@ -751,7 +772,7 @@ static int aarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type
if(unresolved_count==0)
{
del_timer(&aarp_timer);
- aarp_timer.expires=jiffies+AARP_EXPIRY_TIME;
+ aarp_timer.expires=jiffies+sysctl_aarp_expiry_time;
add_timer(&aarp_timer);
}
break;
@@ -804,7 +825,7 @@ __initfunc(void aarp_proto_init(void))
init_timer(&aarp_timer);
aarp_timer.function=aarp_expire_timeout;
aarp_timer.data=0;
- aarp_timer.expires=jiffies+AARP_EXPIRY_TIME;
+ aarp_timer.expires=jiffies+sysctl_aarp_expiry_time;
add_timer(&aarp_timer);
register_netdevice_notifier(&aarp_notifier);
}
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 4dbcc0a9c..de05f7047 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -79,6 +79,11 @@
#define DPRINT(x)
#endif
+#ifdef CONFIG_SYSCTL
+extern inline void atalk_register_sysctl(void);
+extern inline void atalk_unregister_sysctl(void);
+#endif
+
struct datalink_proto *ddp_dl, *aarp_dl;
static struct proto_ops atalk_dgram_ops;
@@ -262,7 +267,6 @@ static void atif_drop_device(struct device *dev)
else
iface = &tmp->next;
}
- MOD_DEC_USE_COUNT;
}
static struct atalk_iface *atif_add_device(struct device *dev, struct at_addr *sa)
@@ -281,7 +285,6 @@ static struct atalk_iface *atif_add_device(struct device *dev, struct at_addr *s
iface->next=atalk_iface_list;
atalk_iface_list=iface;
restore_flags(flags);
- MOD_INC_USE_COUNT;
return iface;
}
@@ -399,9 +402,21 @@ struct at_addr *atalk_find_dev_addr(struct device *dev)
static struct at_addr *atalk_find_primary(void)
{
struct atalk_iface *iface;
+ struct atalk_iface *fiface;
+ /*
+ * Return a point-to-point interface only if
+ * there is no non-ptp interface available.
+ */
+ fiface=NULL;
for(iface=atalk_iface_list;iface!=NULL;iface=iface->next)
- if(!(iface->dev->flags&IFF_LOOPBACK))
+ {
+ if(!fiface && !(iface->dev->flags&IFF_LOOPBACK))
+ fiface=iface;
+ if(!(iface->dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)))
return &iface->address;
+ }
+ if (fiface)
+ return &fiface->address;
if ( atalk_iface_list != NULL )
return &atalk_iface_list->address;
else
@@ -779,6 +794,16 @@ int atif_ioctl(int cmd, void *arg)
((struct sockaddr_at *)(&atreq.ifr_addr))->sat_addr.s_net=atif->address.s_net;
((struct sockaddr_at *)(&atreq.ifr_addr))->sat_addr.s_node=ATADDR_BCAST;
break;
+ case SIOCATALKDIFADDR:
+ if(!suser())
+ return -EPERM;
+ if(sa->sat_family!=AF_APPLETALK)
+ return -EINVAL;
+ if(atif==NULL)
+ return -EADDRNOTAVAIL;
+ atrtr_device_down(atif->dev);
+ atif_drop_device(atif->dev);
+ break;
}
err = copy_to_user(arg,&atreq,sizeof(atreq));
@@ -951,7 +976,8 @@ static int atalk_create(struct socket *sock, int protocol)
MOD_INC_USE_COUNT;
sock_init_data(sock,sk);
-
+
+ sk->destruct=NULL;
/* Checksums on by default */
sk->mtu=DDP_MAXSZ;
sk->zapped=1;
@@ -1928,6 +1954,7 @@ static int atalk_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg)
case SIOCGIFADDR:
case SIOCSIFADDR:
case SIOCGIFBRDADDR:
+ case SIOCATALKDIFADDR:
return atif_ioctl(cmd,(void *)arg);
/*
* Physical layer ioctl calls
@@ -2056,6 +2083,10 @@ __initfunc(void atalk_proto_init(struct net_proto *pro))
proc_net_register(&proc_atalk_iface);
#endif
+#ifdef CONFIG_SYSCTL
+ atalk_register_sysctl();
+#endif
+
#ifdef CONFIG_IPDDP
register_netdev(&dev_ipddp);
#endif /* CONFIG_IPDDP */
@@ -2098,6 +2129,7 @@ extern inline void free_interface_list(void)
while (list != NULL)
{
tmp = list->next;
+ list->dev->atalk_ptr = NULL;
kfree_s(list, sizeof(struct atalk_iface));
list = tmp;
}
@@ -2112,6 +2144,10 @@ void cleanup_module(void)
aarp_cleanup_module();
+#ifdef CONFIG_SYSCTL
+ atalk_unregister_sysctl();
+#endif
+
#ifdef CONFIG_PROC_FS
proc_net_unregister(PROC_NET_ATALK);
proc_net_unregister(PROC_NET_AT_ROUTE);
diff --git a/net/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c
index 307278992..6d5159ddc 100644
--- a/net/appletalk/sysctl_net_atalk.c
+++ b/net/appletalk/sysctl_net_atalk.c
@@ -3,11 +3,55 @@
*
* Begun April 1, 1996, Mike Shaver.
* Added /proc/sys/net/atalk directory entry (empty =) ). [MS]
+ * Dynamic registration, added aarp entries. (5/30/97 Chris Horn)
*/
#include <linux/mm.h>
#include <linux/sysctl.h>
-ctl_table atalk_table[] = {
+extern int sysctl_aarp_expiry_time;
+extern int sysctl_aarp_tick_time;
+extern int sysctl_aarp_retransmit_limit;
+extern int sysctl_aarp_resolve_time;
+
+
+static ctl_table atalk_table[] = {
+ {NET_ATALK_AARP_EXPIRY_TIME, "aarp-expiry-time",
+ &sysctl_aarp_expiry_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies},
+ {NET_ATALK_AARP_TICK_TIME, "aarp-tick-time",
+ &sysctl_aarp_tick_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies},
+ {NET_ATALK_AARP_RETRANSMIT_LIMIT, "aarp-retransmit-limit",
+ &sysctl_aarp_retransmit_limit, sizeof(int), 0644, NULL, &proc_dointvec},
+ {NET_ATALK_AARP_RESOLVE_TIME, "aarp-resolve-time",
+ &sysctl_aarp_resolve_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies},
+ {0}
+};
+
+static ctl_table atalk_dir_table[] = {
+ {NET_ATALK, "appletalk", NULL, 0, 0555, atalk_table},
{0}
};
+
+static ctl_table atalk_root_table[] = {
+ {CTL_NET, "net", NULL, 0, 0555, atalk_dir_table},
+ {0}
+};
+
+static struct ctl_table_header *atalk_table_header;
+
+inline void atalk_register_sysctl(void)
+{
+ atalk_table_header = register_sysctl_table(atalk_root_table, 1);
+}
+
+inline void atalk_unregister_sysctl(void)
+{
+ unregister_sysctl_table(atalk_table_header);
+}
+
+
+
+
+
+
+