aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25/x25_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/x25/x25_dev.c')
-rw-r--r--net/x25/x25_dev.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 3e1efe534645..9005f6daeab5 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -20,9 +20,11 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/netdevice.h> 21#include <linux/netdevice.h>
22#include <linux/skbuff.h> 22#include <linux/skbuff.h>
23#include <linux/slab.h>
23#include <net/sock.h> 24#include <net/sock.h>
24#include <linux/if_arp.h> 25#include <linux/if_arp.h>
25#include <net/x25.h> 26#include <net/x25.h>
27#include <net/x25device.h>
26 28
27static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) 29static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
28{ 30{
@@ -53,7 +55,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
53 if (!sock_owned_by_user(sk)) { 55 if (!sock_owned_by_user(sk)) {
54 queued = x25_process_rx_frame(sk, skb); 56 queued = x25_process_rx_frame(sk, skb);
55 } else { 57 } else {
56 sk_add_backlog(sk, skb); 58 queued = !sk_add_backlog(sk, skb);
57 } 59 }
58 bh_unlock_sock(sk); 60 bh_unlock_sock(sk);
59 sock_put(sk); 61 sock_put(sk);
@@ -114,19 +116,22 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
114 } 116 }
115 117
116 switch (skb->data[0]) { 118 switch (skb->data[0]) {
117 case 0x00: 119
118 skb_pull(skb, 1); 120 case X25_IFACE_DATA:
119 if (x25_receive_data(skb, nb)) { 121 skb_pull(skb, 1);
120 x25_neigh_put(nb); 122 if (x25_receive_data(skb, nb)) {
121 goto out; 123 x25_neigh_put(nb);
122 } 124 goto out;
123 break; 125 }
124 case 0x01: 126 break;
125 x25_link_established(nb); 127
126 break; 128 case X25_IFACE_CONNECT:
127 case 0x02: 129 x25_link_established(nb);
128 x25_link_terminated(nb); 130 break;
129 break; 131
132 case X25_IFACE_DISCONNECT:
133 x25_link_terminated(nb);
134 break;
130 } 135 }
131 x25_neigh_put(nb); 136 x25_neigh_put(nb);
132drop: 137drop:
@@ -147,7 +152,7 @@ void x25_establish_link(struct x25_neigh *nb)
147 return; 152 return;
148 } 153 }
149 ptr = skb_put(skb, 1); 154 ptr = skb_put(skb, 1);
150 *ptr = 0x01; 155 *ptr = X25_IFACE_CONNECT;
151 break; 156 break;
152 157
153#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) 158#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
@@ -183,7 +188,7 @@ void x25_terminate_link(struct x25_neigh *nb)
183 } 188 }
184 189
185 ptr = skb_put(skb, 1); 190 ptr = skb_put(skb, 1);
186 *ptr = 0x02; 191 *ptr = X25_IFACE_DISCONNECT;
187 192
188 skb->protocol = htons(ETH_P_X25); 193 skb->protocol = htons(ETH_P_X25);
189 skb->dev = nb->dev; 194 skb->dev = nb->dev;
@@ -199,7 +204,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb)
199 switch (nb->dev->type) { 204 switch (nb->dev->type) {
200 case ARPHRD_X25: 205 case ARPHRD_X25:
201 dptr = skb_push(skb, 1); 206 dptr = skb_push(skb, 1);
202 *dptr = 0x00; 207 *dptr = X25_IFACE_DATA;
203 break; 208 break;
204 209
205#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) 210#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)