005-linux_2.6.22_skbuff.patch 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. Index: aodv-uu-0.9.3/lnx/kaodv-compat.h
  2. ===================================================================
  3. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  4. +++ aodv-uu-0.9.3/lnx/kaodv-compat.h 2007-06-17 02:49:46.844217144 +0200
  5. @@ -0,0 +1,15 @@
  6. +#ifndef __KAODV_COMPAT_H
  7. +#define __KAODV_COMPAT_H
  8. +
  9. +#include <linux/version.h>
  10. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
  11. +
  12. +#define ip_hdr(_skb) (_skb)->nh.iph
  13. +#define skb_reset_network_header(_skb) do { \
  14. + _skb->nh.iph = (struct iphdr *)_skb->data; \
  15. + } while (0);
  16. +
  17. +
  18. +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) */
  19. +
  20. +#endif
  21. Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.c
  22. ===================================================================
  23. --- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.c 2007-06-17 02:31:56.448941960 +0200
  24. +++ aodv-uu-0.9.3/lnx/kaodv-ipenc.c 2007-06-17 02:45:50.420159064 +0200
  25. @@ -64,7 +64,7 @@
  26. if (skb->sk != NULL)
  27. skb_set_owner_w(nskb, skb->sk);
  28. - iph = skb->nh.iph;
  29. + iph = ip_hdr(skb);
  30. skb_put(nskb, sizeof(struct min_ipenc_hdr));
  31. @@ -78,7 +78,8 @@
  32. skb = nskb;
  33. /* Update pointers */
  34. - iph = skb->nh.iph = (struct iphdr *)skb->data;
  35. + skb_reset_network_header(skb);
  36. + iph = (struct iphdr *)skb->data;
  37. ipe = (struct min_ipenc_hdr *)(skb->data + (iph->ihl << 2));
  38. @@ -99,8 +100,8 @@
  39. ip_send_check(iph);
  40. - if (skb->nh.iph->id == 0)
  41. - ip_select_ident(skb->nh.iph, skb->dst, NULL);
  42. + if (ip_hdr(skb)->id == 0)
  43. + ip_select_ident(ip_hdr(skb), skb->dst, NULL);
  44. return skb;
  45. }
  46. @@ -108,9 +109,7 @@
  47. struct sk_buff *ip_pkt_decapsulate(struct sk_buff *skb)
  48. {
  49. struct min_ipenc_hdr *ipe;
  50. - /* skb->nh.iph is probably not set yet */
  51. - struct iphdr *iph = skb->nh.iph;
  52. -
  53. + struct iphdr *iph = ip_hdr(skb);
  54. ipe = (struct min_ipenc_hdr *)((char *)iph + (iph->ihl << 2));
  55. @@ -123,8 +122,9 @@
  56. skb->len - (iph->ihl << 2) - sizeof(struct min_ipenc_hdr));
  57. skb_trim(skb, skb->len - sizeof(struct min_ipenc_hdr));
  58. -
  59. - skb->nh.iph = iph = (struct iphdr *)skb->data;
  60. +
  61. + skb_reset_network_header(skb);
  62. + iph = (struct iphdr *)skb->data;
  63. iph->tot_len = htons((ntohs(iph->tot_len) - sizeof(struct min_ipenc_hdr)));
  64. ip_send_check(iph);
  65. Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.h
  66. ===================================================================
  67. --- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.h 2007-06-17 02:44:13.881835120 +0200
  68. +++ aodv-uu-0.9.3/lnx/kaodv-ipenc.h 2007-06-17 02:44:16.549429584 +0200
  69. @@ -27,6 +27,7 @@
  70. #include <linux/ip.h>
  71. #include <linux/skbuff.h>
  72. #include <asm/byteorder.h>
  73. +#include "kaodv-compat.h"
  74. #define IPPROTO_MIPE 55
  75. Index: aodv-uu-0.9.3/lnx/kaodv-mod.c
  76. ===================================================================
  77. --- aodv-uu-0.9.3.orig/lnx/kaodv-mod.c 2007-06-17 02:43:33.776931992 +0200
  78. +++ aodv-uu-0.9.3/lnx/kaodv-mod.c 2007-06-17 02:43:39.008136728 +0200
  79. @@ -120,7 +120,7 @@
  80. const struct net_device *out,
  81. int (*okfn) (struct sk_buff *))
  82. {
  83. - struct iphdr *iph = (*skb)->nh.iph;
  84. + struct iphdr *iph = ip_hdr(*skb);
  85. struct expl_entry e;
  86. struct in_addr ifaddr, bcaddr;
  87. int res = 0;
  88. @@ -188,7 +188,7 @@
  89. if (is_gateway && iph->protocol == IPPROTO_MIPE &&
  90. iph->daddr == ifaddr.s_addr) {
  91. ip_pkt_decapsulate(*skb);
  92. - iph = (*skb)->nh.iph;
  93. + iph = ip_hdr(*skb);
  94. return NF_ACCEPT;
  95. }
  96. /* Ignore packets generated locally or that are for this
  97. Index: aodv-uu-0.9.3/lnx/kaodv-mod.h
  98. ===================================================================
  99. --- aodv-uu-0.9.3.orig/lnx/kaodv-mod.h 2007-06-17 02:44:32.498005032 +0200
  100. +++ aodv-uu-0.9.3/lnx/kaodv-mod.h 2007-06-17 02:44:34.662675952 +0200
  101. @@ -5,6 +5,7 @@
  102. #include <linux/inetdevice.h>
  103. #include <linux/list.h>
  104. #include <linux/spinlock.h>
  105. +#include "kaodv-compat.h"
  106. /* Interface information */
  107. struct if_info {
  108. Index: aodv-uu-0.9.3/lnx/kaodv-queue.c
  109. ===================================================================
  110. --- aodv-uu-0.9.3.orig/lnx/kaodv-queue.c 2007-06-17 02:45:01.513593992 +0200
  111. +++ aodv-uu-0.9.3/lnx/kaodv-queue.c 2007-06-17 02:45:11.534070648 +0200
  112. @@ -152,7 +152,7 @@
  113. {
  114. int status = -EINVAL;
  115. struct kaodv_queue_entry *entry;
  116. - struct iphdr *iph = skb->nh.iph;
  117. + struct iphdr *iph = ip_hdr(skb);
  118. entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
  119. Index: aodv-uu-0.9.3/lnx/kaodv-queue.h
  120. ===================================================================
  121. --- aodv-uu-0.9.3.orig/lnx/kaodv-queue.h 2007-06-17 02:44:50.537262648 +0200
  122. +++ aodv-uu-0.9.3/lnx/kaodv-queue.h 2007-06-17 02:44:53.629792512 +0200
  123. @@ -21,6 +21,7 @@
  124. *****************************************************************************/
  125. #ifndef _KAODV_QUEUE_H
  126. #define _KAODV_QUEUE_H
  127. +#include "kaodv-compat.h"
  128. #define KAODV_QUEUE_DROP 1
  129. #define KAODV_QUEUE_SEND 2
  130. Index: aodv-uu-0.9.3/lnx/kaodv-netlink.c
  131. ===================================================================
  132. --- aodv-uu-0.9.3.orig/lnx/kaodv-netlink.c 2007-06-17 02:47:48.927143264 +0200
  133. +++ aodv-uu-0.9.3/lnx/kaodv-netlink.c 2007-06-17 02:49:11.604574384 +0200
  134. @@ -338,8 +338,10 @@
  135. netlink_register_notifier(&kaodv_nl_notifier);
  136. #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
  137. kaodvnl = netlink_kernel_create(NETLINK_AODV, kaodv_netlink_rcv_sk);
  138. -#else
  139. +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
  140. kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, THIS_MODULE);
  141. +#else
  142. + kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, NULL, THIS_MODULE);
  143. #endif
  144. if (kaodvnl == NULL) {
  145. printk(KERN_ERR "kaodv_netlink: failed to create netlink socket\n");