Changeset View
Changeset View
Standalone View
Standalone View
sbin/ping/ping.c
Show First 20 Lines • Show All 1,674 Lines • ▼ Show 20 Lines | pr_iph(struct ip *ip) | ||||
hlen = ip->ip_hl << 2; | hlen = ip->ip_hl << 2; | ||||
cp = (u_char *)ip + 20; /* point to options */ | cp = (u_char *)ip + 20; /* point to options */ | ||||
(void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst\n"); | (void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst\n"); | ||||
(void)printf(" %1x %1x %02x %04x %04x", | (void)printf(" %1x %1x %02x %04x %04x", | ||||
ip->ip_v, ip->ip_hl, ip->ip_tos, ntohs(ip->ip_len), | ip->ip_v, ip->ip_hl, ip->ip_tos, ntohs(ip->ip_len), | ||||
ntohs(ip->ip_id)); | ntohs(ip->ip_id)); | ||||
(void)printf(" %1lx %04lx", | (void)printf(" %1x %04x", | ||||
(u_long) (ntohl(ip->ip_off) & 0xe000) >> 13, | (ntohs(ip->ip_off) & 0xe000) >> 13, | ||||
(u_long) ntohl(ip->ip_off) & 0x1fff); | ntohs(ip->ip_off) & 0x1fff); | ||||
(void)printf(" %02x %02x %04x", ip->ip_ttl, ip->ip_p, | (void)printf(" %02x %02x %04x", ip->ip_ttl, ip->ip_p, | ||||
ntohs(ip->ip_sum)); | ntohs(ip->ip_sum)); | ||||
memcpy(&ina, &ip->ip_src.s_addr, sizeof ina); | memcpy(&ina, &ip->ip_src.s_addr, sizeof ina); | ||||
(void)printf(" %s ", inet_ntoa(ina)); | (void)printf(" %s ", inet_ntoa(ina)); | ||||
memcpy(&ina, &ip->ip_dst.s_addr, sizeof ina); | memcpy(&ina, &ip->ip_dst.s_addr, sizeof ina); | ||||
(void)printf(" %s ", inet_ntoa(ina)); | (void)printf(" %s ", inet_ntoa(ina)); | ||||
/* dump any option bytes */ | /* dump any option bytes */ | ||||
while (hlen-- > 20) { | while (hlen-- > 20) { | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |