Lines Matching refs:opt
73 } opt = {
118 opt.silent_send = true;
121 opt.size = atoi(optarg);
124 opt.sock.family = AF_INET;
127 opt.sock.family = AF_INET6;
131 opt.sock.proto = IPPROTO_UDP;
133 opt.sock.proto = IPPROTO_ICMP;
135 opt.sock.type = SOCK_RAW;
143 opt.mark.ena = true;
144 opt.mark.val = atoi(optarg);
147 opt.sockopt.mark = atoi(optarg);
150 opt.txtime.ena = true;
151 opt.txtime.delay = atoi(optarg);
154 opt.ts.ena = true;
157 opt.v6.dontfrag.ena = true;
158 opt.v6.dontfrag.val = atoi(optarg);
161 opt.sockopt.dontfrag = atoi(optarg);
164 opt.v6.tclass.ena = true;
165 opt.v6.tclass.val = atoi(optarg);
168 opt.sockopt.tclass = atoi(optarg);
171 opt.v6.hlimit.ena = true;
172 opt.v6.hlimit.val = atoi(optarg);
175 opt.sockopt.hlimit = atoi(optarg);
178 opt.v6.exthdr.ena = true;
181 opt.v6.exthdr.val = IPV6_HOPOPTS;
184 opt.v6.exthdr.val = IPV6_DSTOPTS;
187 opt.v6.exthdr.val = IPV6_RTHDRDSTOPTS;
200 opt.host = argv[optind];
201 opt.service = argv[optind + 1];
246 SOL_SOCKET, SO_MARK, &opt.mark);
248 SOL_IPV6, IPV6_DONTFRAG, &opt.v6.dontfrag);
250 SOL_IPV6, IPV6_TCLASS, &opt.v6.tclass);
252 SOL_IPV6, IPV6_HOPLIMIT, &opt.v6.hlimit);
254 if (opt.txtime.ena) {
266 opt.txtime.delay * 1000;
278 if (opt.ts.ena) {
297 if (opt.v6.exthdr.ena) {
304 cmsg->cmsg_type = opt.v6.exthdr.val;
336 if (!opt.ts.ena)
397 if (opt.sockopt.mark &&
399 &opt.sockopt.mark, sizeof(opt.sockopt.mark)))
401 if (opt.sockopt.dontfrag &&
403 &opt.sockopt.dontfrag, sizeof(opt.sockopt.dontfrag)))
405 if (opt.sockopt.tclass &&
407 &opt.sockopt.tclass, sizeof(opt.sockopt.tclass)))
409 if (opt.sockopt.hlimit &&
411 &opt.sockopt.hlimit, sizeof(opt.sockopt.hlimit)))
427 buf = malloc(opt.size);
428 memrnd(buf, opt.size);
431 hints.ai_family = opt.sock.family;
434 err = getaddrinfo(opt.host, opt.service, &hints, &ai);
437 opt.host, opt.service);
441 if (ai->ai_family == AF_INET6 && opt.sock.proto == IPPROTO_ICMP)
442 opt.sock.proto = IPPROTO_ICMPV6;
444 fd = socket(ai->ai_family, opt.sock.type, opt.sock.proto);
451 if (opt.sock.proto == IPPROTO_ICMP) {
454 } else if (opt.sock.proto == IPPROTO_ICMPV6) {
457 } else if (opt.sock.type == SOCK_RAW) {
458 struct udphdr hdr = { 1, 2, htons(opt.size), 0 };
462 sin6->sin6_port = htons(opt.sock.proto);
473 iov[0].iov_len = opt.size;
485 if (!opt.silent_send)
489 } else if (err != (int)opt.size) {
498 usleep(opt.txtime.delay);