Drop unnecessary patches

This commit is contained in:
Jan Synacek 2012-10-16 13:17:35 +02:00
parent f7df95f1ab
commit e355996ccc
5 changed files with 1 additions and 441 deletions

View File

@ -1,126 +0,0 @@
diff -up iputils-s20071127/ping_common.c.warnings iputils-s20071127/ping_common.c
--- iputils-s20071127/ping_common.c.warnings 2008-06-02 13:29:27.000000000 +0200
+++ iputils-s20071127/ping_common.c 2008-06-02 13:29:27.000000000 +0200
@@ -338,7 +338,7 @@ resend:
* high preload or pipe size is very confusing. */
if ((preload < screen_width && pipesize < screen_width) ||
in_flight() < screen_width)
- write(STDOUT_FILENO, ".", 1);
+ printf(".");
}
return interval - tokens;
}
@@ -391,7 +391,7 @@ resend:
if (i == 0 && !(options & F_QUIET)) {
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else
perror("ping: sendmsg");
}
@@ -717,9 +717,9 @@ restamp:
if (options & F_FLOOD) {
if (!csfailed)
- write(STDOUT_FILENO, "\b \b", 3);
+ printf("\b \b");
else
- write(STDOUT_FILENO, "\bC", 1);
+ printf("\bC");
} else {
int i;
__u8 *cp, *dp;
diff -up iputils-s20071127/clockdiff.c.warnings iputils-s20071127/clockdiff.c
--- iputils-s20071127/clockdiff.c.warnings 2007-11-27 01:57:27.000000000 +0100
+++ iputils-s20071127/clockdiff.c 2008-06-02 13:29:27.000000000 +0200
@@ -628,8 +628,6 @@ main(int argc, char *argv[])
}
}
- nice(-16);
-
if ((measure_status = (ip_opt_len ? measure_opt : measure)(&server)) < 0) {
if (errno)
perror("measure");
diff -up iputils-s20071127/ping6.c.warnings iputils-s20071127/ping6.c
--- iputils-s20071127/ping6.c.warnings 2008-06-02 13:30:06.000000000 +0200
+++ iputils-s20071127/ping6.c 2008-06-02 13:31:14.000000000 +0200
@@ -1037,7 +1037,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else if (e->ee_errno != EMSGSIZE)
fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
else
@@ -1060,7 +1060,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
} else {
print_timestamp();
printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_seq));
@@ -1400,7 +1400,7 @@ parse_reply(struct msghdr *msg, int cc,
return 0;
nerrors++;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
return 0;
}
print_timestamp();
diff -up iputils-s20071127/ping.c.warnings iputils-s20071127/ping.c
--- iputils-s20071127/ping.c.warnings 2008-06-02 13:29:27.000000000 +0200
+++ iputils-s20071127/ping.c 2008-06-02 13:29:27.000000000 +0200
@@ -367,7 +367,7 @@ main(int argc, char **argv)
}
source.sin_port = 0;
close(probe_fd);
- } while (0);
+ }
if (whereto.sin_addr.s_addr == 0)
whereto.sin_addr.s_addr = source.sin_addr.s_addr;
@@ -594,7 +594,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else if (e->ee_errno != EMSGSIZE)
fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
else
@@ -630,7 +630,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
} else {
print_timestamp();
printf("From %s icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
@@ -795,7 +795,7 @@ parse_reply(struct msghdr *msg, int cc,
return !error_pkt;
if (options & F_FLOOD) {
if (error_pkt)
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
return !error_pkt;
}
print_timestamp();
@@ -812,9 +812,9 @@ parse_reply(struct msghdr *msg, int cc,
}
if ((options & F_FLOOD) && !(options & (F_VERBOSE|F_QUIET))) {
if (!csfailed)
- write(STDOUT_FILENO, "!E", 2);
+ printf("!E");
else
- write(STDOUT_FILENO, "!EC", 3);
+ printf("!EC");
return 0;
}
if (!(options & F_VERBOSE) || uid)

View File

@ -1,107 +0,0 @@
diff -up iputils-s20101006/Makefile.drop_caps iputils-s20101006/Makefile
--- iputils-s20101006/Makefile.drop_caps 2010-11-08 14:49:53.334577997 +0100
+++ iputils-s20101006/Makefile 2010-11-08 14:49:53.342599113 +0100
@@ -13,7 +13,7 @@ ADDLIB=
CC=gcc
# What a pity, all new gccs are buggy and -Werror does not work. Sigh.
CCOPT=-Wstrict-prototypes -fno-strict-aliasing -Werror
-DEFINES += -D_GNU_SOURCE
+DEFINES += -D_GNU_SOURCE -DHAVE_CAPABILITIES
CFLAGS += $(RPM_OPT_FLAGS) $(CCOPT) $(GLIBCFIX) $(DEFINES)
IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
@@ -30,10 +30,10 @@ tftpd: tftpd.o tftpsubs.o
arping: arping.o
ping: ping.o ping_common.o
- $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -o ping
+ $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -lcap -o ping
ping6: ping6.o ping_common.o
- $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -o ping6
+ $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -lcap -o ping6
ping.o ping6.o ping_common.o: ping_common.h in6_flowlabel.h
tftpd.o tftpsubs.o: tftp.h
diff -up iputils-s20101006/ping6.c.drop_caps iputils-s20101006/ping6.c
--- iputils-s20101006/ping6.c.drop_caps 2010-11-08 14:49:53.338587611 +0100
+++ iputils-s20101006/ping6.c 2010-12-15 16:06:16.949794002 +0100
@@ -73,6 +73,10 @@ char copyright[] =
#include <netinet/icmp6.h>
#include <resolv.h>
+#ifdef HAVE_CAPABILITIES
+#include <sys/capability.h>
+#endif
+
#include "ping6_niquery.h"
#include "in6_flowlabel.h"
@@ -533,6 +537,9 @@ int main(int argc, char *argv[])
int csum_offset, sz_opt;
#endif
static uint32_t scope_id = 0;
+#ifdef HAVE_CAPABILITIES
+ cap_t caps;
+#endif
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
socket_errno = errno;
@@ -543,6 +550,16 @@ int main(int argc, char *argv[])
exit(-1);
}
+#ifdef HAVE_CAPABILITIES
+ /* drop all capabilities unconditionally so even root isn't special anymore */
+ caps = cap_init();
+ if (cap_set_proc(caps) < 0) {
+ perror("ping: cap_set_proc");
+ exit(-1);
+ }
+ cap_free(caps);
+#endif
+
source.sin6_family = AF_INET6;
memset(&firsthop, 0, sizeof(firsthop));
firsthop.sin6_family = AF_INET6;
diff -up iputils-s20101006/ping.c.drop_caps iputils-s20101006/ping.c
--- iputils-s20101006/ping.c.drop_caps 2010-11-08 14:49:53.314577272 +0100
+++ iputils-s20101006/ping.c 2010-12-15 16:05:52.113794002 +0100
@@ -66,6 +66,10 @@ char copyright[] =
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
+#ifdef HAVE_CAPABILITIES
+#include <sys/capability.h>
+#endif
+
#ifndef ICMP_FILTER
#define ICMP_FILTER 1
struct icmp_filter {
@@ -125,6 +129,9 @@ main(int argc, char **argv)
u_char *packet;
char *target, hnamebuf[MAX_HOSTNAMELEN];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
+#ifdef HAVE_CAPABILITIES
+ cap_t caps;
+#endif
char *idn;
int rc = 0;
@@ -139,6 +146,16 @@ main(int argc, char **argv)
exit(-1);
}
+#ifdef HAVE_CAPABILITIES
+ /* drop all capabilities unconditionally so even root isn't special anymore */
+ caps = cap_init();
+ if (cap_set_proc(caps) < 0) {
+ perror("ping: cap_set_proc");
+ exit(-1);
+ }
+ cap_free(caps);
+#endif
+
source.sin_family = AF_INET;
preload = 1;

View File

@ -1,150 +0,0 @@
--- iputils-s20101006/ping.c 2012-06-25 09:53:03.779506643 +0200
+++ iputils-s20101006-patch/ping.c 2012-06-25 10:40:17.610143823 +0200
@@ -66,10 +66,6 @@ char copyright[] =
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
-#ifdef HAVE_CAPABILITIES
-#include <sys/capability.h>
-#endif
-
#ifndef ICMP_FILTER
#define ICMP_FILTER 1
struct icmp_filter {
@@ -119,7 +115,6 @@ struct sockaddr_in source;
char *device;
int pmtudisc = -1;
-
int
main(int argc, char **argv)
{
@@ -130,7 +125,8 @@ main(int argc, char **argv)
char *target, hnamebuf[MAX_HOSTNAMELEN];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
#ifdef HAVE_CAPABILITIES
- cap_t caps;
+ cap_t cap;
+ cap_flag_value_t net_admin_set = CAP_CLEAR;
#endif
char *idn;
@@ -147,13 +143,21 @@ main(int argc, char **argv)
}
#ifdef HAVE_CAPABILITIES
- /* drop all capabilities unconditionally so even root isn't special anymore */
- caps = cap_init();
- if (cap_set_proc(caps) < 0) {
- perror("ping: cap_set_proc");
+ /* check for cap_net_admin because it may be needed to set packet marks */
+ if ((cap = cap_get_proc()) == NULL) {
+ perror("ping: cap_get_proc");
exit(-1);
}
- cap_free(caps);
+ if (cap_get_flag(cap, CAP_NET_ADMIN, CAP_EFFECTIVE, &net_admin_set) != 0) {
+ perror("ping: cap_get_flag");
+ exit(-1);
+ }
+ cap_free(cap);
+
+ /* if CAP_NET_ADMIN is not set, drop all capabilities now, otherwise defer
+ * dropping after the SO_MARK sock opt is set */
+ if (net_admin_set == CAP_CLEAR)
+ drop_capabilities();
#endif
source.sin_family = AF_INET;
--- iputils-s20101006/ping6.c 2012-06-26 08:55:58.751744660 +0200
+++ iputils-s20101006-patch/ping6.c 2012-06-26 08:57:38.276803832 +0200
@@ -73,10 +73,6 @@ char copyright[] =
#include <netinet/icmp6.h>
#include <resolv.h>
-#ifdef HAVE_CAPABILITIES
-#include <sys/capability.h>
-#endif
-
#include "ping6_niquery.h"
#include "in6_flowlabel.h"
@@ -538,7 +534,8 @@ int main(int argc, char *argv[])
#endif
static uint32_t scope_id = 0;
#ifdef HAVE_CAPABILITIES
- cap_t caps;
+ cap_t cap;
+ cap_flag_value_t net_admin_set = CAP_CLEAR;
#endif
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
@@ -551,13 +548,21 @@ int main(int argc, char *argv[])
}
#ifdef HAVE_CAPABILITIES
- /* drop all capabilities unconditionally so even root isn't special anymore */
- caps = cap_init();
- if (cap_set_proc(caps) < 0) {
- perror("ping: cap_set_proc");
+ /* check for cap_net_admin because it may be needed to set packet marks */
+ if ((cap = cap_get_proc()) == NULL) {
+ perror("ping6: cap_get_proc");
exit(-1);
}
- cap_free(caps);
+ if (cap_get_flag(cap, CAP_NET_ADMIN, CAP_EFFECTIVE, &net_admin_set) != 0) {
+ perror("ping6: cap_get_flag");
+ exit(-1);
+ }
+ cap_free(cap);
+
+ /* if CAP_NET_ADMIN is not set, drop all capabilities now, otherwise defer
+ * dropping after the SO_MARK sock opt is set */
+ if (net_admin_set == CAP_CLEAR)
+ drop_capabilities();
#endif
source.sin6_family = AF_INET6;
--- iputils-s20101006/ping_common.h 2010-10-06 13:59:20.000000000 +0200
+++ iputils-s20101006-patch/ping_common.h 2012-06-25 10:43:21.676189489 +0200
@@ -17,6 +17,10 @@
#include <string.h>
#include <netdb.h>
+#ifdef HAVE_CAPABILITIES
+#include <sys/capability.h>
+#endif
+
#include <netinet/in.h>
#include <arpa/inet.h>
#include <linux/types.h>
@@ -188,6 +192,15 @@ static inline void advance_ntransmitted(
acked = (__u16)ntransmitted + 1;
}
+static inline void drop_capabilities(void)
+{
+ cap_t cap = cap_init();
+ if (cap_set_proc(cap) < 0) {
+ perror("ping: cap_set_proc");
+ exit(-1);
+ }
+ cap_free(cap);
+}
extern int send_probe(void);
extern int receive_error_msg(void);
--- iputils-s20101006/ping_common.c 2012-06-25 09:53:03.705506619 +0200
+++ iputils-s20101006-patch/ping_common.c 2012-06-25 10:40:40.220150202 +0200
@@ -486,6 +486,10 @@ void setup(int icmp_sock)
* dont support mark ..
*/
fprintf(stderr, "Warning: Failed to set mark %d\n", mark);
+#ifdef HAVE_CAPABILITIES
+ /* in case we deferred dropping capabilities because of SO_MARK */
+ drop_capabilities();
+#endif
}
}

View File

@ -1,50 +0,0 @@
--- iputils/ping.c.OLD 2006-02-06 10:34:35.000000000 +0100
+++ iputils/ping.c 2006-02-06 10:34:35.000000000 +0100
@@ -855,9 +855,36 @@
case ICMP_SR_FAILED:
printf("Source Route Failed\n");
break;
+ case ICMP_NET_UNKNOWN:
+ printf("Destination Net Unknown\n");
+ break;
+ case ICMP_HOST_UNKNOWN:
+ printf("Destination Host Unknown\n");
+ break;
+ case ICMP_HOST_ISOLATED:
+ printf("Source Host Isolated\n");
+ break;
+ case ICMP_NET_ANO:
+ printf("Destination Net Prohibited\n");
+ break;
+ case ICMP_HOST_ANO:
+ printf("Destination Host Prohibited\n");
+ break;
+ case ICMP_NET_UNR_TOS:
+ printf("Destination Net Unreachable for Type of Service\n");
+ break;
+ case ICMP_HOST_UNR_TOS:
+ printf("Destination Host Unreachable for Type of Service\n");
+ break;
case ICMP_PKT_FILTERED:
printf("Packet filtered\n");
break;
+ case ICMP_PREC_VIOLATION:
+ printf("Precedence Violation\n");
+ break;
+ case ICMP_PREC_CUTOFF:
+ printf("Precedence Cutoff\n");
+ break;
default:
printf("Dest Unreachable, Bad Code: %d\n", code);
break;
--- iputils/ping_common.c.OLD 2006-02-06 10:34:35.000000000 +0100
+++ iputils/ping_common.c 2006-02-06 10:34:35.000000000 +0100
@@ -819,7 +819,7 @@
printf("%spipe %d", comma, pipesize);
comma = ", ";
}
- if (ntransmitted > 1 && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
+ if (ntransmitted > 1 && nreceived && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
printf("%sipg/ewma %d.%03d/%d.%03d ms",
comma, ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);

View File

@ -16,22 +16,18 @@ Patch0: iputils-20020927-rh.patch
Patch1: iputils-20020124-countermeasures.patch
Patch2: iputils-20020927-addrcache.patch
Patch3: iputils-20020927-ping-subint.patch
Patch4: iputils-ping_cleanup.patch
Patch5: iputils-ifenslave.patch
Patch6: iputils-20070202-idn.patch
Patch7: iputils-20070202-traffic_class.patch
Patch8: iputils-20070202-ia64_align.patch
Patch9: iputils-20071127-warnings.patch
Patch10: iputils-20071127-corr_type.patch
Patch11: iputils-20071127-infiniband.patch
Patch12: iputils-20100418-convtoint.patch
Patch13: iputils-20100418-flowlabel.patch
Patch14: iputils-20101006-drop_caps.patch
Patch15: iputils-20101006-unused.patch
Patch16: iputils-20101006-man.patch
Patch17: iputils-20101006-eth.patch
Patch18: iputils-20101006-rr.patch
Patch20: iputils-20101006-ping-defer-caps-drop-when-marking-packets.patch
Patch21: iputils-20101006-ping-integer-overflow.patch
Patch22: iputils-20101006-ping-fallback-to-numeric-addresses-while-exiting.patch
@ -75,22 +71,18 @@ The iputils-sysvinit contains SysV initscritps support.
%patch1 -p1 -b .countermeasures
%patch2 -p1 -b .addrcache
%patch3 -p1 -b .ping-subint
%patch4 -p1 -b .cleanup
%patch5 -p1 -b .addr
%patch6 -p1 -b .idn
%patch7 -p1 -b .traffic_class
%patch8 -p1 -b .ia64_align
%patch9 -p1 -b .warnings
%patch10 -p1 -b .corr_type
%patch11 -p1 -b .infiniband
%patch12 -p1 -b .convtoint
%patch13 -p1 -b .flowlabel
%patch14 -p1 -b .drop_caps
%patch15 -p1 -b .unused
%patch16 -p1 -b .man
%patch17 -p1 -b .eth
%patch18 -p1 -b .rr
%patch20 -p1
%patch21 -p1
%patch22 -p1
@ -177,6 +169,7 @@ mv -f RELNOTES.tmp RELNOTES
%changelog
* Mon Oct 15 2012 Jan Synáček <jsynacek@redhat.com> - 20121011-1
- Update to iputils-s20121011
+ drop unnecessary patches
* Wed Aug 22 2012 Jan Synáček <jsynacek@redhat.com> - 20101006-18
- Improve spec for fedora