patch-2.1.25 linux/net/ax25/af_ax25.c
Next file: linux/net/ax25/ax25_in.c
Previous file: linux/net/appletalk/ddp.c
Back to the patch index
Back to the overall index
- Lines: 243
- Date:
Sun Feb 2 15:18:48 1997
- Orig file:
v2.1.24/linux/net/ax25/af_ax25.c
- Orig date:
Sun Feb 2 15:46:22 1997
diff -u --recursive --new-file v2.1.24/linux/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c
@@ -138,7 +138,7 @@
*/
ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}};
-ax25_cb *ax25_list = NULL;
+ax25_cb *volatile ax25_list = NULL;
static struct proto_ops ax25_proto_ops;
@@ -416,7 +416,6 @@
* Find an AX.25 control block given both ends. It will only pick up
* floating AX.25 control blocks or non Raw socket bound control blocks.
*/
-
static ax25_cb *ax25_find_cb(ax25_address *my_addr, ax25_address *dest_addr, ax25_digi *digi, struct device *dev)
{
ax25_cb *s;
@@ -477,10 +476,8 @@
if ((copy = skb_clone(skb, GFP_ATOMIC)) == NULL)
return;
- skb_set_owner_r(copy, sk);
- skb_queue_tail(&sk->receive_queue, copy);
- if (!sk->dead)
- sk->data_ready(sk, skb->len);
+ if (sock_queue_rcv_skb(sk, copy) != 0)
+ kfree_skb(copy, FREE_READ);
}
sk = sk->next;
@@ -532,7 +529,7 @@
}
if (ax25->sk != NULL) {
- if (ax25->sk->wmem_alloc || ax25->sk->rmem_alloc) { /* Defer: outstanding buffers */
+ if (ax25->sk->wmem_alloc > 0 || ax25->sk->rmem_alloc > 0) { /* Defer: outstanding buffers */
init_timer(&ax25->timer);
ax25->timer.expires = jiffies + 10 * HZ;
ax25->timer.function = ax25_destroy_timer;
@@ -841,7 +838,7 @@
ax25->backoff = ax25_dev_get_value(dev, AX25_VALUES_BACKOFF);
}
-int ax25_send_frame(struct sk_buff *skb, ax25_address *src, ax25_address *dest,
+int ax25_send_frame(struct sk_buff *skb, int fragment, ax25_address *src, ax25_address *dest,
ax25_digi *digi, struct device *dev)
{
ax25_cb *ax25;
@@ -860,7 +857,7 @@
if (ax25_queue_length(ax25, skb) > ax25->maxqueue * ax25->window) {
kfree_skb(skb, FREE_WRITE);
} else {
- ax25_output(ax25, skb);
+ ax25_output(ax25, fragment, skb);
}
ax25->idletimer = ax25->idle;
return 1; /* It already existed */
@@ -900,7 +897,7 @@
ax25_set_timer(ax25);
- ax25_output(ax25, skb);
+ ax25_output(ax25, fragment, skb);
return 1; /* We had to create it */
}
@@ -1004,7 +1001,9 @@
return 0;
case AX25_BACKOFF:
- sk->protinfo.ax25->backoff = opt ? 1 : 0;
+ if (opt < 0 || opt > 2)
+ return -EINVAL;
+ sk->protinfo.ax25->backoff = opt;
return 0;
case AX25_EXTSEQ:
@@ -1097,7 +1096,7 @@
if ((err = verify_area(VERIFY_WRITE, optval, sizeof(int))) != 0)
return err;
- put_user(val, (int *) optval);
+ put_user(val, (int *)optval);
return 0;
}
@@ -1171,12 +1170,11 @@
return -ENOMEM;
}
- sock_init_data(sock,sk);
+ sock_init_data(sock, sk);
- sock->ops = &ax25_proto_ops;
-
- sk->protocol = protocol;
- sk->mtu = AX25_MTU; /* 256 */
+ sock->ops = &ax25_proto_ops;
+ sk->protocol = protocol;
+ sk->mtu = AX25_MTU; /* 256 */
ax25->sk = sk;
sk->protinfo.ax25 = ax25;
@@ -1199,9 +1197,6 @@
ax25_fillin_cb(ax25, dev);
- sk->type = osk->type;
- sk->socket = osk->socket;
-
switch (osk->type) {
case SOCK_DGRAM:
break;
@@ -1213,17 +1208,19 @@
return NULL;
}
- sock_init_data(NULL,sk);
+ sock_init_data(NULL, sk);
- sk->priority = osk->priority;
- sk->protocol = osk->protocol;
- sk->rcvbuf = osk->rcvbuf;
- sk->sndbuf = osk->sndbuf;
- sk->debug = osk->debug;
- sk->state = TCP_ESTABLISHED;
- sk->mtu = osk->mtu;
- sk->sleep = osk->sleep;
- sk->zapped = osk->zapped;
+ sk->type = osk->type;
+ sk->socket = osk->socket;
+ sk->priority = osk->priority;
+ sk->protocol = osk->protocol;
+ sk->rcvbuf = osk->rcvbuf;
+ sk->sndbuf = osk->sndbuf;
+ sk->debug = osk->debug;
+ sk->state = TCP_ESTABLISHED;
+ sk->mtu = osk->mtu;
+ sk->sleep = osk->sleep;
+ sk->zapped = osk->zapped;
ax25->modulus = osk->protinfo.ax25->modulus;
ax25->backoff = osk->protinfo.ax25->backoff;
@@ -1461,7 +1458,7 @@
} else {
sk->protinfo.ax25->digipeat->repeated[ct] = 0;
}
- sk->protinfo.ax25->digipeat->calls[ct] = fsa->fsa_digipeater[ct];
+ sk->protinfo.ax25->digipeat->calls[ct] = fsa->fsa_digipeater[ct];
ct++;
}
}
@@ -1706,9 +1703,9 @@
return 0;
}
#endif
- skb->arp = 1;
- skb->dev = dev_out;
+ skb->dev = dev_out;
skb->priority = SOPRI_NORMAL;
+
ax25_queue_xmit(skb);
return 0;
@@ -1771,10 +1768,8 @@
* Remove the control and PID.
*/
skb_pull(skb, 2);
- skb_set_owner_r(skb, sk);
- skb_queue_tail(&sk->receive_queue, skb);
- if (!sk->dead)
- sk->data_ready(sk, skb->len);
+ if (sock_queue_rcv_skb(sk, skb) != 0)
+ kfree_skb(skb, FREE_READ);
}
} else {
kfree_skb(skb, FREE_READ);
@@ -1975,7 +1970,7 @@
if (sk->protinfo.ax25->device == NULL)
return -ENETUNREACH;
- if (usax) {
+ if (usax != NULL) {
if (addr_len != sizeof(struct sockaddr_ax25) && addr_len != sizeof(struct full_sockaddr_ax25))
return -EINVAL;
if (usax->sax25_family != AF_AX25)
@@ -2030,8 +2025,6 @@
if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL)
return err;
- skb->arp = 1;
-
skb_reserve(skb, size - len);
SOCK_DEBUG(sk, "AX.25: Appending user data\n");
@@ -2052,14 +2045,15 @@
return -ENOTCONN;
}
- ax25_output(sk->protinfo.ax25, skb); /* Shove it onto the queue and kick */
+ ax25_output(sk->protinfo.ax25, 1, skb); /* Shove it onto the queue and kick */
return len;
} else {
asmptr = skb_push(skb, 1 + size_ax25_addr(dp));
SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
- if(dp != 0)
+
+ if (dp != NULL)
SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
/* Build an AX.25 header */
@@ -2081,7 +2075,6 @@
return len;
}
-
}
static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags,
@@ -2468,9 +2461,10 @@
skb->protocol = htons(ETH_P_AX25);
skb->dev = ax25_fwd_dev(skb->dev);
+ skb->arp = 1;
- ptr = skb_push(skb, 1);
- *ptr++ = 0; /* KISS */
+ ptr = skb_push(skb, 1);
+ *ptr++ = 0x00; /* KISS */
dev_queue_xmit(skb);
}
@@ -2568,7 +2562,7 @@
skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
- ax25_send_frame(ourskb, (ax25_address *)(bp + 8), (ax25_address *)(bp + 1), NULL, dev);
+ ax25_send_frame(ourskb, 1, (ax25_address *)(bp + 8), (ax25_address *)(bp + 1), NULL, dev);
return 1;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov