CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Imported core-cross ports from 2.5
[crossrootfs.git] / iputils / iputils-s20071127-fixes-2.patch
1 Submitted By: Jim Gifford (jim at cross-lfs dot org)
2 Date: 02-18-2009
3 Initial Package Version: s20071127
4 Origin: Debian and Fedora
5 Upstream Status: Unknown
6 Description: Fixes Various Issues
7
8 diff -Naur iputils-s20071127.orig/arping.c iputils-s20071127/arping.c
9 --- iputils-s20071127.orig/arping.c 2007-11-26 16:57:27.000000000 -0800
10 +++ iputils-s20071127/arping.c 2009-02-18 23:18:09.239954184 -0800
11 @@ -168,12 +168,17 @@
12 if (start.tv_sec==0)
13 start = tv;
14
15 - if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500))
16 - finish();
17 + if (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500)
18 + finish();
19
20 - if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
21 + if ((!timeout) && (count == 0))
22 + finish();
23 +
24 + if ( count!=0 && (last.tv_sec==0 || MS_TDIFF(tv,last) > 500 ) ) {
25 send_pack(s, src, dst, &me, &he);
26 - if (count == 0 && unsolicited)
27 + if (count >= 0)
28 + count--;
29 + if (count==0 && unsolicited)
30 finish();
31 }
32 alarm(1);
33 diff -Naur iputils-s20071127.orig/doc/docbook2man-spec.pl iputils-s20071127/doc/docbook2man-spec.pl
34 --- iputils-s20071127.orig/doc/docbook2man-spec.pl 2007-11-26 16:57:27.000000000 -0800
35 +++ iputils-s20071127/doc/docbook2man-spec.pl 2009-02-18 23:18:09.239954184 -0800
36 @@ -428,7 +428,7 @@
37 output ' ';
38
39 if($_[0]->attribute('CHOICE')->value =~ /opt/i) {
40 - output '[ ';
41 + output '[';
42 }
43 bold_on();
44 }
45 @@ -441,7 +441,7 @@
46 font_off();
47 }
48 if($_[0]->attribute('CHOICE')->value =~ /opt/i) {
49 - output '] ';
50 + output ']';
51 }
52 }
53
54 diff -Naur iputils-s20071127.orig/doc/Makefile iputils-s20071127/doc/Makefile
55 --- iputils-s20071127.orig/doc/Makefile 2007-11-26 16:57:27.000000000 -0800
56 +++ iputils-s20071127/doc/Makefile 2009-02-18 23:18:09.239954184 -0800
57 @@ -6,7 +6,7 @@
58
59 html: $(HTMLFILES) iputils.html
60
61 -man: $(MANFILES)
62 +man: $(MANFILES) fix_sgml2man
63
64 # docbook scripts are incredibly dirty in the sense that they leak
65 # lots of some strange temporary junk directories and files.
66 @@ -33,6 +33,9 @@
67 @set -e; cd tmp.db2man; nsgmls ../$< | sgmlspl ../docbook2man-spec.pl ; mv $@ ..
68 @-rm -rf tmp.db2man
69
70 +fix_sgml2man:
71 + @sed -i -e 's!\\fB\\fIdestination\\fB\\fR \[\\fB/\\fIport\\fB\\fR\]!\\fB\\fIdestination\\fB\\fR[\\fB/\\fIport\\fB\\fR]!g' tracepath.8
72 +
73 clean:
74 @rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html tmp.db2man
75
76 diff -Naur iputils-s20071127.orig/Makefile iputils-s20071127/Makefile
77 --- iputils-s20071127.orig/Makefile 2007-11-26 16:57:27.000000000 -0800
78 +++ iputils-s20071127/Makefile 2009-02-18 23:18:09.239954184 -0800
79 @@ -16,7 +16,7 @@
80 CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
81 CFLAGS=$(CCOPT) $(GLIBCFIX) $(DEFINES)
82
83 -IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
84 +IPV4_TARGETS=tracepath ping clockdiff rdisc arping
85 IPV6_TARGETS=tracepath6 traceroute6 ping6
86 TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
87
88 @@ -25,7 +25,6 @@
89
90 all: $(TARGETS)
91
92 -
93 tftpd: tftpd.o tftpsubs.o
94 ping: ping.o ping_common.o
95 ping6: ping6.o ping_common.o
96 @@ -37,7 +36,6 @@
97 rdisc_srv.o: rdisc.c
98 $(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
99
100 -
101 check-kernel:
102 ifeq ($(KERNEL_INCLUDE),)
103 @echo "Please, set correct KERNEL_INCLUDE"; false
104 diff -Naur iputils-s20071127.orig/ping6.c iputils-s20071127/ping6.c
105 --- iputils-s20071127.orig/ping6.c 2007-11-26 16:57:27.000000000 -0800
106 +++ iputils-s20071127/ping6.c 2009-02-18 23:18:09.239954184 -0800
107 @@ -414,7 +414,7 @@
108 fprintf(stderr, "ping: unknown iface %s\n", device);
109 exit(2);
110 }
111 - cmsg = (struct cmsghdr*)cmsgbuf;
112 + cmsg = (struct cmsghdr*)(cmsgbuf+cmsglen);
113 cmsglen += CMSG_SPACE(sizeof(*ipi));
114 cmsg->cmsg_len = CMSG_LEN(sizeof(*ipi));
115 cmsg->cmsg_level = SOL_IPV6;
116 @@ -486,7 +486,6 @@
117 /*
118 * select icmp echo reply as icmp type to receive
119 */
120 -
121 ICMP6_FILTER_SETBLOCKALL(&filter);
122
123 if (!working_recverr) {
124 diff -Naur iputils-s20071127.orig/ping.c iputils-s20071127/ping.c
125 --- iputils-s20071127.orig/ping.c 2007-11-26 16:57:27.000000000 -0800
126 +++ iputils-s20071127/ping.c 2009-02-18 23:18:09.239954184 -0800
127 @@ -249,7 +249,7 @@
128 if (argc == 1)
129 options |= F_NUMERIC;
130 } else {
131 - hp = gethostbyname(target);
132 + hp = gethostbyname2(target, AF_INET);
133 if (!hp) {
134 fprintf(stderr, "ping: unknown host %s\n", target);
135 exit(2);
136 @@ -865,9 +865,36 @@
137 case ICMP_SR_FAILED:
138 printf("Source Route Failed\n");
139 break;
140 + case ICMP_NET_UNKNOWN:
141 + printf("Destination Net Unknown\n");
142 + break;
143 + case ICMP_HOST_UNKNOWN:
144 + printf("Destination Host Unknown\n");
145 + break;
146 + case ICMP_HOST_ISOLATED:
147 + printf("Source Host Isolated\n");
148 + break;
149 + case ICMP_NET_ANO:
150 + printf("Destination Net Prohibited\n");
151 + break;
152 + case ICMP_HOST_ANO:
153 + printf("Destination Host Prohibited\n");
154 + break;
155 + case ICMP_NET_UNR_TOS:
156 + printf("Destination Net Unreachable for Type of Service\n");
157 + break;
158 + case ICMP_HOST_UNR_TOS:
159 + printf("Destination Host Unreachable for Type of Service\n");
160 + break;
161 case ICMP_PKT_FILTERED:
162 printf("Packet filtered\n");
163 break;
164 + case ICMP_PREC_VIOLATION:
165 + printf("Precedence Violation\n");
166 + break;
167 + case ICMP_PREC_CUTOFF:
168 + printf("Precedence Cutoff\n");
169 + break;
170 default:
171 printf("Dest Unreachable, Bad Code: %d\n", code);
172 break;
173 diff -Naur iputils-s20071127.orig/ping_common.c iputils-s20071127/ping_common.c
174 --- iputils-s20071127.orig/ping_common.c 2007-11-26 16:57:27.000000000 -0800
175 +++ iputils-s20071127/ping_common.c 2009-02-18 23:18:09.239954184 -0800
176 @@ -818,7 +818,8 @@
177 }
178 if (pipesize > 1)
179 printf(", pipe %d", pipesize);
180 - if (ntransmitted > 1 && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
181 + if (ntransmitted > 1 && nreceived &&
182 + (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
183 int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
184 printf(", ipg/ewma %d.%03d/%d.%03d ms",
185 ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);
186 @@ -852,4 +853,3 @@
187 }
188 fprintf(stderr, "\n");
189 }
190 -
191 diff -Naur iputils-s20071127.orig/rdisc.c iputils-s20071127/rdisc.c
192 --- iputils-s20071127.orig/rdisc.c 2007-11-26 16:57:27.000000000 -0800
193 +++ iputils-s20071127/rdisc.c 2009-02-18 23:18:31.745396284 -0800
194 @@ -240,14 +240,25 @@
195 {
196 int t;
197 pid_t pid;
198 + long open_max;
199
200 if (trace)
201 return;
202 + if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) {
203 + if (errno == 0) {
204 + (void) fprintf(stderr, "OPEN_MAX is not supported\n");
205 + }
206 + else {
207 + (void) fprintf(stderr, "sysconf() error\n");
208 + }
209 + exit(1);
210 + }
211 +
212
213 if ((pid=fork()) != 0)
214 exit(0);
215
216 - for (t = 0; t < OPEN_MAX; t++)
217 + for (t = 0; t < open_max; t++)
218 if (t != s)
219 close(t);
220
221 diff -Naur iputils-s20071127.orig/tracepath.c iputils-s20071127/tracepath.c
222 --- iputils-s20071127.orig/tracepath.c 2007-11-26 16:57:27.000000000 -0800
223 +++ iputils-s20071127/tracepath.c 2009-02-18 23:18:09.239954184 -0800
224 @@ -318,9 +318,9 @@
225 base_port = atoi(p+1);
226 } else
227 base_port = 44444;
228 - he = gethostbyname(argv[0]);
229 + he = gethostbyname2(argv[0], AF_INET);
230 if (he == NULL) {
231 - herror("gethostbyname");
232 + herror("gethostbyname2");
233 exit(1);
234 }
235 memcpy(&target.sin_addr, he->h_addr, 4);