Lines Matching defs:icmp_sock
92 int icmp_sock; /* socket file descriptor */
143 icmp_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
144 if (icmp_sock < 0) {
146 icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
163 (setsockopt(icmp_sock, IPPROTO_IP, IP_TOS,
423 if (icmp_sock < 0) {
434 if (ioctl(icmp_sock, SIOCGIFINDEX, &ifr) < 0) {
458 if (setsockopt(icmp_sock, SOL_IP, IP_MTU_DISCOVER, &pmtudisc, sizeof(pmtudisc)) == -1) {
465 bind(icmp_sock, (struct sockaddr*)&source, sizeof(source)) == -1) {
478 if (setsockopt(icmp_sock, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) == -1)
483 if (setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold)))
486 if (setsockopt(icmp_sock, SOL_IP, IP_RECVTTL, (char *)&hold, sizeof(hold)))
488 if (setsockopt(icmp_sock, SOL_IP, IP_RETOPTS, (char *)&hold, sizeof(hold)))
500 if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, sizeof(rspace)) < 0) {
517 if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, rspace[1]) < 0) {
519 if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, rspace[1]) < 0) {
537 if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, 4 + nroute*4) < 0) {
548 sock_setbufs(icmp_sock, hold);
551 if (setsockopt(icmp_sock, SOL_SOCKET, SO_BROADCAST,
560 if (setsockopt(icmp_sock, IPPROTO_IP, IP_MULTICAST_LOOP,
568 if (setsockopt(icmp_sock, IPPROTO_IP, IP_MULTICAST_TTL,
573 if (setsockopt(icmp_sock, IPPROTO_IP, IP_TTL,
602 setup(icmp_sock);
604 main_loop(icmp_sock, packet, packlen);
632 res = recvmsg(icmp_sock, &msg, MSG_ERRQUEUE|MSG_DONTWAIT);
688 if (setsockopt(icmp_sock, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) == -1)
762 i = sendmsg(icmp_sock, &m, confirm);
1397 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))