Advertisement
Guest User

Untitled

a guest
Nov 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 72.25 KB | None | 0 0
  1. From 5f18b3f41dfb7aa5d9216a6e5bcf4e3d6a5a29d9 Mon Sep 17 00:00:00 2001
  2. From: Jan Kraus <mayosemmel@gmail.com>
  3. Date: Thu, 24 Nov 2016 23:34:55 +0100
  4. Subject: [PATCH] backported Updated of batman-adv to version 2016.4
  5.  
  6. Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
  7. ---
  8. .../0001-bumped-up-batman-adv.patch                | 1641 ++++++++++++++++++++
  9.  buildscript                                        |    5 +
  10.  2 files changed, 1646 insertions(+)
  11.  create mode 100644 build_patches/openwrt-routing/0001-bumped-up-batman-adv.patch
  12.  
  13. diff --git a/build_patches/openwrt-routing/0001-bumped-up-batman-adv.patch b/build_patches/openwrt-routing/0001-bumped-up-batman-adv.patch
  14. new file mode 100644
  15. index 0000000..ba89dde
  16. --- /dev/null
  17. +++ b/build_patches/openwrt-routing/0001-bumped-up-batman-adv.patch
  18. @@ -0,0 +1,1641 @@
  19. +diff --git a/batman-adv/Config.in b/batman-adv/Config.in
  20. +index 48092e7..8c75f31 100644
  21. +--- batman-adv/Config.in
  22. ++++ batman-adv/Config.in
  23. +@@ -14,6 +14,11 @@ config KMOD_BATMAN_ADV_DAT
  24. +   depends on PACKAGE_kmod-batman-adv
  25. +   default y
  26. +
  27. ++config KMOD_BATMAN_ADV_DEBUGFS
  28. ++  bool "enable debugfs support"
  29. ++  depends on PACKAGE_kmod-batman-adv
  30. ++  default y
  31. ++
  32. + config KMOD_BATMAN_ADV_MCAST
  33. +   bool "enable multicast transmission optimization"
  34. +   depends on PACKAGE_kmod-batman-adv
  35. +diff --git a/batman-adv/Makefile b/batman-adv/Makefile
  36. +index e8334d5..23b2f74 100644
  37. +--- batman-adv/Makefile
  38. ++++ batman-adv/Makefile
  39. +@@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk
  40. +
  41. + PKG_NAME:=batman-adv
  42. +
  43. +-PKG_VERSION:=2016.1
  44. +-PKG_RELEASE:=3
  45. +-PKG_MD5SUM:=8c8e449009b4d29512d26ee308960bb5
  46. ++PKG_VERSION:=2016.4
  47. ++PKG_RELEASE:=0
  48. ++PKG_MD5SUM:=1ed28d02ad86050d1518023e354737b6
  49. +
  50. + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  51. + PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
  52. +@@ -50,6 +50,7 @@ endef
  53. + PKG_EXTRA_KCONFIG:= \
  54. +   CONFIG_BATMAN_ADV=m \
  55. +   CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
  56. ++  CONFIG_BATMAN_ADV_DEBUGFS=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUGFS),y,n) \
  57. +   CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
  58. +   CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
  59. +   CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \
  60. +@@ -62,15 +63,22 @@ PKG_EXTRA_CFLAGS:= \
  61. +
  62. + NOSTDINC_FLAGS = \
  63. +   -I$(PKG_BUILD_DIR)/net/batman-adv \
  64. +-  -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  65. +   -I$(STAGING_DIR)/usr/include/mac80211-backport \
  66. +-  -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  67. ++  -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  68. +   -I$(STAGING_DIR)/usr/include/mac80211 \
  69. ++  -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  70. ++  -I$(PKG_BUILD_DIR)/include/ \
  71. +   -include backport/backport.h \
  72. +   -include $(PKG_BUILD_DIR)/compat-hacks.h
  73. +
  74. ++COMPAT_SOURCES = \
  75. ++  $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/core/skbuff.o,) \
  76. ++  $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/ipv4/igmp.o,) \
  77. ++  $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/ipv6/mcast_snoop.o,) \
  78. ++
  79. + define Build/Compile
  80. +-  +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  81. ++  +env "batman-adv-y=$(COMPAT_SOURCES)" \
  82. ++  $(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  83. +       ARCH="$(LINUX_KARCH)" \
  84. +       CROSS_COMPILE="$(TARGET_CROSS)" \
  85. +       SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \
  86. +@@ -83,8 +91,6 @@ endef
  87. + define Build/Prepare
  88. +   $(call Build/Prepare/Default)
  89. +   $(CP) ./files/compat-hacks.h $(PKG_BUILD_DIR)/
  90. +-  $(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \
  91. +-      $(PKG_BUILD_DIR)/net/batman-adv/main.h
  92. + endef
  93. +
  94. + define Build/Clean
  95. +diff --git a/batman-adv/files/compat-hacks.h b/batman-adv/files/compat-hacks.h
  96. +index 5126fc2..32903b5 100644
  97. +--- batman-adv/files/compat-hacks.h
  98. ++++ batman-adv/files/compat-hacks.h
  99. +@@ -1,5 +1,7 @@
  100. + /* Please avoid adding hacks here - instead add it to mac80211/backports.git */
  101. +
  102. ++#undef CONFIG_MODULE_STRIPPED
  103. ++
  104. + #include <linux/version.h>    /* LINUX_VERSION_CODE */
  105. + #include <linux/types.h>
  106. +
  107. +@@ -31,6 +33,17 @@
  108. +
  109. + #endif /* < KERNEL_VERSION(4, 5, 0) */
  110. +
  111. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  112. ++
  113. ++struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
  114. ++                   unsigned int transport_len,
  115. ++                   __sum16(*skb_chkf)(struct sk_buff *skb));
  116. ++
  117. ++int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed);
  118. ++
  119. ++int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed);
  120. ++
  121. ++#endif /* < KERNEL_VERSION(4, 2, 0) */
  122. +
  123. + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  124. +
  125. +@@ -74,3 +87,103 @@ batadv_ethtool_get_link_ksettings(struct net_device *dev,
  126. + }
  127. +
  128. + #endif /* < KERNEL_VERSION(4, 6, 0) */
  129. ++
  130. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
  131. ++
  132. ++#define netif_trans_update batadv_netif_trans_update
  133. ++static inline void batadv_netif_trans_update(struct net_device *dev)
  134. ++{
  135. ++  dev->trans_start = jiffies;
  136. ++}
  137. ++
  138. ++#endif /* < KERNEL_VERSION(4, 7, 0) */
  139. ++
  140. ++
  141. ++#include_next <linux/netlink.h>
  142. ++
  143. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
  144. ++
  145. ++#include_next <net/netlink.h>
  146. ++
  147. ++static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb);
  148. ++
  149. ++static inline int batadv_nla_align_64bit(struct sk_buff *skb, int padattr)
  150. ++{
  151. ++  if (batadv_nla_need_padding_for_64bit(skb) &&
  152. ++      !nla_reserve(skb, padattr, 0))
  153. ++      return -EMSGSIZE;
  154. ++
  155. ++  return 0;
  156. ++}
  157. ++
  158. ++static inline struct nlattr *batadv__nla_reserve_64bit(struct sk_buff *skb,
  159. ++                             int attrtype,
  160. ++                             int attrlen, int padattr)
  161. ++{
  162. ++  if (batadv_nla_need_padding_for_64bit(skb))
  163. ++      batadv_nla_align_64bit(skb, padattr);
  164. ++
  165. ++  return __nla_reserve(skb, attrtype, attrlen);
  166. ++}
  167. ++
  168. ++static inline void batadv__nla_put_64bit(struct sk_buff *skb, int attrtype,
  169. ++                   int attrlen, const void *data,
  170. ++                   int padattr)
  171. ++{
  172. ++  struct nlattr *nla;
  173. ++
  174. ++  nla = batadv__nla_reserve_64bit(skb, attrtype, attrlen, padattr);
  175. ++  memcpy(nla_data(nla), data, attrlen);
  176. ++}
  177. ++
  178. ++static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb)
  179. ++{
  180. ++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  181. ++  /* The nlattr header is 4 bytes in size, that's why we test
  182. ++   * if the skb->data _is_ aligned.  A NOP attribute, plus
  183. ++   * nlattr header for next attribute, will make nla_data()
  184. ++   * 8-byte aligned.
  185. ++   */
  186. ++  if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
  187. ++      return true;
  188. ++#endif
  189. ++  return false;
  190. ++}
  191. ++
  192. ++static inline int batadv_nla_total_size_64bit(int payload)
  193. ++{
  194. ++  return NLA_ALIGN(nla_attr_size(payload))
  195. ++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  196. ++      + NLA_ALIGN(nla_attr_size(0))
  197. ++#endif
  198. ++      ;
  199. ++}
  200. ++
  201. ++static inline int batadv_nla_put_64bit(struct sk_buff *skb, int attrtype,
  202. ++                     int attrlen, const void *data,
  203. ++                     int padattr)
  204. ++{
  205. ++  size_t len;
  206. ++
  207. ++  if (batadv_nla_need_padding_for_64bit(skb))
  208. ++      len = batadv_nla_total_size_64bit(attrlen);
  209. ++  else
  210. ++      len = nla_total_size(attrlen);
  211. ++  if (unlikely(skb_tailroom(skb) < len))
  212. ++      return -EMSGSIZE;
  213. ++
  214. ++  batadv__nla_put_64bit(skb, attrtype, attrlen, data, padattr);
  215. ++  return 0;
  216. ++}
  217. ++
  218. ++#define nla_put_u64_64bit(_skb, _attrtype, _value, _padattr) \
  219. ++  batadv_nla_put_u64_64bit(_skb, _attrtype, _value, _padattr)
  220. ++static inline int batadv_nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
  221. ++                     u64 value, int padattr)
  222. ++{
  223. ++  return batadv_nla_put_64bit(skb, attrtype, sizeof(u64), &value,
  224. ++                  padattr);
  225. ++}
  226. ++
  227. ++#endif /* < KERNEL_VERSION(4, 7, 0) */
  228. ++
  229. +diff --git a/batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch b/batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch
  230. +deleted file mode 100644
  231. +index 70adb91..0000000
  232. +--- batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch
  233. ++++ /dev/null
  234. +@@ -1,64 +0,0 @@
  235. +-From a636bf0b69010222ea58337d425ca9ff8ce52639 Mon Sep 17 00:00:00 2001
  236. +-From: Antonio Quartulli <a@unstable.cc>
  237. +-Date: Mon, 2 May 2016 18:27:38 +0800
  238. +-Subject: [PATCH 1/6] batman-adv: make sure ELP/OGM orig MAC is updated on
  239. +- address change
  240. +-
  241. +-When the MAC address of the primary interface is changed,
  242. +-update the originator address in the ELP and OGM skb buffers as
  243. +-well in order to reflect the change.
  244. +-
  245. +-Fixes: a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")
  246. +-Reported-by: Marek Lindner <marek@neomailbox.ch>
  247. +-Signed-off-by: Antonio Quartulli <a@unstable.cc>
  248. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  249. +----
  250. +- net/batman-adv/bat_v.c | 26 ++++++++++++++++++++++----
  251. +- 1 file changed, 22 insertions(+), 4 deletions(-)
  252. +-
  253. +-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
  254. +-index 4026f19..4547fce 100644
  255. +---- a/net/batman-adv/bat_v.c
  256. +-+++ b/net/batman-adv/bat_v.c
  257. +-@@ -72,16 +72,34 @@ static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
  258. +-  batadv_v_elp_iface_disable(hard_iface);
  259. +- }
  260. +-
  261. +--static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
  262. +--{
  263. +--}
  264. +--
  265. +- static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
  266. +- {
  267. +-  batadv_v_elp_primary_iface_set(hard_iface);
  268. +-  batadv_v_ogm_primary_iface_set(hard_iface);
  269. +- }
  270. +-
  271. +-+/**
  272. +-+ * batadv_v_iface_update_mac - react to hard-interface MAC address change
  273. +-+ * @hard_iface: the modified interface
  274. +-+ *
  275. +-+ * If the modified interface is the primary one, update the originator
  276. +-+ * address in the ELP and OGM messages to reflect the new MAC address.
  277. +-+ */
  278. +-+static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
  279. +-+{
  280. +-+ struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
  281. +-+ struct batadv_hard_iface *primary_if;
  282. +-+
  283. +-+ primary_if = batadv_primary_if_get_selected(bat_priv);
  284. +-+ if (primary_if != hard_iface)
  285. +-+     goto out;
  286. +-+
  287. +-+ batadv_v_primary_iface_set(hard_iface);
  288. +-+out:
  289. +-+ if (primary_if)
  290. +-+     batadv_hardif_put(primary_if);
  291. +-+}
  292. +-+
  293. +- static void
  294. +- batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
  295. +- {
  296. +---
  297. +-2.8.0.rc3
  298. +-
  299. +diff --git a/batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch b/batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch
  300. +deleted file mode 100644
  301. +index ea191b3..0000000
  302. +--- batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch
  303. ++++ /dev/null
  304. +@@ -1,89 +0,0 @@
  305. +-From 8013ae257447c99d7ba037967458f91ceb4051ae Mon Sep 17 00:00:00 2001
  306. +-From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  307. +-Date: Thu, 7 Jan 2016 08:11:12 +0100
  308. +-Subject: [PATCH 2/6] batman-adv: Avoid duplicate neigh_node additions
  309. +-MIME-Version: 1.0
  310. +-Content-Type: text/plain; charset=UTF-8
  311. +-Content-Transfer-Encoding: 8bit
  312. +-
  313. +-Two parallel calls to batadv_neigh_node_new() might race for creating
  314. +-and adding the same neig_node. Fix this by including the check for any
  315. +-already existing, identical neigh_node within the spin-lock.
  316. +-
  317. +-This fixes splats like the following:
  318. +-
  319. +-[  739.535069] ------------[ cut here ]------------
  320. +-[  739.535079] WARNING: CPU: 0 PID: 0 at /usr/src/batman-adv/git/batman-adv/net/batman-adv/bat_iv_ogm.c:1004 batadv_iv_ogm_process_per_outif+0xe3f/0xe60 [batman_adv]()
  321. +-[  739.535092] too many matching neigh_nodes
  322. +-[  739.535094] Modules linked in: dm_mod tun ip6table_filter ip6table_mangle ip6table_nat nf_nat_ipv6 ip6_tables xt_nat iptable_nat nf_nat_ipv4 nf_nat xt_TCPMSS xt_mark iptable_mangle xt_tcpudp xt_conntrack iptable_filter ip_tables x_tables ip_gre ip_tunnel gre bridge stp llc thermal_sys kvm_intel kvm crct10dif_pclmul crc32_pclmul sha256_ssse3 sha256_generic hmac drbg ansi_cprng aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd evdev pcspkr ip6_gre ip6_tunnel tunnel6 batman_adv(O) libcrc32c nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack autofs4 ext4 crc16 mbcache jbd2 xen_netfront xen_blkfront crc32c_intel
  323. +-[  739.535177] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O    4.2.0-0.bpo.1-amd64 #1 Debian 4.2.6-3~bpo8+2
  324. +-[  739.535186]  0000000000000000 ffffffffa013b050 ffffffff81554521 ffff88007d003c18
  325. +-[  739.535201]  ffffffff8106fa01 0000000000000000 ffff8800047a087a ffff880079c3a000
  326. +-[  739.735602]  ffff88007b82bf40 ffff88007bc2d1c0 ffffffff8106fa7a ffffffffa013aa8e
  327. +-[  739.735624] Call Trace:
  328. +-[  739.735639]  <IRQ>  [<ffffffff81554521>] ? dump_stack+0x40/0x50
  329. +-[  739.735677]  [<ffffffff8106fa01>] ? warn_slowpath_common+0x81/0xb0
  330. +-[  739.735692]  [<ffffffff8106fa7a>] ? warn_slowpath_fmt+0x4a/0x50
  331. +-[  739.735715]  [<ffffffffa012448f>] ? batadv_iv_ogm_process_per_outif+0xe3f/0xe60 [batman_adv]
  332. +-[  739.735740]  [<ffffffffa0124813>] ? batadv_iv_ogm_receive+0x363/0x380 [batman_adv]
  333. +-[  739.735762]  [<ffffffffa0124813>] ? batadv_iv_ogm_receive+0x363/0x380 [batman_adv]
  334. +-[  739.735783]  [<ffffffff810b0841>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
  335. +-[  739.735804]  [<ffffffffa012cb39>] ? batadv_batman_skb_recv+0xc9/0x110 [batman_adv]
  336. +-[  739.735825]  [<ffffffff81464891>] ? __netif_receive_skb_core+0x841/0x9a0
  337. +-[  739.735838]  [<ffffffff810b0841>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
  338. +-[  739.735853]  [<ffffffff81465681>] ? process_backlog+0xa1/0x140
  339. +-[  739.735864]  [<ffffffff81464f1a>] ? net_rx_action+0x20a/0x320
  340. +-[  739.735878]  [<ffffffff81073aa7>] ? __do_softirq+0x107/0x270
  341. +-[  739.735891]  [<ffffffff81073d82>] ? irq_exit+0x92/0xa0
  342. +-[  739.735905]  [<ffffffff8137e0d1>] ? xen_evtchn_do_upcall+0x31/0x40
  343. +-[  739.735924]  [<ffffffff8155b8fe>] ? xen_do_hypervisor_callback+0x1e/0x40
  344. +-[  739.735939]  <EOI>  [<ffffffff810013aa>] ? xen_hypercall_sched_op+0xa/0x20
  345. +-[  739.735965]  [<ffffffff810013aa>] ? xen_hypercall_sched_op+0xa/0x20
  346. +-[  739.735979]  [<ffffffff8100a39c>] ? xen_safe_halt+0xc/0x20
  347. +-[  739.735991]  [<ffffffff8101da6c>] ? default_idle+0x1c/0xa0
  348. +-[  739.736004]  [<ffffffff810abf6b>] ? cpu_startup_entry+0x2eb/0x350
  349. +-[  739.736019]  [<ffffffff81b2af5e>] ? start_kernel+0x480/0x48b
  350. +-[  739.736032]  [<ffffffff81b2d116>] ? xen_start_kernel+0x507/0x511
  351. +-[  739.736048] ---[ end trace c106bb901244bc8c ]---
  352. +-
  353. +-Reported-by: Martin Weinelt <martin@darmstadt.freifunk.net>
  354. +-Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  355. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  356. +----
  357. +- net/batman-adv/originator.c | 6 ++++--
  358. +- 1 file changed, 4 insertions(+), 2 deletions(-)
  359. +-
  360. +-diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
  361. +-index c355a82..28241a4 100644
  362. +---- a/net/batman-adv/originator.c
  363. +-+++ b/net/batman-adv/originator.c
  364. +-@@ -630,6 +630,8 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
  365. +-  struct batadv_neigh_node *neigh_node;
  366. +-  struct batadv_hardif_neigh_node *hardif_neigh = NULL;
  367. +-
  368. +-+ spin_lock_bh(&orig_node->neigh_list_lock);
  369. +-+
  370. +-  neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
  371. +-  if (neigh_node)
  372. +-      goto out;
  373. +-@@ -666,15 +668,15 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
  374. +-  kref_init(&neigh_node->refcount);
  375. +-  kref_get(&neigh_node->refcount);
  376. +-
  377. +-- spin_lock_bh(&orig_node->neigh_list_lock);
  378. +-  hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
  379. +-- spin_unlock_bh(&orig_node->neigh_list_lock);
  380. +-
  381. +-  batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
  382. +-         "Creating new neighbor %pM for orig_node %pM on interface %s\n",
  383. +-         neigh_addr, orig_node->orig, hard_iface->net_dev->name);
  384. +-
  385. +- out:
  386. +-+ spin_unlock_bh(&orig_node->neigh_list_lock);
  387. +-+
  388. +-  if (hardif_neigh)
  389. +-      batadv_hardif_neigh_put(hardif_neigh);
  390. +-  return neigh_node;
  391. +---
  392. +-2.8.0.rc3
  393. +-
  394. +diff --git a/batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch b/batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch
  395. +deleted file mode 100644
  396. +index aa07ad5..0000000
  397. +--- batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch
  398. ++++ /dev/null
  399. +@@ -1,38 +0,0 @@
  400. +-From 036aa7b7181ee96ae6971eb31dd97b6ace7c0a80 Mon Sep 17 00:00:00 2001
  401. +-From: Sven Eckelmann <sven@narfation.org>
  402. +-Date: Fri, 6 May 2016 11:43:38 +0200
  403. +-Subject: [PATCH 3/6] batman-adv: Avoid nullptr derefence in
  404. +- batadv_v_neigh_is_sob
  405. +-
  406. +-batadv_neigh_ifinfo_get can return NULL when it cannot find (even when only
  407. +-temporarily) anymore the neigh_ifinfo in the list neigh->ifinfo_list. This
  408. +-has to be checked to avoid kernel Oopses when the ifinfo is dereferenced.
  409. +-
  410. +-This a situation which isn't expected but is already handled by functions
  411. +-like batadv_v_neigh_cmp. The same kind of warning is therefore used before
  412. +-the function returns without dereferencing the pointers.
  413. +-
  414. +-Fixes: b05bbab5e1fc ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
  415. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  416. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  417. +----
  418. +- net/batman-adv/bat_v.c | 3 +++
  419. +- 1 file changed, 3 insertions(+)
  420. +-
  421. +-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
  422. +-index 4547fce..7e1467a 100644
  423. +---- a/net/batman-adv/bat_v.c
  424. +-+++ b/net/batman-adv/bat_v.c
  425. +-@@ -295,6 +295,9 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
  426. +-  ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
  427. +-  ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
  428. +-
  429. +-+ if (WARN_ON(!ifinfo1 || !ifinfo2))
  430. +-+     return false;
  431. +-+
  432. +-  threshold = ifinfo1->bat_v.throughput / 4;
  433. +-  threshold = ifinfo1->bat_v.throughput - threshold;
  434. +-
  435. +---
  436. +-2.8.0.rc3
  437. +-
  438. +diff --git a/batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch b/batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch
  439. +deleted file mode 100644
  440. +index 15ef21c..0000000
  441. +--- batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch
  442. ++++ /dev/null
  443. +@@ -1,81 +0,0 @@
  444. +-From 650d41de4be2fe9e9d1842c1abdd357dedbaa7ba Mon Sep 17 00:00:00 2001
  445. +-From: Sven Eckelmann <sven@narfation.org>
  446. +-Date: Fri, 6 May 2016 11:43:39 +0200
  447. +-Subject: [PATCH 4/6] batman-adv: Fix refcnt leak in batadv_v_neigh_*
  448. +-
  449. +-The functions batadv_neigh_ifinfo_get increase the reference counter of the
  450. +-batadv_neigh_ifinfo. These have to be reduced again when the reference is
  451. +-not used anymore to correctly free the objects.
  452. +-
  453. +-Fixes: b05bbab5e1fc ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
  454. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  455. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  456. +----
  457. +- net/batman-adv/bat_v.c | 32 +++++++++++++++++++++++++-------
  458. +- 1 file changed, 25 insertions(+), 7 deletions(-)
  459. +-
  460. +-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
  461. +-index 7e1467a..2bcb29b 100644
  462. +---- a/net/batman-adv/bat_v.c
  463. +-+++ b/net/batman-adv/bat_v.c
  464. +-@@ -274,14 +274,23 @@ static int batadv_v_neigh_cmp(struct batadv_neigh_node *neigh1,
  465. +-                struct batadv_hard_iface *if_outgoing2)
  466. +- {
  467. +-  struct batadv_neigh_ifinfo *ifinfo1, *ifinfo2;
  468. +-+ int ret = 0;
  469. +-
  470. +-  ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
  471. +-+ if (WARN_ON(!ifinfo1))
  472. +-+     goto err_ifinfo1;
  473. +-+
  474. +-  ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
  475. +-+ if (WARN_ON(!ifinfo2))
  476. +-+     goto err_ifinfo2;
  477. +-
  478. +-- if (WARN_ON(!ifinfo1 || !ifinfo2))
  479. +--     return 0;
  480. +-+ ret = ifinfo1->bat_v.throughput - ifinfo2->bat_v.throughput;
  481. +-
  482. +-- return ifinfo1->bat_v.throughput - ifinfo2->bat_v.throughput;
  483. +-+ batadv_neigh_ifinfo_put(ifinfo2);
  484. +-+err_ifinfo2:
  485. +-+ batadv_neigh_ifinfo_put(ifinfo1);
  486. +-+err_ifinfo1:
  487. +-+ return ret;
  488. +- }
  489. +-
  490. +- static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
  491. +-@@ -291,17 +300,26 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
  492. +- {
  493. +-  struct batadv_neigh_ifinfo *ifinfo1, *ifinfo2;
  494. +-  u32 threshold;
  495. +-+ bool ret = false;
  496. +-
  497. +-  ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
  498. +-- ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
  499. +-+ if (WARN_ON(!ifinfo1))
  500. +-+     goto err_ifinfo1;
  501. +-
  502. +-- if (WARN_ON(!ifinfo1 || !ifinfo2))
  503. +--     return false;
  504. +-+ ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
  505. +-+ if (WARN_ON(!ifinfo2))
  506. +-+     goto err_ifinfo2;
  507. +-
  508. +-  threshold = ifinfo1->bat_v.throughput / 4;
  509. +-  threshold = ifinfo1->bat_v.throughput - threshold;
  510. +-
  511. +-- return ifinfo2->bat_v.throughput > threshold;
  512. +-+ ret = ifinfo2->bat_v.throughput > threshold;
  513. +-+
  514. +-+ batadv_neigh_ifinfo_put(ifinfo2);
  515. +-+err_ifinfo2:
  516. +-+ batadv_neigh_ifinfo_put(ifinfo1);
  517. +-+err_ifinfo1:
  518. +-+ return ret;
  519. +- }
  520. +-
  521. +- static struct batadv_algo_ops batadv_batman_v __read_mostly = {
  522. +---
  523. +-2.8.0.rc3
  524. +-
  525. +diff --git a/batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch b/batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch
  526. +deleted file mode 100644
  527. +index 8ea3788..0000000
  528. +--- batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch
  529. ++++ /dev/null
  530. +@@ -1,40 +0,0 @@
  531. +-From fc3e79d9ef2a1006f94e441d9613749cbbe7176a Mon Sep 17 00:00:00 2001
  532. +-From: Sven Eckelmann <sven@narfation.org>
  533. +-Date: Fri, 6 May 2016 22:27:09 +0200
  534. +-Subject: [PATCH 5/6] batman-adv: Fix double neigh_node_put in
  535. +- batadv_v_ogm_route_update
  536. +-
  537. +-The router is put down twice when it was non-NULL and either orig_ifinfo is
  538. +-NULL afterwards or batman-adv receives a packet with the same sequence
  539. +-number. This will end up in a use-after-free when the batadv_neigh_node is
  540. +-removed because the reference counter ended up too early at 0.
  541. +-
  542. +-Fixes: 667996ebeab4 ("batman-adv: OGMv2 - implement originators logic")
  543. +-Reported-by: Gui Iribarren <gui@altermundi.net>
  544. +-Tested-by: Antonio Quartulli <a@unstable.cc>
  545. +-Tested-by: Marek Lindner <mareklindner@neomailbox.ch>
  546. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  547. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  548. +----
  549. +- net/batman-adv/bat_v_ogm.c | 4 +++-
  550. +- 1 file changed, 3 insertions(+), 1 deletion(-)
  551. +-
  552. +-diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
  553. +-index d9bcbe6..91df28a 100644
  554. +---- a/net/batman-adv/bat_v_ogm.c
  555. +-+++ b/net/batman-adv/bat_v_ogm.c
  556. +-@@ -529,8 +529,10 @@ static void batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
  557. +-      goto out;
  558. +-  }
  559. +-
  560. +-- if (router)
  561. +-+ if (router) {
  562. +-      batadv_neigh_node_put(router);
  563. +-+     router = NULL;
  564. +-+ }
  565. +-
  566. +-  /* Update routes, and check if the OGM is from the best next hop */
  567. +-  batadv_v_ogm_orig_update(bat_priv, orig_node, neigh_node, ogm2,
  568. +---
  569. +-2.8.0.rc3
  570. +-
  571. +diff --git a/batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch b/batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch
  572. +deleted file mode 100644
  573. +index f87ddf0..0000000
  574. +--- batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch
  575. ++++ /dev/null
  576. +@@ -1,110 +0,0 @@
  577. +-From f58a0b03873fd3aa9568c11af198f997ed2208cc Mon Sep 17 00:00:00 2001
  578. +-From: Marek Lindner <mareklindner@neomailbox.ch>
  579. +-Date: Sat, 7 May 2016 19:54:17 +0800
  580. +-Subject: [PATCH 6/6] batman-adv: initialize ELP orig address on secondary
  581. +- interfaces
  582. +-
  583. +-This fix prevents nodes to wrongly create a 00:00:00:00:00:00 originator
  584. +-which can potentially interfere with the rest of the neighbor statistics.
  585. +-
  586. +-Fixes: a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")
  587. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  588. +----
  589. +- net/batman-adv/bat_v.c     | 10 ++++++++++
  590. +- net/batman-adv/bat_v_elp.c | 31 ++++++++++++++++++++++---------
  591. +- net/batman-adv/bat_v_elp.h |  2 ++
  592. +- 3 files changed, 34 insertions(+), 9 deletions(-)
  593. +-
  594. +-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
  595. +-index 2bcb29b..0caca2f 100644
  596. +---- a/net/batman-adv/bat_v.c
  597. +-+++ b/net/batman-adv/bat_v.c
  598. +-@@ -39,6 +39,16 @@
  599. +-
  600. +- static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
  601. +- {
  602. +-+ struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
  603. +-+ struct batadv_hard_iface *primary_if;
  604. +-+
  605. +-+ primary_if = batadv_primary_if_get_selected(bat_priv);
  606. +-+
  607. +-+ if (primary_if) {
  608. +-+     batadv_v_elp_iface_activate(primary_if, hard_iface);
  609. +-+     batadv_hardif_put(primary_if);
  610. +-+ }
  611. +-+
  612. +-  /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
  613. +-   * set the interface as ACTIVE right away, without any risk of race
  614. +-   * condition
  615. +-diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
  616. +-index 3844e7e..df42eb1 100644
  617. +---- a/net/batman-adv/bat_v_elp.c
  618. +-+++ b/net/batman-adv/bat_v_elp.c
  619. +-@@ -377,6 +377,27 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
  620. +- }
  621. +-
  622. +- /**
  623. +-+ * batadv_v_elp_iface_activate - update the ELP buffer belonging to the given
  624. +-+ *  hard-interface
  625. +-+ * @primary_iface: the new primary interface
  626. +-+ * @hard_iface: interface holding the to-be-updated buffer
  627. +-+ */
  628. +-+void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
  629. +-+              struct batadv_hard_iface *hard_iface)
  630. +-+{
  631. +-+ struct batadv_elp_packet *elp_packet;
  632. +-+ struct sk_buff *skb;
  633. +-+
  634. +-+ if (!hard_iface->bat_v.elp_skb)
  635. +-+     return;
  636. +-+
  637. +-+ skb = hard_iface->bat_v.elp_skb;
  638. +-+ elp_packet = (struct batadv_elp_packet *)skb->data;
  639. +-+ ether_addr_copy(elp_packet->orig,
  640. +-+         primary_iface->net_dev->dev_addr);
  641. +-+}
  642. +-+
  643. +-+/**
  644. +-  * batadv_v_elp_primary_iface_set - change internal data to reflect the new
  645. +-  *  primary interface
  646. +-  * @primary_iface: the new primary interface
  647. +-@@ -384,8 +405,6 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
  648. +- void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
  649. +- {
  650. +-  struct batadv_hard_iface *hard_iface;
  651. +-- struct batadv_elp_packet *elp_packet;
  652. +-- struct sk_buff *skb;
  653. +-
  654. +-  /* update orig field of every elp iface belonging to this mesh */
  655. +-  rcu_read_lock();
  656. +-@@ -393,13 +412,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
  657. +-      if (primary_iface->soft_iface != hard_iface->soft_iface)
  658. +-          continue;
  659. +-
  660. +--     if (!hard_iface->bat_v.elp_skb)
  661. +--         continue;
  662. +--
  663. +--     skb = hard_iface->bat_v.elp_skb;
  664. +--     elp_packet = (struct batadv_elp_packet *)skb->data;
  665. +--     ether_addr_copy(elp_packet->orig,
  666. +--             primary_iface->net_dev->dev_addr);
  667. +-+     batadv_v_elp_iface_activate(primary_iface, hard_iface);
  668. +-  }
  669. +-  rcu_read_unlock();
  670. +- }
  671. +-diff --git a/net/batman-adv/bat_v_elp.h b/net/batman-adv/bat_v_elp.h
  672. +-index e95f1bc..cc130b2 100644
  673. +---- a/net/batman-adv/bat_v_elp.h
  674. +-+++ b/net/batman-adv/bat_v_elp.h
  675. +-@@ -25,6 +25,8 @@ struct work_struct;
  676. +-
  677. +- int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
  678. +- void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
  679. +-+void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
  680. +-+              struct batadv_hard_iface *hard_iface);
  681. +- void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface);
  682. +- int batadv_v_elp_packet_recv(struct sk_buff *skb,
  683. +-               struct batadv_hard_iface *if_incoming);
  684. +---
  685. +-2.8.0.rc3
  686. +-
  687. +diff --git a/batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch b/batman-adv/patches/0007-batman-adv-Add-missing-inclu
  688. +de-for-batadv_v_neigh_is.patch
  689. +deleted file mode 100644
  690. +index 82ffd07..0000000
  691. +--- batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch
  692. ++++ /dev/null
  693. +@@ -1,28 +0,0 @@
  694. +-From: Sven Eckelmann <sven@narfation.org>
  695. +-Date: Sat, 7 May 2016 09:50:44 +0200
  696. +-Subject: [PATCH] batman-adv: Add missing include for batadv_v_neigh_is_sob
  697. +-
  698. +-batadv_v_neigh_is_sob started to use false which is defined in
  699. +-linux/stddef.h.
  700. +-
  701. +-Fixes: 036aa7b7181e ("batman-adv: Avoid nullptr derefence in batadv_v_neigh_is_sob")
  702. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  703. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  704. +-
  705. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/9685688ae7dd85804aec2f6ce760611551fe9635
  706. +----
  707. +- net/batman-adv/bat_v.c | 1 +
  708. +- 1 file changed, 1 insertion(+)
  709. +-
  710. +-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
  711. +-index 0caca2f..1f960c9 100644
  712. +---- a/net/batman-adv/bat_v.c
  713. +-+++ b/net/batman-adv/bat_v.c
  714. +-@@ -27,6 +27,7 @@
  715. +- #include <linux/rculist.h>
  716. +- #include <linux/rcupdate.h>
  717. +- #include <linux/seq_file.h>
  718. +-+#include <linux/stddef.h>
  719. +- #include <linux/types.h>
  720. +- #include <linux/workqueue.h>
  721. +-
  722. +diff --git a/batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch b/batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch
  723. +deleted file mode 100644
  724. +index 5c8bfd8..0000000
  725. +--- batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch
  726. ++++ /dev/null
  727. +@@ -1,46 +0,0 @@
  728. +-From: Florian Westphal <fw@strlen.de>
  729. +-Date: Tue, 10 May 2016 23:17:59 +0200
  730. +-Subject: [PATCH] batman-adv: fix skb deref after free
  731. +-
  732. +-batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len.
  733. +-
  734. +-Fixes: d28785996ad8 ("batman-adv: network coding - buffer unicast packets before forward")
  735. +-
  736. +-Signed-off-by: Florian Westphal <fw@strlen.de>
  737. +-Reviewed-by: Sven Eckelmann <sven@narfation.org>
  738. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  739. +-
  740. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6863d3b59fd1f1bef3c4b86707a0b1c5d21e0a07
  741. +----
  742. +- net/batman-adv/routing.c | 4 +++-
  743. +- 1 file changed, 3 insertions(+), 1 deletion(-)
  744. +-
  745. +-diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
  746. +-index b781bf7..0c0c30e 100644
  747. +---- a/net/batman-adv/routing.c
  748. +-+++ b/net/batman-adv/routing.c
  749. +-@@ -601,6 +601,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
  750. +-       struct batadv_unicast_packet *unicast_packet;
  751. +-       struct ethhdr *ethhdr = eth_hdr(skb);
  752. +-       int res, hdr_len, ret = NET_RX_DROP;
  753. +-+      unsigned int len;
  754. +-
  755. +-       unicast_packet = (struct batadv_unicast_packet *)skb->data;
  756. +-
  757. +-@@ -641,6 +642,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
  758. +-       if (hdr_len > 0)
  759. +-               batadv_skb_set_priority(skb, hdr_len);
  760. +-
  761. +-+      len = skb->len;
  762. +-       res = batadv_send_skb_to_orig(skb, orig_node, recv_if);
  763. +-
  764. +-       /* translate transmit result into receive result */
  765. +-@@ -648,7 +650,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
  766. +-               /* skb was transmitted and consumed */
  767. +-               batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
  768. +-               batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
  769. +--                                 skb->len + ETH_HLEN);
  770. +-+                                 len + ETH_HLEN);
  771. +-
  772. +-               ret = NET_RX_SUCCESS;
  773. +-       } else if (res == NET_XMIT_POLICED) {
  774. +
  775. +diff --git a/batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch b/batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch
  776. +deleted file mode 100644
  777. +index 07274b6..0000000
  778. +--- batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch
  779. ++++ /dev/null
  780. +@@ -1,40 +0,0 @@
  781. +-From: Simon Wunderlich <sw@simonwunderlich.de>
  782. +-Date: Thu, 12 May 2016 18:52:03 +0200
  783. +-Subject: [PATCH] batman-adv: replace WARN with rate limited output on non-existing VLAN
  784. +-
  785. +-If a VLAN tagged frame is received and the corresponding VLAN is not
  786. +-configured on the soft interface, it will splat a WARN on every packet
  787. +-received. This is a quite annoying behaviour for some scenarios, e.g. if
  788. +-bat0 is bridged with eth0, and there are arbitrary VLAN tagged frames
  789. +-from Ethernet coming in without having any VLAN configuration on bat0.
  790. +-
  791. +-The code should probably create vlan objects on the fly and
  792. +-transparently transport these VLAN-tagged Ethernet frames, but until
  793. +-this is done, at least the WARN splat should be replaced by a rate
  794. +-limited output.
  795. +-
  796. +-Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  797. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  798. +-
  799. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/04792115d24408a72bf8fccd5c4059478fc15eae
  800. +----
  801. +- net/batman-adv/translation-table.c | 6 ++++--
  802. +- 1 file changed, 4 insertions(+), 2 deletions(-)
  803. +-
  804. +-diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
  805. +-index 9b4551a..48adb91 100644
  806. +---- a/net/batman-adv/translation-table.c
  807. +-+++ b/net/batman-adv/translation-table.c
  808. +-@@ -650,8 +650,10 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
  809. +-
  810. +-       /* increase the refcounter of the related vlan */
  811. +-       vlan = batadv_softif_vlan_get(bat_priv, vid);
  812. +--      if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",
  813. +--               addr, BATADV_PRINT_VID(vid))) {
  814. +-+      if (!vlan) {
  815. +-+              net_ratelimited_function(batadv_info, soft_iface,
  816. +-+                                       "adding TT local entry %pM to non-existent VLAN %d\n",
  817. +-+                                       addr, BATADV_PRINT_VID(vid));
  818. +-               kfree(tt_local);
  819. +-               tt_local = NULL;
  820. +-               goto out;
  821. +
  822. +diff --git a/batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch b/batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch
  823. +deleted file mode 100644
  824. +index 127cac8..0000000
  825. +--- batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch
  826. ++++ /dev/null
  827. +@@ -1,58 +0,0 @@
  828. +-From: Sven Eckelmann <sven@narfation.org>
  829. +-Date: Sat, 28 May 2016 10:32:48 +0200
  830. +-Subject: [PATCH] batman-adv: Fix build against recent Debian Stretch kernels
  831. +-
  832. +-The kernels for Debian stretch require some special CFLAGS settings which
  833. +-are only correctly defined when NOSTDINC_FLAGS is defined inside the
  834. +-execution of the Makefile via kbuild. But batman-adv sets it currently
  835. +-outside to insert compatibility include headers and compat-sources.
  836. +-
  837. +-This can be avoided by making the top Makefile kbuild compatible and
  838. +-redefining the NOSTDINC_FLAGS when kbuild include this Makefile. The actual
  839. +-build of the batman-adv module is then done by adding the subdirectory to
  840. +-obj-y.
  841. +-
  842. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  843. +-Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
  844. +-
  845. +-Origin: https://git.open-mesh.org/batman-adv.git/commit/f8fd441e1e30f3a274c9bf44cc33372d4065cbb6
  846. +----
  847. +- Makefile | 10 +++++++---
  848. +- 1 file changed, 7 insertions(+), 3 deletions(-)
  849. +-
  850. +-diff --git a/Makefile b/Makefile
  851. +-index 5d2c058..2568fb2 100644
  852. +---- a/Makefile
  853. +-+++ b/Makefile
  854. +-@@ -43,7 +43,7 @@ RM ?= rm -f
  855. +- REVISION= $(shell     if [ -d "$(PWD)/.git" ]; then \
  856. +-                               echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
  857. +-                       fi)
  858. +--export NOSTDINC_FLAGS := \
  859. +-+NOSTDINC_FLAGS += \
  860. +-       -I$(PWD)/compat-include/ \
  861. +-       -include $(PWD)/compat.h \
  862. +-       $(CFLAGS)
  863. +-@@ -52,8 +52,12 @@ ifneq ($(REVISION),)
  864. +- NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
  865. +- endif
  866. +-
  867. +-+obj-y += net/batman-adv/
  868. +-+
  869. +- BUILD_FLAGS := \
  870. +--      M=$(PWD)/net/batman-adv \
  871. +-+      M=$(PWD) \
  872. +-+      PWD=$(PWD) \
  873. +-+      REVISION=$(REVISION) \
  874. +-       CONFIG_BATMAN_ADV=m \
  875. +-       CONFIG_BATMAN_ADV_DEBUG=$(CONFIG_BATMAN_ADV_DEBUG) \
  876. +-       CONFIG_BATMAN_ADV_BLA=$(CONFIG_BATMAN_ADV_BLA) \
  877. +-@@ -61,7 +65,7 @@ BUILD_FLAGS := \
  878. +-       CONFIG_BATMAN_ADV_NC=$(CONFIG_BATMAN_ADV_NC) \
  879. +-       CONFIG_BATMAN_ADV_MCAST=$(CONFIG_BATMAN_ADV_MCAST) \
  880. +-       CONFIG_BATMAN_ADV_BATMAN_V=$(CONFIG_BATMAN_ADV_BATMAN_V) \
  881. +--      INSTALL_MOD_DIR=updates/net/batman-adv/
  882. +-+      INSTALL_MOD_DIR=updates/
  883. +-
  884. +- all: config
  885. +-       $(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules
  886. +
  887. +diff --git a/batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch b/batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch
  888. +index b03d795..d2f2d24 100644
  889. +--- batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch
  890. ++++ batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch
  891. +@@ -19,17 +19,7 @@ diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
  892. + index 8a136b6..3710620 100644
  893. + --- a/net/batman-adv/soft-interface.c
  894. + +++ b/net/batman-adv/soft-interface.c
  895. +-@@ -1017,7 +1017,9 @@ void batadv_softif_destroy_sysfs(struct net_device *soft_iface)
  896. +- static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
  897. +-                                         struct list_head *head)
  898. +- {
  899. +-+      struct batadv_priv *bat_priv = netdev_priv(soft_iface);
  900. +-       struct batadv_hard_iface *hard_iface;
  901. +-+      struct batadv_softif_vlan *vlan;
  902. +-
  903. +-       list_for_each_entry(hard_iface, &batadv_hardif_list, list) {
  904. +-               if (hard_iface->soft_iface == soft_iface)
  905. +-@@ -1025,6 +1027,13 @@ static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
  906. ++@@ -1046,6 +1046,13 @@ static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
  907. +                                                        BATADV_IF_CLEANUP_KEEP);
  908. +        }
  909. +  
  910. +@@ -43,3 +33,4 @@ index 8a136b6..3710620 100644
  911. +        batadv_sysfs_del_meshif(soft_iface);
  912. +        unregister_netdevice_queue(soft_iface, head);
  913. +  }
  914. ++
  915. +diff --git a/batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch b/batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch
  916. +index 5204cdc..ca8fe64 100644
  917. +--- batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch
  918. ++++ batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch
  919. +@@ -21,7 +21,7 @@ diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
  920. + index 0c0c30e..27e07dd 100644
  921. + --- a/net/batman-adv/routing.c
  922. + +++ b/net/batman-adv/routing.c
  923. +-@@ -374,6 +374,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
  924. ++@@ -254,6 +254,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
  925. +                if (skb_cow(skb, ETH_HLEN) < 0)
  926. +                        goto out;
  927. +  
  928. +@@ -29,3 +29,4 @@ index 0c0c30e..27e07dd 100644
  929. +                icmph = (struct batadv_icmp_header *)skb->data;
  930. +                icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmph;
  931. +                if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN)
  932. ++
  933. +diff --git a/batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch b/batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch
  934. +deleted file mode 100644
  935. +index 6ea8311..0000000
  936. +--- batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch
  937. ++++ /dev/null
  938. +@@ -1,32 +0,0 @@
  939. +-From: Ben Hutchings <ben@decadent.org.uk>
  940. +-Date: Fri, 3 Jun 2016 00:00:44 +0100
  941. +-Subject: [PATCH] batman-adv: Fix double-put of vlan object
  942. +-
  943. +-Commit a33d970d0b54 "batman-adv: Fix reference counting of vlan object
  944. +-for tt_local_entry") makes each batadv_tt_local_entry hold a single
  945. +-reference to a batadv_softif_vlan.  In case a new entry cannot be
  946. +-added to the hash table, the error path puts the reference, but the
  947. +-reference will also now be dropped by batadv_tt_local_entry_release().
  948. +-
  949. +-Fixes: a33d970d0b54 ("batman-adv: Fix reference counting of vlan object ...")
  950. +-Cc: Sven Eckelmann <sven@narfation.org>
  951. +-Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  952. +-Acked-by: Sven Eckelmann <sven@narfation.org>
  953. +-
  954. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/22bb8b894900064d3fb09032a47577e89fc30d7c
  955. +----
  956. +- net/batman-adv/translation-table.c | 1 -
  957. +- 1 file changed, 1 deletion(-)
  958. +-
  959. +-diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
  960. +-index 48adb91..5ed782b 100644
  961. +---- a/net/batman-adv/translation-table.c
  962. +-+++ b/net/batman-adv/translation-table.c
  963. +-@@ -693,7 +693,6 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
  964. +-       if (unlikely(hash_added != 0)) {
  965. +-               /* remove the reference for the hash */
  966. +-               batadv_tt_local_entry_put(tt_local);
  967. +--              batadv_softif_vlan_put(vlan);
  968. +-               goto out;
  969. +-       }
  970. +-
  971. +diff --git a/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch b/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch
  972. +index 33c7f3b..e74becb 100644
  973. +--- a/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch
  974. ++++ b/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch
  975. +@@ -68,7 +68,7 @@ diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-tab
  976. + index 5ed782b..23fb7ea 100644
  977. + --- a/net/batman-adv/translation-table.c
  978. + +++ b/net/batman-adv/translation-table.c
  979. +-@@ -2271,6 +2271,29 @@ static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
  980. ++@@ -2726,6 +2726,29 @@ static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
  981. +        return crc;
  982. +  }
  983. +  
  984. +@@ -98,75 +98,4 @@ index 5ed782b..23fb7ea 100644
  985. +  static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
  986. +  {
  987. +        struct batadv_tt_req_node *node;
  988. +-@@ -2280,7 +2303,7 @@ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
  989. +-
  990. +-       hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
  991. +-               hlist_del_init(&node->list);
  992. +--              kfree(node);
  993. +-+              batadv_tt_req_node_put(node);
  994. +-       }
  995. +-
  996. +-       spin_unlock_bh(&bat_priv->tt.req_list_lock);
  997. +-@@ -2317,7 +2340,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
  998. +-               if (batadv_has_timed_out(node->issued_at,
  999. +-                                        BATADV_TT_REQUEST_TIMEOUT)) {
  1000. +-                       hlist_del_init(&node->list);
  1001. +--                      kfree(node);
  1002. +-+                      batadv_tt_req_node_put(node);
  1003. +-               }
  1004. +-       }
  1005. +-       spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1006. +-@@ -2349,9 +2372,11 @@ batadv_tt_req_node_new(struct batadv_priv *bat_priv,
  1007. +-       if (!tt_req_node)
  1008. +-               goto unlock;
  1009. +-
  1010. +-+      kref_init(&tt_req_node->refcount);
  1011. +-       ether_addr_copy(tt_req_node->addr, orig_node->orig);
  1012. +-       tt_req_node->issued_at = jiffies;
  1013. +-
  1014. +-+      kref_get(&tt_req_node->refcount);
  1015. +-       hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);
  1016. +- unlock:
  1017. +-       spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1018. +-@@ -2618,9 +2643,13 @@ out:
  1019. +-               spin_lock_bh(&bat_priv->tt.req_list_lock);
  1020. +-               /* hlist_del_init() verifies tt_req_node still is in the list */
  1021. +-               hlist_del_init(&tt_req_node->list);
  1022. +-+              batadv_tt_req_node_put(tt_req_node);
  1023. +-               spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1024. +--              kfree(tt_req_node);
  1025. +-       }
  1026. +-+
  1027. +-+      if (tt_req_node)
  1028. +-+              batadv_tt_req_node_put(tt_req_node);
  1029. +-+
  1030. +-       kfree(tvlv_tt_data);
  1031. +-       return ret;
  1032. +- }
  1033. +-@@ -3056,7 +3085,7 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
  1034. +-               if (!batadv_compare_eth(node->addr, resp_src))
  1035. +-                       continue;
  1036. +-               hlist_del_init(&node->list);
  1037. +--              kfree(node);
  1038. +-+              batadv_tt_req_node_put(node);
  1039. +-       }
  1040. +-
  1041. +-       spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1042. +-diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
  1043. +-index 1e47fbe..d75beef 100644
  1044. +---- a/net/batman-adv/types.h
  1045. +-+++ b/net/batman-adv/types.h
  1046. +-@@ -1129,11 +1129,13 @@ struct batadv_tt_change_node {
  1047. +-  * struct batadv_tt_req_node - data to keep track of the tt requests in flight
  1048. +-  * @addr: mac address address of the originator this request was sent to
  1049. +-  * @issued_at: timestamp used for purging stale tt requests
  1050. +-+ * @refcount: number of contexts the object is used by
  1051. +-  * @list: list node for batadv_priv_tt::req_list
  1052. +-  */
  1053. +- struct batadv_tt_req_node {
  1054. +-       u8 addr[ETH_ALEN];
  1055. +-       unsigned long issued_at;
  1056. +-+      struct kref refcount;
  1057. +-       struct hlist_node list;
  1058. +- };
  1059. +-
  1060. ++
  1061. +diff --git a/batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch b/batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch
  1062. +deleted file mode 100644
  1063. +index 907c1a1..0000000
  1064. +--- batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch
  1065. ++++ /dev/null
  1066. +@@ -1,35 +0,0 @@
  1067. +-From: Sven Eckelmann <sven@narfation.org>
  1068. +-Date: Sat, 2 Jul 2016 09:52:13 +0200
  1069. +-Subject: [PATCH] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
  1070. +-
  1071. +-vlan_insert_tag can return NULL on errors. The bridge loop avoidance code
  1072. +-therefore has to check the return value of vlan_insert_tag for NULL before
  1073. +-it can safely operate on this pointer.
  1074. +-
  1075. +-Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
  1076. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  1077. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1078. +-
  1079. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/e4cffba4d3353ea15287abbfbdd65208aa62c156
  1080. +----
  1081. +- net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
  1082. +- 1 file changed, 4 insertions(+), 1 deletion(-)
  1083. +-
  1084. +-diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
  1085. +-index 0a6c8b8..fe8b62f 100644
  1086. +---- a/net/batman-adv/bridge_loop_avoidance.c
  1087. +-+++ b/net/batman-adv/bridge_loop_avoidance.c
  1088. +-@@ -409,9 +409,12 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
  1089. +-               break;
  1090. +-       }
  1091. +-
  1092. +--      if (vid & BATADV_VLAN_HAS_TAG)
  1093. +-+      if (vid & BATADV_VLAN_HAS_TAG) {
  1094. +-               skb = vlan_insert_tag(skb, htons(ETH_P_8021Q),
  1095. +-                                     vid & VLAN_VID_MASK);
  1096. +-+              if (!skb)
  1097. +-+                      goto out;
  1098. +-+      }
  1099. +-
  1100. +-       skb_reset_mac_header(skb);
  1101. +-       skb->protocol = eth_type_trans(skb, soft_iface);
  1102. +diff --git a/batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch b/batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch
  1103. +deleted file mode 100644
  1104. +index d896811..0000000
  1105. +--- batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch
  1106. ++++ /dev/null
  1107. +@@ -1,49 +0,0 @@
  1108. +-From: Sven Eckelmann <sven@narfation.org>
  1109. +-Date: Sat, 2 Jul 2016 09:52:14 +0200
  1110. +-Subject: [PATCH] batman-adv: Avoid nullptr dereference in dat after vlan_insert_tag
  1111. +-
  1112. +-vlan_insert_tag can return NULL on errors. The distributed arp table code
  1113. +-therefore has to check the return value of vlan_insert_tag for NULL before
  1114. +-it can safely operate on this pointer.
  1115. +-
  1116. +-Fixes: 53c6c262a581 ("batman-adv: tag locally generated ARP reply if needed")
  1117. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  1118. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1119. +-
  1120. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/898382d11fa1f737cd4f7033db1088c601fd11ed
  1121. +----
  1122. +- net/batman-adv/distributed-arp-table.c | 10 ++++++++--
  1123. +- 1 file changed, 8 insertions(+), 2 deletions(-)
  1124. +-
  1125. +-diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
  1126. +-index 3e6b262..5a89be0 100644
  1127. +---- a/net/batman-adv/distributed-arp-table.c
  1128. +-+++ b/net/batman-adv/distributed-arp-table.c
  1129. +-@@ -1009,9 +1009,12 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
  1130. +-               if (!skb_new)
  1131. +-                       goto out;
  1132. +-
  1133. +--              if (vid & BATADV_VLAN_HAS_TAG)
  1134. +-+              if (vid & BATADV_VLAN_HAS_TAG) {
  1135. +-                       skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
  1136. +-                                                 vid & VLAN_VID_MASK);
  1137. +-+                      if (!skb_new)
  1138. +-+                              goto out;
  1139. +-+              }
  1140. +-
  1141. +-               skb_reset_mac_header(skb_new);
  1142. +-               skb_new->protocol = eth_type_trans(skb_new,
  1143. +-@@ -1089,9 +1092,12 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
  1144. +-        */
  1145. +-       skb_reset_mac_header(skb_new);
  1146. +-
  1147. +--      if (vid & BATADV_VLAN_HAS_TAG)
  1148. +-+      if (vid & BATADV_VLAN_HAS_TAG) {
  1149. +-               skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
  1150. +-                                         vid & VLAN_VID_MASK);
  1151. +-+              if (!skb_new)
  1152. +-+                      goto out;
  1153. +-+      }
  1154. +-
  1155. +-       /* To preserve backwards compatibility, the node has choose the outgoing
  1156. +-        * format based on the incoming request packet type. The assumption is
  1157. +diff --git a/batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch b/batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch
  1158. +deleted file mode 100644
  1159. +index 09f90d3..0000000
  1160. +--- batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch
  1161. ++++ /dev/null
  1162. +@@ -1,41 +0,0 @@
  1163. +-From: Sven Eckelmann <sven@narfation.org>
  1164. +-Date: Fri, 24 Jun 2016 21:43:32 +0200
  1165. +-Subject: [PATCH] batman-adv: Avoid tt_req_node list put for unhashed entry
  1166. +-
  1167. +-It can happen that a tt_req_node list entry was already removed from
  1168. +-tt.req_list when batadv_send_tt_request reaches the end of the function.
  1169. +-The reference counter was already reduced by 1 for the list entry and thus
  1170. +-the reference counter is not allowed to be reduced again. Otherwise, the
  1171. +-entry is freed too early and the next batadv_tt_req_node_put in this
  1172. +-function will operate on freed memory.
  1173. +-
  1174. +-Fixes: cea194d90b11 ("batman-adv: improved client announcement mechanism")
  1175. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  1176. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1177. +-
  1178. +-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/03ecc9f957b837c755f09251c5f684996521e487
  1179. +----
  1180. +- net/batman-adv/translation-table.c | 8 +++++---
  1181. +- 1 file changed, 5 insertions(+), 3 deletions(-)
  1182. +-
  1183. +-diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
  1184. +-index 23fb7ea..f7d44c6 100644
  1185. +---- a/net/batman-adv/translation-table.c
  1186. +-+++ b/net/batman-adv/translation-table.c
  1187. +-@@ -2639,11 +2639,13 @@ static int batadv_send_tt_request(struct batadv_priv *bat_priv,
  1188. +- out:
  1189. +-       if (primary_if)
  1190. +-               batadv_hardif_put(primary_if);
  1191. +-+
  1192. +-       if (ret && tt_req_node) {
  1193. +-               spin_lock_bh(&bat_priv->tt.req_list_lock);
  1194. +--              /* hlist_del_init() verifies tt_req_node still is in the list */
  1195. +--              hlist_del_init(&tt_req_node->list);
  1196. +--              batadv_tt_req_node_put(tt_req_node);
  1197. +-+              if (!hlist_unhashed(&tt_req_node->list)) {
  1198. +-+                      hlist_del_init(&tt_req_node->list);
  1199. +-+                      batadv_tt_req_node_put(tt_req_node);
  1200. +-+              }
  1201. +-               spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1202. +-       }
  1203. +-
  1204. +diff --git a/batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch b/batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch
  1205. +index 13c74e4..a5fbba4 100644
  1206. +--- batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch
  1207. ++++ batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch
  1208. +@@ -19,14 +19,6 @@ diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
  1209. + index 28241a4..3a3948a 100644
  1210. + --- a/net/batman-adv/originator.c
  1211. + +++ b/net/batman-adv/originator.c
  1212. +-@@ -781,6 +781,7 @@ static void batadv_orig_node_release(struct kref *ref)
  1213. +-       struct batadv_neigh_node *neigh_node;
  1214. +-       struct batadv_orig_node *orig_node;
  1215. +-       struct batadv_orig_ifinfo *orig_ifinfo;
  1216. +-+      struct batadv_orig_node_vlan *vlan;
  1217. +-
  1218. +-       orig_node = container_of(ref, struct batadv_orig_node, refcount);
  1219. +-
  1220. + @@ -800,6 +801,13 @@ static void batadv_orig_node_release(struct kref *ref)
  1221. +        }
  1222. +        spin_unlock_bh(&orig_node->neigh_list_lock);
  1223. +diff --git a/batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch b/batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch
  1224. +deleted file mode 100644
  1225. +index 9631ebe..0000000
  1226. +--- batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch
  1227. ++++ /dev/null
  1228. +@@ -1,291 +0,0 @@
  1229. +-From: Sven Eckelmann <sven@narfation.org>
  1230. +-Date: Fri, 1 Jul 2016 15:49:43 +0200
  1231. +-Subject: [PATCH] batman-adv: Fix non-atomic bla_claim::backbone_gw access
  1232. +-
  1233. +-The pointer batadv_bla_claim::backbone_gw can be changed at any time.
  1234. +-Therefore, access to it must be protected to ensure that two function
  1235. +-accessing the same backbone_gw are actually accessing the same. This is
  1236. +-especially important when the crc_lock is used or when the backbone_gw of a
  1237. +-claim is exchanged.
  1238. +-
  1239. +-Not doing so leads to invalid memory access and/or reference leaks.
  1240. +-
  1241. +-Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
  1242. +-Fixes: b307e72d119f ("batman-adv: lock crc access in bridge loop avoidance")
  1243. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  1244. +-Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
  1245. +-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1246. +-
  1247. +-Origin: backport, https://git.open-mesh.org/batman-adv.git/commit/e401297e3a393896e9b07bef8d6e2df203b60d43
  1248. +----
  1249. +- net/batman-adv/bridge_loop_avoidance.c | 111 ++++++++++++++++++++++++++-------
  1250. +- net/batman-adv/types.h                 |   2 +
  1251. +- 2 files changed, 90 insertions(+), 23 deletions(-)
  1252. +-
  1253. +-diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
  1254. +-index fe8b62f..30fd72e 100644
  1255. +---- a/net/batman-adv/bridge_loop_avoidance.c
  1256. +-+++ b/net/batman-adv/bridge_loop_avoidance.c
  1257. +-@@ -176,10 +176,21 @@ static void batadv_backbone_gw_put(struct batadv_bla_backbone_gw *backbone_gw)
  1258. +- static void batadv_claim_release(struct kref *ref)
  1259. +- {
  1260. +-       struct batadv_bla_claim *claim;
  1261. +-+      struct batadv_bla_backbone_gw *old_backbone_gw;
  1262. +-
  1263. +-       claim = container_of(ref, struct batadv_bla_claim, refcount);
  1264. +-
  1265. +--      batadv_backbone_gw_put(claim->backbone_gw);
  1266. +-+      spin_lock_bh(&claim->backbone_lock);
  1267. +-+      old_backbone_gw = claim->backbone_gw;
  1268. +-+      claim->backbone_gw = NULL;
  1269. +-+      spin_unlock_bh(&claim->backbone_lock);
  1270. +-+
  1271. +-+      spin_lock_bh(&old_backbone_gw->crc_lock);
  1272. +-+      old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
  1273. +-+      spin_unlock_bh(&old_backbone_gw->crc_lock);
  1274. +-+
  1275. +-+      batadv_backbone_gw_put(old_backbone_gw);
  1276. +-+
  1277. +-       kfree_rcu(claim, rcu);
  1278. +- }
  1279. +-
  1280. +-@@ -637,8 +648,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
  1281. +-                                const u8 *mac, const unsigned short vid,
  1282. +-                                struct batadv_bla_backbone_gw *backbone_gw)
  1283. +- {
  1284. +-+      struct batadv_bla_backbone_gw *old_backbone_gw;
  1285. +-       struct batadv_bla_claim *claim;
  1286. +-       struct batadv_bla_claim search_claim;
  1287. +-+      bool remove_crc = false;
  1288. +-       int hash_added;
  1289. +-
  1290. +-       ether_addr_copy(search_claim.addr, mac);
  1291. +-@@ -652,8 +665,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
  1292. +-                       return;
  1293. +-
  1294. +-               ether_addr_copy(claim->addr, mac);
  1295. +-+              spin_lock_init(&claim->backbone_lock);
  1296. +-               claim->vid = vid;
  1297. +-               claim->lasttime = jiffies;
  1298. +-+              kref_get(&backbone_gw->refcount);
  1299. +-               claim->backbone_gw = backbone_gw;
  1300. +-
  1301. +-               kref_init(&claim->refcount);
  1302. +-@@ -681,15 +696,26 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
  1303. +-                          "bla_add_claim(): changing ownership for %pM, vid %d\n",
  1304. +-                          mac, BATADV_PRINT_VID(vid));
  1305. +-
  1306. +--              spin_lock_bh(&claim->backbone_gw->crc_lock);
  1307. +--              claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
  1308. +--              spin_unlock_bh(&claim->backbone_gw->crc_lock);
  1309. +--              batadv_backbone_gw_put(claim->backbone_gw);
  1310. +-+              remove_crc = true;
  1311. +-       }
  1312. +--      /* set (new) backbone gw */
  1313. +-+
  1314. +-+      /* replace backbone_gw atomically and adjust reference counters */
  1315. +-+      spin_lock_bh(&claim->backbone_lock);
  1316. +-+      old_backbone_gw = claim->backbone_gw;
  1317. +-       kref_get(&backbone_gw->refcount);
  1318. +-       claim->backbone_gw = backbone_gw;
  1319. +-+      spin_unlock_bh(&claim->backbone_lock);
  1320. +-
  1321. +-+      if (remove_crc) {
  1322. +-+              /* remove claim address from old backbone_gw */
  1323. +-+              spin_lock_bh(&old_backbone_gw->crc_lock);
  1324. +-+              old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
  1325. +-+              spin_unlock_bh(&old_backbone_gw->crc_lock);
  1326. +-+      }
  1327. +-+
  1328. +-+      batadv_backbone_gw_put(old_backbone_gw);
  1329. +-+
  1330. +-+      /* add claim address to new backbone_gw */
  1331. +-       spin_lock_bh(&backbone_gw->crc_lock);
  1332. +-       backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
  1333. +-       spin_unlock_bh(&backbone_gw->crc_lock);
  1334. +-@@ -700,6 +726,26 @@ claim_free_ref:
  1335. +- }
  1336. +-
  1337. +- /**
  1338. +-+ * batadv_bla_claim_get_backbone_gw - Get valid reference for backbone_gw of
  1339. +-+ *  claim
  1340. +-+ * @claim: claim whose backbone_gw should be returned
  1341. +-+ *
  1342. +-+ * Return: valid reference to claim::backbone_gw
  1343. +-+ */
  1344. +-+static struct batadv_bla_backbone_gw *
  1345. +-+batadv_bla_claim_get_backbone_gw(struct batadv_bla_claim *claim)
  1346. +-+{
  1347. +-+      struct batadv_bla_backbone_gw *backbone_gw;
  1348. +-+
  1349. +-+      spin_lock_bh(&claim->backbone_lock);
  1350. +-+      backbone_gw = claim->backbone_gw;
  1351. +-+      kref_get(&backbone_gw->refcount);
  1352. +-+      spin_unlock_bh(&claim->backbone_lock);
  1353. +-+
  1354. +-+      return backbone_gw;
  1355. +-+}
  1356. +-+
  1357. +-+/**
  1358. +-  * batadv_bla_del_claim - delete a claim from the claim hash
  1359. +-  * @bat_priv: the bat priv with all the soft interface information
  1360. +-  * @mac: mac address of the claim to be removed
  1361. +-@@ -723,10 +769,6 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
  1362. +-                          batadv_choose_claim, claim);
  1363. +-       batadv_claim_put(claim); /* reference from the hash is gone */
  1364. +-
  1365. +--      spin_lock_bh(&claim->backbone_gw->crc_lock);
  1366. +--      claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
  1367. +--      spin_unlock_bh(&claim->backbone_gw->crc_lock);
  1368. +--
  1369. +-       /* don't need the reference from hash_find() anymore */
  1370. +-       batadv_claim_put(claim);
  1371. +- }
  1372. +-@@ -1175,6 +1217,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
  1373. +-                                   struct batadv_hard_iface *primary_if,
  1374. +-                                   int now)
  1375. +- {
  1376. +-+      struct batadv_bla_backbone_gw *backbone_gw;
  1377. +-       struct batadv_bla_claim *claim;
  1378. +-       struct hlist_head *head;
  1379. +-       struct batadv_hashtable *hash;
  1380. +-@@ -1189,14 +1232,17 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
  1381. +-
  1382. +-               rcu_read_lock();
  1383. +-               hlist_for_each_entry_rcu(claim, head, hash_entry) {
  1384. +-+                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
  1385. +-                       if (now)
  1386. +-                               goto purge_now;
  1387. +--                      if (!batadv_compare_eth(claim->backbone_gw->orig,
  1388. +-+
  1389. +-+                      if (!batadv_compare_eth(backbone_gw->orig,
  1390. +-                                               primary_if->net_dev->dev_addr))
  1391. +--                              continue;
  1392. +-+                              goto skip;
  1393. +-+
  1394. +-                       if (!batadv_has_timed_out(claim->lasttime,
  1395. +-                                                 BATADV_BLA_CLAIM_TIMEOUT))
  1396. +--                              continue;
  1397. +-+                              goto skip;
  1398. +-
  1399. +-                       batadv_dbg(BATADV_DBG_BLA, bat_priv,
  1400. +-                                  "bla_purge_claims(): %pM, vid %d, time out\n",
  1401. +-@@ -1204,8 +1250,10 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
  1402. +-
  1403. +- purge_now:
  1404. +-                       batadv_handle_unclaim(bat_priv, primary_if,
  1405. +--                                            claim->backbone_gw->orig,
  1406. +-+                                            backbone_gw->orig,
  1407. +-                                             claim->addr, claim->vid);
  1408. +-+skip:
  1409. +-+                      batadv_backbone_gw_put(backbone_gw);
  1410. +-               }
  1411. +-               rcu_read_unlock();
  1412. +-       }
  1413. +-@@ -1623,9 +1671,11 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
  1414. +- int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
  1415. +-                 unsigned short vid, bool is_bcast)
  1416. +- {
  1417. +-+      struct batadv_bla_backbone_gw *backbone_gw;
  1418. +-       struct ethhdr *ethhdr;
  1419. +-       struct batadv_bla_claim search_claim, *claim = NULL;
  1420. +-       struct batadv_hard_iface *primary_if;
  1421. +-+      bool own_claim;
  1422. +-       int ret;
  1423. +-
  1424. +-       ethhdr = eth_hdr(skb);
  1425. +-@@ -1657,8 +1707,12 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
  1426. +-       }
  1427. +-
  1428. +-       /* if it is our own claim ... */
  1429. +--      if (batadv_compare_eth(claim->backbone_gw->orig,
  1430. +--                             primary_if->net_dev->dev_addr)) {
  1431. +-+      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
  1432. +-+      own_claim = batadv_compare_eth(backbone_gw->orig,
  1433. +-+                                     primary_if->net_dev->dev_addr);
  1434. +-+      batadv_backbone_gw_put(backbone_gw);
  1435. +-+
  1436. +-+      if (own_claim) {
  1437. +-               /* ... allow it in any case */
  1438. +-               claim->lasttime = jiffies;
  1439. +-               goto allow;
  1440. +-@@ -1722,7 +1776,9 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
  1441. +- {
  1442. +-       struct ethhdr *ethhdr;
  1443. +-       struct batadv_bla_claim search_claim, *claim = NULL;
  1444. +-+      struct batadv_bla_backbone_gw *backbone_gw;
  1445. +-       struct batadv_hard_iface *primary_if;
  1446. +-+      bool client_roamed;
  1447. +-       int ret = 0;
  1448. +-
  1449. +-       primary_if = batadv_primary_if_get_selected(bat_priv);
  1450. +-@@ -1752,8 +1808,12 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
  1451. +-               goto allow;
  1452. +-
  1453. +-       /* check if we are responsible. */
  1454. +--      if (batadv_compare_eth(claim->backbone_gw->orig,
  1455. +--                             primary_if->net_dev->dev_addr)) {
  1456. +-+      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
  1457. +-+      client_roamed = batadv_compare_eth(backbone_gw->orig,
  1458. +-+                                         primary_if->net_dev->dev_addr);
  1459. +-+      batadv_backbone_gw_put(backbone_gw);
  1460. +-+
  1461. +-+      if (client_roamed) {
  1462. +-               /* if yes, the client has roamed and we have
  1463. +-                * to unclaim it.
  1464. +-                */
  1465. +-@@ -1801,6 +1861,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
  1466. +-       struct net_device *net_dev = (struct net_device *)seq->private;
  1467. +-       struct batadv_priv *bat_priv = netdev_priv(net_dev);
  1468. +-       struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
  1469. +-+      struct batadv_bla_backbone_gw *backbone_gw;
  1470. +-       struct batadv_bla_claim *claim;
  1471. +-       struct batadv_hard_iface *primary_if;
  1472. +-       struct hlist_head *head;
  1473. +-@@ -1825,17 +1886,21 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
  1474. +-
  1475. +-               rcu_read_lock();
  1476. +-               hlist_for_each_entry_rcu(claim, head, hash_entry) {
  1477. +--                      is_own = batadv_compare_eth(claim->backbone_gw->orig,
  1478. +-+                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
  1479. +-+
  1480. +-+                      is_own = batadv_compare_eth(backbone_gw->orig,
  1481. +-                                                   primary_addr);
  1482. +-
  1483. +--                      spin_lock_bh(&claim->backbone_gw->crc_lock);
  1484. +--                      backbone_crc = claim->backbone_gw->crc;
  1485. +--                      spin_unlock_bh(&claim->backbone_gw->crc_lock);
  1486. +-+                      spin_lock_bh(&backbone_gw->crc_lock);
  1487. +-+                      backbone_crc = backbone_gw->crc;
  1488. +-+                      spin_unlock_bh(&backbone_gw->crc_lock);
  1489. +-                       seq_printf(seq, " * %pM on %5d by %pM [%c] (%#.4x)\n",
  1490. +-                                  claim->addr, BATADV_PRINT_VID(claim->vid),
  1491. +--                                 claim->backbone_gw->orig,
  1492. +-+                                 backbone_gw->orig,
  1493. +-                                  (is_own ? 'x' : ' '),
  1494. +-                                  backbone_crc);
  1495. +-+
  1496. +-+                      batadv_backbone_gw_put(backbone_gw);
  1497. +-               }
  1498. +-               rcu_read_unlock();
  1499. +-       }
  1500. +-diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
  1501. +-index d75beef..41a85b5 100644
  1502. +---- a/net/batman-adv/types.h
  1503. +-+++ b/net/batman-adv/types.h
  1504. +-@@ -1034,6 +1034,7 @@ struct batadv_bla_backbone_gw {
  1505. +-  * @addr: mac address of claimed non-mesh client
  1506. +-  * @vid: vlan id this client was detected on
  1507. +-  * @backbone_gw: pointer to backbone gw claiming this client
  1508. +-+ * @backbone_lock: lock protecting backbone_gw pointer
  1509. +-  * @lasttime: last time we heard of claim (locals only)
  1510. +-  * @hash_entry: hlist node for batadv_priv_bla::claim_hash
  1511. +-  * @refcount: number of contexts the object is used
  1512. +-@@ -1043,6 +1044,7 @@ struct batadv_bla_claim {
  1513. +-       u8 addr[ETH_ALEN];
  1514. +-       unsigned short vid;
  1515. +-       struct batadv_bla_backbone_gw *backbone_gw;
  1516. +-+      spinlock_t backbone_lock; /* protects backbone_gw */
  1517. +-       unsigned long lasttime;
  1518. +-       struct hlist_node hash_entry;
  1519. +-       struct rcu_head rcu;
  1520. +diff --git a/batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch b/batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch
  1521. +index 38956cf..febb3fd 100644
  1522. +--- batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch
  1523. ++++ batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch
  1524. +@@ -54,67 +54,3 @@ index 27e07dd..694dc74 100644
  1525. +   * batadv_find_router - find a suitable router for this originator
  1526. +   * @bat_priv: the bat priv with all the soft interface information
  1527. +   * @orig_node: the destination node
  1528. +-@@ -562,10 +585,6 @@ next:
  1529. +-       }
  1530. +-       rcu_read_unlock();
  1531. +-
  1532. +--      /* last_bonding_candidate is reset below, remove the old reference. */
  1533. +--      if (orig_node->last_bonding_candidate)
  1534. +--              batadv_orig_ifinfo_put(orig_node->last_bonding_candidate);
  1535. +--
  1536. +-       /* After finding candidates, handle the three cases:
  1537. +-        * 1) there is a next candidate, use that
  1538. +-        * 2) there is no next candidate, use the first of the list
  1539. +-@@ -574,21 +593,28 @@ next:
  1540. +-       if (next_candidate) {
  1541. +-               batadv_neigh_node_put(router);
  1542. +-
  1543. +--              /* remove references to first candidate, we don't need it. */
  1544. +--              if (first_candidate) {
  1545. +--                      batadv_neigh_node_put(first_candidate_router);
  1546. +--                      batadv_orig_ifinfo_put(first_candidate);
  1547. +--              }
  1548. +-+              kref_get(&next_candidate_router->refcount);
  1549. +-               router = next_candidate_router;
  1550. +--              orig_node->last_bonding_candidate = next_candidate;
  1551. +-+              batadv_last_bonding_replace(orig_node, next_candidate);
  1552. +-       } else if (first_candidate) {
  1553. +-               batadv_neigh_node_put(router);
  1554. +-
  1555. +--              /* refcounting has already been done in the loop above. */
  1556. +-+              kref_get(&first_candidate_router->refcount);
  1557. +-               router = first_candidate_router;
  1558. +--              orig_node->last_bonding_candidate = first_candidate;
  1559. +-+              batadv_last_bonding_replace(orig_node, first_candidate);
  1560. +-       } else {
  1561. +--              orig_node->last_bonding_candidate = NULL;
  1562. +-+              batadv_last_bonding_replace(orig_node, NULL);
  1563. +-+      }
  1564. +-+
  1565. +-+      /* cleanup of candidates */
  1566. +-+      if (first_candidate) {
  1567. +-+              batadv_neigh_node_put(first_candidate_router);
  1568. +-+              batadv_orig_ifinfo_put(first_candidate);
  1569. +-+      }
  1570. +-+
  1571. +-+      if (next_candidate) {
  1572. +-+              batadv_neigh_node_put(next_candidate_router);
  1573. +-+              batadv_orig_ifinfo_put(next_candidate);
  1574. +-       }
  1575. +-
  1576. +-       return router;
  1577. +-diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
  1578. +-index 41a85b5..c143649 100644
  1579. +---- a/net/batman-adv/types.h
  1580. +-+++ b/net/batman-adv/types.h
  1581. +-@@ -330,7 +330,9 @@ struct batadv_orig_node {
  1582. +-       DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
  1583. +-       u32 last_bcast_seqno;
  1584. +-       struct hlist_head neigh_list;
  1585. +--      /* neigh_list_lock protects: neigh_list and router */
  1586. +-+      /* neigh_list_lock protects: neigh_list, ifinfo_list,
  1587. +-+       * last_bonding_candidate and router
  1588. +-+       */
  1589. +-       spinlock_t neigh_list_lock;
  1590. +-       struct hlist_node hash_entry;
  1591. +-       struct batadv_priv *bat_priv;
  1592. +diff --git a/batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch b/batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch
  1593. +index b35a801..5a730f0 100644
  1594. +--- batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch
  1595. ++++ batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch
  1596. +@@ -28,18 +28,3 @@ index 3a3948a..7594afd 100644
  1597. +  
  1598. +        orig_node = container_of(ref, struct batadv_orig_node, refcount);
  1599. +  
  1600. +-@@ -799,8 +800,14 @@ static void batadv_orig_node_release(struct kref *ref)
  1601. +-               hlist_del_rcu(&orig_ifinfo->list);
  1602. +-               batadv_orig_ifinfo_put(orig_ifinfo);
  1603. +-       }
  1604. +-+
  1605. +-+      last_candidate = orig_node->last_bonding_candidate;
  1606. +-+      orig_node->last_bonding_candidate = NULL;
  1607. +-       spin_unlock_bh(&orig_node->neigh_list_lock);
  1608. +-
  1609. +-+      if (last_candidate)
  1610. +-+              batadv_orig_ifinfo_put(last_candidate);
  1611. +-+
  1612. +-       spin_lock_bh(&orig_node->vlan_list_lock);
  1613. +-       hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) {
  1614. +-               hlist_del_rcu(&vlan->list);
  1615. +diff --git a/batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch b/batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch
  1616. +deleted file mode 100644
  1617. +index fa61a1b..0000000
  1618. +--- batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch
  1619. ++++ /dev/null
  1620. +@@ -1,35 +0,0 @@
  1621. +-From: Sven Eckelmann <sven@narfation.org>
  1622. +-Date: Sun, 12 Jun 2016 10:43:19 +0200
  1623. +-Subject: [PATCH] batman-adv: Fix speedy join in gateway client mode
  1624. +-
  1625. +-Speedy join only works when the received packet is either broadcast or an
  1626. +-4addr unicast packet. Thus packets converted from broadcast to unicast via
  1627. +-the gateway handling code have to be converted to 4addr packets to allow
  1628. +-the receiving gateway server to add the sender address as temporary entry
  1629. +-to the translation table.
  1630. +-
  1631. +-Not doing it will make the batman-adv gateway server drop the DHCP response
  1632. +-in many situations because it doesn't yet have the TT entry for the
  1633. +-destination of the DHCP response.
  1634. +-
  1635. +-Fixes: 9cbc67d9da47 ("batman-adv: change interface_rx to get orig node")
  1636. +-Signed-off-by: Sven Eckelmann <sven@narfation.org>
  1637. +----
  1638. +- net/batman-adv/send.c | 4 ++--
  1639. +- 1 file changed, 2 insertions(+), 2 deletions(-)
  1640. +-
  1641. +-diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
  1642. +-index 7641785..e5be212 100644
  1643. +---- a/net/batman-adv/send.c
  1644. +-+++ b/net/batman-adv/send.c
  1645. +-@@ -423,8 +423,8 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
  1646. +-       struct batadv_orig_node *orig_node;
  1647. +-
  1648. +-       orig_node = batadv_gw_get_selected_orig(bat_priv);
  1649. +--      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
  1650. +--                                     orig_node, vid);
  1651. +-+      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR,
  1652. +-+                                     BATADV_P_DATA, orig_node, vid);
  1653. +- }
  1654. +-
  1655. +- void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface)
  1656. +
  1657. +
  1658. +
  1659. +
  1660. diff --git a/buildscript b/buildscript
  1661. index d9a3951..ef0afc8 100755
  1662. --- a/buildscript
  1663. +++ b/buildscript
  1664. @@ -127,6 +127,11 @@ patch_target() {
  1665.              patch -N -r - --no-backup-if-mismatch -p0 -d "$PWD/src/packages/openwrt" -i "$patch"
  1666.          done
  1667.      fi
  1668. +        if [ "$(find "$PWD"/build_patches/openwrt-routing/*.patch 2> /dev/null | wc -l)" -ge 1 ]; then
  1669. +        for patch in "$PWD"/build_patches/openwrt-routing/*.patch; do
  1670. +            patch -N -r - --no-backup-if-mismatch -p0 -d "$PWD/src/packages/routing" -i "$patch"
  1671. +        done
  1672. +    fi
  1673.  }
  1674.  
  1675.  prepare() {
  1676. --
  1677. 2.1.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement