From 52583dbb14130550852fee5011085ed4343911f3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 7 Jan 2010 19:20:31 +0100 Subject: libc/uClibc: add patch to fix IP frames on BE targets Pack netinet structs to be possible to use for creating IP frames on big-endian targets. Signed-off-by: Joachim Nilsson [yann.morin.1998@anciens.enib.fr: removed getline patch, already in] Signed-off-by: "Yann E. MORIN" (transplanted from 5c246abe7716271c0ce31d980d92eb9a304995c8) diff --git a/patches/uClibc/0.9.30.1/200-pack-netinet-structs.patch b/patches/uClibc/0.9.30.1/200-pack-netinet-structs.patch new file mode 100644 index 0000000..d727f4d --- /dev/null +++ b/patches/uClibc/0.9.30.1/200-pack-netinet-structs.patch @@ -0,0 +1,224 @@ +diff -urN uClibc-0.9.30.1.orig/include/netinet/igmp.h uClibc-0.9.30.1/include/netinet/igmp.h +--- uClibc-0.9.30.1.orig/include/netinet/igmp.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/igmp.h 2009-04-08 09:00:26.242514273 +0200 +@@ -69,7 +69,7 @@ + u_int8_t igmp_code; /* routing code */ + u_int16_t igmp_cksum; /* checksum */ + struct in_addr igmp_group; /* group address */ +-}; ++} __attribute__ ((__packed__)); + + #define IGMP_MINLEN 8 + +diff -urN uClibc-0.9.30.1.orig/include/netinet/in.h uClibc-0.9.30.1/include/netinet/in.h +--- uClibc-0.9.30.1.orig/include/netinet/in.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/in.h 2009-04-08 09:00:26.242514273 +0200 +@@ -202,7 +202,7 @@ + #define s6_addr in6_u.u6_addr8 + #define s6_addr16 in6_u.u6_addr16 + #define s6_addr32 in6_u.u6_addr32 +- }; ++ } __attribute__ ((__packed__)); + + extern const struct in6_addr in6addr_any; /* :: */ + extern const struct in6_addr in6addr_loopback; /* ::1 */ +@@ -229,7 +229,7 @@ + __SOCKADDR_COMMON_SIZE - + sizeof (in_port_t) - + sizeof (struct in_addr)]; +- }; ++ } __attribute__ ((__packed__)); + #endif + + /* Ditto, for IPv6. */ +@@ -240,7 +240,7 @@ + uint32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + uint32_t sin6_scope_id; /* IPv6 scope-id */ +- }; ++ } __attribute__ ((__packed__)); + + + /* IPv4 multicast request. */ +@@ -251,7 +251,7 @@ + + /* Local IP address of interface. */ + struct in_addr imr_interface; +- }; ++ } __attribute__ ((__packed__)); + + struct ip_mreq_source + { +@@ -263,7 +263,7 @@ + + /* IP address of interface. */ + struct in_addr imr_sourceaddr; +- }; ++ } __attribute__ ((__packed__)); + + /* Likewise, for IPv6. */ + struct ipv6_mreq +@@ -273,7 +273,7 @@ + + /* local interface */ + unsigned int ipv6mr_interface; +- }; ++ } __attribute__ ((__packed__)); + + + /* Multicast group request. */ +@@ -284,7 +284,7 @@ + + /* Group address. */ + struct sockaddr_storage gr_group; +- }; ++ } __attribute__ ((__packed__)); + + struct group_source_req + { +@@ -296,7 +296,7 @@ + + /* Source address. */ + struct sockaddr_storage gsr_source; +- }; ++ } __attribute__ ((__packed__)); + + + /* Full-state filter operations. */ +@@ -315,7 +315,7 @@ + uint32_t imsf_numsrc; + /* Source addresses. */ + struct in_addr imsf_slist[1]; +- }; ++ } __attribute__ ((__packed__)); + + #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \ + - sizeof (struct in_addr) \ +@@ -336,7 +336,7 @@ + uint32_t gf_numsrc; + /* Source addresses. */ + struct sockaddr_storage gf_slist[1]; +-}; ++} __attribute__ ((__packed__)); + + #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \ + - sizeof (struct sockaddr_storage) \ +@@ -460,14 +460,14 @@ + { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ +- }; ++ } __attribute__ ((__packed__)); + + /* IPv6 MTU information. */ + struct ip6_mtuinfo + { + struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ + uint32_t ip6m_mtu; /* path MTU in host byte order */ +- }; ++ } __attribute__ ((__packed__)); + + + #if 0 /*def __USE_GNU*/ +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip.h uClibc-0.9.30.1/include/netinet/ip.h +--- uClibc-0.9.30.1.orig/include/netinet/ip.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/ip.h 2009-04-08 09:00:26.242514273 +0200 +@@ -63,7 +63,7 @@ + u_int32_t saddr; + u_int32_t daddr; + /*The options start here. */ +- }; ++ } __attribute__ ((__packed__)); + + #ifdef __USE_BSD + /* +@@ -127,7 +127,7 @@ + u_int8_t ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +- }; ++ } __attribute__ ((__packed__)); + + /* + * Time stamp option structure. +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h uClibc-0.9.30.1/include/netinet/ip_icmp.h +--- uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/ip_icmp.h 2009-04-08 09:00:26.242514273 +0200 +@@ -43,7 +43,7 @@ + u_int16_t mtu; + } frag; /* path mtu discovery */ + } un; +-}; ++} __attribute__ ((__packed__)); + + #define ICMP_ECHOREPLY 0 /* Echo Reply */ + #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ +@@ -199,7 +199,7 @@ + #define icmp_radv icmp_dun.id_radv + #define icmp_mask icmp_dun.id_mask + #define icmp_data icmp_dun.id_data +-}; ++} __attribute__ ((__packed__)); + + /* + * Lower bounds on packet lengths for various types. +diff -urN uClibc-0.9.30.1.orig/include/netinet/tcp.h uClibc-0.9.30.1/include/netinet/tcp.h +--- uClibc-0.9.30.1.orig/include/netinet/tcp.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/tcp.h 2009-04-08 09:00:26.242514273 +0200 +@@ -86,7 +86,7 @@ + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ +-}; ++} __attribute__ ((__packed__)); + + # else /* !__FAVOR_BSD */ + struct tcphdr +@@ -121,7 +121,7 @@ + u_int16_t window; + u_int16_t check; + u_int16_t urg_ptr; +-}; ++} __attribute__ ((__packed__)); + # endif /* __FAVOR_BSD */ + + enum +@@ -226,7 +226,7 @@ + u_int32_t tcpi_rcv_space; + + u_int32_t tcpi_total_retrans; +-}; ++} __attribute__ ((__packed__)); + + + /* For TCP_MD5SIG socket option. */ +@@ -239,7 +239,7 @@ + u_int16_t tcpm_keylen; /* Key length. */ + u_int32_t __tcpm_pad2; /* Zero. */ + u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ +-}; ++} __attribute__ ((__packed__)); + + #endif /* Misc. */ + +diff -urN uClibc-0.9.30.1.orig/include/netinet/udp.h uClibc-0.9.30.1/include/netinet/udp.h +--- uClibc-0.9.30.1.orig/include/netinet/udp.h 2009-04-08 09:00:10.926545132 +0200 ++++ uClibc-0.9.30.1/include/netinet/udp.h 2009-04-08 09:00:26.242514273 +0200 +@@ -61,7 +61,7 @@ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ +-}; ++} __attribute__ ((__packed__)); + + #else + +@@ -71,7 +71,7 @@ + u_int16_t dest; + u_int16_t len; + u_int16_t check; +-}; ++} __attribute__ ((__packed__)); + #endif + + #define SOL_UDP 17 /* sockopt level for UDP */ -- cgit v0.10.2-6-g49f6