linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / ax25 / ax25_ip.c
index 136c3ae..d643dac 100644 (file)
@@ -6,12 +6,12 @@
  *
  * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
  */
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
 #include <linux/string.h>
@@ -103,13 +103,11 @@ int ax25_rebuild_header(struct sk_buff *skb)
 {
        struct sk_buff *ourskb;
        unsigned char *bp  = skb->data;
-       ax25_route *route;
-       struct net_device *dev = NULL;
+       struct net_device *dev;
        ax25_address *src, *dst;
-       ax25_digi *digipeat = NULL;
        ax25_dev *ax25_dev;
+       ax25_route _route, *route = &_route;
        ax25_cb *ax25;
-       char ip_mode = ' ';
 
        dst = (ax25_address *)(bp + 1);
        src = (ax25_address *)(bp + 8);
@@ -117,12 +115,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
        if (arp_find(bp + 1, skb))
                return 1;
 
-       route = ax25_get_route(dst, NULL);
-       if (route) {
-               digipeat = route->digipeat;
-               dev = route->dev;
-               ip_mode = route->ip_mode;
-       };
+       route = ax25_rt_find_route(route, dst, NULL);
+       dev      = route->dev;
 
        if (dev == NULL)
                dev = skb->dev;
@@ -132,7 +126,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
        }
 
        if (bp[16] == AX25_P_IP) {
-               if (ip_mode == 'V' || (ip_mode == ' ' && ax25_dev->values[AX25_VALUES_IPDEFMODE])) {
+               if (route->ip_mode == 'V' || (route->ip_mode == ' ' && ax25_dev->values[AX25_VALUES_IPDEFMODE])) {
                        /*
                         *      We copy the buffer and release the original thereby
                         *      keeping it straight
@@ -178,7 +172,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
                            ourskb, 
                            ax25_dev->values[AX25_VALUES_PACLEN], 
                            &src_c,
-                           &dst_c, digipeat, dev);
+                           &dst_c, route->digipeat, dev);
                        if (ax25) {
                                ax25_cb_put(ax25);
                        }
@@ -196,7 +190,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
 
        skb_pull(skb, AX25_KISS_HEADER_LEN);
 
-       if (digipeat != NULL) {
+       if (route->digipeat != NULL) {
                if ((ourskb = ax25_rt_build_path(skb, src, dst, route->digipeat)) == NULL) {
                        kfree_skb(skb);
                        goto put;
@@ -208,8 +202,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
        ax25_queue_xmit(skb, dev);
 
 put:
-       if (route)
-               ax25_put_route(route);
+       ax25_put_route(route);
 
        return 1;
 }
@@ -228,5 +221,3 @@ int ax25_rebuild_header(struct sk_buff *skb)
 
 #endif
 
-EXPORT_SYMBOL(ax25_hard_header);
-EXPORT_SYMBOL(ax25_rebuild_header);