libc/uClibc: add patch to fix IP frames on BE targets
authorJoachim Nilsson <jocke@vmlinux.org>
Thu Jan 07 19:20:31 2010 +0100 (2010-01-07)
changeset 17015c246abe7716
parent 1700 eccc37dd1a25
child 1702 eff73d8f3ce2
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 <jocke@vmlinux.org>
[yann.morin.1998@anciens.enib.fr: removed getline patch, already in]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
patches/uClibc/0.9.30.1/200-pack-netinet-structs.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.30.1/200-pack-netinet-structs.patch	Thu Jan 07 19:20:31 2010 +0100
     1.3 @@ -0,0 +1,224 @@
     1.4 +diff -urN uClibc-0.9.30.1.orig/include/netinet/igmp.h uClibc-0.9.30.1/include/netinet/igmp.h
     1.5 +--- uClibc-0.9.30.1.orig/include/netinet/igmp.h	2009-04-08 09:00:10.926545132 +0200
     1.6 ++++ uClibc-0.9.30.1/include/netinet/igmp.h	2009-04-08 09:00:26.242514273 +0200
     1.7 +@@ -69,7 +69,7 @@
     1.8 +   u_int8_t igmp_code;             /* routing code */
     1.9 +   u_int16_t igmp_cksum;           /* checksum */
    1.10 +   struct in_addr igmp_group;      /* group address */
    1.11 +-};
    1.12 ++} __attribute__ ((__packed__));
    1.13 + 
    1.14 + #define IGMP_MINLEN			8
    1.15 + 
    1.16 +diff -urN uClibc-0.9.30.1.orig/include/netinet/in.h uClibc-0.9.30.1/include/netinet/in.h
    1.17 +--- uClibc-0.9.30.1.orig/include/netinet/in.h	2009-04-08 09:00:10.926545132 +0200
    1.18 ++++ uClibc-0.9.30.1/include/netinet/in.h	2009-04-08 09:00:26.242514273 +0200
    1.19 +@@ -202,7 +202,7 @@
    1.20 + #define s6_addr			in6_u.u6_addr8
    1.21 + #define s6_addr16		in6_u.u6_addr16
    1.22 + #define s6_addr32		in6_u.u6_addr32
    1.23 +-  };
    1.24 ++  } __attribute__ ((__packed__));
    1.25 + 
    1.26 + extern const struct in6_addr in6addr_any;        /* :: */
    1.27 + extern const struct in6_addr in6addr_loopback;   /* ::1 */
    1.28 +@@ -229,7 +229,7 @@
    1.29 + 			   __SOCKADDR_COMMON_SIZE -
    1.30 + 			   sizeof (in_port_t) -
    1.31 + 			   sizeof (struct in_addr)];
    1.32 +-  };
    1.33 ++  } __attribute__ ((__packed__));
    1.34 + #endif
    1.35 + 
    1.36 + /* Ditto, for IPv6.  */
    1.37 +@@ -240,7 +240,7 @@
    1.38 +     uint32_t sin6_flowinfo;	/* IPv6 flow information */
    1.39 +     struct in6_addr sin6_addr;	/* IPv6 address */
    1.40 +     uint32_t sin6_scope_id;	/* IPv6 scope-id */
    1.41 +-  };
    1.42 ++  } __attribute__ ((__packed__));
    1.43 + 
    1.44 + 
    1.45 + /* IPv4 multicast request.  */
    1.46 +@@ -251,7 +251,7 @@
    1.47 + 
    1.48 +     /* Local IP address of interface.  */
    1.49 +     struct in_addr imr_interface;
    1.50 +-  };
    1.51 ++  } __attribute__ ((__packed__));
    1.52 + 
    1.53 + struct ip_mreq_source
    1.54 +   {
    1.55 +@@ -263,7 +263,7 @@
    1.56 + 
    1.57 +     /* IP address of interface.  */
    1.58 +     struct in_addr imr_sourceaddr;
    1.59 +-  };
    1.60 ++  } __attribute__ ((__packed__));
    1.61 + 
    1.62 + /* Likewise, for IPv6.  */
    1.63 + struct ipv6_mreq
    1.64 +@@ -273,7 +273,7 @@
    1.65 + 
    1.66 +     /* local interface */
    1.67 +     unsigned int ipv6mr_interface;
    1.68 +-  };
    1.69 ++  } __attribute__ ((__packed__));
    1.70 + 
    1.71 + 
    1.72 + /* Multicast group request.  */
    1.73 +@@ -284,7 +284,7 @@
    1.74 + 
    1.75 +     /* Group address.  */
    1.76 +     struct sockaddr_storage gr_group;
    1.77 +-  };
    1.78 ++  } __attribute__ ((__packed__));
    1.79 + 
    1.80 + struct group_source_req
    1.81 +   {
    1.82 +@@ -296,7 +296,7 @@
    1.83 + 
    1.84 +     /* Source address.  */
    1.85 +     struct sockaddr_storage gsr_source;
    1.86 +-  };
    1.87 ++  } __attribute__ ((__packed__));
    1.88 + 
    1.89 + 
    1.90 + /* Full-state filter operations.  */
    1.91 +@@ -315,7 +315,7 @@
    1.92 +     uint32_t imsf_numsrc;
    1.93 +     /* Source addresses.  */
    1.94 +     struct in_addr imsf_slist[1];
    1.95 +-  };
    1.96 ++  } __attribute__ ((__packed__));
    1.97 + 
    1.98 + #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
    1.99 + 				  - sizeof (struct in_addr)		      \
   1.100 +@@ -336,7 +336,7 @@
   1.101 +     uint32_t gf_numsrc;
   1.102 +     /* Source addresses.  */
   1.103 +     struct sockaddr_storage gf_slist[1];
   1.104 +-};
   1.105 ++} __attribute__ ((__packed__));
   1.106 + 
   1.107 + #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
   1.108 + 				   - sizeof (struct sockaddr_storage)	      \
   1.109 +@@ -460,14 +460,14 @@
   1.110 +   {
   1.111 +     struct in6_addr ipi6_addr;	/* src/dst IPv6 address */
   1.112 +     unsigned int ipi6_ifindex;	/* send/recv interface index */
   1.113 +-  };
   1.114 ++  } __attribute__ ((__packed__));
   1.115 + 
   1.116 + /* IPv6 MTU information.  */
   1.117 + struct ip6_mtuinfo
   1.118 +   {
   1.119 +     struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
   1.120 +     uint32_t ip6m_mtu;		   /* path MTU in host byte order */
   1.121 +-  };
   1.122 ++  } __attribute__ ((__packed__));
   1.123 + 
   1.124 + 
   1.125 + #if 0 /*def __USE_GNU*/
   1.126 +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip.h uClibc-0.9.30.1/include/netinet/ip.h
   1.127 +--- uClibc-0.9.30.1.orig/include/netinet/ip.h	2009-04-08 09:00:10.926545132 +0200
   1.128 ++++ uClibc-0.9.30.1/include/netinet/ip.h	2009-04-08 09:00:26.242514273 +0200
   1.129 +@@ -63,7 +63,7 @@
   1.130 +     u_int32_t saddr;
   1.131 +     u_int32_t daddr;
   1.132 +     /*The options start here. */
   1.133 +-  };
   1.134 ++  } __attribute__ ((__packed__));
   1.135 + 
   1.136 + #ifdef __USE_BSD
   1.137 + /*
   1.138 +@@ -127,7 +127,7 @@
   1.139 +     u_int8_t ip_p;			/* protocol */
   1.140 +     u_short ip_sum;			/* checksum */
   1.141 +     struct in_addr ip_src, ip_dst;	/* source and dest address */
   1.142 +-  };
   1.143 ++  } __attribute__ ((__packed__));
   1.144 + 
   1.145 + /*
   1.146 +  * Time stamp option structure.
   1.147 +diff -urN uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h uClibc-0.9.30.1/include/netinet/ip_icmp.h
   1.148 +--- uClibc-0.9.30.1.orig/include/netinet/ip_icmp.h	2009-04-08 09:00:10.926545132 +0200
   1.149 ++++ uClibc-0.9.30.1/include/netinet/ip_icmp.h	2009-04-08 09:00:26.242514273 +0200
   1.150 +@@ -43,7 +43,7 @@
   1.151 +       u_int16_t	mtu;
   1.152 +     } frag;			/* path mtu discovery */
   1.153 +   } un;
   1.154 +-};
   1.155 ++} __attribute__ ((__packed__));
   1.156 + 
   1.157 + #define ICMP_ECHOREPLY		0	/* Echo Reply			*/
   1.158 + #define ICMP_DEST_UNREACH	3	/* Destination Unreachable	*/
   1.159 +@@ -199,7 +199,7 @@
   1.160 + #define	icmp_radv	icmp_dun.id_radv
   1.161 + #define	icmp_mask	icmp_dun.id_mask
   1.162 + #define	icmp_data	icmp_dun.id_data
   1.163 +-};
   1.164 ++} __attribute__ ((__packed__));
   1.165 + 
   1.166 + /*
   1.167 +  * Lower bounds on packet lengths for various types.
   1.168 +diff -urN uClibc-0.9.30.1.orig/include/netinet/tcp.h uClibc-0.9.30.1/include/netinet/tcp.h
   1.169 +--- uClibc-0.9.30.1.orig/include/netinet/tcp.h	2009-04-08 09:00:10.926545132 +0200
   1.170 ++++ uClibc-0.9.30.1/include/netinet/tcp.h	2009-04-08 09:00:26.242514273 +0200
   1.171 +@@ -86,7 +86,7 @@
   1.172 +     u_int16_t th_win;		/* window */
   1.173 +     u_int16_t th_sum;		/* checksum */
   1.174 +     u_int16_t th_urp;		/* urgent pointer */
   1.175 +-};
   1.176 ++} __attribute__ ((__packed__));
   1.177 + 
   1.178 + # else /* !__FAVOR_BSD */
   1.179 + struct tcphdr
   1.180 +@@ -121,7 +121,7 @@
   1.181 +     u_int16_t window;
   1.182 +     u_int16_t check;
   1.183 +     u_int16_t urg_ptr;
   1.184 +-};
   1.185 ++} __attribute__ ((__packed__));
   1.186 + # endif /* __FAVOR_BSD */
   1.187 + 
   1.188 + enum
   1.189 +@@ -226,7 +226,7 @@
   1.190 +   u_int32_t	tcpi_rcv_space;
   1.191 + 
   1.192 +   u_int32_t	tcpi_total_retrans;
   1.193 +-};
   1.194 ++} __attribute__ ((__packed__));
   1.195 + 
   1.196 + 
   1.197 + /* For TCP_MD5SIG socket option.  */
   1.198 +@@ -239,7 +239,7 @@
   1.199 +   u_int16_t	tcpm_keylen;			/* Key length.  */
   1.200 +   u_int32_t	__tcpm_pad2;			/* Zero.  */
   1.201 +   u_int8_t	tcpm_key[TCP_MD5SIG_MAXKEYLEN];	/* Key (binary).  */
   1.202 +-};
   1.203 ++} __attribute__ ((__packed__));
   1.204 + 
   1.205 + #endif /* Misc.  */
   1.206 + 
   1.207 +diff -urN uClibc-0.9.30.1.orig/include/netinet/udp.h uClibc-0.9.30.1/include/netinet/udp.h
   1.208 +--- uClibc-0.9.30.1.orig/include/netinet/udp.h	2009-04-08 09:00:10.926545132 +0200
   1.209 ++++ uClibc-0.9.30.1/include/netinet/udp.h	2009-04-08 09:00:26.242514273 +0200
   1.210 +@@ -61,7 +61,7 @@
   1.211 +   u_int16_t uh_dport;		/* destination port */
   1.212 +   u_int16_t uh_ulen;		/* udp length */
   1.213 +   u_int16_t uh_sum;		/* udp checksum */
   1.214 +-};
   1.215 ++} __attribute__ ((__packed__));
   1.216 + 
   1.217 + #else
   1.218 + 
   1.219 +@@ -71,7 +71,7 @@
   1.220 +   u_int16_t dest;
   1.221 +   u_int16_t len;
   1.222 +   u_int16_t check;
   1.223 +-};
   1.224 ++} __attribute__ ((__packed__));
   1.225 + #endif
   1.226 + 
   1.227 + #define SOL_UDP            17      /* sockopt level for UDP */