0001-Update-batman-adv-and-alfred-to-v2015.0-patches-from-the-Gluon-master.patch 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 6 Aug 2015 21:46:47 +0200
  3. Subject: Update batman-adv and alfred to v2015.0 + patches from the Gluon master
  4. diff --git a/alfred/Makefile b/alfred/Makefile
  5. index 648a5ef..3fccbb9 100644
  6. --- a/alfred/Makefile
  7. +++ b/alfred/Makefile
  8. @@ -11,12 +11,13 @@ include $(TOPDIR)/rules.mk
  9. # The latest alfred git hash in PKG_REV can be obtained from http://git.open-mesh.org/alfred.git
  10. #
  11. PKG_NAME:=alfred
  12. -PKG_VERSION:=2014.3.0
  13. +PKG_VERSION:=2015.0
  14. PKG_RELEASE:=0
  15. -PKG_MD5SUM:=b8ab5677ed73d817b02b0e4fae10357a
  16. +PKG_MD5SUM:=53e2436dbc506e69f9675b69385ae131
  17. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  18. PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
  19. +PKG_LICENSE:=GPL-2.0
  20. include $(INCLUDE_DIR)/package.mk
  21. @@ -27,7 +28,7 @@ define Package/alfred
  22. SECTION:=net
  23. CATEGORY:=Network
  24. TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon
  25. - DEPENDS:= +libc +IPV6:kmod-ipv6 +librt \
  26. + DEPENDS:= +libc +kmod-ipv6 +librt \
  27. +ALFRED_NEEDS_lua:lua \
  28. +ALFRED_NEEDS_libgps:libgps
  29. endef
  30. @@ -58,7 +59,8 @@ endef
  31. MAKE_ALFRED_FLAGS=\
  32. CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \
  33. - CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n)
  34. + CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n) \
  35. + CONFIG_ALFRED_CAPABILITIES=n
  36. TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
  37. TARGET_LDFLAGS += -Wl,--gc-sections -fuse-linker-plugin
  38. @@ -73,7 +75,7 @@ define Package/alfred/install
  39. $(INSTALL_DIR) $(1)/usr/sbin
  40. cp -fpR $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/
  41. [ "x$(CONFIG_PACKAGE_ALFRED_VIS)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/batadv-vis $(1)/usr/sbin/ ; true
  42. - [ "x$(CONFIG_PACKAGE_ALFRED_GPSD)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/alfred-gpsd $(1)/usr/sbin/ ; true
  43. + [ "x$(CONFIG_PACKAGE_ALFRED_GPSD)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/gpsd/alfred-gpsd $(1)/usr/sbin/ ; true
  44. $(INSTALL_DIR) $(1)/etc/init.d
  45. $(INSTALL_BIN) ./files/alfred.init $(1)/etc/init.d/alfred
  46. $(INSTALL_DIR) $(1)/etc/config
  47. diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init
  48. index b777b53..5ce06c0 100755
  49. --- a/alfred/files/alfred.init
  50. +++ b/alfred/files/alfred.init
  51. @@ -16,10 +16,27 @@ pid_file_alfred="/var/run/alfred.pid"
  52. pid_file_vis="/var/run/batadv-vis.pid"
  53. enable=0
  54. vis_enable=0
  55. -batmanif=""
  56. SERVICE_DAEMONIZE=1
  57. SERVICE_WRITE_PID=1
  58. +wait_for_dir()
  59. +{
  60. + local ifce="$1" dir="$2"
  61. +
  62. + if ! [ -d "$dir" ] ; then
  63. + timeout=30
  64. + echo "${initscript}: waiting $timeout secs for $ifce interface..."
  65. + for i in $(seq $timeout); do
  66. + sleep 1
  67. + [ -d "$dir" ] && break
  68. + if [ $i == $timeout ] ; then
  69. + echo "${initscript}: $ifce not detected, alfred not starting."
  70. + exit 1
  71. + fi
  72. + done
  73. + fi
  74. +}
  75. +
  76. alfred_start()
  77. {
  78. local args=""
  79. @@ -41,14 +58,20 @@ alfred_start()
  80. config_get batmanif "$section" batmanif
  81. append args "-b $batmanif"
  82. + if [ "$batmanif" != "none" ]; then
  83. + wait_for_dir "$batmanif" "/sys/class/net/$batmanif/mesh"
  84. + fi
  85. +
  86. + wait_for_dir "$interface" "/sys/class/net/$interface/"
  87. +
  88. append alfred_args "$args"
  89. enable=1
  90. - config_get_bool start_vis "$section" start_vis 0
  91. - if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then
  92. - vis_enable=1
  93. - append vis_args "-i $batmanif -s"
  94. - fi
  95. + config_get_bool start_vis "$section" start_vis 0
  96. + if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then
  97. + vis_enable=1
  98. + append vis_args "-i $batmanif -s"
  99. + fi
  100. config_get_bool run_facters "$section" run_facters 0
  101. @@ -64,20 +87,6 @@ start()
  102. exit 0
  103. fi
  104. - mesh_dir="/sys/class/net/$batmanif/mesh/"
  105. - if ! [ -d "$mesh_dir" ] ; then
  106. - timeout=30
  107. - echo "${initscript}: waiting $timeout secs for $batmanif interface..."
  108. - for i in $(seq $timeout); do
  109. - sleep 1
  110. - [ -d "$mesh_dir" ] && break
  111. - if [ $i == $timeout ] ; then
  112. - echo "${initscript}: $batmanif not detected, alfred not starting."
  113. - exit 1
  114. - fi
  115. - done
  116. - fi
  117. -
  118. echo "${initscript}: starting alfred"
  119. SERVICE_PID_FILE="$pid_file_alfred"
  120. service_start /usr/sbin/alfred ${alfred_args}
  121. diff --git a/alfred/patches/0001-alfred-adjust-intervals.patch b/alfred/patches/0001-alfred-adjust-intervals.patch
  122. new file mode 100644
  123. index 0000000..a8e0b4d
  124. --- /dev/null
  125. +++ b/alfred/patches/0001-alfred-adjust-intervals.patch
  126. @@ -0,0 +1,15 @@
  127. +--- a/alfred.h
  128. ++++ b/alfred.h
  129. +@@ -32,10 +32,10 @@
  130. + #include "list.h"
  131. + #include "packet.h"
  132. +
  133. +-#define ALFRED_INTERVAL 10
  134. ++#define ALFRED_INTERVAL 60
  135. + #define ALFRED_IF_CHECK_INTERVAL 60
  136. + #define ALFRED_REQUEST_TIMEOUT 10
  137. +-#define ALFRED_SERVER_TIMEOUT 60
  138. ++#define ALFRED_SERVER_TIMEOUT 180
  139. + #define ALFRED_DATA_TIMEOUT 600
  140. + #define ALFRED_SOCK_PATH_DEFAULT "/var/run/alfred.sock"
  141. + #define NO_FILTER -1
  142. diff --git a/batctl/Makefile b/batctl/Makefile
  143. index ae22286..1009b03 100644
  144. --- a/batctl/Makefile
  145. +++ b/batctl/Makefile
  146. @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk
  147. PKG_NAME:=batctl
  148. -PKG_VERSION:=2014.2.0
  149. +PKG_VERSION:=2014.4.0
  150. PKG_RELEASE:=1
  151. -PKG_MD5SUM:=c196cf95b7324d9123b701a56b06b31d
  152. +PKG_MD5SUM:=f3a14565699313258ee6ba3de783eb0a
  153. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  154. PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
  155. diff --git a/batman-adv/Makefile b/batman-adv/Makefile
  156. index 889dea7..8a932aa 100644
  157. --- a/batman-adv/Makefile
  158. +++ b/batman-adv/Makefile
  159. @@ -10,12 +10,13 @@ include $(TOPDIR)/rules.mk
  160. PKG_NAME:=batman-adv
  161. -PKG_VERSION:=2014.2.0
  162. +PKG_VERSION:=2015.0
  163. PKG_RELEASE:=1
  164. -PKG_MD5SUM:=1243029b3a3e2f4fa721d1a59c2faaf5
  165. +PKG_MD5SUM:=178b082266a8bfb3041178a0c821d843
  166. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  167. PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
  168. +PKG_LICENSE:=GPL-2.0
  169. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
  170. @@ -42,6 +43,10 @@ define KernelPackage/batman-adv/config
  171. source "$(SOURCE)/Config.in"
  172. endef
  173. +define Package/kmod-batman-adv/conffiles
  174. +/etc/config/batman-adv
  175. +endef
  176. +
  177. MAKE_BATMAN_ADV_ARGS += \
  178. CROSS_COMPILE="$(TARGET_CROSS)" \
  179. KERNELPATH="$(LINUX_DIR)" \
  180. diff --git a/batman-adv/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh
  181. index 632a209..01f567f 100644
  182. --- a/batman-adv/files/lib/netifd/proto/batadv.sh
  183. +++ b/batman-adv/files/lib/netifd/proto/batadv.sh
  184. @@ -6,16 +6,19 @@ init_proto "$@"
  185. proto_batadv_init_config() {
  186. proto_config_add_string "mesh"
  187. + proto_config_add_string "mesh_no_rebroadcast"
  188. }
  189. proto_batadv_setup() {
  190. local config="$1"
  191. local iface="$2"
  192. - local mesh
  193. - json_get_vars mesh
  194. + local mesh mesh_no_rebroadcast
  195. + json_get_vars mesh mesh_no_rebroadcast
  196. echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
  197. + [ -n "$mesh_no_rebroadcast" ] && echo "$mesh_no_rebroadcast" > "/sys/class/net/$iface/batman_adv/no_rebroadcast"
  198. +
  199. proto_init_update "$iface" 1
  200. proto_send_update "$config"
  201. }
  202. diff --git a/batman-adv/patches/0001-batman-adv-Avoid-u32-overflow-during-gateway-select.patch b/batman-adv/patches/0001-batman-adv-Avoid-u32-overflow-during-gateway-select.patch
  203. new file mode 100644
  204. index 0000000..b7232e7
  205. --- /dev/null
  206. +++ b/batman-adv/patches/0001-batman-adv-Avoid-u32-overflow-during-gateway-select.patch
  207. @@ -0,0 +1,42 @@
  208. +From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001
  209. +From: Ruben Wisniewski <ruben@freifunk-nrw.de>
  210. +Date: Tue, 26 May 2015 18:34:27 +0200
  211. +Subject: [PATCH 01/17] batman-adv: Avoid u32 overflow during gateway select
  212. +
  213. +The gateway selection based on fast connections is using a single value
  214. +calculated from the average tq (0-255) and the download bandwidth (in
  215. +100Kibit). The formula for the first step (tq ** 2 * 10000 * bandwidth)
  216. +tends to overflow a u32 with low bandwidth settings like 50 [100KiBit]
  217. +and a tq value of over 92.
  218. +
  219. +Changing this to a 64 bit unsigned integer allows to support a
  220. +bandwidth_down with up to ~2.8e10 [100KiBit] and a perfect tq of 255. This
  221. +is ~6.6 times higher than the maximum possible value of the gateway
  222. +announcement TVLV.
  223. +
  224. +This problem only affects the non-default gw_sel_class 1.
  225. +
  226. +Signed-off-by: Ruben Wisniewsi <ruben@vfn-nrw.de>
  227. +[sven@narfation.org: rewritten commit message, changed to kernel type]
  228. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  229. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  230. +---
  231. + gateway_client.c | 2 +-
  232. + 1 file changed, 1 insertion(+), 1 deletion(-)
  233. +
  234. +diff --git a/gateway_client.c b/gateway_client.c
  235. +index a85eaca..3f32357 100644
  236. +--- a/gateway_client.c
  237. ++++ b/gateway_client.c
  238. +@@ -133,7 +133,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
  239. + struct batadv_neigh_node *router;
  240. + struct batadv_neigh_ifinfo *router_ifinfo;
  241. + struct batadv_gw_node *gw_node, *curr_gw = NULL;
  242. +- uint32_t max_gw_factor = 0, tmp_gw_factor = 0;
  243. ++ uint64_t max_gw_factor = 0, tmp_gw_factor = 0;
  244. + uint32_t gw_divisor;
  245. + uint8_t max_tq = 0;
  246. + uint8_t tq_avg;
  247. +--
  248. +2.1.4
  249. +
  250. diff --git a/batman-adv/patches/0002-batman-adv-avoid-DAT-to-mess-up-LAN-state.patch b/batman-adv/patches/0002-batman-adv-avoid-DAT-to-mess-up-LAN-state.patch
  251. new file mode 100644
  252. index 0000000..b335f4f
  253. --- /dev/null
  254. +++ b/batman-adv/patches/0002-batman-adv-avoid-DAT-to-mess-up-LAN-state.patch
  255. @@ -0,0 +1,74 @@
  256. +From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001
  257. +From: Antonio Quartulli <antonio@meshcoding.com>
  258. +Date: Mon, 1 Jun 2015 17:29:57 +0200
  259. +Subject: [PATCH 02/17] batman-adv: avoid DAT to mess up LAN state
  260. +
  261. +When a node running DAT receives an ARP request from the LAN for the
  262. +first time, it is likely that this node will request the ARP entry
  263. +through the distributed ARP table (DAT) in the mesh.
  264. +
  265. +Once a DAT reply is received the asking node must check if the MAC
  266. +address for which the IP address has been asked is local. If it is, the
  267. +node must drop the ARP reply bceause the client should have replied on
  268. +its own locally.
  269. +
  270. +Forwarding this reply means fooling any L2 bridge (e.g. Ethernet
  271. +switches) lying between the batman-adv node and the LAN. This happens
  272. +because the L2 bridge will think that the client sending the ARP reply
  273. +lies somewhere in the mesh, while this node is sitting in the same LAN.
  274. +
  275. +Reported-by: Simon Wunderlich <sw@simonwunderlich.de>
  276. +Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
  277. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  278. +---
  279. + distributed-arp-table.c | 18 +++++++++++++-----
  280. + 1 file changed, 13 insertions(+), 5 deletions(-)
  281. +
  282. +diff --git a/distributed-arp-table.c b/distributed-arp-table.c
  283. +index da1742d..0d791dc 100644
  284. +--- a/distributed-arp-table.c
  285. ++++ b/distributed-arp-table.c
  286. +@@ -1107,6 +1107,9 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
  287. + * @bat_priv: the bat priv with all the soft interface information
  288. + * @skb: packet to check
  289. + * @hdr_size: size of the encapsulation header
  290. ++ *
  291. ++ * Returns true if the packet was snooped and consumed by DAT. False if the
  292. ++ * packet has to be delivered to the interface
  293. + */
  294. + bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
  295. + struct sk_buff *skb, int hdr_size)
  296. +@@ -1114,7 +1117,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
  297. + uint16_t type;
  298. + __be32 ip_src, ip_dst;
  299. + uint8_t *hw_src, *hw_dst;
  300. +- bool ret = false;
  301. ++ bool dropped = false;
  302. + unsigned short vid;
  303. +
  304. + if (!atomic_read(&bat_priv->distributed_arp_table))
  305. +@@ -1143,12 +1146,17 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
  306. + /* if this REPLY is directed to a client of mine, let's deliver the
  307. + * packet to the interface
  308. + */
  309. +- ret = !batadv_is_my_client(bat_priv, hw_dst, vid);
  310. ++ dropped = !batadv_is_my_client(bat_priv, hw_dst, vid);
  311. ++
  312. ++ /* if this REPLY is sent on behalf of a client of mine, let's drop the
  313. ++ * packet because the client will reply by itself
  314. ++ */
  315. ++ dropped |= batadv_is_my_client(bat_priv, hw_src, vid);
  316. + out:
  317. +- if (ret)
  318. ++ if (dropped)
  319. + kfree_skb(skb);
  320. +- /* if ret == false -> packet has to be delivered to the interface */
  321. +- return ret;
  322. ++ /* if dropped == false -> deliver to the interface */
  323. ++ return dropped;
  324. + }
  325. +
  326. + /**
  327. +--
  328. +2.1.4
  329. +
  330. diff --git a/batman-adv/patches/0003-batman-adv-Make-DAT-capability-changes-atomic.patch b/batman-adv/patches/0003-batman-adv-Make-DAT-capability-changes-atomic.patch
  331. new file mode 100644
  332. index 0000000..4152a52
  333. --- /dev/null
  334. +++ b/batman-adv/patches/0003-batman-adv-Make-DAT-capability-changes-atomic.patch
  335. @@ -0,0 +1,54 @@
  336. +From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001
  337. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  338. +Date: Tue, 16 Jun 2015 17:10:22 +0200
  339. +Subject: [PATCH 03/17] batman-adv: Make DAT capability changes atomic
  340. +MIME-Version: 1.0
  341. +Content-Type: text/plain; charset=UTF-8
  342. +Content-Transfer-Encoding: 8bit
  343. +
  344. +Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
  345. +OGM handler might undo the set/clear of a specific bit from another
  346. +handler run in between.
  347. +
  348. +Fix this by using the atomic set_bit()/clear_bit() functions.
  349. +
  350. +Fixes: 2b1c07b918d2 ("batman-adv: tvlv - add distributed arp table container")
  351. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  352. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  353. +---
  354. + distributed-arp-table.c | 4 ++--
  355. + types.h | 2 +-
  356. + 2 files changed, 3 insertions(+), 3 deletions(-)
  357. +
  358. +diff --git a/distributed-arp-table.c b/distributed-arp-table.c
  359. +index 0d791dc..b2cc19b 100644
  360. +--- a/distributed-arp-table.c
  361. ++++ b/distributed-arp-table.c
  362. +@@ -682,9 +682,9 @@ static void batadv_dat_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  363. + uint16_t tvlv_value_len)
  364. + {
  365. + if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND)
  366. +- orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_DAT;
  367. ++ clear_bit(BATADV_ORIG_CAPA_HAS_DAT, &orig->capabilities);
  368. + else
  369. +- orig->capabilities |= BATADV_ORIG_CAPA_HAS_DAT;
  370. ++ set_bit(BATADV_ORIG_CAPA_HAS_DAT, &orig->capabilities);
  371. + }
  372. +
  373. + /**
  374. +diff --git a/types.h b/types.h
  375. +index 28f2461..e33b5aa 100644
  376. +--- a/types.h
  377. ++++ b/types.h
  378. +@@ -256,7 +256,7 @@ struct batadv_orig_node {
  379. + struct hlist_node mcast_want_all_ipv4_node;
  380. + struct hlist_node mcast_want_all_ipv6_node;
  381. + #endif
  382. +- uint8_t capabilities;
  383. ++ unsigned long capabilities;
  384. + uint8_t capa_initialized;
  385. + atomic_t last_ttvn;
  386. + unsigned char *tt_buff;
  387. +--
  388. +2.1.4
  389. +
  390. diff --git a/batman-adv/patches/0004-batman-adv-Make-NC-capability-changes-atomic.patch b/batman-adv/patches/0004-batman-adv-Make-NC-capability-changes-atomic.patch
  391. new file mode 100644
  392. index 0000000..935a6cd
  393. --- /dev/null
  394. +++ b/batman-adv/patches/0004-batman-adv-Make-NC-capability-changes-atomic.patch
  395. @@ -0,0 +1,40 @@
  396. +From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
  397. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  398. +Date: Tue, 16 Jun 2015 17:10:23 +0200
  399. +Subject: [PATCH 04/17] batman-adv: Make NC capability changes atomic
  400. +MIME-Version: 1.0
  401. +Content-Type: text/plain; charset=UTF-8
  402. +Content-Transfer-Encoding: 8bit
  403. +
  404. +Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
  405. +OGM handler might undo the set/clear of a specific bit from another
  406. +handler run in between.
  407. +
  408. +Fix this by using the atomic set_bit()/clear_bit() functions.
  409. +
  410. +Fixes: 7dd9d8992b0c ("batman-adv: tvlv - add network coding container")
  411. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  412. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  413. +---
  414. + network-coding.c | 4 ++--
  415. + 1 file changed, 2 insertions(+), 2 deletions(-)
  416. +
  417. +diff --git a/network-coding.c b/network-coding.c
  418. +index 89e1d47..3ce493e 100644
  419. +--- a/network-coding.c
  420. ++++ b/network-coding.c
  421. +@@ -105,9 +105,9 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  422. + uint16_t tvlv_value_len)
  423. + {
  424. + if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND)
  425. +- orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_NC;
  426. ++ clear_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
  427. + else
  428. +- orig->capabilities |= BATADV_ORIG_CAPA_HAS_NC;
  429. ++ set_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
  430. + }
  431. +
  432. + /**
  433. +--
  434. +2.1.4
  435. +
  436. diff --git a/batman-adv/patches/0005-batman-adv-Make-TT-capability-changes-atomic.patch b/batman-adv/patches/0005-batman-adv-Make-TT-capability-changes-atomic.patch
  437. new file mode 100644
  438. index 0000000..c6e9078
  439. --- /dev/null
  440. +++ b/batman-adv/patches/0005-batman-adv-Make-TT-capability-changes-atomic.patch
  441. @@ -0,0 +1,60 @@
  442. +From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001
  443. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  444. +Date: Tue, 16 Jun 2015 17:10:24 +0200
  445. +Subject: [PATCH 05/17] batman-adv: Make TT capability changes atomic
  446. +MIME-Version: 1.0
  447. +Content-Type: text/plain; charset=UTF-8
  448. +Content-Transfer-Encoding: 8bit
  449. +
  450. +Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
  451. +OGM handler might undo the set/clear of a specific bit from another
  452. +handler run in between.
  453. +
  454. +Fix this by using the atomic set_bit()/clear_bit() functions.
  455. +
  456. +Fixes: 5d2121af6d31 ("batman-adv: introduce capability initialization bitfield")
  457. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  458. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  459. +---
  460. + translation-table.c | 4 ++--
  461. + types.h | 2 +-
  462. + 2 files changed, 3 insertions(+), 3 deletions(-)
  463. +
  464. +diff --git a/translation-table.c b/translation-table.c
  465. +index b098e53..e95a424 100644
  466. +--- a/translation-table.c
  467. ++++ b/translation-table.c
  468. +@@ -1843,7 +1843,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
  469. + }
  470. + spin_unlock_bh(list_lock);
  471. + }
  472. +- orig_node->capa_initialized &= ~BATADV_ORIG_CAPA_HAS_TT;
  473. ++ clear_bit(BATADV_ORIG_CAPA_HAS_TT, &orig_node->capa_initialized);
  474. + }
  475. +
  476. + static bool batadv_tt_global_to_purge(struct batadv_tt_global_entry *tt_global,
  477. +@@ -2802,7 +2802,7 @@ static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
  478. + return;
  479. + }
  480. + }
  481. +- orig_node->capa_initialized |= BATADV_ORIG_CAPA_HAS_TT;
  482. ++ set_bit(BATADV_ORIG_CAPA_HAS_TT, &orig_node->capa_initialized);
  483. + }
  484. +
  485. + static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
  486. +diff --git a/types.h b/types.h
  487. +index e33b5aa..c6ec558 100644
  488. +--- a/types.h
  489. ++++ b/types.h
  490. +@@ -257,7 +257,7 @@ struct batadv_orig_node {
  491. + struct hlist_node mcast_want_all_ipv6_node;
  492. + #endif
  493. + unsigned long capabilities;
  494. +- uint8_t capa_initialized;
  495. ++ unsigned long capa_initialized;
  496. + atomic_t last_ttvn;
  497. + unsigned char *tt_buff;
  498. + int16_t tt_buff_len;
  499. +--
  500. +2.1.4
  501. +
  502. diff --git a/batman-adv/patches/0006-batman-adv-Make-MCAST-capability-changes-atomic.patch b/batman-adv/patches/0006-batman-adv-Make-MCAST-capability-changes-atomic.patch
  503. new file mode 100644
  504. index 0000000..d1d7beb
  505. --- /dev/null
  506. +++ b/batman-adv/patches/0006-batman-adv-Make-MCAST-capability-changes-atomic.patch
  507. @@ -0,0 +1,50 @@
  508. +From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001
  509. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  510. +Date: Tue, 16 Jun 2015 17:10:25 +0200
  511. +Subject: [PATCH 06/17] batman-adv: Make MCAST capability changes atomic
  512. +MIME-Version: 1.0
  513. +Content-Type: text/plain; charset=UTF-8
  514. +Content-Transfer-Encoding: 8bit
  515. +
  516. +Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
  517. +OGM handler might undo the set/clear of a specific bit from another
  518. +handler run in between.
  519. +
  520. +Fix this by using the atomic set_bit()/clear_bit() functions.
  521. +
  522. +Fixes: 77ec494490d6 ("batman-adv: Announce new capability via multicast TVLV")
  523. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  524. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  525. +---
  526. + multicast.c | 6 +++---
  527. + 1 file changed, 3 insertions(+), 3 deletions(-)
  528. +
  529. +diff --git a/multicast.c b/multicast.c
  530. +index 09f2838..00612bf 100644
  531. +--- a/multicast.c
  532. ++++ b/multicast.c
  533. +@@ -684,7 +684,7 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  534. + !(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) {
  535. + if (orig_initialized)
  536. + atomic_dec(&bat_priv->mcast.num_disabled);
  537. +- orig->capabilities |= BATADV_ORIG_CAPA_HAS_MCAST;
  538. ++ set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
  539. + /* If mcast support is being switched off or if this is an initial
  540. + * OGM without mcast support then increase the disabled mcast
  541. + * node counter.
  542. +@@ -693,10 +693,10 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  543. + (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST ||
  544. + !orig_initialized)) {
  545. + atomic_inc(&bat_priv->mcast.num_disabled);
  546. +- orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_MCAST;
  547. ++ clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
  548. + }
  549. +
  550. +- orig->capa_initialized |= BATADV_ORIG_CAPA_HAS_MCAST;
  551. ++ set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized);
  552. +
  553. + if (orig_mcast_enabled && tvlv_value &&
  554. + (tvlv_value_len >= sizeof(mcast_flags)))
  555. +--
  556. +2.1.4
  557. +
  558. diff --git a/batman-adv/patches/0007-batman-adv-Fix-potential-synchronization-issues-in-m.patch b/batman-adv/patches/0007-batman-adv-Fix-potential-synchronization-issues-in-m.patch
  559. new file mode 100644
  560. index 0000000..66d61b3
  561. --- /dev/null
  562. +++ b/batman-adv/patches/0007-batman-adv-Fix-potential-synchronization-issues-in-m.patch
  563. @@ -0,0 +1,254 @@
  564. +From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001
  565. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  566. +Date: Tue, 16 Jun 2015 17:10:26 +0200
  567. +Subject: [PATCH 07/17] batman-adv: Fix potential synchronization issues in
  568. + mcast tvlv handler
  569. +MIME-Version: 1.0
  570. +Content-Type: text/plain; charset=UTF-8
  571. +Content-Transfer-Encoding: 8bit
  572. +
  573. +So far the mcast tvlv handler did not anticipate the processing of
  574. +multiple incoming OGMs from the same originator at the same time. This
  575. +can lead to various issues:
  576. +
  577. +* Broken refcounting: For instance two mcast handlers might both assume
  578. + that an originator just got multicast capabilities and will together
  579. + wrongly decrease mcast.num_disabled by two, potentially leading to
  580. + an integer underflow.
  581. +
  582. +* Potential kernel panic on hlist_del_rcu(): Two mcast handlers might
  583. + one after another try to do an
  584. + hlist_del_rcu(&orig->mcast_want_all_*_node). The second one will
  585. + cause memory corruption / crashes.
  586. + (Reported by: Sven Eckelmann <sven@narfation.org>)
  587. +
  588. +Right in the beginning the code path makes assumptions about the current
  589. +multicast related state of an originator and bases all updates on that. The
  590. +easiest and least error prune way to fix the issues in this case is to
  591. +serialize multiple mcast handler invocations with a spinlock.
  592. +
  593. +Fixes: 77ec494490d6 ("batman-adv: Announce new capability via multicast TVLV")
  594. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  595. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  596. +---
  597. + multicast.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++-------------
  598. + originator.c | 4 ++++
  599. + types.h | 3 +++
  600. + 3 files changed, 56 insertions(+), 13 deletions(-)
  601. +
  602. +diff --git a/multicast.c b/multicast.c
  603. +index 00612bf..b75bcc3 100644
  604. +--- a/multicast.c
  605. ++++ b/multicast.c
  606. +@@ -565,19 +565,26 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
  607. + *
  608. + * If the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag of this originator,
  609. + * orig, has toggled then this method updates counter and list accordingly.
  610. ++ *
  611. ++ * Caller needs to hold orig->mcast_handler_lock.
  612. + */
  613. + static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv,
  614. + struct batadv_orig_node *orig,
  615. + uint8_t mcast_flags)
  616. + {
  617. ++ struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node;
  618. ++ struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list;
  619. ++
  620. + /* switched from flag unset to set */
  621. + if (mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES &&
  622. + !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) {
  623. + atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables);
  624. +
  625. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  626. +- hlist_add_head_rcu(&orig->mcast_want_all_unsnoopables_node,
  627. +- &bat_priv->mcast.want_all_unsnoopables_list);
  628. ++ /* flag checks above + mcast_handler_lock prevents this */
  629. ++ BUG_ON(!hlist_unhashed(node));
  630. ++
  631. ++ hlist_add_head_rcu(node, head);
  632. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  633. + /* switched from flag set to unset */
  634. + } else if (!(mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) &&
  635. +@@ -585,7 +592,10 @@ static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv,
  636. + atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables);
  637. +
  638. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  639. +- hlist_del_rcu(&orig->mcast_want_all_unsnoopables_node);
  640. ++ /* flag checks above + mcast_handler_lock prevents this */
  641. ++ BUG_ON(hlist_unhashed(node));
  642. ++
  643. ++ hlist_del_init_rcu(node);
  644. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  645. + }
  646. + }
  647. +@@ -598,19 +608,26 @@ static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv,
  648. + *
  649. + * If the BATADV_MCAST_WANT_ALL_IPV4 flag of this originator, orig, has
  650. + * toggled then this method updates counter and list accordingly.
  651. ++ *
  652. ++ * Caller needs to hold orig->mcast_handler_lock.
  653. + */
  654. + static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv,
  655. + struct batadv_orig_node *orig,
  656. + uint8_t mcast_flags)
  657. + {
  658. ++ struct hlist_node *node = &orig->mcast_want_all_ipv4_node;
  659. ++ struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list;
  660. ++
  661. + /* switched from flag unset to set */
  662. + if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV4 &&
  663. + !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) {
  664. + atomic_inc(&bat_priv->mcast.num_want_all_ipv4);
  665. +
  666. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  667. +- hlist_add_head_rcu(&orig->mcast_want_all_ipv4_node,
  668. +- &bat_priv->mcast.want_all_ipv4_list);
  669. ++ /* flag checks above + mcast_handler_lock prevents this */
  670. ++ BUG_ON(!hlist_unhashed(node));
  671. ++
  672. ++ hlist_add_head_rcu(node, head);
  673. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  674. + /* switched from flag set to unset */
  675. + } else if (!(mcast_flags & BATADV_MCAST_WANT_ALL_IPV4) &&
  676. +@@ -618,7 +635,10 @@ static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv,
  677. + atomic_dec(&bat_priv->mcast.num_want_all_ipv4);
  678. +
  679. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  680. +- hlist_del_rcu(&orig->mcast_want_all_ipv4_node);
  681. ++ /* flag checks above + mcast_handler_lock prevents this */
  682. ++ BUG_ON(hlist_unhashed(node));
  683. ++
  684. ++ hlist_del_init_rcu(node);
  685. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  686. + }
  687. + }
  688. +@@ -631,19 +651,26 @@ static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv,
  689. + *
  690. + * If the BATADV_MCAST_WANT_ALL_IPV6 flag of this originator, orig, has
  691. + * toggled then this method updates counter and list accordingly.
  692. ++ *
  693. ++ * Caller needs to hold orig->mcast_handler_lock.
  694. + */
  695. + static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv,
  696. + struct batadv_orig_node *orig,
  697. + uint8_t mcast_flags)
  698. + {
  699. ++ struct hlist_node *node = &orig->mcast_want_all_ipv6_node;
  700. ++ struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list;
  701. ++
  702. + /* switched from flag unset to set */
  703. + if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV6 &&
  704. + !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) {
  705. + atomic_inc(&bat_priv->mcast.num_want_all_ipv6);
  706. +
  707. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  708. +- hlist_add_head_rcu(&orig->mcast_want_all_ipv6_node,
  709. +- &bat_priv->mcast.want_all_ipv6_list);
  710. ++ /* flag checks above + mcast_handler_lock prevents this */
  711. ++ BUG_ON(!hlist_unhashed(node));
  712. ++
  713. ++ hlist_add_head_rcu(node, head);
  714. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  715. + /* switched from flag set to unset */
  716. + } else if (!(mcast_flags & BATADV_MCAST_WANT_ALL_IPV6) &&
  717. +@@ -651,7 +678,10 @@ static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv,
  718. + atomic_dec(&bat_priv->mcast.num_want_all_ipv6);
  719. +
  720. + spin_lock_bh(&bat_priv->mcast.want_lists_lock);
  721. +- hlist_del_rcu(&orig->mcast_want_all_ipv6_node);
  722. ++ /* flag checks above + mcast_handler_lock prevents this */
  723. ++ BUG_ON(hlist_unhashed(node));
  724. ++
  725. ++ hlist_del_init_rcu(node);
  726. + spin_unlock_bh(&bat_priv->mcast.want_lists_lock);
  727. + }
  728. + }
  729. +@@ -674,6 +704,11 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  730. + uint8_t mcast_flags = BATADV_NO_FLAGS;
  731. + bool orig_initialized;
  732. +
  733. ++ if (orig_mcast_enabled && tvlv_value &&
  734. ++ (tvlv_value_len >= sizeof(mcast_flags)))
  735. ++ mcast_flags = *(uint8_t *)tvlv_value;
  736. ++
  737. ++ spin_lock_bh(&orig->mcast_handler_lock);
  738. + orig_initialized = orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST;
  739. +
  740. + /* If mcast support is turned on decrease the disabled mcast node
  741. +@@ -698,15 +733,12 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  742. +
  743. + set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized);
  744. +
  745. +- if (orig_mcast_enabled && tvlv_value &&
  746. +- (tvlv_value_len >= sizeof(mcast_flags)))
  747. +- mcast_flags = *(uint8_t *)tvlv_value;
  748. +-
  749. + batadv_mcast_want_unsnoop_update(bat_priv, orig, mcast_flags);
  750. + batadv_mcast_want_ipv4_update(bat_priv, orig, mcast_flags);
  751. + batadv_mcast_want_ipv6_update(bat_priv, orig, mcast_flags);
  752. +
  753. + orig->mcast_flags = mcast_flags;
  754. ++ spin_unlock_bh(&orig->mcast_handler_lock);
  755. + }
  756. +
  757. + /**
  758. +@@ -740,6 +772,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
  759. + {
  760. + struct batadv_priv *bat_priv = orig->bat_priv;
  761. +
  762. ++ spin_lock_bh(&orig->mcast_handler_lock);
  763. ++
  764. + if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) &&
  765. + orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST)
  766. + atomic_dec(&bat_priv->mcast.num_disabled);
  767. +@@ -747,4 +781,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
  768. + batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
  769. + batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
  770. + batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);
  771. ++
  772. ++ spin_unlock_bh(&orig->mcast_handler_lock);
  773. + }
  774. +diff --git a/originator.c b/originator.c
  775. +index e3900e4..a2ba182 100644
  776. +--- a/originator.c
  777. ++++ b/originator.c
  778. +@@ -658,11 +658,15 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
  779. + INIT_HLIST_HEAD(&orig_node->neigh_list);
  780. + INIT_LIST_HEAD(&orig_node->vlan_list);
  781. + INIT_HLIST_HEAD(&orig_node->ifinfo_list);
  782. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_unsnoopables_node);
  783. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv4_node);
  784. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv6_node);
  785. + spin_lock_init(&orig_node->bcast_seqno_lock);
  786. + spin_lock_init(&orig_node->neigh_list_lock);
  787. + spin_lock_init(&orig_node->tt_buff_lock);
  788. + spin_lock_init(&orig_node->tt_lock);
  789. + spin_lock_init(&orig_node->vlan_list_lock);
  790. ++ spin_lock_init(&orig_node->mcast_handler_lock);
  791. +
  792. + batadv_nc_init_orig(orig_node);
  793. +
  794. +diff --git a/types.h b/types.h
  795. +index c6ec558..65dc6bf 100644
  796. +--- a/types.h
  797. ++++ b/types.h
  798. +@@ -204,6 +204,7 @@ struct batadv_orig_bat_iv {
  799. + * @batadv_dat_addr_t: address of the orig node in the distributed hash
  800. + * @last_seen: time when last packet from this node was received
  801. + * @bcast_seqno_reset: time when the broadcast seqno window was reset
  802. ++ * @mcast_handler_lock: synchronizes mcast-capability and -flag changes
  803. + * @mcast_flags: multicast flags announced by the orig node
  804. + * @mcast_want_all_unsnoop_node: a list node for the
  805. + * mcast.want_all_unsnoopables list
  806. +@@ -251,6 +252,8 @@ struct batadv_orig_node {
  807. + unsigned long last_seen;
  808. + unsigned long bcast_seqno_reset;
  809. + #ifdef CONFIG_BATMAN_ADV_MCAST
  810. ++ /* synchronizes mcast tvlv specific orig changes */
  811. ++ spinlock_t mcast_handler_lock;
  812. + uint8_t mcast_flags;
  813. + struct hlist_node mcast_want_all_unsnoopables_node;
  814. + struct hlist_node mcast_want_all_ipv4_node;
  815. +--
  816. +2.1.4
  817. +
  818. diff --git a/batman-adv/patches/0008-batman-adv-Fix-compile-error-on-deactivated-MCAST-fe.patch b/batman-adv/patches/0008-batman-adv-Fix-compile-error-on-deactivated-MCAST-fe.patch
  819. new file mode 100644
  820. index 0000000..c854522
  821. --- /dev/null
  822. +++ b/batman-adv/patches/0008-batman-adv-Fix-compile-error-on-deactivated-MCAST-fe.patch
  823. @@ -0,0 +1,58 @@
  824. +From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001
  825. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  826. +Date: Thu, 18 Jun 2015 06:47:19 +0200
  827. +Subject: [PATCH 08/17] batman-adv: Fix compile error on deactivated MCAST
  828. + feature
  829. +MIME-Version: 1.0
  830. +Content-Type: text/plain; charset=UTF-8
  831. +Content-Transfer-Encoding: 8bit
  832. +
  833. +Some members of "struct batadv_orig_node" are not available if compiling
  834. +without the multicast optimizations feature.
  835. +
  836. +Fix this by moving their initialization into the right #ifdef's.
  837. +
  838. +Fixes: 7f220ed1f063 ("batman-adv: Fix potential synchronization issues in mcast tvlv handler")
  839. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  840. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  841. +---
  842. + originator.c | 9 +++++----
  843. + 1 file changed, 5 insertions(+), 4 deletions(-)
  844. +
  845. +diff --git a/originator.c b/originator.c
  846. +index a2ba182..a5276db 100644
  847. +--- a/originator.c
  848. ++++ b/originator.c
  849. +@@ -658,15 +658,11 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
  850. + INIT_HLIST_HEAD(&orig_node->neigh_list);
  851. + INIT_LIST_HEAD(&orig_node->vlan_list);
  852. + INIT_HLIST_HEAD(&orig_node->ifinfo_list);
  853. +- INIT_HLIST_NODE(&orig_node->mcast_want_all_unsnoopables_node);
  854. +- INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv4_node);
  855. +- INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv6_node);
  856. + spin_lock_init(&orig_node->bcast_seqno_lock);
  857. + spin_lock_init(&orig_node->neigh_list_lock);
  858. + spin_lock_init(&orig_node->tt_buff_lock);
  859. + spin_lock_init(&orig_node->tt_lock);
  860. + spin_lock_init(&orig_node->vlan_list_lock);
  861. +- spin_lock_init(&orig_node->mcast_handler_lock);
  862. +
  863. + batadv_nc_init_orig(orig_node);
  864. +
  865. +@@ -682,8 +678,13 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
  866. + orig_node->last_seen = jiffies;
  867. + reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS);
  868. + orig_node->bcast_seqno_reset = reset_time;
  869. ++
  870. + #ifdef CONFIG_BATMAN_ADV_MCAST
  871. + orig_node->mcast_flags = BATADV_NO_FLAGS;
  872. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_unsnoopables_node);
  873. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv4_node);
  874. ++ INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv6_node);
  875. ++ spin_lock_init(&orig_node->mcast_handler_lock);
  876. + #endif
  877. +
  878. + /* create a vlan object for the "untagged" LAN */
  879. +--
  880. +2.1.4
  881. +
  882. diff --git a/batman-adv/patches/0009-batman-adv-fix-kernel-crash-due-to-missing-NULL-chec.patch b/batman-adv/patches/0009-batman-adv-fix-kernel-crash-due-to-missing-NULL-chec.patch
  883. new file mode 100644
  884. index 0000000..3e19c0e
  885. --- /dev/null
  886. +++ b/batman-adv/patches/0009-batman-adv-fix-kernel-crash-due-to-missing-NULL-chec.patch
  887. @@ -0,0 +1,93 @@
  888. +From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001
  889. +From: Marek Lindner <mareklindner@neomailbox.ch>
  890. +Date: Tue, 9 Jun 2015 21:24:36 +0800
  891. +Subject: [PATCH 09/17] batman-adv: fix kernel crash due to missing NULL checks
  892. +
  893. +batadv_softif_vlan_get() may return NULL which has to be verified
  894. +by the caller.
  895. +
  896. +Fixes: 9729d20 ("batman-adv: fix TT VLAN inconsistency on VLAN re-add")
  897. +
  898. +Reported-by: Ryan Thompson <ryan@eero.com>
  899. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  900. +Acked-by: Antonio Quartulli <antonio@meshcoding.com>
  901. +---
  902. + soft-interface.c | 3 +++
  903. + translation-table.c | 19 +++++++++++++++----
  904. + 2 files changed, 18 insertions(+), 4 deletions(-)
  905. +
  906. +diff --git a/soft-interface.c b/soft-interface.c
  907. +index da89336..7841a4b 100644
  908. +--- a/soft-interface.c
  909. ++++ b/soft-interface.c
  910. +@@ -455,6 +455,9 @@ out:
  911. + */
  912. + void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
  913. + {
  914. ++ if (!vlan)
  915. ++ return;
  916. ++
  917. + if (atomic_dec_and_test(&vlan->refcount)) {
  918. + spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);
  919. + hlist_del_rcu(&vlan->list);
  920. +diff --git a/translation-table.c b/translation-table.c
  921. +index e95a424..807a4e6 100644
  922. +--- a/translation-table.c
  923. ++++ b/translation-table.c
  924. +@@ -26,6 +26,7 @@
  925. + #include "bridge_loop_avoidance.h"
  926. + #include "multicast.h"
  927. +
  928. ++#include <linux/bug.h>
  929. + #include <linux/crc32c.h>
  930. +
  931. + /* hash class keys */
  932. +@@ -575,6 +576,9 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
  933. +
  934. + /* increase the refcounter of the related vlan */
  935. + vlan = batadv_softif_vlan_get(bat_priv, vid);
  936. ++ if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",
  937. ++ addr, BATADV_PRINT_VID(vid)))
  938. ++ goto out;
  939. +
  940. + batadv_dbg(BATADV_DBG_TT, bat_priv,
  941. + "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
  942. +@@ -1047,6 +1051,9 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv,
  943. +
  944. + /* decrease the reference held for this vlan */
  945. + vlan = batadv_softif_vlan_get(bat_priv, vid);
  946. ++ if (!vlan)
  947. ++ goto out;
  948. ++
  949. + batadv_softif_vlan_free_ref(vlan);
  950. + batadv_softif_vlan_free_ref(vlan);
  951. +
  952. +@@ -1147,8 +1154,10 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
  953. + /* decrease the reference held for this vlan */
  954. + vlan = batadv_softif_vlan_get(bat_priv,
  955. + tt_common_entry->vid);
  956. +- batadv_softif_vlan_free_ref(vlan);
  957. +- batadv_softif_vlan_free_ref(vlan);
  958. ++ if (vlan) {
  959. ++ batadv_softif_vlan_free_ref(vlan);
  960. ++ batadv_softif_vlan_free_ref(vlan);
  961. ++ }
  962. +
  963. + batadv_tt_local_entry_free_ref(tt_local);
  964. + }
  965. +@@ -3188,8 +3197,10 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
  966. +
  967. + /* decrease the reference held for this vlan */
  968. + vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
  969. +- batadv_softif_vlan_free_ref(vlan);
  970. +- batadv_softif_vlan_free_ref(vlan);
  971. ++ if (vlan) {
  972. ++ batadv_softif_vlan_free_ref(vlan);
  973. ++ batadv_softif_vlan_free_ref(vlan);
  974. ++ }
  975. +
  976. + batadv_tt_local_entry_free_ref(tt_local);
  977. + }
  978. +--
  979. +2.1.4
  980. +
  981. diff --git a/batman-adv/patches/0010-batman-adv-protect-tt_local_entry-from-concurrent-de.patch b/batman-adv/patches/0010-batman-adv-protect-tt_local_entry-from-concurrent-de.patch
  982. new file mode 100644
  983. index 0000000..5cc27ee
  984. --- /dev/null
  985. +++ b/batman-adv/patches/0010-batman-adv-protect-tt_local_entry-from-concurrent-de.patch
  986. @@ -0,0 +1,55 @@
  987. +From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001
  988. +From: Marek Lindner <mareklindner@neomailbox.ch>
  989. +Date: Wed, 17 Jun 2015 20:01:36 +0800
  990. +Subject: [PATCH 10/17] batman-adv: protect tt_local_entry from concurrent
  991. + delete events
  992. +
  993. +The tt_local_entry deletion performed in batadv_tt_local_remove() was neither
  994. +protecting against simultaneous deletes nor checking whether the element was
  995. +still part of the list before calling hlist_del_rcu().
  996. +
  997. +Replacing the hlist_del_rcu() call with batadv_hash_remove() provides adequate
  998. +protection via hash spinlocks as well as an is-element-still-in-hash check to
  999. +avoid 'blind' hash removal.
  1000. +
  1001. +Fixes: 2443ba3 ("batman-adv: roaming handling mechanism redesign")
  1002. +
  1003. +Reported-by: alfonsname@web.de
  1004. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1005. +Acked-by: Antonio Quartulli <antonio@meshcoding.com>
  1006. +---
  1007. + translation-table.c | 11 ++++++++++-
  1008. + 1 file changed, 10 insertions(+), 1 deletion(-)
  1009. +
  1010. +diff --git a/translation-table.c b/translation-table.c
  1011. +index 807a4e6..dfe8896 100644
  1012. +--- a/translation-table.c
  1013. ++++ b/translation-table.c
  1014. +@@ -1019,6 +1019,7 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv,
  1015. + struct batadv_tt_local_entry *tt_local_entry;
  1016. + uint16_t flags, curr_flags = BATADV_NO_FLAGS;
  1017. + struct batadv_softif_vlan *vlan;
  1018. ++ void *tt_entry_exists;
  1019. +
  1020. + tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
  1021. + if (!tt_local_entry)
  1022. +@@ -1046,7 +1047,15 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv,
  1023. + * immediately purge it
  1024. + */
  1025. + batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
  1026. +- hlist_del_rcu(&tt_local_entry->common.hash_entry);
  1027. ++
  1028. ++ tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash,
  1029. ++ batadv_compare_tt,
  1030. ++ batadv_choose_tt,
  1031. ++ &tt_local_entry->common);
  1032. ++ if (!tt_entry_exists)
  1033. ++ goto out;
  1034. ++
  1035. ++ /* extra call to free the local tt entry */
  1036. + batadv_tt_local_entry_free_ref(tt_local_entry);
  1037. +
  1038. + /* decrease the reference held for this vlan */
  1039. +--
  1040. +2.1.4
  1041. +
  1042. diff --git a/batman-adv/patches/0011-batman-adv-protect-tt-request-from-double-deletion.patch b/batman-adv/patches/0011-batman-adv-protect-tt-request-from-double-deletion.patch
  1043. new file mode 100644
  1044. index 0000000..dd0e26f
  1045. --- /dev/null
  1046. +++ b/batman-adv/patches/0011-batman-adv-protect-tt-request-from-double-deletion.patch
  1047. @@ -0,0 +1,58 @@
  1048. +From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001
  1049. +From: Marek Lindner <mareklindner@neomailbox.ch>
  1050. +Date: Mon, 22 Jun 2015 00:36:28 +0800
  1051. +Subject: [PATCH 11/17] batman-adv: protect tt request from double deletion
  1052. +
  1053. +The list_del() calls were changed to list_del_init() to prevent
  1054. +an accidental double deletion in batadv_tt_req_node_new().
  1055. +
  1056. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1057. +Acked-by: Antonio Quartulli <antonio@meshcoding.com>
  1058. +---
  1059. + translation-table.c | 9 +++++----
  1060. + 1 file changed, 5 insertions(+), 4 deletions(-)
  1061. +
  1062. +diff --git a/translation-table.c b/translation-table.c
  1063. +index dfe8896..b6c0f52 100644
  1064. +--- a/translation-table.c
  1065. ++++ b/translation-table.c
  1066. +@@ -2194,7 +2194,7 @@ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
  1067. + spin_lock_bh(&bat_priv->tt.req_list_lock);
  1068. +
  1069. + list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
  1070. +- list_del(&node->list);
  1071. ++ list_del_init(&node->list);
  1072. + kfree(node);
  1073. + }
  1074. +
  1075. +@@ -2230,7 +2230,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
  1076. + list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
  1077. + if (batadv_has_timed_out(node->issued_at,
  1078. + BATADV_TT_REQUEST_TIMEOUT)) {
  1079. +- list_del(&node->list);
  1080. ++ list_del_init(&node->list);
  1081. + kfree(node);
  1082. + }
  1083. + }
  1084. +@@ -2512,7 +2512,8 @@ out:
  1085. + batadv_hardif_free_ref(primary_if);
  1086. + if (ret && tt_req_node) {
  1087. + spin_lock_bh(&bat_priv->tt.req_list_lock);
  1088. +- list_del(&tt_req_node->list);
  1089. ++ /* list_del_init() verifies tt_req_node still is in the list */
  1090. ++ list_del_init(&tt_req_node->list);
  1091. + spin_unlock_bh(&bat_priv->tt.req_list_lock);
  1092. + kfree(tt_req_node);
  1093. + }
  1094. +@@ -2949,7 +2950,7 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
  1095. + list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
  1096. + if (!batadv_compare_eth(node->addr, resp_src))
  1097. + continue;
  1098. +- list_del(&node->list);
  1099. ++ list_del_init(&node->list);
  1100. + kfree(node);
  1101. + }
  1102. +
  1103. +--
  1104. +2.1.4
  1105. +
  1106. diff --git a/batman-adv/patches/0012-batman-adv-initialize-up-down-values-when-adding-a-g.patch b/batman-adv/patches/0012-batman-adv-initialize-up-down-values-when-adding-a-g.patch
  1107. new file mode 100644
  1108. index 0000000..04b3758
  1109. --- /dev/null
  1110. +++ b/batman-adv/patches/0012-batman-adv-initialize-up-down-values-when-adding-a-g.patch
  1111. @@ -0,0 +1,42 @@
  1112. +From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001
  1113. +From: Simon Wunderlich <simon@open-mesh.com>
  1114. +Date: Wed, 24 Jun 2015 14:50:19 +0200
  1115. +Subject: [PATCH 12/17] batman-adv: initialize up/down values when adding a
  1116. + gateway
  1117. +
  1118. +Without this initialization, gateways which actually announce up/down
  1119. +bandwidth of 0/0 could be added. If these nodes get purged via
  1120. +_batadv_purge_orig() later, the gw_node structure does not get removed
  1121. +since batadv_gw_node_delete() updates the gw_node with up/down
  1122. +bandwidth of 0/0, and the updating function then discards the change
  1123. +and does not free gw_node.
  1124. +
  1125. +This results in leaking the gw_node structures, which references other
  1126. +structures: gw_node -> orig_node -> orig_node_ifinfo -> hardif. When
  1127. +removing the interface later, the open reference on the hardif may cause
  1128. +hangs with the infamous "unregister_netdevice: waiting for mesh1 to
  1129. +become free. Usage count = 1" message.
  1130. +
  1131. +Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
  1132. +Acked-by: Antonio Quartulli <antonio@meshcoding.com>
  1133. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1134. +---
  1135. + gateway_client.c | 2 ++
  1136. + 1 file changed, 2 insertions(+)
  1137. +
  1138. +diff --git a/gateway_client.c b/gateway_client.c
  1139. +index 3f32357..d8e3ead 100644
  1140. +--- a/gateway_client.c
  1141. ++++ b/gateway_client.c
  1142. +@@ -419,6 +419,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
  1143. +
  1144. + INIT_HLIST_NODE(&gw_node->list);
  1145. + gw_node->orig_node = orig_node;
  1146. ++ gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
  1147. ++ gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
  1148. + atomic_set(&gw_node->refcount, 1);
  1149. +
  1150. + spin_lock_bh(&bat_priv->gw.list_lock);
  1151. +--
  1152. +2.1.4
  1153. +
  1154. diff --git a/batman-adv/patches/0013-batman-adv-remove-broadcast-packets-scheduled-for-pu.patch b/batman-adv/patches/0013-batman-adv-remove-broadcast-packets-scheduled-for-pu.patch
  1155. new file mode 100644
  1156. index 0000000..b7a27ef
  1157. --- /dev/null
  1158. +++ b/batman-adv/patches/0013-batman-adv-remove-broadcast-packets-scheduled-for-pu.patch
  1159. @@ -0,0 +1,32 @@
  1160. +From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001
  1161. +From: Simon Wunderlich <simon@open-mesh.com>
  1162. +Date: Wed, 24 Jun 2015 14:50:20 +0200
  1163. +Subject: [PATCH 13/17] batman-adv: remove broadcast packets scheduled for
  1164. + purged outgoing if
  1165. +
  1166. +When an interface is purged, the broadcast packets scheduled for this
  1167. +interface should get purged as well.
  1168. +
  1169. +Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
  1170. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1171. +---
  1172. + send.c | 3 ++-
  1173. + 1 file changed, 2 insertions(+), 1 deletion(-)
  1174. +
  1175. +diff --git a/send.c b/send.c
  1176. +index 23635bd..a7e84b2 100644
  1177. +--- a/send.c
  1178. ++++ b/send.c
  1179. +@@ -598,7 +598,8 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
  1180. + * we delete only packets belonging to the given interface
  1181. + */
  1182. + if ((hard_iface) &&
  1183. +- (forw_packet->if_incoming != hard_iface))
  1184. ++ (forw_packet->if_incoming != hard_iface) &&
  1185. ++ (forw_packet->if_outgoing != hard_iface))
  1186. + continue;
  1187. +
  1188. + spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
  1189. +--
  1190. +2.1.4
  1191. +
  1192. diff --git a/batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch b/batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch
  1193. new file mode 100644
  1194. index 0000000..bffabb3
  1195. --- /dev/null
  1196. +++ b/batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch
  1197. @@ -0,0 +1,53 @@
  1198. +From de4666781c5a64cd55aa6688f77de95f8f66b2c0 Mon Sep 17 00:00:00 2001
  1199. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  1200. +Date: Fri, 3 Jul 2015 18:29:56 +0200
  1201. +Subject: [PATCH 14/17] batman-adv: Fix broken DAT capability check
  1202. +MIME-Version: 1.0
  1203. +Content-Type: text/plain; charset=UTF-8
  1204. +Content-Transfer-Encoding: 8bit
  1205. +
  1206. +The introduction of set_bit() and clear_bit() calls in batman-adv
  1207. +wrongly passed bitmasks and not the bit numbers to these functions.
  1208. +This leads to broken capability checks.
  1209. +
  1210. +Fixing this by making the capability enum a non-bitmasked one and by
  1211. +that passing non-masked values to set_bit()/clear_bit().
  1212. +
  1213. +Fixes: bfd0fbaef270 ("batman-adv: Make DAT capability changes atomic")
  1214. +Reported-by: Def <def@laposte.net>
  1215. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  1216. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1217. +---
  1218. + distributed-arp-table.c | 2 +-
  1219. + types.h | 2 +-
  1220. + 2 files changed, 2 insertions(+), 2 deletions(-)
  1221. +
  1222. +diff --git a/distributed-arp-table.c b/distributed-arp-table.c
  1223. +index b2cc19b..c0c514d 100644
  1224. +--- a/distributed-arp-table.c
  1225. ++++ b/distributed-arp-table.c
  1226. +@@ -422,7 +422,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
  1227. + int j;
  1228. +
  1229. + /* check if orig node candidate is running DAT */
  1230. +- if (!(candidate->capabilities & BATADV_ORIG_CAPA_HAS_DAT))
  1231. ++ if (!(test_bit(BATADV_ORIG_CAPA_HAS_DAT, &candidate->capabilities)))
  1232. + goto out;
  1233. +
  1234. + /* Check if this node has already been selected... */
  1235. +diff --git a/types.h b/types.h
  1236. +index 65dc6bf..08a6343 100644
  1237. +--- a/types.h
  1238. ++++ b/types.h
  1239. +@@ -299,7 +299,7 @@ struct batadv_orig_node {
  1240. + * (= orig node announces a tvlv of type BATADV_TVLV_MCAST)
  1241. + */
  1242. + enum batadv_orig_capabilities {
  1243. +- BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
  1244. ++ BATADV_ORIG_CAPA_HAS_DAT,
  1245. + BATADV_ORIG_CAPA_HAS_NC = BIT(1),
  1246. + BATADV_ORIG_CAPA_HAS_TT = BIT(2),
  1247. + BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
  1248. +--
  1249. +2.1.4
  1250. +
  1251. diff --git a/batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch b/batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch
  1252. new file mode 100644
  1253. index 0000000..86ecd92
  1254. --- /dev/null
  1255. +++ b/batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch
  1256. @@ -0,0 +1,53 @@
  1257. +From dfb27e75b5586e356e88b9d827d772a6cbdf3cc1 Mon Sep 17 00:00:00 2001
  1258. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  1259. +Date: Fri, 3 Jul 2015 18:29:57 +0200
  1260. +Subject: [PATCH 15/17] batman-adv: Fix broken NC capability check
  1261. +MIME-Version: 1.0
  1262. +Content-Type: text/plain; charset=UTF-8
  1263. +Content-Transfer-Encoding: 8bit
  1264. +
  1265. +The introduction of set_bit() and clear_bit() calls in batman-adv
  1266. +wrongly passed bitmasks and not the bit numbers to these functions.
  1267. +This leads to broken capability checks.
  1268. +
  1269. +Fixing this by making the capability enum a non-bitmasked one and by
  1270. +that passing non-masked values to set_bit()/clear_bit().
  1271. +
  1272. +Fixes: 586df9e2537b ("batman-adv: Make NC capability changes atomic")
  1273. +Reported-by: Def <def@laposte.net>
  1274. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  1275. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1276. +---
  1277. + network-coding.c | 2 +-
  1278. + types.h | 2 +-
  1279. + 2 files changed, 2 insertions(+), 2 deletions(-)
  1280. +
  1281. +diff --git a/network-coding.c b/network-coding.c
  1282. +index 3ce493e..0309c2c 100644
  1283. +--- a/network-coding.c
  1284. ++++ b/network-coding.c
  1285. +@@ -871,7 +871,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  1286. + goto out;
  1287. +
  1288. + /* check if orig node is network coding enabled */
  1289. +- if (!(orig_node->capabilities & BATADV_ORIG_CAPA_HAS_NC))
  1290. ++ if (!(test_bit(BATADV_ORIG_CAPA_HAS_NC, &orig_node->capabilities)))
  1291. + goto out;
  1292. +
  1293. + /* accept ogms from 'good' neighbors and single hop neighbors */
  1294. +diff --git a/types.h b/types.h
  1295. +index 08a6343..cb7ccb1 100644
  1296. +--- a/types.h
  1297. ++++ b/types.h
  1298. +@@ -300,7 +300,7 @@ struct batadv_orig_node {
  1299. + */
  1300. + enum batadv_orig_capabilities {
  1301. + BATADV_ORIG_CAPA_HAS_DAT,
  1302. +- BATADV_ORIG_CAPA_HAS_NC = BIT(1),
  1303. ++ BATADV_ORIG_CAPA_HAS_NC,
  1304. + BATADV_ORIG_CAPA_HAS_TT = BIT(2),
  1305. + BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
  1306. + };
  1307. +--
  1308. +2.1.4
  1309. +
  1310. diff --git a/batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch b/batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch
  1311. new file mode 100644
  1312. index 0000000..5295026
  1313. --- /dev/null
  1314. +++ b/batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch
  1315. @@ -0,0 +1,54 @@
  1316. +From a4824ffaa200050a0b3e68101ebe074a7c45b7d5 Mon Sep 17 00:00:00 2001
  1317. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  1318. +Date: Fri, 3 Jul 2015 18:29:58 +0200
  1319. +Subject: [PATCH 16/17] batman-adv: Fix broken TT capability check
  1320. +MIME-Version: 1.0
  1321. +Content-Type: text/plain; charset=UTF-8
  1322. +Content-Transfer-Encoding: 8bit
  1323. +
  1324. +The introduction of set_bit() and clear_bit() calls in batman-adv
  1325. +wrongly passed bitmasks and not the bit numbers to these functions.
  1326. +This leads to broken capability checks.
  1327. +
  1328. +Fixing this by making the capability enum a non-bitmasked one and by
  1329. +that passing non-masked values to set_bit()/clear_bit().
  1330. +
  1331. +Fixes: a51fa16ecf3f ("batman-adv: Make TT capability changes atomic")
  1332. +Reported-by: Def <def@laposte.net>
  1333. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  1334. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1335. +---
  1336. + translation-table.c | 3 ++-
  1337. + types.h | 2 +-
  1338. + 2 files changed, 3 insertions(+), 2 deletions(-)
  1339. +
  1340. +diff --git a/translation-table.c b/translation-table.c
  1341. +index b6c0f52..d73b103 100644
  1342. +--- a/translation-table.c
  1343. ++++ b/translation-table.c
  1344. +@@ -3323,7 +3323,8 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
  1345. + bool has_tt_init;
  1346. +
  1347. + tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff;
  1348. +- has_tt_init = orig_node->capa_initialized & BATADV_ORIG_CAPA_HAS_TT;
  1349. ++ has_tt_init = test_bit(BATADV_ORIG_CAPA_HAS_TT,
  1350. ++ &orig_node->capa_initialized);
  1351. +
  1352. + /* orig table not initialised AND first diff is in the OGM OR the ttvn
  1353. + * increased by one -> we can apply the attached changes
  1354. +diff --git a/types.h b/types.h
  1355. +index cb7ccb1..6f4486c 100644
  1356. +--- a/types.h
  1357. ++++ b/types.h
  1358. +@@ -301,7 +301,7 @@ struct batadv_orig_node {
  1359. + enum batadv_orig_capabilities {
  1360. + BATADV_ORIG_CAPA_HAS_DAT,
  1361. + BATADV_ORIG_CAPA_HAS_NC,
  1362. +- BATADV_ORIG_CAPA_HAS_TT = BIT(2),
  1363. ++ BATADV_ORIG_CAPA_HAS_TT,
  1364. + BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
  1365. + };
  1366. +
  1367. +--
  1368. +2.1.4
  1369. +
  1370. diff --git a/batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch b/batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch
  1371. new file mode 100644
  1372. index 0000000..8930543
  1373. --- /dev/null
  1374. +++ b/batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch
  1375. @@ -0,0 +1,82 @@
  1376. +From 1798ad3fb6ba72f8c6f96024b27ad27193648787 Mon Sep 17 00:00:00 2001
  1377. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
  1378. +Date: Fri, 3 Jul 2015 18:29:59 +0200
  1379. +Subject: [PATCH 17/17] batman-adv: Fix broken MCAST capability check
  1380. +MIME-Version: 1.0
  1381. +Content-Type: text/plain; charset=UTF-8
  1382. +Content-Transfer-Encoding: 8bit
  1383. +
  1384. +The introduction of set_bit() and clear_bit() calls in batman-adv
  1385. +wrongly passed bitmasks and not the bit numbers to these functions.
  1386. +This leads to broken capability checks.
  1387. +
  1388. +Fixing this by making the capability enum a non-bitmasked one and by
  1389. +that passing non-masked values to set_bit()/clear_bit().
  1390. +
  1391. +Fixes: 201a54ba710a ("batman-adv: Make MCAST capability changes atomic")
  1392. +Reported-by: Def <def@laposte.net>
  1393. +Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
  1394. +Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
  1395. +---
  1396. + multicast.c | 11 ++++++-----
  1397. + types.h | 2 +-
  1398. + 2 files changed, 7 insertions(+), 6 deletions(-)
  1399. +
  1400. +diff --git a/multicast.c b/multicast.c
  1401. +index b75bcc3..ee8317f 100644
  1402. +--- a/multicast.c
  1403. ++++ b/multicast.c
  1404. +@@ -709,14 +709,15 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  1405. + mcast_flags = *(uint8_t *)tvlv_value;
  1406. +
  1407. + spin_lock_bh(&orig->mcast_handler_lock);
  1408. +- orig_initialized = orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST;
  1409. ++ orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,
  1410. ++ &orig->capa_initialized);
  1411. +
  1412. + /* If mcast support is turned on decrease the disabled mcast node
  1413. + * counter only if we had increased it for this node before. If this
  1414. + * is a completely new orig_node no need to decrease the counter.
  1415. + */
  1416. + if (orig_mcast_enabled &&
  1417. +- !(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) {
  1418. ++ !(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities))) {
  1419. + if (orig_initialized)
  1420. + atomic_dec(&bat_priv->mcast.num_disabled);
  1421. + set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
  1422. +@@ -725,7 +726,7 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
  1423. + * node counter.
  1424. + */
  1425. + } else if (!orig_mcast_enabled &&
  1426. +- (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST ||
  1427. ++ (test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) ||
  1428. + !orig_initialized)) {
  1429. + atomic_inc(&bat_priv->mcast.num_disabled);
  1430. + clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
  1431. +@@ -774,8 +775,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
  1432. +
  1433. + spin_lock_bh(&orig->mcast_handler_lock);
  1434. +
  1435. +- if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) &&
  1436. +- orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST)
  1437. ++ if (!(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) &&
  1438. ++ test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized))
  1439. + atomic_dec(&bat_priv->mcast.num_disabled);
  1440. +
  1441. + batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
  1442. +diff --git a/types.h b/types.h
  1443. +index 6f4486c..3baf595 100644
  1444. +--- a/types.h
  1445. ++++ b/types.h
  1446. +@@ -302,7 +302,7 @@ enum batadv_orig_capabilities {
  1447. + BATADV_ORIG_CAPA_HAS_DAT,
  1448. + BATADV_ORIG_CAPA_HAS_NC,
  1449. + BATADV_ORIG_CAPA_HAS_TT,
  1450. +- BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
  1451. ++ BATADV_ORIG_CAPA_HAS_MCAST,
  1452. + };
  1453. +
  1454. + /**
  1455. +--
  1456. +2.1.4
  1457. +
  1458. diff --git a/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch
  1459. new file mode 100644
  1460. index 0000000..9fc9426
  1461. --- /dev/null
  1462. +++ b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch
  1463. @@ -0,0 +1,172 @@
  1464. +From 5ba3f1eac041857deabe39432fdfe1a584bbdd81 Mon Sep 17 00:00:00 2001
  1465. +Message-Id: <5ba3f1eac041857deabe39432fdfe1a584bbdd81.1420645650.git.mschiffer@universe-factory.net>
  1466. +From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
  1467. +Date: Tue, 24 Sep 2013 04:36:27 +0200
  1468. +Subject: [PATCH] batman-adv: introduce 'no_rebroadcast' option
  1469. +MIME-Version: 1.0
  1470. +Content-Type: text/plain; charset=UTF-8
  1471. +Content-Transfer-Encoding: 8bit
  1472. +
  1473. +This patch introduces a new sysfs option named "no_rebroadcast" on
  1474. +a per hard interface basis. It allows manually enabling a split-horizon
  1475. +like behaviour for the layer 2 multicast payload frames, in that
  1476. +incoming multicast payload frames on such a hard interface are only
  1477. +being rebroadcasted on all interfaces except the incoming one instead
  1478. +of being rebroadcasted on all interfaces.
  1479. +
  1480. +Such an option should only be enabled if you are certain that these
  1481. +rebroadcasts are unnecessary. This is usually the case for instance
  1482. +for point-to-point wifi longshots or wired links.
  1483. +
  1484. +This option can especially safe a significant amount of upload overhead
  1485. +if the neighbourhood on a link is rather large, for instance in some
  1486. +transitive, symmetric VPN configurations.
  1487. +
  1488. +Using this option wrongly will break your mesh network, use this option
  1489. +wisely and at your own risk!
  1490. +
  1491. +Signed-off-by: Linus Lüssing <linus.luessing@web.de>
  1492. +---
  1493. + hard-interface.c | 2 ++
  1494. + send.c | 4 ++++
  1495. + sysfs-class-net-batman-adv | 10 ++++++++
  1496. + sysfs.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++
  1497. + types.h | 1 +
  1498. + 5 files changed, 76 insertions(+)
  1499. +
  1500. +--- a/hard-interface.c
  1501. ++++ b/hard-interface.c
  1502. +@@ -592,6 +592,8 @@ batadv_hardif_add_interface(struct net_d
  1503. + /* extra reference for return */
  1504. + atomic_set(&hard_iface->refcount, 2);
  1505. +
  1506. ++ atomic_set(&hard_iface->no_rebroadcast, 0);
  1507. ++
  1508. + batadv_check_known_mac_addr(hard_iface->net_dev);
  1509. + list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
  1510. +
  1511. +--- a/send.c
  1512. ++++ b/send.c
  1513. +@@ -513,6 +513,10 @@ static void batadv_send_outstanding_bcas
  1514. + if (forw_packet->num_packets >= hard_iface->num_bcasts)
  1515. + continue;
  1516. +
  1517. ++ if (atomic_read(&hard_iface->no_rebroadcast) &&
  1518. ++ forw_packet->skb->dev == hard_iface->net_dev)
  1519. ++ continue;
  1520. ++
  1521. + /* send a copy of the saved skb */
  1522. + skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
  1523. + if (skb1)
  1524. +--- a/sysfs-class-net-batman-adv
  1525. ++++ b/sysfs-class-net-batman-adv
  1526. +@@ -13,3 +13,13 @@ Description:
  1527. + displays the batman mesh interface this <iface>
  1528. + currently is associated with.
  1529. +
  1530. ++What: /sys/class/net/<iface>/batman-adv/no_rebroadcast
  1531. ++Date: Sep 2013
  1532. ++Contact: Linus Lüssing <linus.luessing@web.de>
  1533. ++Description:
  1534. ++ With this option set incoming multicast payload frames on
  1535. ++ <iface> are not being rebroadcasted on <iface> again. This
  1536. ++ option should be set on links which are known to be transitive
  1537. ++ and symmetric only, for instance point-to-point wifi longshots
  1538. ++ or wired links. Using this option wrongly is going to
  1539. ++ break your mesh network, use at your own risk!
  1540. +--- a/sysfs.c
  1541. ++++ b/sysfs.c
  1542. +@@ -110,6 +110,17 @@ struct batadv_attribute batadv_attr_vlan
  1543. + .store = _store, \
  1544. + }
  1545. +
  1546. ++/* Use this, if you have customized show and store functions
  1547. ++ * for hard interface attrs
  1548. ++ */
  1549. ++#define BATADV_ATTR_HIF(_name, _mode, _show, _store) \
  1550. ++struct batadv_attribute batadv_attr_hif_##_name = { \
  1551. ++ .attr = {.name = __stringify(_name), \
  1552. ++ .mode = _mode }, \
  1553. ++ .show = _show, \
  1554. ++ .store = _store, \
  1555. ++};
  1556. ++
  1557. + /* Use this, if you have customized show and store functions */
  1558. + #define BATADV_ATTR(_name, _mode, _show, _store) \
  1559. + struct batadv_attribute batadv_attr_##_name = { \
  1560. +@@ -220,6 +231,52 @@ ssize_t batadv_show_vlan_##_name(struct
  1561. + static BATADV_ATTR_VLAN(_name, _mode, batadv_show_vlan_##_name, \
  1562. + batadv_store_vlan_##_name)
  1563. +
  1564. ++#define BATADV_ATTR_HIF_STORE_BOOL(_name, _post_func) \
  1565. ++ssize_t batadv_store_hif_##_name(struct kobject *kobj, \
  1566. ++ struct attribute *attr, char *buff, \
  1567. ++ size_t count) \
  1568. ++{ \
  1569. ++ struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
  1570. ++ struct batadv_hard_iface *hard_iface; \
  1571. ++ size_t res; \
  1572. ++ \
  1573. ++ hard_iface = batadv_hardif_get_by_netdev(net_dev); \
  1574. ++ if (!hard_iface) \
  1575. ++ return 0; \
  1576. ++ \
  1577. ++ res = __batadv_store_bool_attr(buff, count, _post_func, \
  1578. ++ attr, &hard_iface->_name, \
  1579. ++ hard_iface->soft_iface); \
  1580. ++ batadv_hardif_free_ref(hard_iface); \
  1581. ++ return res; \
  1582. ++}
  1583. ++
  1584. ++#define BATADV_ATTR_HIF_SHOW_BOOL(_name) \
  1585. ++ssize_t batadv_show_hif_##_name(struct kobject *kobj, \
  1586. ++ struct attribute *attr, char *buff) \
  1587. ++{ \
  1588. ++ struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
  1589. ++ struct batadv_hard_iface *hard_iface; \
  1590. ++ size_t res; \
  1591. ++ \
  1592. ++ hard_iface = batadv_hardif_get_by_netdev(net_dev); \
  1593. ++ if (!hard_iface) \
  1594. ++ return 0; \
  1595. ++ \
  1596. ++ res = sprintf(buff, "%s\n", \
  1597. ++ atomic_read(&hard_iface->_name) == 0 ? \
  1598. ++ "disabled" : "enabled"); \
  1599. ++ batadv_hardif_free_ref(hard_iface); \
  1600. ++ return res; \
  1601. ++}
  1602. ++
  1603. ++/* Use this, if you are going to turn a [name] in the vlan struct on or off */
  1604. ++#define BATADV_ATTR_HIF_BOOL(_name, _mode, _post_func) \
  1605. ++ static BATADV_ATTR_HIF_STORE_BOOL(_name, _post_func) \
  1606. ++ static BATADV_ATTR_HIF_SHOW_BOOL(_name) \
  1607. ++ static BATADV_ATTR_HIF(_name, _mode, batadv_show_hif_##_name, \
  1608. ++ batadv_store_hif_##_name)
  1609. ++
  1610. + static int batadv_store_bool_attr(char *buff, size_t count,
  1611. + struct net_device *net_dev,
  1612. + const char *attr_name, atomic_t *attr)
  1613. +@@ -843,10 +900,12 @@ static ssize_t batadv_show_iface_status(
  1614. + static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface,
  1615. + batadv_store_mesh_iface);
  1616. + static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL);
  1617. ++BATADV_ATTR_HIF_BOOL(no_rebroadcast, S_IRUGO | S_IWUSR, NULL);
  1618. +
  1619. + static struct batadv_attribute *batadv_batman_attrs[] = {
  1620. + &batadv_attr_mesh_iface,
  1621. + &batadv_attr_iface_status,
  1622. ++ &batadv_attr_hif_no_rebroadcast,
  1623. + NULL,
  1624. + };
  1625. +
  1626. +--- a/types.h
  1627. ++++ b/types.h
  1628. +@@ -101,6 +101,7 @@ struct batadv_hard_iface {
  1629. + struct batadv_hard_iface_bat_iv bat_iv;
  1630. + struct work_struct cleanup_work;
  1631. + struct dentry *debug_dir;
  1632. ++ atomic_t no_rebroadcast;
  1633. + };
  1634. +
  1635. + /**
  1636. diff --git a/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch b/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch
  1637. new file mode 100644
  1638. index 0000000..a93b9fa
  1639. --- /dev/null
  1640. +++ b/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch
  1641. @@ -0,0 +1,11 @@
  1642. +--- a/main.h
  1643. ++++ b/main.h
  1644. +@@ -148,7 +148,7 @@ enum batadv_uev_type {
  1645. + /* Maximum number of fragments for one packet */
  1646. + #define BATADV_FRAG_MAX_FRAGMENTS 16
  1647. + /* Maxumim size of each fragment */
  1648. +-#define BATADV_FRAG_MAX_FRAG_SIZE 1400
  1649. ++#define BATADV_FRAG_MAX_FRAG_SIZE 1280
  1650. + /* Time to keep fragments while waiting for rest of the fragments */
  1651. + #define BATADV_FRAG_TIMEOUT 10000
  1652. +