]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - pkgs/core/net-tools/patches/net-tools-1.60-arp-unaligned-access.patch
net-tools: New package.
[people/amarx/ipfire-3.x.git] / pkgs / core / net-tools / patches / net-tools-1.60-arp-unaligned-access.patch
1 --- net-tools-1.60/arp.c 2001-04-08 10:05:05.000000000 -0700
2 +++ net-tools-1.60.new/arp.c 2006-01-31 13:10:01.479716750 -0800
3 @@ -100,7 +100,7 @@ static int arp_del(char **args)
4 {
5 char host[128];
6 struct arpreq req;
7 - struct sockaddr sa;
8 + struct sockaddr_storage ss;
9 int flags = 0;
10 int err;
11
12 @@ -112,12 +112,12 @@ static int arp_del(char **args)
13 return (-1);
14 }
15 safe_strncpy(host, *args, (sizeof host));
16 - if (ap->input(0, host, &sa) < 0) {
17 + if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
18 ap->herror(host);
19 return (-1);
20 }
21 /* If a host has more than one address, use the correct one! */
22 - memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr));
23 + memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr));
24
25 if (hw_set)
26 req.arp_ha.sa_family = hw->type;
27 @@ -177,11 +177,11 @@ static int arp_del(char **args)
28 usage();
29 if (strcmp(*args, "255.255.255.255") != 0) {
30 strcpy(host, *args);
31 - if (ap->input(0, host, &sa) < 0) {
32 + if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
33 ap->herror(host);
34 return (-1);
35 }
36 - memcpy((char *) &req.arp_netmask, (char *) &sa,
37 + memcpy((char *) &req.arp_netmask, (char *) &ss,
38 sizeof(struct sockaddr));
39 req.arp_flags |= ATF_NETMASK;
40 }
41 @@ -260,7 +260,7 @@ static int arp_set(char **args)
42 {
43 char host[128];
44 struct arpreq req;
45 - struct sockaddr sa;
46 + struct sockaddr_storage ss;
47 int flags;
48
49 memset((char *) &req, 0, sizeof(req));
50 @@ -271,12 +271,12 @@ static int arp_set(char **args)
51 return (-1);
52 }
53 safe_strncpy(host, *args++, (sizeof host));
54 - if (ap->input(0, host, &sa) < 0) {
55 + if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
56 ap->herror(host);
57 return (-1);
58 }
59 /* If a host has more than one address, use the correct one! */
60 - memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr));
61 + memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr));
62
63 /* Fetch the hardware address. */
64 if (*args == NULL) {
65 @@ -346,11 +346,11 @@ static int arp_set(char **args)
66 usage();
67 if (strcmp(*args, "255.255.255.255") != 0) {
68 strcpy(host, *args);
69 - if (ap->input(0, host, &sa) < 0) {
70 + if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
71 ap->herror(host);
72 return (-1);
73 }
74 - memcpy((char *) &req.arp_netmask, (char *) &sa,
75 + memcpy((char *) &req.arp_netmask, (char *) &ss,
76 sizeof(struct sockaddr));
77 flags |= ATF_NETMASK;
78 }
79 @@ -519,7 +519,7 @@ static void arp_disp(char *name, char *i
80 static int arp_show(char *name)
81 {
82 char host[100];
83 - struct sockaddr sa;
84 + struct sockaddr_storage ss;
85 char ip[100];
86 char hwa[100];
87 char mask[100];
88 @@ -535,11 +535,11 @@ static int arp_show(char *name)
89 if (name != NULL) {
90 /* Resolve the host name. */
91 safe_strncpy(host, name, (sizeof host));
92 - if (ap->input(0, host, &sa) < 0) {
93 + if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
94 ap->herror(host);
95 return (-1);
96 }
97 - safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host));
98 + safe_strncpy(host, ap->sprint((struct sockaddr*)&ss, 1), sizeof(host));
99 }
100 /* Open the PROCps kernel table. */
101 if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) {
102 @@ -575,10 +575,11 @@ static int arp_show(char *name)
103 if (opt_n)
104 hostname = "?";
105 else {
106 - if (ap->input(0, ip, &sa) < 0)
107 + if (ap->input(0, ip, (struct sockaddr*)&ss) < 0)
108 hostname = ip;
109 else
110 - hostname = ap->sprint(&sa, opt_n | 0x8000);
111 + hostname = ap->sprint((struct sockaddr*)&ss,
112 + opt_n | 0x8000);
113 if (strcmp(hostname, ip) == 0)
114 hostname = "?";
115 }
116