Changeset 1477
- Timestamp:
- 11/08/09 14:56:51 (10 months ago)
- Location:
- trunk/batctl
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/batctl/ping.c
r1476 r1477 149 149 icmp_packet_out.seqno = 0; 150 150 151 printf("PING %s (%s) %z i(%zi) bytes of data\n", dst_string, mac_string,151 printf("PING %s (%s) %zu(%zu) bytes of data\n", dst_string, mac_string, 152 152 sizeof(icmp_packet_out), sizeof(icmp_packet_out) + 28); 153 153 … … 197 197 198 198 if ((size_t)read_len < sizeof(icmp_packet_in)) { 199 printf("Warning - dropping received packet as it is smaller than expected (%z d): %zd\n",199 printf("Warning - dropping received packet as it is smaller than expected (%zu): %zd\n", 200 200 sizeof(icmp_packet_in), read_len); 201 201 goto sleep; … … 205 205 case ECHO_REPLY: 206 206 time_delta = end_timer(); 207 printf("%zd bytes from %s icmp_seq=% u ttl=%d time=%.2f ms\n",207 printf("%zd bytes from %s icmp_seq=%hu ttl=%d time=%.2f ms\n", 208 208 read_len, dst_string, ntohs(icmp_packet_in.seqno), 209 209 icmp_packet_in.ttl, time_delta); … … 217 217 break; 218 218 case DESTINATION_UNREACHABLE: 219 printf("From %s: Destination Host Unreachable (icmp_seq % u)\n", dst_string, ntohs(icmp_packet_in.seqno));219 printf("From %s: Destination Host Unreachable (icmp_seq %hu)\n", dst_string, ntohs(icmp_packet_in.seqno)); 220 220 break; 221 221 case TTL_EXCEEDED: 222 printf("From %s: Time to live exceeded (icmp_seq % u)\n", dst_string, ntohs(icmp_packet_in.seqno));222 printf("From %s: Time to live exceeded (icmp_seq %hu)\n", dst_string, ntohs(icmp_packet_in.seqno)); 223 223 break; 224 224 case PARAMETER_PROBLEM: … … 244 244 245 245 printf("--- %s ping statistics ---\n", dst_string); 246 printf("% d packets transmitted, %d received, %d%% packet loss\n",246 printf("%u packets transmitted, %u received, %u%% packet loss\n", 247 247 packets_out, packets_in, packets_loss); 248 248 printf("rtt min/avg/max/mdev = %.3f/%.3f/%.3f/%.3f ms\n", -
trunk/batctl/tcpdump.c
r1463 r1477 46 46 #define LEN_CHECK(buff_len, check_len, desc) \ 47 47 if ((size_t)(buff_len) < (check_len)) { \ 48 printf("Warning - dropping received %s packet as it is smaller than expected (%z d): %zd\n", \48 printf("Warning - dropping received %s packet as it is smaller than expected (%zu): %zu\n", \ 49 49 desc, (check_len), (size_t)(buff_len)); \ 50 50 return; \ … … 128 128 switch (icmphdr->type) { 129 129 case ICMP_ECHOREPLY: 130 printf("%s: ICMP echo reply, id % u, seq %u, length %zd\n",130 printf("%s: ICMP echo reply, id %hu, seq %hu, length %zu\n", 131 131 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 132 132 ntohs(icmphdr->un.echo.id), ntohs(icmphdr->un.echo.sequence), … … 143 143 144 144 printf("%s: ICMP ", inet_ntoa(*(struct in_addr *)&iphdr->daddr)); 145 printf("%s udp port % u unreachable, length %zd\n",145 printf("%s udp port %hu unreachable, length %zu\n", 146 146 inet_ntoa(*(struct in_addr *)&tmp_iphdr->daddr), 147 147 ntohs(tmp_udphdr->dest), (size_t)buff_len - (iphdr->ihl * 4)); 148 148 break; 149 149 default: 150 printf("%s: ICMP unreachable % u, length %zd\n",150 printf("%s: ICMP unreachable %hhu, length %zu\n", 151 151 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 152 152 icmphdr->code, (size_t)buff_len - (iphdr->ihl * 4)); … … 156 156 break; 157 157 case ICMP_ECHO: 158 printf("%s: ICMP echo request, id % u, seq %u, length %zd\n",158 printf("%s: ICMP echo request, id %hu, seq %hu, length %zu\n", 159 159 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 160 160 ntohs(icmphdr->un.echo.id), ntohs(icmphdr->un.echo.sequence), … … 162 162 break; 163 163 case ICMP_TIME_EXCEEDED: 164 printf("%s: ICMP time exceeded in-transit, length %z d\n",164 printf("%s: ICMP time exceeded in-transit, length %zu\n", 165 165 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 166 166 (size_t)buff_len - (iphdr->ihl * 4)); 167 167 break; 168 168 default: 169 printf("%s: ICMP type % u, length %zd\n",169 printf("%s: ICMP type %hhu, length %zu\n", 170 170 inet_ntoa(*(struct in_addr *)&iphdr->daddr), icmphdr->type, 171 171 (size_t)buff_len - (iphdr->ihl * 4)); … … 179 179 tcphdr = (struct tcphdr *)(packet_buff + (iphdr->ihl * 4)); 180 180 printf("IP %s.%i > ", inet_ntoa(*(struct in_addr *)&iphdr->saddr), ntohs(tcphdr->source)); 181 printf("%s.%i: TCP, flags [%c%c%c%c%c%c], length %z d\n",181 printf("%s.%i: TCP, flags [%c%c%c%c%c%c], length %zu\n", 182 182 inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(tcphdr->dest), 183 183 (tcphdr->fin ? 'F' : '.'), (tcphdr->syn ? 'S' : '.'), … … 195 195 case 67: 196 196 LEN_CHECK((size_t)buff_len - (iphdr->ihl * 4) - sizeof(struct udphdr), (size_t) 44, "DHCP"); 197 printf("%s.67: BOOTP/DHCP, Request from %s, length %z d\n",197 printf("%s.67: BOOTP/DHCP, Request from %s, length %zu\n", 198 198 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 199 199 ether_ntoa_long((struct ether_addr *)(((char *)udphdr) + sizeof(struct udphdr) + 28)), … … 201 201 break; 202 202 case 68: 203 printf("%s.68: BOOTP/DHCP, Reply, length %z d\n",203 printf("%s.68: BOOTP/DHCP, Reply, length %zu\n", 204 204 inet_ntoa(*(struct in_addr *)&iphdr->daddr), 205 205 (size_t)buff_len - (iphdr->ihl * 4) - sizeof(struct udphdr)); 206 206 break; 207 207 default: 208 printf("%s.%i: UDP, length %z d\n",208 printf("%s.%i: UDP, length %zu\n", 209 209 inet_ntoa(*(struct in_addr *)&iphdr->daddr), ntohs(udphdr->dest), 210 210 (size_t)buff_len - (iphdr->ihl * 4) - sizeof(struct udphdr)); … … 237 237 get_name_by_macaddr((struct ether_addr *)batman_packet->orig, read_opt)); 238 238 239 printf("OGM via neigh %s, seqno %d, tq %3d, ttl %2d, v %d, flags [%c%c], length %z d\n",239 printf("OGM via neigh %s, seqno %d, tq %3d, ttl %2d, v %d, flags [%c%c], length %zu\n", 240 240 get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt), 241 241 ntohs(batman_packet->seqno), batman_packet->tq, … … 265 265 switch (icmp_packet->msg_type) { 266 266 case ECHO_REPLY: 267 printf("%s: ICMP echo reply, id % u, seq %u, ttl %2d, v %d, length %zd\n",267 printf("%s: ICMP echo reply, id %hhu, seq %hu, ttl %2d, v %d, length %zu\n", 268 268 name, icmp_packet->uid, ntohs(icmp_packet->seqno), 269 269 icmp_packet->ttl, icmp_packet->version, … … 271 271 break; 272 272 case ECHO_REQUEST: 273 printf("%s: ICMP echo request, id % u, seq %u, ttl %2d, v %d, length %zd\n",273 printf("%s: ICMP echo request, id %hhu, seq %hu, ttl %2d, v %d, length %zu\n", 274 274 name, icmp_packet->uid, ntohs(icmp_packet->seqno), 275 275 icmp_packet->ttl, icmp_packet->version, … … 277 277 break; 278 278 case TTL_EXCEEDED: 279 printf("%s: ICMP time exceeded in-transit, id % u, seq %u, ttl %2d, v %d, length %zd\n",279 printf("%s: ICMP time exceeded in-transit, id %hhu, seq %hu, ttl %2d, v %d, length %zu\n", 280 280 name, icmp_packet->uid, ntohs(icmp_packet->seqno), 281 281 icmp_packet->ttl, icmp_packet->version, … … 283 283 break; 284 284 default: 285 printf("%s: ICMP type % u, length %zd\n",285 printf("%s: ICMP type %hhu, length %zu\n", 286 286 name, icmp_packet->msg_type, (size_t)buff_len - sizeof(struct ether_header)); 287 287 break; … … 306 306 get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt)); 307 307 308 printf("%s: UCAST, ttl % u, ",308 printf("%s: UCAST, ttl %hu, ", 309 309 get_name_by_macaddr((struct ether_addr *)unicast_packet->dest, read_opt), 310 310 unicast_packet->ttl); … … 322 322 break; 323 323 default: 324 printf(" unknown payload ether type: % u\n", ntohs(ether_header->ether_type));324 printf(" unknown payload ether type: %hu\n", ntohs(ether_header->ether_type)); 325 325 break; 326 326 } … … 344 344 get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt)); 345 345 346 printf("BCAST, orig %s, seqno % u, ",346 printf("BCAST, orig %s, seqno %hu, ", 347 347 get_name_by_macaddr((struct ether_addr *)bcast_packet->orig, read_opt), 348 348 ntohs(bcast_packet->seqno)); … … 360 360 break; 361 361 default: 362 printf(" unknown payload ether type: % u\n", ntohs(ether_header->ether_type));362 printf(" unknown payload ether type: %hu\n", ntohs(ether_header->ether_type)); 363 363 break; 364 364 } … … 493 493 494 494 if ((size_t)read_len < sizeof(struct ether_header)) { 495 printf("Warning - dropping received packet as it is smaller than expected (%z d): %zd\n",495 printf("Warning - dropping received packet as it is smaller than expected (%zu): %zd\n", 496 496 sizeof(struct ether_header), read_len); 497 497 continue; … … 539 539 break; 540 540 default: 541 printf("Warning - packet contains unknown ether type: % u\n", ether_type);541 printf("Warning - packet contains unknown ether type: %hu\n", ether_type); 542 542 break; 543 543 } -
trunk/batctl/traceroute.c
r1463 r1477 115 115 icmp_packet_out.seqno = 0; 116 116 117 printf("traceroute to %s (%s), %d hops max, %z dbyte packets\n",117 printf("traceroute to %s (%s), %d hops max, %zu byte packets\n", 118 118 dst_string, mac_string, TTL_MAX, sizeof(icmp_packet_out)); 119 119 … … 140 140 if (res <= 0) { 141 141 if (i == 0) 142 printf("%2 u: ", icmp_packet_out.ttl);142 printf("%2hu: ", icmp_packet_out.ttl); 143 143 144 144 printf(" * "); … … 155 155 156 156 if ((size_t)read_len < sizeof(icmp_packet_in)) { 157 printf("Warning - dropping received packet as it is smaller than expected (%z d): %zd\n",157 printf("Warning - dropping received packet as it is smaller than expected (%zu): %zd\n", 158 158 sizeof(icmp_packet_in), read_len); 159 159 continue; … … 177 177 178 178 if (!bat_host) 179 printf("%2 u: %s %.3f ms",179 printf("%2hu: %s %.3f ms", 180 180 icmp_packet_out.ttl, return_mac, time_delta); 181 181 else 182 printf("%2 u: %s (%s) %.3f ms",182 printf("%2hu: %s (%s) %.3f ms", 183 183 icmp_packet_out.ttl, bat_host->name, return_mac, time_delta); 184 184
