-/* $OpenBSD: traceroute.c,v 1.126 2014/04/23 09:27:13 florian Exp $ */
+/* $OpenBSD: traceroute.c,v 1.127 2014/04/28 09:45:30 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
rcvmhdr.msg_iovlen = 1;
rcvcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
CMSG_SPACE(sizeof(int));
-
+
if ((rcvcmsgbuf = malloc(rcvcmsglen)) == NULL)
errx(1, "malloc");
rcvmhdr.msg_control = (caddr_t) rcvcmsgbuf;
u_int32_t label;
u_int16_t off, olen;
u_int8_t type;
-
+
ip = (struct ip *)buf;
hlen = ip->ip_hl << 2;
if (cc < hlen + ICMP_MINLEN)
buf += off;
memcpy(&exthdr, buf, sizeof(exthdr));
- /* verify version */
+ /* verify version */
if ((exthdr.ieh_version & ICMP_EXT_HDR_VMASK) != ICMP_EXT_HDR_VERSION)
return;
cc -= sizeof(exthdr);
while (cc > sizeof(objhdr)) {
- memcpy(&objhdr, buf, sizeof(objhdr));
+ memcpy(&objhdr, buf, sizeof(objhdr));
olen = ntohs(objhdr.ieo_length);
- /* Sanity check the length field */
+ /* Sanity check the length field */
if (olen < sizeof(objhdr) || olen > cc)
return;
label = htonl(label);
buf += sizeof(u_int32_t);
olen -= sizeof(u_int32_t);
-
+
if (first == 0) {
printf(" [MPLS Label ");
first++;
}
if (olen > 0) {
printf("|]");
- return;
+ return;
}
if (first != 0)
printf("]");
return(NULL);
}
-void icmp_code(int af, int code, int *got_there, int *unreachable)
+void
+icmp_code(int af, int code, int *got_there, int *unreachable)
{
switch (af) {
case AF_INET:
break;
case AF_INET6:
uaddr = (const u_char *)&((struct sockaddr_in6 *) ss)->sin6_addr;
- if (snprintf(qbuf, sizeof qbuf,
+ if (snprintf(qbuf, sizeof qbuf,
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."
"origin6.asn.cymru.com",
{ "netcontrol", IPTOS_PREC_NETCONTROL },
{ "reliability", IPTOS_RELIABILITY },
{ "throughput", IPTOS_THROUGHPUT },
- { NULL, -1 },
+ { NULL, -1 },
};
-
+
for (t = toskeywords; t->keyword != NULL; t++) {
if (strcmp(s, t->keyword) == 0) {
*val = t->val;
return (1);
}
}
-
+
return (0);
}
usage(void)
{
if (v6flag) {
- fprintf(stderr, "usage: traceroute6 [-AcDdIlnSv] [-f firsthop] "
- "[-m hoplimit]\n"
- "\t[-p port] [-q probes] [-s src] [-V rtableid] [-w waittime]\n"
- "\thost [datalen]\n");
+ fprintf(stderr, "usage: traceroute6 [-AcDdIlnSv] [-f firsthop] "
+ "[-m hoplimit]\n"
+ "\t[-p port] [-q probes] [-s src] [-V rtableid] [-w waittime]\n"
+ "\thost [datalen]\n");
} else {
fprintf(stderr,
"usage: %s [-AcDdIlnSvx] [-f first_ttl] [-g gateway_addr] "