summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-19 20:32:02 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-19 20:32:02 +0000
commit28703015ab71784f40bc97f720ed900e26bd03ca (patch)
treeff0f9a21d1822c9a2f35819db4156d9555f56116 /networking
parentf58906b6463436f6a19f72d43c3ab4ba69d79104 (diff)
downloadbusybox-w32-28703015ab71784f40bc97f720ed900e26bd03ca.tar.gz
busybox-w32-28703015ab71784f40bc97f720ed900e26bd03ca.tar.bz2
busybox-w32-28703015ab71784f40bc97f720ed900e26bd03ca.zip
u_short, ulong exterminated
fdiskXXX: add a bit of sanity (not enough by far)
Diffstat (limited to 'networking')
-rw-r--r--networking/inetd.c6
-rw-r--r--networking/traceroute.c32
-rw-r--r--networking/udhcp/arpping.c6
-rw-r--r--networking/udhcp/dhcprelay.c2
4 files changed, 22 insertions, 24 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index ec7b2e8f7..4856b11ae 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -985,7 +985,7 @@ static void config(int sig ATTRIBUTE_UNUSED)
985 } else 985 } else
986#endif 986#endif
987 { 987 {
988 u_short port = htons(atoi(sep->se_service)); 988 uint16_t port = htons(atoi(sep->se_service));
989 // FIXME: atoi_or_else(str, 0) would be handy here 989 // FIXME: atoi_or_else(str, 0) would be handy here
990 if (!port) { 990 if (!port) {
991 /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname)); 991 /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname));
@@ -1037,8 +1037,8 @@ static void config(int sig ATTRIBUTE_UNUSED)
1037 register_rpc(sep); 1037 register_rpc(sep);
1038 } else 1038 } else
1039#endif 1039#endif
1040 { 1040 {
1041 u_short port = htons(atoi(sep->se_service)); 1041 uint16_t port = htons(atoi(sep->se_service));
1042 1042
1043 if (!port) { 1043 if (!port) {
1044 /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname)); 1044 /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname));
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 490076543..1462543f1 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -316,8 +316,8 @@ static int pmtu; /* Path MTU Discovery (RFC1191) */
316 316
317static char *hostname; 317static char *hostname;
318 318
319static u_short ident; 319static uint16_t ident;
320static u_short port = 32768 + 666; /* start udp dest port # for probe packets */ 320static uint16_t port = 32768 + 666; /* start udp dest port # for probe packets */
321 321
322static int waittime = 5; /* time to wait for response (in seconds) */ 322static int waittime = 5; /* time to wait for response (in seconds) */
323static int nflag; /* print addresses numerically */ 323static int nflag; /* print addresses numerically */
@@ -539,12 +539,12 @@ wait_for_reply(int sock, struct sockaddr_in *fromp, const struct timeval *tp)
539/* 539/*
540 * Checksum routine for Internet Protocol family headers (C Version) 540 * Checksum routine for Internet Protocol family headers (C Version)
541 */ 541 */
542static u_short 542static uint16_t
543in_cksum(u_short *addr, int len) 543in_cksum(uint16_t *addr, int len)
544{ 544{
545 int nleft = len; 545 int nleft = len;
546 u_short *w = addr; 546 uint16_t *w = addr;
547 u_short answer; 547 uint16_t answer;
548 int sum = 0; 548 int sum = 0;
549 549
550 /* 550 /*
@@ -589,7 +589,7 @@ send_probe(int seq, int ttl, struct timeval *tp)
589 */ 589 */
590 if (doipcksum) { 590 if (doipcksum) {
591 outip->ip_sum = 591 outip->ip_sum =
592 in_cksum((u_short *)outip, sizeof(*outip) + optlen); 592 in_cksum((uint16_t *)outip, sizeof(*outip) + optlen);
593 if (outip->ip_sum == 0) 593 if (outip->ip_sum == 0)
594 outip->ip_sum = 0xffff; 594 outip->ip_sum = 0xffff;
595 } 595 }
@@ -610,7 +610,7 @@ send_probe(int seq, int ttl, struct timeval *tp)
610 if (useicmp) { 610 if (useicmp) {
611 /* Always calculate checksum for icmp packets */ 611 /* Always calculate checksum for icmp packets */
612 outicmp->icmp_cksum = 0; 612 outicmp->icmp_cksum = 0;
613 outicmp->icmp_cksum = in_cksum((u_short *)outicmp, 613 outicmp->icmp_cksum = in_cksum((uint16_t *)outicmp,
614 packlen - (sizeof(*outip) + optlen)); 614 packlen - (sizeof(*outip) + optlen));
615 if (outicmp->icmp_cksum == 0) 615 if (outicmp->icmp_cksum == 0)
616 outicmp->icmp_cksum = 0xffff; 616 outicmp->icmp_cksum = 0xffff;
@@ -628,7 +628,7 @@ send_probe(int seq, int ttl, struct timeval *tp)
628 ui->ui_pr = oui->ui_pr; 628 ui->ui_pr = oui->ui_pr;
629 ui->ui_len = outudp->len; 629 ui->ui_len = outudp->len;
630 outudp->check = 0; 630 outudp->check = 0;
631 outudp->check = in_cksum((u_short *)ui, packlen); 631 outudp->check = in_cksum((uint16_t *)ui, packlen);
632 if (outudp->check == 0) 632 if (outudp->check == 0)
633 outudp->check = 0xffff; 633 outudp->check = 0xffff;
634 *outip = tip; 634 *outip = tip;
@@ -637,11 +637,11 @@ send_probe(int seq, int ttl, struct timeval *tp)
637#if ENABLE_FEATURE_TRACEROUTE_VERBOSE 637#if ENABLE_FEATURE_TRACEROUTE_VERBOSE
638 /* XXX undocumented debugging hack */ 638 /* XXX undocumented debugging hack */
639 if (verbose > 1) { 639 if (verbose > 1) {
640 const u_short *sp; 640 const uint16_t *sp;
641 int nshorts, i; 641 int nshorts, i;
642 642
643 sp = (u_short *)outip; 643 sp = (uint16_t *)outip;
644 nshorts = (u_int)packlen / sizeof(u_short); 644 nshorts = (u_int)packlen / sizeof(uint16_t);
645 i = 0; 645 i = 0;
646 printf("[ %d bytes", packlen); 646 printf("[ %d bytes", packlen);
647 while (--nshorts >= 0) { 647 while (--nshorts >= 0) {
@@ -906,7 +906,7 @@ traceroute_main(int argc, char *argv[])
906#if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE 906#if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
907 int lsrr = 0; 907 int lsrr = 0;
908#endif 908#endif
909 u_short off = 0; 909 uint16_t off = 0;
910 struct IFADDRLIST *al; 910 struct IFADDRLIST *al;
911 char *device = NULL; 911 char *device = NULL;
912 int max_ttl = 30; 912 int max_ttl = 30;
@@ -1137,17 +1137,15 @@ traceroute_main(int argc, char *argv[])
1137 outicmp = (struct icmp *)outp; 1137 outicmp = (struct icmp *)outp;
1138 outicmp->icmp_type = ICMP_ECHO; 1138 outicmp->icmp_type = ICMP_ECHO;
1139 outicmp->icmp_id = htons(ident); 1139 outicmp->icmp_id = htons(ident);
1140
1141 outdata = (struct outdata *)(outp + 8); /* XXX magic number */ 1140 outdata = (struct outdata *)(outp + 8); /* XXX magic number */
1142 } else 1141 } else
1143#endif 1142#endif
1144 { 1143 {
1145 outip->ip_p = IPPROTO_UDP; 1144 outip->ip_p = IPPROTO_UDP;
1146 1145
1147 outudp = (struct udphdr *)outp; 1146 outudp = (struct udphdr *)outp;
1148 outudp->source = htons(ident); 1147 outudp->source = htons(ident);
1149 outudp->len = 1148 outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen)));
1150 htons((u_short)(packlen - (sizeof(*outip) + optlen)));
1151 outdata = (struct outdata *)(outudp + 1); 1149 outdata = (struct outdata *)(outudp + 1);
1152 } 1150 }
1153 1151
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 9c8b9c562..f78fd3fd8 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -15,9 +15,9 @@
15 15
16struct arpMsg { 16struct arpMsg {
17 /* Ethernet header */ 17 /* Ethernet header */
18 u_char h_dest[6]; /* destination ether addr */ 18 uint8_t h_dest[6]; /* destination ether addr */
19 u_char h_source[6]; /* source ether addr */ 19 uint8_t h_source[6]; /* source ether addr */
20 u_short h_proto; /* packet type ID field */ 20 uint16_t h_proto; /* packet type ID field */
21 21
22 /* ARP packet */ 22 /* ARP packet */
23 uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */ 23 uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 052739400..a3ea327c3 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -103,7 +103,7 @@ static void xid_del(u_int32_t xid)
103 */ 103 */
104static int get_dhcp_packet_type(struct dhcpMessage *p) 104static int get_dhcp_packet_type(struct dhcpMessage *p)
105{ 105{
106 u_char *op; 106 uint8_t *op;
107 107
108 /* it must be either a BOOTREQUEST or a BOOTREPLY */ 108 /* it must be either a BOOTREQUEST or a BOOTREPLY */
109 if (p->op != BOOTREQUEST && p->op != BOOTREPLY) 109 if (p->op != BOOTREQUEST && p->op != BOOTREPLY)