void-packages/srcpkgs/iputils/patches/iputils-20071127-corr_type.patch

88 lines
3.1 KiB
Diff

diff -up iputils-s20100418/ping6.c.corr_type iputils-s20100418/ping6.c
--- iputils-s20100418/ping6.c.corr_type 2010-04-20 15:42:39.181245576 +0200
+++ iputils-s20100418/ping6.c 2010-04-20 15:42:39.198230879 +0200
@@ -1335,7 +1335,7 @@ parse_reply(struct msghdr *msg, int cc,
#endif
if (c->cmsg_len < CMSG_LEN(sizeof(int)))
continue;
- hops = *(int*)CMSG_DATA(c);
+ memcpy(&hops, CMSG_DATA(c), sizeof (int));
}
}
diff -up iputils-s20100418/ping.c.corr_type iputils-s20100418/ping.c
--- iputils-s20100418/ping.c.corr_type 2010-04-20 15:42:39.193242030 +0200
+++ iputils-s20100418/ping.c 2010-04-20 15:42:39.199231317 +0200
@@ -1211,18 +1211,20 @@ pr_addr(__u32 addr)
struct hostent *hp;
static char buf[4096];
static __u32 addr_cache = 0;
+ struct in_addr tmp_addr;
if ( addr == addr_cache )
return buf;
addr_cache = addr;
+ tmp_addr.s_addr = addr;
if ((options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
- sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr));
+ sprintf(buf, "%s", inet_ntoa(tmp_addr));
else
snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
- inet_ntoa(*(struct in_addr *)&addr));
+ inet_ntoa(tmp_addr));
return(buf);
}
diff -up iputils-s20100418/rdisc.c.corr_type iputils-s20100418/rdisc.c
--- iputils-s20100418/rdisc.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/rdisc.c 2010-04-20 15:42:39.201230377 +0200
@@ -1487,14 +1487,19 @@ rtioctl(struct in_addr addr, int op)
{
int sock;
struct rtentry rt;
- struct sockaddr_in *sin;
+ union {
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+ } conv;
memset((char *)&rt, 0, sizeof(struct rtentry));
rt.rt_dst.sa_family = AF_INET;
rt.rt_gateway.sa_family = AF_INET;
rt.rt_genmask.sa_family = AF_INET;
- sin = (struct sockaddr_in *)ALLIGN(&rt.rt_gateway);
- sin->sin_addr = addr;
+ // gcc4.4 hack
+ conv.sa = ALLIGN(&rt.rt_gateway);
+ memcpy(&conv.sin->sin_addr, &addr, sizeof(struct in_addr));
+ // -----------
rt.rt_flags = RTF_UP | RTF_GATEWAY;
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
diff -up iputils-s20100418/tracepath6.c.corr_type iputils-s20100418/tracepath6.c
--- iputils-s20100418/tracepath6.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/tracepath6.c 2010-04-20 15:44:15.129480911 +0200
@@ -173,7 +173,7 @@ restart:
#ifdef IPV6_2292HOPLIMIT
case IPV6_2292HOPLIMIT:
#endif
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof (int));
break;
default:
printf("cmsg6:%d\n ", cmsg->cmsg_type);
diff -up iputils-s20100418/tracepath.c.corr_type iputils-s20100418/tracepath.c
--- iputils-s20100418/tracepath.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/tracepath.c 2010-04-20 15:42:39.203240403 +0200
@@ -145,7 +145,7 @@ restart:
if (cmsg->cmsg_type == IP_RECVERR) {
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
} else if (cmsg->cmsg_type == IP_TTL) {
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof(int));
} else {
printf("cmsg:%d\n ", cmsg->cmsg_type);
}