patch-1.3.6 linux/net/netrom/nr_subr.c
Next file: linux/net/netrom/nr_timer.c
Previous file: linux/net/netrom/nr_route.c
Back to the patch index
Back to the overall index
- Lines: 102
- Date:
Thu Jun 29 19:18:53 1995
- Orig file:
v1.3.5/linux/net/netrom/nr_subr.c
- Orig date:
Tue Jun 6 12:16:45 1995
diff -u --recursive --new-file v1.3.5/linux/net/netrom/nr_subr.c linux/net/netrom/nr_subr.c
@@ -1,5 +1,5 @@
/*
- * NET/ROM release 002
+ * NET/ROM release 003
*
* This is ALPHA test software. This code may break your machine, randomly fail to work with new
* releases, misbehave and/or generally screw up. It might even work.
@@ -14,6 +14,7 @@
*
* History
* NET/ROM 001 Jonathan(G4KLX) Cloned from ax25_subr.c
+ * NET/ROM 003 Jonathan(G4KLX) Added G8BPQ NET/ROM extensions.
*/
#include <linux/config.h>
@@ -150,11 +151,11 @@
{
struct sk_buff *skb;
unsigned char *dptr;
- int len;
+ int len, timeout;
switch (frametype & 0x0F) {
- case NR_CONNREQ: len = 52; break;
- case NR_CONNACK: len = 38; break;
+ case NR_CONNREQ: len = 54; break;
+ case NR_CONNACK: len = (sk->nr->bpqext) ? 39 : 38; break;
case NR_DISCREQ: len = 37; break;
case NR_DISCACK: len = 37; break;
case NR_INFOACK: len = 37; break;
@@ -166,11 +167,17 @@
if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL)
return;
- dptr = skb->data + 32;
+ /*
+ * Space for AX.25
+ */
+ skb_reserve(skb,17);
+
+ dptr = skb_put(skb,len-17);
switch (frametype & 0x0F) {
case NR_CONNREQ:
+ timeout = (sk->nr->rtt / PR_SLOWHZ) * 2;
*dptr++ = sk->nr->my_index;
*dptr++ = sk->nr->my_id;
*dptr++ = 0;
@@ -186,6 +193,9 @@
dptr[6] &= ~LAPB_C;
dptr[6] &= ~LAPB_E;
dptr[6] |= SSID_SPARE;
+ dptr += 7;
+ *dptr++ = timeout % 256;
+ *dptr++ = timeout / 256;
break;
case NR_CONNACK:
@@ -195,6 +205,7 @@
*dptr++ = sk->nr->my_id;
*dptr++ = frametype;
*dptr++ = sk->window;
+ if (sk->nr->bpqext) *dptr++ = nr_default.ttl;
break;
case NR_DISCREQ:
@@ -216,7 +227,6 @@
}
skb->free = 1;
- skb->len = len;
nr_transmit_buffer(sk, skb);
}
@@ -233,7 +243,8 @@
if ((skbn = alloc_skb(38, GFP_ATOMIC)) == NULL)
return;
- dptr = skbn->data + 16;
+ skb_reserve(skbn,17);
+ dptr = skb_put(skbn,21);
*dptr++ = AX25_P_NETROM;
@@ -259,7 +270,6 @@
*dptr++ = 0;
skbn->free = 1;
- skbn->len = 38;
skbn->sk = NULL;
if (!nr_route_frame(skbn, NULL))
@@ -284,7 +294,7 @@
*/
void nr_calculate_rtt(struct sock *sk)
{
- if (sk->nr->n2count == 0)
+ if (sk->nr->t1timer > 0 && sk->nr->n2count == 0)
sk->nr->rtt = (9 * sk->nr->rtt + sk->nr->t1 - sk->nr->t1timer) / 10;
/* Don't go below one second */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this