diff options
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/if_x25.h | 26 | ||||
-rw-r--r-- | include/net/x25device.h | 1 | ||||
-rw-r--r-- | net/x25/x25_dev.c | 36 |
4 files changed, 48 insertions, 16 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index e2ea0b2159cd..2fc8e14cc24a 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -94,6 +94,7 @@ header-y += if_ppp.h | |||
94 | header-y += if_slip.h | 94 | header-y += if_slip.h |
95 | header-y += if_strip.h | 95 | header-y += if_strip.h |
96 | header-y += if_tun.h | 96 | header-y += if_tun.h |
97 | header-y += if_x25.h | ||
97 | header-y += in_route.h | 98 | header-y += in_route.h |
98 | header-y += ioctl.h | 99 | header-y += ioctl.h |
99 | header-y += ip6_tunnel.h | 100 | header-y += ip6_tunnel.h |
diff --git a/include/linux/if_x25.h b/include/linux/if_x25.h new file mode 100644 index 000000000000..897765f5feb8 --- /dev/null +++ b/include/linux/if_x25.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Linux X.25 packet to device interface | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _IF_X25_H | ||
16 | #define _IF_X25_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | /* Documentation/networking/x25-iface.txt */ | ||
21 | #define X25_IFACE_DATA 0x00 | ||
22 | #define X25_IFACE_CONNECT 0x01 | ||
23 | #define X25_IFACE_DISCONNECT 0x02 | ||
24 | #define X25_IFACE_PARAMS 0x03 | ||
25 | |||
26 | #endif /* _IF_X25_H */ | ||
diff --git a/include/net/x25device.h b/include/net/x25device.h index 1415bcf93980..1fa08b49f1c2 100644 --- a/include/net/x25device.h +++ b/include/net/x25device.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/if_ether.h> | 4 | #include <linux/if_ether.h> |
5 | #include <linux/if_packet.h> | 5 | #include <linux/if_packet.h> |
6 | #include <linux/if_x25.h> | ||
6 | #include <linux/skbuff.h> | 7 | #include <linux/skbuff.h> |
7 | 8 | ||
8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) | 9 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) |
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index b9ef682230a0..9005f6daeab5 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <net/sock.h> | 24 | #include <net/sock.h> |
25 | #include <linux/if_arp.h> | 25 | #include <linux/if_arp.h> |
26 | #include <net/x25.h> | 26 | #include <net/x25.h> |
27 | #include <net/x25device.h> | ||
27 | 28 | ||
28 | static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) | 29 | static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) |
29 | { | 30 | { |
@@ -115,19 +116,22 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, | |||
115 | } | 116 | } |
116 | 117 | ||
117 | switch (skb->data[0]) { | 118 | switch (skb->data[0]) { |
118 | case 0x00: | 119 | |
119 | skb_pull(skb, 1); | 120 | case X25_IFACE_DATA: |
120 | if (x25_receive_data(skb, nb)) { | 121 | skb_pull(skb, 1); |
121 | x25_neigh_put(nb); | 122 | if (x25_receive_data(skb, nb)) { |
122 | goto out; | 123 | x25_neigh_put(nb); |
123 | } | 124 | goto out; |
124 | break; | 125 | } |
125 | case 0x01: | 126 | break; |
126 | x25_link_established(nb); | 127 | |
127 | break; | 128 | case X25_IFACE_CONNECT: |
128 | case 0x02: | 129 | x25_link_established(nb); |
129 | x25_link_terminated(nb); | 130 | break; |
130 | break; | 131 | |
132 | case X25_IFACE_DISCONNECT: | ||
133 | x25_link_terminated(nb); | ||
134 | break; | ||
131 | } | 135 | } |
132 | x25_neigh_put(nb); | 136 | x25_neigh_put(nb); |
133 | drop: | 137 | drop: |
@@ -148,7 +152,7 @@ void x25_establish_link(struct x25_neigh *nb) | |||
148 | return; | 152 | return; |
149 | } | 153 | } |
150 | ptr = skb_put(skb, 1); | 154 | ptr = skb_put(skb, 1); |
151 | *ptr = 0x01; | 155 | *ptr = X25_IFACE_CONNECT; |
152 | break; | 156 | break; |
153 | 157 | ||
154 | #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) | 158 | #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) |
@@ -184,7 +188,7 @@ void x25_terminate_link(struct x25_neigh *nb) | |||
184 | } | 188 | } |
185 | 189 | ||
186 | ptr = skb_put(skb, 1); | 190 | ptr = skb_put(skb, 1); |
187 | *ptr = 0x02; | 191 | *ptr = X25_IFACE_DISCONNECT; |
188 | 192 | ||
189 | skb->protocol = htons(ETH_P_X25); | 193 | skb->protocol = htons(ETH_P_X25); |
190 | skb->dev = nb->dev; | 194 | skb->dev = nb->dev; |
@@ -200,7 +204,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb) | |||
200 | switch (nb->dev->type) { | 204 | switch (nb->dev->type) { |
201 | case ARPHRD_X25: | 205 | case ARPHRD_X25: |
202 | dptr = skb_push(skb, 1); | 206 | dptr = skb_push(skb, 1); |
203 | *dptr = 0x00; | 207 | *dptr = X25_IFACE_DATA; |
204 | break; | 208 | break; |
205 | 209 | ||
206 | #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) | 210 | #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE) |