aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25/ax25_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ax25/ax25_ip.c')
-rw-r--r--net/ax25/ax25_ip.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index a0b534f80f17..136c3aefa9de 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) 7 * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
8 */ 8 */
9#include <linux/config.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
11#include <linux/types.h> 10#include <linux/types.h>
12#include <linux/socket.h> 11#include <linux/socket.h>
@@ -104,11 +103,13 @@ int ax25_rebuild_header(struct sk_buff *skb)
104{ 103{
105 struct sk_buff *ourskb; 104 struct sk_buff *ourskb;
106 unsigned char *bp = skb->data; 105 unsigned char *bp = skb->data;
107 struct net_device *dev; 106 ax25_route *route;
107 struct net_device *dev = NULL;
108 ax25_address *src, *dst; 108 ax25_address *src, *dst;
109 ax25_digi *digipeat = NULL;
109 ax25_dev *ax25_dev; 110 ax25_dev *ax25_dev;
110 ax25_route _route, *route = &_route;
111 ax25_cb *ax25; 111 ax25_cb *ax25;
112 char ip_mode = ' ';
112 113
113 dst = (ax25_address *)(bp + 1); 114 dst = (ax25_address *)(bp + 1);
114 src = (ax25_address *)(bp + 8); 115 src = (ax25_address *)(bp + 8);
@@ -116,8 +117,12 @@ int ax25_rebuild_header(struct sk_buff *skb)
116 if (arp_find(bp + 1, skb)) 117 if (arp_find(bp + 1, skb))
117 return 1; 118 return 1;
118 119
119 route = ax25_rt_find_route(route, dst, NULL); 120 route = ax25_get_route(dst, NULL);
120 dev = route->dev; 121 if (route) {
122 digipeat = route->digipeat;
123 dev = route->dev;
124 ip_mode = route->ip_mode;
125 };
121 126
122 if (dev == NULL) 127 if (dev == NULL)
123 dev = skb->dev; 128 dev = skb->dev;
@@ -127,7 +132,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
127 } 132 }
128 133
129 if (bp[16] == AX25_P_IP) { 134 if (bp[16] == AX25_P_IP) {
130 if (route->ip_mode == 'V' || (route->ip_mode == ' ' && ax25_dev->values[AX25_VALUES_IPDEFMODE])) { 135 if (ip_mode == 'V' || (ip_mode == ' ' && ax25_dev->values[AX25_VALUES_IPDEFMODE])) {
131 /* 136 /*
132 * We copy the buffer and release the original thereby 137 * We copy the buffer and release the original thereby
133 * keeping it straight 138 * keeping it straight
@@ -173,7 +178,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
173 ourskb, 178 ourskb,
174 ax25_dev->values[AX25_VALUES_PACLEN], 179 ax25_dev->values[AX25_VALUES_PACLEN],
175 &src_c, 180 &src_c,
176 &dst_c, route->digipeat, dev); 181 &dst_c, digipeat, dev);
177 if (ax25) { 182 if (ax25) {
178 ax25_cb_put(ax25); 183 ax25_cb_put(ax25);
179 } 184 }
@@ -191,7 +196,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
191 196
192 skb_pull(skb, AX25_KISS_HEADER_LEN); 197 skb_pull(skb, AX25_KISS_HEADER_LEN);
193 198
194 if (route->digipeat != NULL) { 199 if (digipeat != NULL) {
195 if ((ourskb = ax25_rt_build_path(skb, src, dst, route->digipeat)) == NULL) { 200 if ((ourskb = ax25_rt_build_path(skb, src, dst, route->digipeat)) == NULL) {
196 kfree_skb(skb); 201 kfree_skb(skb);
197 goto put; 202 goto put;
@@ -203,7 +208,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
203 ax25_queue_xmit(skb, dev); 208 ax25_queue_xmit(skb, dev);
204 209
205put: 210put:
206 ax25_put_route(route); 211 if (route)
212 ax25_put_route(route);
207 213
208 return 1; 214 return 1;
209} 215}