Commit 4b04ea0b authored by Ralf Bächle's avatar Ralf Bächle

Eleminate race caused by static variable in ax25_rt_find_route.

parent 6a7ae931
...@@ -289,7 +289,8 @@ extern void ax25_rt_device_down(struct net_device *); ...@@ -289,7 +289,8 @@ extern void ax25_rt_device_down(struct net_device *);
extern int ax25_rt_ioctl(unsigned int, void *); extern int ax25_rt_ioctl(unsigned int, void *);
extern int ax25_rt_get_info(char *, char **, off_t, int); extern int ax25_rt_get_info(char *, char **, off_t, int);
extern int ax25_rt_autobind(ax25_cb *, ax25_address *); extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *); extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *,
struct net_device *);
extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
extern void ax25_rt_free(void); extern void ax25_rt_free(void);
......
...@@ -112,8 +112,8 @@ int ax25_rebuild_header(struct sk_buff *skb) ...@@ -112,8 +112,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
unsigned char *bp = skb->data; unsigned char *bp = skb->data;
struct net_device *dev; struct net_device *dev;
ax25_address *src, *dst; ax25_address *src, *dst;
ax25_route *route;
ax25_dev *ax25_dev; ax25_dev *ax25_dev;
ax25_route _route, *route = &_route;
dst = (ax25_address *)(bp + 1); dst = (ax25_address *)(bp + 1);
src = (ax25_address *)(bp + 8); src = (ax25_address *)(bp + 8);
...@@ -121,7 +121,7 @@ int ax25_rebuild_header(struct sk_buff *skb) ...@@ -121,7 +121,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
if (arp_find(bp + 1, skb)) if (arp_find(bp + 1, skb))
return 1; return 1;
route = ax25_rt_find_route(dst, NULL); route = ax25_rt_find_route(route, dst, NULL);
dev = route->dev; dev = route->dev;
if (dev == NULL) if (dev == NULL)
......
...@@ -439,28 +439,25 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) ...@@ -439,28 +439,25 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
return 0; return 0;
} }
/* ax25_route *ax25_rt_find_route(ax25_route * route, ax25_address *addr,
* dl1bke 960117: build digipeater path struct net_device *dev)
* dl1bke 960301: use the default route if it exists
*/
ax25_route *ax25_rt_find_route(ax25_address *addr, struct net_device *dev)
{ {
static ax25_route route;
ax25_route *ax25_rt; ax25_route *ax25_rt;
if ((ax25_rt = ax25_find_route(addr, dev)) == NULL) { if (ax25_rt = ax25_find_route(addr, dev))
route.next = NULL; return ax25_rt;
route.callsign = *addr;
route.dev = dev; route->next = NULL;
route.digipeat = NULL; route->callsign = *addr;
route.ip_mode = ' '; route->dev = dev;
return &route; route->digipeat = NULL;
} route->ip_mode = ' ';
return ax25_rt; return route;
} }
struct sk_buff *ax25_rt_build_path(struct sk_buff *skb, ax25_address *src, ax25_address *dest, ax25_digi *digi) struct sk_buff *ax25_rt_build_path(struct sk_buff *skb, ax25_address *src,
ax25_address *dest, ax25_digi *digi)
{ {
struct sk_buff *skbn; struct sk_buff *skbn;
unsigned char *bp; unsigned char *bp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment