Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 503914 | Differences between
and this patch

Collapse All | Expand All

(-)a/clockdiff.c (-8 / +8 lines)
Lines 44-54 void usage(void) __attribute__((noreturn)); Link Here
44
	} \
44
	} \
45
}
45
}
46
46
47
int in_cksum(u_short *addr, int len)
47
int in_cksum(unsigned short *addr, int len)
48
{
48
{
49
	union word {
49
	union word {
50
		char	c[2];
50
		char	c[2];
51
		u_short	s;
51
		unsigned short	s;
52
	} u;
52
	} u;
53
	int sum = 0;
53
	int sum = 0;
54
54
Lines 71-77 int in_cksum(u_short *addr, int len) Link Here
71
			/*
71
			/*
72
			 * Odd number of bytes.
72
			 * Odd number of bytes.
73
			 */
73
			 */
74
			u.c[0] = *(u_char *)addr;
74
			u.c[0] = *(unsigned char *)addr;
75
	}
75
	}
76
	if (len == -1) {
76
	if (len == -1) {
77
		/* The last mbuf has odd # of bytes. Follow the
77
		/* The last mbuf has odd # of bytes. Follow the
Lines 112-118 int ip_opt_len = 0; Link Here
112
112
113
int measure_delta;
113
int measure_delta;
114
int measure_delta1;
114
int measure_delta1;
115
static u_short seqno, seqno0, acked;
115
static unsigned short seqno, seqno0, acked;
116
long rtt = 1000;
116
long rtt = 1000;
117
long min_rtt;
117
long min_rtt;
118
long rtt_sigma = 0;
118
long rtt_sigma = 0;
Lines 132-138 measure(struct sockaddr_in * addr) Link Here
132
	long min1, min2, diff;
132
	long min1, min2, diff;
133
	long delta1, delta2;
133
	long delta1, delta2;
134
	struct timeval tv1, tout;
134
	struct timeval tv1, tout;
135
	u_char packet[PACKET_IN], opacket[64];
135
	unsigned char packet[PACKET_IN], opacket[64];
136
	struct icmphdr *icp = (struct icmphdr *) packet;
136
	struct icmphdr *icp = (struct icmphdr *) packet;
137
	struct icmphdr *oicp = (struct icmphdr *) opacket;
137
	struct icmphdr *oicp = (struct icmphdr *) opacket;
138
	struct iphdr *ip = (struct iphdr *) packet;
138
	struct iphdr *ip = (struct iphdr *) packet;
Lines 194-200 empty: Link Here
194
		(void)gettimeofday (&tv1, (struct timezone *)0);
194
		(void)gettimeofday (&tv1, (struct timezone *)0);
195
		*(__u32*)(oicp+1) = htonl((tv1.tv_sec % (24*60*60)) * 1000
195
		*(__u32*)(oicp+1) = htonl((tv1.tv_sec % (24*60*60)) * 1000
196
					  + tv1.tv_usec / 1000);
196
					  + tv1.tv_usec / 1000);
197
		oicp->checksum = in_cksum((u_short *)oicp, sizeof(*oicp) + 12);
197
		oicp->checksum = in_cksum((unsigned short *)oicp, sizeof(*oicp) + 12);
198
198
199
		count = sendto(sock_raw, (char *)opacket, sizeof(*oicp)+12, 0,
199
		count = sendto(sock_raw, (char *)opacket, sizeof(*oicp)+12, 0,
200
			       (struct sockaddr *)addr, sizeof(struct sockaddr_in));
200
			       (struct sockaddr *)addr, sizeof(struct sockaddr_in));
Lines 309-315 measure_opt(struct sockaddr_in * addr) Link Here
309
	long min1, min2, diff;
309
	long min1, min2, diff;
310
	long delta1, delta2;
310
	long delta1, delta2;
311
	struct timeval tv1, tout;
311
	struct timeval tv1, tout;
312
	u_char packet[PACKET_IN], opacket[64];
312
	unsigned char packet[PACKET_IN], opacket[64];
313
	struct icmphdr *icp = (struct icmphdr *) packet;
313
	struct icmphdr *icp = (struct icmphdr *) packet;
314
	struct icmphdr *oicp = (struct icmphdr *) opacket;
314
	struct icmphdr *oicp = (struct icmphdr *) opacket;
315
	struct iphdr *ip = (struct iphdr *) packet;
315
	struct iphdr *ip = (struct iphdr *) packet;
Lines 372-378 empty: Link Here
372
		gettimeofday (&tv1, NULL);
372
		gettimeofday (&tv1, NULL);
373
		((__u32*)(oicp+1))[0] = htonl((tv1.tv_sec % (24*60*60)) * 1000
373
		((__u32*)(oicp+1))[0] = htonl((tv1.tv_sec % (24*60*60)) * 1000
374
					      + tv1.tv_usec / 1000);
374
					      + tv1.tv_usec / 1000);
375
		oicp->checksum = in_cksum((u_short *)oicp, sizeof(*oicp)+12);
375
		oicp->checksum = in_cksum((unsigned short *)oicp, sizeof(*oicp)+12);
376
376
377
		count = sendto(sock_raw, (char *)opacket, sizeof(*oicp)+12, 0,
377
		count = sendto(sock_raw, (char *)opacket, sizeof(*oicp)+12, 0,
378
			       (struct sockaddr *)addr, sizeof(struct sockaddr_in));
378
			       (struct sockaddr *)addr, sizeof(struct sockaddr_in));
(-)a/ping.c (-16 / +16 lines)
Lines 91-97 struct sockaddr_in whereto; /* who to ping */ Link Here
91
int optlen = 0;
91
int optlen = 0;
92
int settos = 0;			/* Set TOS, Precendence or other QOS options */
92
int settos = 0;			/* Set TOS, Precendence or other QOS options */
93
int icmp_sock;			/* socket file descriptor */
93
int icmp_sock;			/* socket file descriptor */
94
u_char outpack[0x10000];
94
unsigned char outpack[0x10000];
95
int maxpacket = sizeof(outpack);
95
int maxpacket = sizeof(outpack);
96
96
97
static int broadcast_pings = 0;
97
static int broadcast_pings = 0;
Lines 100-106 static char *pr_addr(__u32); Link Here
100
static void pr_options(unsigned char * cp, int hlen);
100
static void pr_options(unsigned char * cp, int hlen);
101
static void pr_iph(struct iphdr *ip);
101
static void pr_iph(struct iphdr *ip);
102
static void usage(void) __attribute__((noreturn));
102
static void usage(void) __attribute__((noreturn));
103
static u_short in_cksum(const u_short *addr, int len, u_short salt);
103
static unsigned short in_cksum(const unsigned short *addr, int len, unsigned short salt);
104
static void pr_icmph(__u8 type, __u8 code, __u32 info, struct icmphdr *icp);
104
static void pr_icmph(__u8 type, __u8 code, __u32 info, struct icmphdr *icp);
105
static int parsetos(char *str);
105
static int parsetos(char *str);
106
106
Lines 122-128 main(int argc, char **argv) Link Here
122
	struct hostent *hp;
122
	struct hostent *hp;
123
	int ch, hold, packlen;
123
	int ch, hold, packlen;
124
	int socket_errno;
124
	int socket_errno;
125
	u_char *packet;
125
	unsigned char *packet;
126
	char *target;
126
	char *target;
127
#ifdef USE_IDN
127
#ifdef USE_IDN
128
	char *hnamebuf = NULL;
128
	char *hnamebuf = NULL;
Lines 575-581 main(int argc, char **argv) Link Here
575
	if (datalen >= sizeof(struct timeval))	/* can we time transfer */
575
	if (datalen >= sizeof(struct timeval))	/* can we time transfer */
576
		timing = 1;
576
		timing = 1;
577
	packlen = datalen + MAXIPLEN + MAXICMPLEN;
577
	packlen = datalen + MAXIPLEN + MAXICMPLEN;
578
	if (!(packet = (u_char *)malloc((u_int)packlen))) {
578
	if (!(packet = (unsigned char *)malloc((unsigned int)packlen))) {
579
		fprintf(stderr, "ping: out of memory.\n");
579
		fprintf(stderr, "ping: out of memory.\n");
580
		exit(2);
580
		exit(2);
581
	}
581
	}
Lines 720-732 int send_probe() Link Here
720
	cc = datalen + 8;			/* skips ICMP portion */
720
	cc = datalen + 8;			/* skips ICMP portion */
721
721
722
	/* compute ICMP checksum here */
722
	/* compute ICMP checksum here */
723
	icp->checksum = in_cksum((u_short *)icp, cc, 0);
723
	icp->checksum = in_cksum((unsigned short *)icp, cc, 0);
724
724
725
	if (timing && !(options&F_LATENCY)) {
725
	if (timing && !(options&F_LATENCY)) {
726
		struct timeval tmp_tv;
726
		struct timeval tmp_tv;
727
		gettimeofday(&tmp_tv, NULL);
727
		gettimeofday(&tmp_tv, NULL);
728
		memcpy(icp+1, &tmp_tv, sizeof(tmp_tv));
728
		memcpy(icp+1, &tmp_tv, sizeof(tmp_tv));
729
		icp->checksum = in_cksum((u_short *)&tmp_tv, sizeof(tmp_tv), ~icp->checksum);
729
		icp->checksum = in_cksum((unsigned short *)&tmp_tv, sizeof(tmp_tv), ~icp->checksum);
730
	}
730
	}
731
731
732
	do {
732
	do {
Lines 779-785 parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv) Link Here
779
	/* Now the ICMP part */
779
	/* Now the ICMP part */
780
	cc -= hlen;
780
	cc -= hlen;
781
	icp = (struct icmphdr *)(buf + hlen);
781
	icp = (struct icmphdr *)(buf + hlen);
782
	csfailed = in_cksum((u_short *)icp, cc, 0);
782
	csfailed = in_cksum((unsigned short *)icp, cc, 0);
783
783
784
	if (icp->type == ICMP_ECHOREPLY) {
784
	if (icp->type == ICMP_ECHOREPLY) {
785
		if (icp->un.echo.id != ident)
785
		if (icp->un.echo.id != ident)
Lines 894-910 parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv) Link Here
894
#if BYTE_ORDER == LITTLE_ENDIAN
894
#if BYTE_ORDER == LITTLE_ENDIAN
895
# define ODDBYTE(v)	(v)
895
# define ODDBYTE(v)	(v)
896
#elif BYTE_ORDER == BIG_ENDIAN
896
#elif BYTE_ORDER == BIG_ENDIAN
897
# define ODDBYTE(v)	((u_short)(v) << 8)
897
# define ODDBYTE(v)	((unsigned short)(v) << 8)
898
#else
898
#else
899
# define ODDBYTE(v)	htons((u_short)(v) << 8)
899
# define ODDBYTE(v)	htons((unsigned short)(v) << 8)
900
#endif
900
#endif
901
901
902
u_short
902
unsigned short
903
in_cksum(const u_short *addr, register int len, u_short csum)
903
in_cksum(const unsigned short *addr, register int len, unsigned short csum)
904
{
904
{
905
	register int nleft = len;
905
	register int nleft = len;
906
	const u_short *w = addr;
906
	const unsigned short *w = addr;
907
	register u_short answer;
907
	register unsigned short answer;
908
	register int sum = csum;
908
	register int sum = csum;
909
909
910
	/*
910
	/*
Lines 920-926 in_cksum(const u_short *addr, register int len, u_short csum) Link Here
920
920
921
	/* mop up an odd byte, if necessary */
921
	/* mop up an odd byte, if necessary */
922
	if (nleft == 1)
922
	if (nleft == 1)
923
		sum += ODDBYTE(*(u_char *)w); /* le16toh() may be unavailable on old systems */
923
		sum += ODDBYTE(*(unsigned char *)w); /* le16toh() may be unavailable on old systems */
924
924
925
	/*
925
	/*
926
	 * add back carry outs from top 16 bits to low 16 bits
926
	 * add back carry outs from top 16 bits to low 16 bits
Lines 1238-1247 void pr_options(unsigned char * cp, int hlen) Link Here
1238
void pr_iph(struct iphdr *ip)
1238
void pr_iph(struct iphdr *ip)
1239
{
1239
{
1240
	int hlen;
1240
	int hlen;
1241
	u_char *cp;
1241
	unsigned char *cp;
1242
1242
1243
	hlen = ip->ihl << 2;
1243
	hlen = ip->ihl << 2;
1244
	cp = (u_char *)ip + 20;		/* point to options */
1244
	cp = (unsigned char *)ip + 20;		/* point to options */
1245
1245
1246
	printf("Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst Data\n");
1246
	printf("Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst Data\n");
1247
	printf(" %1x  %1x  %02x %04x %04x",
1247
	printf(" %1x  %1x  %02x %04x %04x",
(-)a/ping6.c (-3 / +3 lines)
Lines 149-155 struct cmsghdr *srcrt; Link Here
149
#endif
149
#endif
150
150
151
struct sockaddr_in6 whereto;	/* who to ping */
151
struct sockaddr_in6 whereto;	/* who to ping */
152
u_char outpack[MAXPACKET];
152
unsigned char outpack[MAXPACKET];
153
int maxpacket = sizeof(outpack);
153
int maxpacket = sizeof(outpack);
154
154
155
static unsigned char cmsgbuf[4096];
155
static unsigned char cmsgbuf[4096];
Lines 695-701 static int hextoui(const char *str) Link Here
695
int main(int argc, char *argv[])
695
int main(int argc, char *argv[])
696
{
696
{
697
	int ch, hold, packlen;
697
	int ch, hold, packlen;
698
	u_char *packet;
698
	unsigned char *packet;
699
	char *target;
699
	char *target;
700
	struct addrinfo hints, *ai;
700
	struct addrinfo hints, *ai;
701
	int gai;
701
	int gai;
Lines 1074-1080 int main(int argc, char *argv[]) Link Here
1074
		timing = 1;
1074
		timing = 1;
1075
	}
1075
	}
1076
	packlen = datalen + 8 + 4096 + 40 + 8; /* 4096 for rthdr */
1076
	packlen = datalen + 8 + 4096 + 40 + 8; /* 4096 for rthdr */
1077
	if (!(packet = (u_char *)malloc((u_int)packlen))) {
1077
	if (!(packet = (unsigned char *)malloc((unsigned int)packlen))) {
1078
		fprintf(stderr, "ping: out of memory.\n");
1078
		fprintf(stderr, "ping: out of memory.\n");
1079
		exit(2);
1079
		exit(2);
1080
	}
1080
	}
(-)a/ping_common.c (-4 / +4 lines)
Lines 209-215 static void fill(char *patp) Link Here
209
	int ii, jj, kk;
209
	int ii, jj, kk;
210
	int pat[16];
210
	int pat[16];
211
	char *cp;
211
	char *cp;
212
	u_char *bp = outpack+8;
212
	unsigned char *bp = outpack+8;
213
213
214
#ifdef USE_IDN
214
#ifdef USE_IDN
215
	setlocale(LC_ALL, "C");
215
	setlocale(LC_ALL, "C");
Lines 672-678 void setup(int icmp_sock) Link Here
672
672
673
	if (!(options & F_PINGFILLED)) {
673
	if (!(options & F_PINGFILLED)) {
674
		int i;
674
		int i;
675
		u_char *p = outpack+8;
675
		unsigned char *p = outpack+8;
676
676
677
		/* Do not forget about case of small datalen,
677
		/* Do not forget about case of small datalen,
678
		 * fill timestamp area too!
678
		 * fill timestamp area too!
Lines 958-970 restamp: Link Here
958
			printf(" (BAD CHECKSUM!)");
958
			printf(" (BAD CHECKSUM!)");
959
959
960
		/* check the data */
960
		/* check the data */
961
		cp = ((u_char*)ptr) + sizeof(struct timeval);
961
		cp = ((unsigned char*)ptr) + sizeof(struct timeval);
962
		dp = &outpack[8 + sizeof(struct timeval)];
962
		dp = &outpack[8 + sizeof(struct timeval)];
963
		for (i = sizeof(struct timeval); i < datalen; ++i, ++cp, ++dp) {
963
		for (i = sizeof(struct timeval); i < datalen; ++i, ++cp, ++dp) {
964
			if (*cp != *dp) {
964
			if (*cp != *dp) {
965
				printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
965
				printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
966
				       i, *dp, *cp);
966
				       i, *dp, *cp);
967
				cp = (u_char*)ptr + sizeof(struct timeval);
967
				cp = (unsigned char*)ptr + sizeof(struct timeval);
968
				for (i = sizeof(struct timeval); i < datalen; ++i, ++cp) {
968
				for (i = sizeof(struct timeval); i < datalen; ++i, ++cp) {
969
					if ((i % 32) == sizeof(struct timeval))
969
					if ((i % 32) == sizeof(struct timeval))
970
						printf("\n#%d\t", i);
970
						printf("\n#%d\t", i);
(-)a/ping_common.h (-1 / +1 lines)
Lines 118-124 static inline bitmap_t rcvd_test(__u16 seq) Link Here
118
	return A(bit) & B(bit);
118
	return A(bit) & B(bit);
119
}
119
}
120
120
121
extern u_char outpack[];
121
extern unsigned char outpack[];
122
extern int maxpacket;
122
extern int maxpacket;
123
123
124
extern int datalen;
124
extern int datalen;
(-)a/rdisc.c (-20 / +20 lines)
Lines 119-129 static void init(void); Link Here
119
/* For router advertisement */
119
/* For router advertisement */
120
struct icmp_ra
120
struct icmp_ra
121
{
121
{
122
	u_char	icmp_type;		/* type of message, see below */
122
	unsigned char	icmp_type;		/* type of message, see below */
123
	u_char	icmp_code;		/* type sub code */
123
	unsigned char	icmp_code;		/* type sub code */
124
	u_short	icmp_cksum;		/* ones complement cksum of struct */
124
	unsigned short	icmp_cksum;		/* ones complement cksum of struct */
125
	u_char	icmp_num_addrs;
125
	unsigned char	icmp_num_addrs;
126
	u_char	icmp_wpa;		/* Words per address */
126
	unsigned char	icmp_wpa;		/* Words per address */
127
	short 	icmp_lifetime;
127
	short 	icmp_lifetime;
128
};
128
};
129
129
Lines 208-214 static void graceful_finish(void); Link Here
208
static void finish(void);
208
static void finish(void);
209
static void timer(void);
209
static void timer(void);
210
static void initifs(void);
210
static void initifs(void);
211
static u_short in_cksum(u_short *addr, int len);
211
static unsigned short in_cksum(unsigned short *addr, int len);
212
212
213
static int logging = 0;
213
static int logging = 0;
214
214
Lines 460-466 next: Link Here
460
	timer();	/* start things going */
460
	timer();	/* start things going */
461
461
462
	for (;;) {
462
	for (;;) {
463
		u_char	packet[MAXPACKET];
463
		unsigned char	packet[MAXPACKET];
464
		int len = sizeof (packet);
464
		int len = sizeof (packet);
465
		socklen_t fromlen = sizeof (from);
465
		socklen_t fromlen = sizeof (from);
466
		int cc;
466
		int cc;
Lines 540-546 void timer() Link Here
540
void
540
void
541
solicitor(struct sockaddr_in *sin)
541
solicitor(struct sockaddr_in *sin)
542
{
542
{
543
	static u_char outpack[MAXPACKET];
543
	static unsigned char outpack[MAXPACKET];
544
	struct icmphdr *icp = (struct icmphdr *) ALLIGN(outpack);
544
	struct icmphdr *icp = (struct icmphdr *) ALLIGN(outpack);
545
	int packetlen, i;
545
	int packetlen, i;
546
546
Lines 555-561 solicitor(struct sockaddr_in *sin) Link Here
555
	packetlen = 8;
555
	packetlen = 8;
556
556
557
	/* Compute ICMP checksum here */
557
	/* Compute ICMP checksum here */
558
	icp->checksum = in_cksum( (u_short *)icp, packetlen );
558
	icp->checksum = in_cksum( (unsigned short *)icp, packetlen );
559
559
560
	if (isbroadcast(sin))
560
	if (isbroadcast(sin))
561
		i = sendbcast(s, (char *)outpack, packetlen);
561
		i = sendbcast(s, (char *)outpack, packetlen);
Lines 584-590 solicitor(struct sockaddr_in *sin) Link Here
584
void
584
void
585
advertise(struct sockaddr_in *sin, int lft)
585
advertise(struct sockaddr_in *sin, int lft)
586
{
586
{
587
	static u_char outpack[MAXPACKET];
587
	static unsigned char outpack[MAXPACKET];
588
	struct icmp_ra *rap = (struct icmp_ra *) ALLIGN(outpack);
588
	struct icmp_ra *rap = (struct icmp_ra *) ALLIGN(outpack);
589
	struct icmp_ra_addr *ap;
589
	struct icmp_ra_addr *ap;
590
	int packetlen, i, cc;
590
	int packetlen, i, cc;
Lines 615-621 advertise(struct sockaddr_in *sin, int lft) Link Here
615
		rap->icmp_num_addrs++;
615
		rap->icmp_num_addrs++;
616
616
617
		/* Compute ICMP checksum here */
617
		/* Compute ICMP checksum here */
618
		rap->icmp_cksum = in_cksum( (u_short *)rap, packetlen );
618
		rap->icmp_cksum = in_cksum( (unsigned short *)rap, packetlen );
619
619
620
		if (isbroadcast(sin))
620
		if (isbroadcast(sin))
621
			cc = sendbcastif(s, (char *)outpack, packetlen,
621
			cc = sendbcastif(s, (char *)outpack, packetlen,
Lines 749-755 pr_pack(char *buf, int cc, struct sockaddr_in *from) Link Here
749
749
750
		/* TBD verify that the link is multicast or broadcast */
750
		/* TBD verify that the link is multicast or broadcast */
751
		/* XXX Find out the link it came in over? */
751
		/* XXX Find out the link it came in over? */
752
		if (in_cksum((u_short *)ALLIGN(buf+hlen), cc)) {
752
		if (in_cksum((unsigned short *)ALLIGN(buf+hlen), cc)) {
753
			if (verbose)
753
			if (verbose)
754
				logtrace("ICMP %s from %s: Bad checksum\n",
754
				logtrace("ICMP %s from %s: Bad checksum\n",
755
					 pr_type((int)rap->icmp_type),
755
					 pr_type((int)rap->icmp_type),
Lines 838-844 pr_pack(char *buf, int cc, struct sockaddr_in *from) Link Here
838
		/* TBD verify that the link is multicast or broadcast */
838
		/* TBD verify that the link is multicast or broadcast */
839
		/* XXX Find out the link it came in over? */
839
		/* XXX Find out the link it came in over? */
840
840
841
		if (in_cksum((u_short *)ALLIGN(buf+hlen), cc)) {
841
		if (in_cksum((unsigned short *)ALLIGN(buf+hlen), cc)) {
842
			if (verbose)
842
			if (verbose)
843
				logtrace("ICMP %s from %s: Bad checksum\n",
843
				logtrace("ICMP %s from %s: Bad checksum\n",
844
					      pr_type((int)icp->type),
844
					      pr_type((int)icp->type),
Lines 914-929 pr_pack(char *buf, int cc, struct sockaddr_in *from) Link Here
914
#if BYTE_ORDER == LITTLE_ENDIAN
914
#if BYTE_ORDER == LITTLE_ENDIAN
915
# define ODDBYTE(v)	(v)
915
# define ODDBYTE(v)	(v)
916
#elif BYTE_ORDER == BIG_ENDIAN
916
#elif BYTE_ORDER == BIG_ENDIAN
917
# define ODDBYTE(v)	((u_short)(v) << 8)
917
# define ODDBYTE(v)	((unsigned short)(v) << 8)
918
#else
918
#else
919
# define ODDBYTE(v)	htons((u_short)(v) << 8)
919
# define ODDBYTE(v)	htons((unsigned short)(v) << 8)
920
#endif
920
#endif
921
921
922
u_short in_cksum(u_short *addr, int len)
922
unsigned short in_cksum(unsigned short *addr, int len)
923
{
923
{
924
	register int nleft = len;
924
	register int nleft = len;
925
	register u_short *w = addr;
925
	register unsigned short *w = addr;
926
	register u_short answer;
926
	register unsigned short answer;
927
	register int sum = 0;
927
	register int sum = 0;
928
928
929
	/*
929
	/*
Lines 939-945 u_short in_cksum(u_short *addr, int len) Link Here
939
939
940
	/* mop up an odd byte, if necessary */
940
	/* mop up an odd byte, if necessary */
941
	if( nleft == 1 )
941
	if( nleft == 1 )
942
		sum += ODDBYTE(*(u_char *)w);	/* le16toh() may be unavailable on old systems */
942
		sum += ODDBYTE(*(unsigned char *)w);	/* le16toh() may be unavailable on old systems */
943
943
944
	/*
944
	/*
945
	 * add back carry outs from top 16 bits to low 16 bits
945
	 * add back carry outs from top 16 bits to low 16 bits
Lines 1263-1269 join(int sock, struct sockaddr_in *sin) Link Here
1263
int support_multicast()
1263
int support_multicast()
1264
{
1264
{
1265
	int sock;
1265
	int sock;
1266
	u_char ttl = 1;
1266
	unsigned char ttl = 1;
1267
1267
1268
	sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
1268
	sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
1269
	if (sock < 0) {
1269
	if (sock < 0) {
(-)a/tftpd.c (-12 / +12 lines)
Lines 363-370 void sendfile(struct formats *pf) Link Here
363
			nak(errno + 100);
363
			nak(errno + 100);
364
			goto abort;
364
			goto abort;
365
		}
365
		}
366
		dp->th_opcode = htons((u_short)DATA);
366
		dp->th_opcode = htons((unsigned short)DATA);
367
		dp->th_block = htons((u_short)block);
367
		dp->th_block = htons((unsigned short)block);
368
		timeout = 0;
368
		timeout = 0;
369
		(void) setjmp(timeoutbuf);
369
		(void) setjmp(timeoutbuf);
370
370
Lines 383-390 send_data: Link Here
383
				syslog(LOG_ERR, "tftpd: read: %m\n");
383
				syslog(LOG_ERR, "tftpd: read: %m\n");
384
				goto abort;
384
				goto abort;
385
			}
385
			}
386
			ap->th_opcode = ntohs((u_short)ap->th_opcode);
386
			ap->th_opcode = ntohs((unsigned short)ap->th_opcode);
387
			ap->th_block = ntohs((u_short)ap->th_block);
387
			ap->th_block = ntohs((unsigned short)ap->th_block);
388
388
389
			if (ap->th_opcode == ERROR)
389
			if (ap->th_opcode == ERROR)
390
				goto abort;
390
				goto abort;
Lines 429-436 void recvfile(struct formats *pf) Link Here
429
	ap = (struct tftphdr *)ackbuf;
429
	ap = (struct tftphdr *)ackbuf;
430
	do {
430
	do {
431
		timeout = 0;
431
		timeout = 0;
432
		ap->th_opcode = htons((u_short)ACK);
432
		ap->th_opcode = htons((unsigned short)ACK);
433
		ap->th_block = htons((u_short)block);
433
		ap->th_block = htons((unsigned short)block);
434
		block++;
434
		block++;
435
		(void) setjmp(timeoutbuf);
435
		(void) setjmp(timeoutbuf);
436
send_ack:
436
send_ack:
Lines 448-455 send_ack: Link Here
448
				syslog(LOG_ERR, "tftpd: read: %m\n");
448
				syslog(LOG_ERR, "tftpd: read: %m\n");
449
				goto abort;
449
				goto abort;
450
			}
450
			}
451
			dp->th_opcode = ntohs((u_short)dp->th_opcode);
451
			dp->th_opcode = ntohs((unsigned short)dp->th_opcode);
452
			dp->th_block = ntohs((u_short)dp->th_block);
452
			dp->th_block = ntohs((unsigned short)dp->th_block);
453
			if (dp->th_opcode == ERROR)
453
			if (dp->th_opcode == ERROR)
454
				goto abort;
454
				goto abort;
455
			if (dp->th_opcode == DATA) {
455
			if (dp->th_opcode == DATA) {
Lines 474-481 send_ack: Link Here
474
	write_behind(file, pf->f_convert);
474
	write_behind(file, pf->f_convert);
475
	(void) fclose(file);            /* close data file */
475
	(void) fclose(file);            /* close data file */
476
476
477
	ap->th_opcode = htons((u_short)ACK);    /* send the "final" ack */
477
	ap->th_opcode = htons((unsigned short)ACK);    /* send the "final" ack */
478
	ap->th_block = htons((u_short)(block));
478
	ap->th_block = htons((unsigned short)(block));
479
	(void) send(peer, ackbuf, 4, confirmed);
479
	(void) send(peer, ackbuf, 4, confirmed);
480
480
481
	signal(SIGALRM, justquit);      /* just quit on timeout */
481
	signal(SIGALRM, justquit);      /* just quit on timeout */
Lines 519-526 void nak(int error) Link Here
519
	register struct errmsg *pe;
519
	register struct errmsg *pe;
520
520
521
	tp = (struct tftphdr *)buf;
521
	tp = (struct tftphdr *)buf;
522
	tp->th_opcode = htons((u_short)ERROR);
522
	tp->th_opcode = htons((unsigned short)ERROR);
523
	tp->th_code = htons((u_short)error);
523
	tp->th_code = htons((unsigned short)error);
524
	for (pe = errmsgs; pe->e_code >= 0; pe++)
524
	for (pe = errmsgs; pe->e_code >= 0; pe++)
525
		if (pe->e_code == error)
525
		if (pe->e_code == error)
526
			break;
526
			break;
(-)a/traceroute6.c (-6 / +5 lines)
Lines 288-297 char copyright[] = Link Here
288
#define Fprintf (void)fprintf
288
#define Fprintf (void)fprintf
289
#define Printf (void)printf
289
#define Printf (void)printf
290
290
291
u_char	packet[512];		/* last inbound (icmp) packet */
291
unsigned char	packet[512];		/* last inbound (icmp) packet */
292
292
293
int	wait_for_reply(int, struct sockaddr_in6 *, struct in6_addr *, int);
293
int	wait_for_reply(int, struct sockaddr_in6 *, struct in6_addr *, int);
294
int	packet_ok(u_char *buf, int cc, struct sockaddr_in6 *from,
294
int	packet_ok(unsigned char *buf, int cc, struct sockaddr_in6 *from,
295
		  struct in6_addr *to, int seq, struct timeval *);
295
		  struct in6_addr *to, int seq, struct timeval *);
296
void	send_probe(int seq, int ttl);
296
void	send_probe(int seq, int ttl);
297
double	deltaT (struct timeval *, struct timeval *);
297
double	deltaT (struct timeval *, struct timeval *);
Lines 314-320 char *hostname; Link Here
314
int nprobes = 3;
314
int nprobes = 3;
315
int max_ttl = 30;
315
int max_ttl = 30;
316
pid_t ident;
316
pid_t ident;
317
u_short port = 32768+666;	/* start udp dest port # for probe packets */
317
unsigned short port = 32768+666;	/* start udp dest port # for probe packets */
318
int options;			/* socket options */
318
int options;			/* socket options */
319
int verbose;
319
int verbose;
320
int waittime = 5;		/* time to wait for response (in seconds) */
320
int waittime = 5;		/* time to wait for response (in seconds) */
Lines 821-832 char * pr_type(unsigned char t) Link Here
821
}
821
}
822
822
823
823
824
int packet_ok(u_char *buf, int cc, struct sockaddr_in6 *from,
824
int packet_ok(unsigned char *buf, int cc, struct sockaddr_in6 *from,
825
	      struct in6_addr *to, int seq,
825
	      struct in6_addr *to, int seq,
826
	      struct timeval *tv)
826
	      struct timeval *tv)
827
{
827
{
828
	struct icmp6_hdr *icp;
828
	struct icmp6_hdr *icp;
829
	u_char type, code;
829
	unsigned char type, code;
830
830
831
	icp = (struct icmp6_hdr *) buf;
831
	icp = (struct icmp6_hdr *) buf;
832
832
833
- 

Return to bug 503914