* [Buildroot] [PATCH] batctl: fix musl builds
@ 2015-03-27 17:04 Alex Suykov
2015-03-30 21:10 ` Thomas Petazzoni
0 siblings, 1 reply; 3+ messages in thread
From: Alex Suykov @ 2015-03-27 17:04 UTC (permalink / raw)
To: buildroot
Fixes
http://autobuild.buildroot.net/results/0701b880d0f82ef92d742346bfa97bb2af216ed3/
Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
---
package/batctl/0001-musl-netinet.patch | 192 +++++++++++++++++++++++++++++++++
1 file changed, 192 insertions(+)
create mode 100644 package/batctl/0001-musl-netinet.patch
diff --git a/package/batctl/0001-musl-netinet.patch b/package/batctl/0001-musl-netinet.patch
new file mode 100644
index 0000000..b9f605a
--- /dev/null
+++ b/package/batctl/0001-musl-netinet.patch
@@ -0,0 +1,192 @@
+musl does not allow including netinet/* and linux/* headers together.
+batctl includes netinet/if_ether.h indirectly via net/ethernet.h,
+so netinet/if_ether.h must be used instead of linux/if_ether.h.
+
+__be16 and __be32 are linux-specific typedefs for uint16_t and
+uint32_t with __attribute__((bitwise)) that has no effect
+outside of the kernel.
+
+Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
+
+--- batctl-2014.4.0/ping.c
++++ batctl-2014.4.0/ping.c
+@@ -34,7 +34,7 @@
+ #include <stdint.h>
+ #include <sys/select.h>
+ #include <sys/time.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include "main.h"
+ #include "ping.h"
+--- batctl-2014.4.0/tcpdump.h
++++ batctl-2014.4.0/tcpdump.h
+@@ -23,7 +23,7 @@
+ #define _BATCTL_TCPDUMP_H
+
+ #include <netpacket/packet.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <net/if_arp.h>
+ #include <sys/types.h>
+ #include "main.h"
+--- batctl-2014.4.0/traceroute.c
++++ batctl-2014.4.0/traceroute.c
+@@ -28,7 +28,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <string.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <stddef.h>
+ #include <sys/select.h>
+ #include <sys/time.h>
+--- batctl-2014.4.0/packet.h
++++ batctl-2014.4.0/packet.h
+@@ -196,7 +196,7 @@
+ struct batadv_bla_claim_dst {
+ uint8_t magic[3]; /* FF:43:05 */
+ uint8_t type; /* bla_claimframe */
+- __be16 group; /* group id */
++ uint16_t group; /* group id */
+ };
+ #pragma pack()
+
+@@ -213,12 +213,12 @@
+ uint8_t version;
+ uint8_t ttl;
+ uint8_t flags;
+- __be32 seqno;
++ uint32_t seqno;
+ uint8_t orig[ETH_ALEN];
+ uint8_t prev_sender[ETH_ALEN];
+ uint8_t reserved;
+ uint8_t tq;
+- __be16 tvlv_len;
++ uint16_t tvlv_len;
+ /* __packed is not needed as the struct size is divisible by 4,
+ * and the largest data type in this struct has a size of 4.
+ */
+@@ -273,7 +273,7 @@
+ uint8_t orig[ETH_ALEN];
+ uint8_t uid;
+ uint8_t reserved;
+- __be16 seqno;
++ uint16_t seqno;
+ };
+
+ #define BATADV_RR_LEN 16
+@@ -300,7 +300,7 @@
+ uint8_t orig[ETH_ALEN];
+ uint8_t uid;
+ uint8_t rr_cur;
+- __be16 seqno;
++ uint16_t seqno;
+ uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
+ };
+
+@@ -380,8 +380,8 @@
+ #endif
+ uint8_t dest[ETH_ALEN];
+ uint8_t orig[ETH_ALEN];
+- __be16 seqno;
+- __be16 total_size;
++ uint16_t seqno;
++ uint16_t total_size;
+ };
+
+ /**
+@@ -398,7 +398,7 @@
+ uint8_t version; /* batman version field */
+ uint8_t ttl;
+ uint8_t reserved;
+- __be32 seqno;
++ uint32_t seqno;
+ uint8_t orig[ETH_ALEN];
+ /* "4 bytes boundary + 2 bytes" long to make the payload after the
+ * following ethernet header again 4 bytes boundary aligned
+@@ -431,14 +431,14 @@
+ /* uint8_t first_dest[ETH_ALEN]; - saved in mac header destination */
+ uint8_t first_source[ETH_ALEN];
+ uint8_t first_orig_dest[ETH_ALEN];
+- __be32 first_crc;
++ uint32_t first_crc;
+ uint8_t second_ttl;
+ uint8_t second_ttvn;
+ uint8_t second_dest[ETH_ALEN];
+ uint8_t second_source[ETH_ALEN];
+ uint8_t second_orig_dest[ETH_ALEN];
+- __be32 second_crc;
+- __be16 coded_len;
++ uint32_t second_crc;
++ uint16_t coded_len;
+ };
+
+ #pragma pack()
+@@ -461,7 +461,7 @@
+ uint8_t reserved;
+ uint8_t dst[ETH_ALEN];
+ uint8_t src[ETH_ALEN];
+- __be16 tvlv_len;
++ uint16_t tvlv_len;
+ uint16_t align;
+ };
+
+@@ -474,7 +474,7 @@
+ struct batadv_tvlv_hdr {
+ uint8_t type;
+ uint8_t version;
+- __be16 len;
++ uint16_t len;
+ };
+
+ /**
+@@ -484,8 +484,8 @@
+ * @bandwidth_up: advertised uplink upload bandwidth
+ */
+ struct batadv_tvlv_gateway_data {
+- __be32 bandwidth_down;
+- __be32 bandwidth_up;
++ uint32_t bandwidth_down;
++ uint32_t bandwidth_up;
+ };
+
+ /**
+@@ -498,7 +498,7 @@
+ struct batadv_tvlv_tt_data {
+ uint8_t flags;
+ uint8_t ttvn;
+- __be16 num_vlan;
++ uint16_t num_vlan;
+ };
+
+ /**
+@@ -509,8 +509,8 @@
+ * @reserved: unused, useful for alignment purposes
+ */
+ struct batadv_tvlv_tt_vlan_data {
+- __be32 crc;
+- __be16 vid;
++ uint32_t crc;
++ uint16_t vid;
+ uint16_t reserved;
+ };
+
+@@ -526,7 +526,7 @@
+ uint8_t flags;
+ uint8_t reserved[3];
+ uint8_t addr[ETH_ALEN];
+- __be16 vid;
++ uint16_t vid;
+ };
+
+ /**
+@@ -536,7 +536,7 @@
+ */
+ struct batadv_tvlv_roam_adv {
+ uint8_t client[ETH_ALEN];
+- __be16 vid;
++ uint16_t vid;
+ };
+
+ /**
--
2.0.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Buildroot] [PATCH] batctl: fix musl builds
2015-03-27 17:04 [Buildroot] [PATCH] batctl: fix musl builds Alex Suykov
@ 2015-03-30 21:10 ` Thomas Petazzoni
2015-03-31 19:50 ` Alex Suykov
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2015-03-30 21:10 UTC (permalink / raw)
To: buildroot
Dear Alex Suykov,
On Fri, 27 Mar 2015 19:04:15 +0200, Alex Suykov wrote:
> diff --git a/package/batctl/0001-musl-netinet.patch b/package/batctl/0001-musl-netinet.patch
This patch is badly named: 0001-musl-netinet, while it also fixes
things unrelated to netinet: the __be16/__be32 types. So either name it
0001-musl-fixes, or better maybe, split it in two patches.
Also, can you submit the corresponding patches upstream?
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] batctl: fix musl builds
2015-03-30 21:10 ` Thomas Petazzoni
@ 2015-03-31 19:50 ` Alex Suykov
0 siblings, 0 replies; 3+ messages in thread
From: Alex Suykov @ 2015-03-31 19:50 UTC (permalink / raw)
To: buildroot
Mon, Mar 30, 2015 at 11:10:56PM +0200, Thomas Petazzoni wrote:
> > diff --git a/package/batctl/0001-musl-netinet.patch b/package/batctl/0001-musl-netinet.patch
>
> This patch is badly named: 0001-musl-netinet, while it also fixes
> things unrelated to netinet: the __be16/__be32 types. So either name it
> 0001-musl-fixes, or better maybe, split it in two patches.
Those are related changes actually. It looks like this:
linux/if_ether.h:
struct ethhdr { ... __be16 h_proto; }
netinet/if_ether.h (musl):
struct ethhdr { ... uint16_t h_proto; }
and that's where batctl code gets __be* types from if I got it right,
because it was written with linux/if_ether.h in mind.
Anyway, this is non-obvious and -musl-fixes.patch would work just as well,
so I'm sending v2 with the patch renamed.
> Also, can you submit the corresponding patches upstream?
No problem, patch sent upstream.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-31 19:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 17:04 [Buildroot] [PATCH] batctl: fix musl builds Alex Suykov
2015-03-30 21:10 ` Thomas Petazzoni
2015-03-31 19:50 ` Alex Suykov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox