272-batman-adv-Remove-kernel-fixed-width-types-in-packet.patch 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. From: Sven Eckelmann <sven.eckelmann@openmesh.com>
  2. Date: Thu, 21 Dec 2017 10:17:40 +0100
  3. Subject: [PATCH] batman-adv: Remove kernel fixed width types in packet.h
  4. The uapi headers use the __u8/__u16/... version of the fixed width types
  5. instead of u8/u16/... The use of the latter must be avoided before
  6. packet.h is copied to include/uapi/linux/.
  7. Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
  8. Signed-off-by: David S. Miller <davem@davemloft.net>
  9. ---
  10. --- a/net/batman-adv/packet.h
  11. +++ b/net/batman-adv/packet.h
  12. @@ -22,7 +22,7 @@
  13. #include <linux/if_ether.h>
  14. #include <linux/types.h>
  15. -#define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
  16. +#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0)
  17. /**
  18. * enum batadv_packettype - types for batman-adv encapsulated packets
  19. @@ -169,8 +169,8 @@ enum batadv_tvlv_type {
  20. * transport the claim type and the group id
  21. */
  22. struct batadv_bla_claim_dst {
  23. - u8 magic[3]; /* FF:43:05 */
  24. - u8 type; /* bla_claimframe */
  25. + __u8 magic[3]; /* FF:43:05 */
  26. + __u8 type; /* bla_claimframe */
  27. __be16 group; /* group id */
  28. };
  29. @@ -190,15 +190,15 @@ struct batadv_bla_claim_dst {
  30. * @tvlv_len: length of tvlv data following the ogm header
  31. */
  32. struct batadv_ogm_packet {
  33. - u8 packet_type;
  34. - u8 version;
  35. - u8 ttl;
  36. - u8 flags;
  37. + __u8 packet_type;
  38. + __u8 version;
  39. + __u8 ttl;
  40. + __u8 flags;
  41. __be32 seqno;
  42. - u8 orig[ETH_ALEN];
  43. - u8 prev_sender[ETH_ALEN];
  44. - u8 reserved;
  45. - u8 tq;
  46. + __u8 orig[ETH_ALEN];
  47. + __u8 prev_sender[ETH_ALEN];
  48. + __u8 reserved;
  49. + __u8 tq;
  50. __be16 tvlv_len;
  51. /* __packed is not needed as the struct size is divisible by 4,
  52. * and the largest data type in this struct has a size of 4.
  53. @@ -219,12 +219,12 @@ struct batadv_ogm_packet {
  54. * @throughput: the currently flooded path throughput
  55. */
  56. struct batadv_ogm2_packet {
  57. - u8 packet_type;
  58. - u8 version;
  59. - u8 ttl;
  60. - u8 flags;
  61. + __u8 packet_type;
  62. + __u8 version;
  63. + __u8 ttl;
  64. + __u8 flags;
  65. __be32 seqno;
  66. - u8 orig[ETH_ALEN];
  67. + __u8 orig[ETH_ALEN];
  68. __be16 tvlv_len;
  69. __be32 throughput;
  70. /* __packed is not needed as the struct size is divisible by 4,
  71. @@ -243,9 +243,9 @@ struct batadv_ogm2_packet {
  72. * @elp_interval: currently used ELP sending interval in ms
  73. */
  74. struct batadv_elp_packet {
  75. - u8 packet_type;
  76. - u8 version;
  77. - u8 orig[ETH_ALEN];
  78. + __u8 packet_type;
  79. + __u8 version;
  80. + __u8 orig[ETH_ALEN];
  81. __be32 seqno;
  82. __be32 elp_interval;
  83. };
  84. @@ -268,14 +268,14 @@ struct batadv_elp_packet {
  85. * members are padded the same way as they are in real packets.
  86. */
  87. struct batadv_icmp_header {
  88. - u8 packet_type;
  89. - u8 version;
  90. - u8 ttl;
  91. - u8 msg_type; /* see ICMP message types above */
  92. - u8 dst[ETH_ALEN];
  93. - u8 orig[ETH_ALEN];
  94. - u8 uid;
  95. - u8 align[3];
  96. + __u8 packet_type;
  97. + __u8 version;
  98. + __u8 ttl;
  99. + __u8 msg_type; /* see ICMP message types above */
  100. + __u8 dst[ETH_ALEN];
  101. + __u8 orig[ETH_ALEN];
  102. + __u8 uid;
  103. + __u8 align[3];
  104. };
  105. /**
  106. @@ -291,14 +291,14 @@ struct batadv_icmp_header {
  107. * @seqno: ICMP sequence number
  108. */
  109. struct batadv_icmp_packet {
  110. - u8 packet_type;
  111. - u8 version;
  112. - u8 ttl;
  113. - u8 msg_type; /* see ICMP message types above */
  114. - u8 dst[ETH_ALEN];
  115. - u8 orig[ETH_ALEN];
  116. - u8 uid;
  117. - u8 reserved;
  118. + __u8 packet_type;
  119. + __u8 version;
  120. + __u8 ttl;
  121. + __u8 msg_type; /* see ICMP message types above */
  122. + __u8 dst[ETH_ALEN];
  123. + __u8 orig[ETH_ALEN];
  124. + __u8 uid;
  125. + __u8 reserved;
  126. __be16 seqno;
  127. };
  128. @@ -320,15 +320,15 @@ struct batadv_icmp_packet {
  129. * store it using network order
  130. */
  131. struct batadv_icmp_tp_packet {
  132. - u8 packet_type;
  133. - u8 version;
  134. - u8 ttl;
  135. - u8 msg_type; /* see ICMP message types above */
  136. - u8 dst[ETH_ALEN];
  137. - u8 orig[ETH_ALEN];
  138. - u8 uid;
  139. - u8 subtype;
  140. - u8 session[2];
  141. + __u8 packet_type;
  142. + __u8 version;
  143. + __u8 ttl;
  144. + __u8 msg_type; /* see ICMP message types above */
  145. + __u8 dst[ETH_ALEN];
  146. + __u8 orig[ETH_ALEN];
  147. + __u8 uid;
  148. + __u8 subtype;
  149. + __u8 session[2];
  150. __be32 seqno;
  151. __be32 timestamp;
  152. };
  153. @@ -359,16 +359,16 @@ enum batadv_icmp_tp_subtype {
  154. * @rr: route record array
  155. */
  156. struct batadv_icmp_packet_rr {
  157. - u8 packet_type;
  158. - u8 version;
  159. - u8 ttl;
  160. - u8 msg_type; /* see ICMP message types above */
  161. - u8 dst[ETH_ALEN];
  162. - u8 orig[ETH_ALEN];
  163. - u8 uid;
  164. - u8 rr_cur;
  165. + __u8 packet_type;
  166. + __u8 version;
  167. + __u8 ttl;
  168. + __u8 msg_type; /* see ICMP message types above */
  169. + __u8 dst[ETH_ALEN];
  170. + __u8 orig[ETH_ALEN];
  171. + __u8 uid;
  172. + __u8 rr_cur;
  173. __be16 seqno;
  174. - u8 rr[BATADV_RR_LEN][ETH_ALEN];
  175. + __u8 rr[BATADV_RR_LEN][ETH_ALEN];
  176. };
  177. #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
  178. @@ -394,11 +394,11 @@ struct batadv_icmp_packet_rr {
  179. * @dest: originator destination of the unicast packet
  180. */
  181. struct batadv_unicast_packet {
  182. - u8 packet_type;
  183. - u8 version;
  184. - u8 ttl;
  185. - u8 ttvn; /* destination translation table version number */
  186. - u8 dest[ETH_ALEN];
  187. + __u8 packet_type;
  188. + __u8 version;
  189. + __u8 ttl;
  190. + __u8 ttvn; /* destination translation table version number */
  191. + __u8 dest[ETH_ALEN];
  192. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  193. * following ethernet header again 4 bytes boundary aligned
  194. */
  195. @@ -413,9 +413,9 @@ struct batadv_unicast_packet {
  196. */
  197. struct batadv_unicast_4addr_packet {
  198. struct batadv_unicast_packet u;
  199. - u8 src[ETH_ALEN];
  200. - u8 subtype;
  201. - u8 reserved;
  202. + __u8 src[ETH_ALEN];
  203. + __u8 subtype;
  204. + __u8 reserved;
  205. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  206. * following ethernet header again 4 bytes boundary aligned
  207. */
  208. @@ -435,22 +435,22 @@ struct batadv_unicast_4addr_packet {
  209. * @total_size: size of the merged packet
  210. */
  211. struct batadv_frag_packet {
  212. - u8 packet_type;
  213. - u8 version; /* batman version field */
  214. - u8 ttl;
  215. + __u8 packet_type;
  216. + __u8 version; /* batman version field */
  217. + __u8 ttl;
  218. #if defined(__BIG_ENDIAN_BITFIELD)
  219. - u8 no:4;
  220. - u8 priority:3;
  221. - u8 reserved:1;
  222. + __u8 no:4;
  223. + __u8 priority:3;
  224. + __u8 reserved:1;
  225. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  226. - u8 reserved:1;
  227. - u8 priority:3;
  228. - u8 no:4;
  229. + __u8 reserved:1;
  230. + __u8 priority:3;
  231. + __u8 no:4;
  232. #else
  233. #error "unknown bitfield endianness"
  234. #endif
  235. - u8 dest[ETH_ALEN];
  236. - u8 orig[ETH_ALEN];
  237. + __u8 dest[ETH_ALEN];
  238. + __u8 orig[ETH_ALEN];
  239. __be16 seqno;
  240. __be16 total_size;
  241. };
  242. @@ -465,12 +465,12 @@ struct batadv_frag_packet {
  243. * @orig: originator of the broadcast packet
  244. */
  245. struct batadv_bcast_packet {
  246. - u8 packet_type;
  247. - u8 version; /* batman version field */
  248. - u8 ttl;
  249. - u8 reserved;
  250. + __u8 packet_type;
  251. + __u8 version; /* batman version field */
  252. + __u8 ttl;
  253. + __u8 reserved;
  254. __be32 seqno;
  255. - u8 orig[ETH_ALEN];
  256. + __u8 orig[ETH_ALEN];
  257. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  258. * following ethernet header again 4 bytes boundary aligned
  259. */
  260. @@ -494,19 +494,19 @@ struct batadv_bcast_packet {
  261. * @coded_len: length of network coded part of the payload
  262. */
  263. struct batadv_coded_packet {
  264. - u8 packet_type;
  265. - u8 version; /* batman version field */
  266. - u8 ttl;
  267. - u8 first_ttvn;
  268. - /* u8 first_dest[ETH_ALEN]; - saved in mac header destination */
  269. - u8 first_source[ETH_ALEN];
  270. - u8 first_orig_dest[ETH_ALEN];
  271. + __u8 packet_type;
  272. + __u8 version; /* batman version field */
  273. + __u8 ttl;
  274. + __u8 first_ttvn;
  275. + /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */
  276. + __u8 first_source[ETH_ALEN];
  277. + __u8 first_orig_dest[ETH_ALEN];
  278. __be32 first_crc;
  279. - u8 second_ttl;
  280. - u8 second_ttvn;
  281. - u8 second_dest[ETH_ALEN];
  282. - u8 second_source[ETH_ALEN];
  283. - u8 second_orig_dest[ETH_ALEN];
  284. + __u8 second_ttl;
  285. + __u8 second_ttvn;
  286. + __u8 second_dest[ETH_ALEN];
  287. + __u8 second_source[ETH_ALEN];
  288. + __u8 second_orig_dest[ETH_ALEN];
  289. __be32 second_crc;
  290. __be16 coded_len;
  291. };
  292. @@ -525,14 +525,14 @@ struct batadv_coded_packet {
  293. * @align: 2 bytes to align the header to a 4 byte boundary
  294. */
  295. struct batadv_unicast_tvlv_packet {
  296. - u8 packet_type;
  297. - u8 version; /* batman version field */
  298. - u8 ttl;
  299. - u8 reserved;
  300. - u8 dst[ETH_ALEN];
  301. - u8 src[ETH_ALEN];
  302. + __u8 packet_type;
  303. + __u8 version; /* batman version field */
  304. + __u8 ttl;
  305. + __u8 reserved;
  306. + __u8 dst[ETH_ALEN];
  307. + __u8 src[ETH_ALEN];
  308. __be16 tvlv_len;
  309. - u16 align;
  310. + __u16 align;
  311. };
  312. /**
  313. @@ -542,8 +542,8 @@ struct batadv_unicast_tvlv_packet {
  314. * @len: tvlv container length
  315. */
  316. struct batadv_tvlv_hdr {
  317. - u8 type;
  318. - u8 version;
  319. + __u8 type;
  320. + __u8 version;
  321. __be16 len;
  322. };
  323. @@ -566,8 +566,8 @@ struct batadv_tvlv_gateway_data {
  324. * one batadv_tvlv_tt_vlan_data object per announced vlan
  325. */
  326. struct batadv_tvlv_tt_data {
  327. - u8 flags;
  328. - u8 ttvn;
  329. + __u8 flags;
  330. + __u8 ttvn;
  331. __be16 num_vlan;
  332. };
  333. @@ -581,7 +581,7 @@ struct batadv_tvlv_tt_data {
  334. struct batadv_tvlv_tt_vlan_data {
  335. __be32 crc;
  336. __be16 vid;
  337. - u16 reserved;
  338. + __u16 reserved;
  339. };
  340. /**
  341. @@ -593,9 +593,9 @@ struct batadv_tvlv_tt_vlan_data {
  342. * @vid: VLAN identifier
  343. */
  344. struct batadv_tvlv_tt_change {
  345. - u8 flags;
  346. - u8 reserved[3];
  347. - u8 addr[ETH_ALEN];
  348. + __u8 flags;
  349. + __u8 reserved[3];
  350. + __u8 addr[ETH_ALEN];
  351. __be16 vid;
  352. };
  353. @@ -605,7 +605,7 @@ struct batadv_tvlv_tt_change {
  354. * @vid: VLAN identifier
  355. */
  356. struct batadv_tvlv_roam_adv {
  357. - u8 client[ETH_ALEN];
  358. + __u8 client[ETH_ALEN];
  359. __be16 vid;
  360. };
  361. @@ -615,8 +615,8 @@ struct batadv_tvlv_roam_adv {
  362. * @reserved: reserved field
  363. */
  364. struct batadv_tvlv_mcast_data {
  365. - u8 flags;
  366. - u8 reserved[3];
  367. + __u8 flags;
  368. + __u8 reserved[3];
  369. };
  370. #endif /* _NET_BATMAN_ADV_PACKET_H_ */