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
5 The uapi headers use the __u8/__u16/... version of the fixed width types
6 instead of u8/u16/... The use of the latter must be avoided before
7 packet.h is copied to include/uapi/linux/.
9 Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
10 Signed-off-by: David S. Miller <davem@davemloft.net>
13 --- a/net/batman-adv/packet.h
14 +++ b/net/batman-adv/packet.h
16 #include <linux/if_ether.h>
17 #include <linux/types.h>
19 -#define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
20 +#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0)
23 * enum batadv_packettype - types for batman-adv encapsulated packets
24 @@ -169,8 +169,8 @@ enum batadv_tvlv_type {
25 * transport the claim type and the group id
27 struct batadv_bla_claim_dst {
28 - u8 magic[3]; /* FF:43:05 */
29 - u8 type; /* bla_claimframe */
30 + __u8 magic[3]; /* FF:43:05 */
31 + __u8 type; /* bla_claimframe */
32 __be16 group; /* group id */
35 @@ -190,15 +190,15 @@ struct batadv_bla_claim_dst {
36 * @tvlv_len: length of tvlv data following the ogm header
38 struct batadv_ogm_packet {
49 - u8 prev_sender[ETH_ALEN];
52 + __u8 orig[ETH_ALEN];
53 + __u8 prev_sender[ETH_ALEN];
57 /* __packed is not needed as the struct size is divisible by 4,
58 * and the largest data type in this struct has a size of 4.
59 @@ -219,12 +219,12 @@ struct batadv_ogm_packet {
60 * @throughput: the currently flooded path throughput
62 struct batadv_ogm2_packet {
73 + __u8 orig[ETH_ALEN];
76 /* __packed is not needed as the struct size is divisible by 4,
77 @@ -243,9 +243,9 @@ struct batadv_ogm2_packet {
78 * @elp_interval: currently used ELP sending interval in ms
80 struct batadv_elp_packet {
86 + __u8 orig[ETH_ALEN];
90 @@ -268,14 +268,14 @@ struct batadv_elp_packet {
91 * members are padded the same way as they are in real packets.
93 struct batadv_icmp_header {
97 - u8 msg_type; /* see ICMP message types above */
105 + __u8 msg_type; /* see ICMP message types above */
106 + __u8 dst[ETH_ALEN];
107 + __u8 orig[ETH_ALEN];
113 @@ -291,14 +291,14 @@ struct batadv_icmp_header {
114 * @seqno: ICMP sequence number
116 struct batadv_icmp_packet {
120 - u8 msg_type; /* see ICMP message types above */
128 + __u8 msg_type; /* see ICMP message types above */
129 + __u8 dst[ETH_ALEN];
130 + __u8 orig[ETH_ALEN];
136 @@ -320,15 +320,15 @@ struct batadv_icmp_packet {
137 * store it using network order
139 struct batadv_icmp_tp_packet {
143 - u8 msg_type; /* see ICMP message types above */
152 + __u8 msg_type; /* see ICMP message types above */
153 + __u8 dst[ETH_ALEN];
154 + __u8 orig[ETH_ALEN];
161 @@ -359,16 +359,16 @@ enum batadv_icmp_tp_subtype {
162 * @rr: route record array
164 struct batadv_icmp_packet_rr {
168 - u8 msg_type; /* see ICMP message types above */
176 + __u8 msg_type; /* see ICMP message types above */
177 + __u8 dst[ETH_ALEN];
178 + __u8 orig[ETH_ALEN];
182 - u8 rr[BATADV_RR_LEN][ETH_ALEN];
183 + __u8 rr[BATADV_RR_LEN][ETH_ALEN];
186 #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
187 @@ -394,11 +394,11 @@ struct batadv_icmp_packet_rr {
188 * @dest: originator destination of the unicast packet
190 struct batadv_unicast_packet {
194 - u8 ttvn; /* destination translation table version number */
199 + __u8 ttvn; /* destination translation table version number */
200 + __u8 dest[ETH_ALEN];
201 /* "4 bytes boundary + 2 bytes" long to make the payload after the
202 * following ethernet header again 4 bytes boundary aligned
204 @@ -413,9 +413,9 @@ struct batadv_unicast_packet {
206 struct batadv_unicast_4addr_packet {
207 struct batadv_unicast_packet u;
211 + __u8 src[ETH_ALEN];
214 /* "4 bytes boundary + 2 bytes" long to make the payload after the
215 * following ethernet header again 4 bytes boundary aligned
217 @@ -435,22 +435,22 @@ struct batadv_unicast_4addr_packet {
218 * @total_size: size of the merged packet
220 struct batadv_frag_packet {
222 - u8 version; /* batman version field */
225 + __u8 version; /* batman version field */
227 #if defined(__BIG_ENDIAN_BITFIELD)
234 #elif defined(__LITTLE_ENDIAN_BITFIELD)
242 #error "unknown bitfield endianness"
246 + __u8 dest[ETH_ALEN];
247 + __u8 orig[ETH_ALEN];
251 @@ -465,12 +465,12 @@ struct batadv_frag_packet {
252 * @orig: originator of the broadcast packet
254 struct batadv_bcast_packet {
256 - u8 version; /* batman version field */
260 + __u8 version; /* batman version field */
265 + __u8 orig[ETH_ALEN];
266 /* "4 bytes boundary + 2 bytes" long to make the payload after the
267 * following ethernet header again 4 bytes boundary aligned
269 @@ -494,19 +494,19 @@ struct batadv_bcast_packet {
270 * @coded_len: length of network coded part of the payload
272 struct batadv_coded_packet {
274 - u8 version; /* batman version field */
277 - /* u8 first_dest[ETH_ALEN]; - saved in mac header destination */
278 - u8 first_source[ETH_ALEN];
279 - u8 first_orig_dest[ETH_ALEN];
281 + __u8 version; /* batman version field */
284 + /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */
285 + __u8 first_source[ETH_ALEN];
286 + __u8 first_orig_dest[ETH_ALEN];
290 - u8 second_dest[ETH_ALEN];
291 - u8 second_source[ETH_ALEN];
292 - u8 second_orig_dest[ETH_ALEN];
295 + __u8 second_dest[ETH_ALEN];
296 + __u8 second_source[ETH_ALEN];
297 + __u8 second_orig_dest[ETH_ALEN];
301 @@ -525,14 +525,14 @@ struct batadv_coded_packet {
302 * @align: 2 bytes to align the header to a 4 byte boundary
304 struct batadv_unicast_tvlv_packet {
306 - u8 version; /* batman version field */
312 + __u8 version; /* batman version field */
315 + __u8 dst[ETH_ALEN];
316 + __u8 src[ETH_ALEN];
323 @@ -542,8 +542,8 @@ struct batadv_unicast_tvlv_packet {
324 * @len: tvlv container length
326 struct batadv_tvlv_hdr {
334 @@ -566,8 +566,8 @@ struct batadv_tvlv_gateway_data {
335 * one batadv_tvlv_tt_vlan_data object per announced vlan
337 struct batadv_tvlv_tt_data {
345 @@ -581,7 +581,7 @@ struct batadv_tvlv_tt_data {
346 struct batadv_tvlv_tt_vlan_data {
354 @@ -593,9 +593,9 @@ struct batadv_tvlv_tt_vlan_data {
355 * @vid: VLAN identifier
357 struct batadv_tvlv_tt_change {
363 + __u8 addr[ETH_ALEN];
367 @@ -605,7 +605,7 @@ struct batadv_tvlv_tt_change {
368 * @vid: VLAN identifier
370 struct batadv_tvlv_roam_adv {
371 - u8 client[ETH_ALEN];
372 + __u8 client[ETH_ALEN];
376 @@ -615,8 +615,8 @@ struct batadv_tvlv_roam_adv {
377 * @reserved: reserved field
379 struct batadv_tvlv_mcast_data {
386 #endif /* _NET_BATMAN_ADV_PACKET_H_ */