Lines Matching refs:pr
759 calc_packetlen(int plen_input, struct pr_set *pr)
785 optlen = 8 + gw_count * pr->addr_len;
791 minpacket = pr->ip_hdr_len + sizeof (struct outdata) + optlen;
793 minpacket += pr->icmp_minlen; /* minimum ICMP header size */
801 prog, pr->name, minpacket, IP_MAXPACKET);
816 set_src_addr(struct pr_set *pr, struct ifaddrlist **alp)
823 struct sockaddr_in *sin_from = (struct sockaddr_in *)pr->from;
825 struct sockaddr_in6 *sin6_from = (struct sockaddr_in6 *)pr->from;
840 num_ifs = ifaddrlist(&al, pr->family, ifaddrflags, errbuf);
854 prog, pr->name);
864 " interface\n", prog, device, if_index, pr->name);
872 get_hostinfo(source, pr->family, &aip);
876 prog, source, pr->name);
884 if (pr->family == AF_INET)
896 tmp2_al = find_ifaddr(al, num_ifs, ap, pr->family);
898 (void) inet_ntop(pr->family, ap, abuf, sizeof (abuf));
900 prog, abuf, pr->name);
918 if (pr->family == AF_INET)
919 set_sin(pr->from, &(tmp1_al->addr), pr->family);
925 set_sin(pr->from, ap, pr->family);
928 (void) inet_ntop(pr->family, pr->from_sin_addr,
940 if (pr->family == AF_INET) {
954 set_sin(pr->from, ap, pr->family);
969 if (pr->family == AF_INET && !raw_req) {
972 if (bind(sndsock4, (struct sockaddr *)pr->from,
978 } else if (pr->family == AF_INET6) {
981 if (bind(sndsock6, (struct sockaddr *)pr->from,
1161 setup_protocol(struct pr_set *pr, int family)
1167 pr->family = family;
1174 (void) strcpy(pr->name, "IPv4");
1175 (void) strcpy(pr->icmp, "icmp");
1176 pr->icmp_minlen = ICMP_MINLEN;
1177 pr->addr_len = sizeof (struct in_addr);
1178 pr->ip_hdr_len = sizeof (struct ip);
1179 pr->sock_size = sizeof (struct sockaddr_in);
1180 pr->to = (struct sockaddr *)&whereto;
1181 pr->from = (struct sockaddr *)&wherefrom;
1182 pr->from_sin_addr = (void *)&wherefrom.sin_addr;
1183 pr->gwIPlist = gwIPlist;
1184 pr->set_buffers_fn = set_buffers;
1185 pr->check_reply_fn = check_reply;
1186 pr->print_icmp_other_fn = print_icmp_other;
1187 pr->print_addr_fn = print_addr;
1188 pr->packlen = calc_packetlen(packlen_input, pr);
1190 (void) strcpy(pr->name, "IPv6");
1191 (void) strcpy(pr->icmp, "ipv6-icmp");
1192 pr->icmp_minlen = ICMP6_MINLEN;
1193 pr->addr_len = sizeof (struct in6_addr);
1194 pr->ip_hdr_len = sizeof (struct ip6_hdr);
1195 pr->sock_size = sizeof (struct sockaddr_in6);
1196 pr->to = (struct sockaddr *)&whereto6;
1197 pr->from = (struct sockaddr *)&wherefrom6;
1198 pr->from_sin_addr = (void *)&wherefrom6.sin6_addr;
1199 pr->gwIPlist = gwIP6list;
1200 pr->set_buffers_fn = set_buffers6;
1201 pr->check_reply_fn = check_reply6;
1202 pr->print_icmp_other_fn = print_icmp_other6;
1203 pr->print_addr_fn = print_addr6;
1204 pr->packlen = calc_packetlen(packlen_input, pr);
1206 if (pr->packlen == 0)
1214 setup_socket(struct pr_set *pr, int packet_len)
1224 if ((pe = getprotobyname(pr->icmp)) == NULL) {
1225 Fprintf(stderr, "%s: unknown protocol %s\n", prog, pr->icmp);
1232 if ((rsock = socket(pr->family, SOCK_RAW, pe->p_proto)) < 0) {
1254 if (pr->family == AF_INET6) {
1290 if (pr->family == AF_INET && raw_req) {
1295 if (pr->family == AF_INET)
1303 ssock = socket(pr->family, type, proto);
1325 if (pr->family == AF_INET && raw_req) {
1368 if (pr->family == AF_INET) {
1384 if (pr->family == AF_INET) {
1471 struct pr_set *pr)
1479 if (memcmp(&tmp_al->addr, ip_addr, pr->addr_len) == 0) {
1491 traceroute(union any_in_addr *ip_addr, struct msghdr *msg6, struct pr_set *pr,
1514 msg6->msg_name = pr->to;
1516 sndsock = (pr->family == AF_INET) ? sndsock4 : sndsock6;
1517 rcvsock = (pr->family == AF_INET) ? rcvsock4 : rcvsock6;
1531 (void) select_src_addr(pr->gwIPlist, &src_addr,
1532 pr->family);
1534 (void) select_src_addr(ip_addr, &src_addr, pr->family);
1536 set_sin(pr->from, &src_addr, pr->family);
1547 dev_name = device_name(al, num_ifs, &src_addr, pr);
1551 (void) inet_ntop(pr->family, pr->from_sin_addr, abuf,
1559 if (pr->family == AF_INET) {
1560 outip4->ip_src = *(struct in_addr *)pr->from_sin_addr;
1567 if (pr->family == AF_INET6 &&
1572 inet_ntop(pr->family, ip_addr, abuf, sizeof (abuf)));
1578 pr->packlen);
1586 if (pr->family == AF_INET && gw_count > 0)
1587 set_IPv4opt_sourcerouting(sndsock, ip_addr, pr->gwIPlist);
1654 if (pr->family == AF_INET) {
1655 send_probe(sndsock, pr->to, outip4, seq, ttl,
1656 &t1, pr->packlen);
1659 &t1, pr->packlen);
1663 in_msg.msg_name = pr->from;
1664 in_msg.msg_namelen = pr->sock_size;
1679 reply = (*pr->check_reply_fn) (&in_msg, cc, seq,
1695 if (memcmp(pr->from_sin_addr, &lastaddr,
1696 pr->addr_len) != 0) {
1697 (*pr->print_addr_fn) ((uchar_t *)packet,
1698 cc, pr->from);
1701 pr->from_sin_addr, pr->addr_len);
1712 if (pr->family == AF_INET6) {
1728 if (((pr->family == AF_INET) &&
1730 ((pr->family == AF_INET6) &&
1736 if (pr->family == AF_INET) {
1746 if ((*pr->print_icmp_other_fn)
1753 if (pr->family == AF_INET &&