Lines Matching refs:TT
181 TT.length += 4; in fill_option()
186 uint8_t *tmp = &mesg.options[TT.length]; in fill_clientID()
195 get_mac(mac, TT.interface_name); in fill_clientID()
203 TT.length += sizeof(DUID); in fill_clientID()
209 uint8_t *tmp = &mesg.options[TT.length]; in fill_optionRequest()
214 TT.length += 4; in fill_optionRequest()
219 uint8_t *tmp = &mesg.options[TT.length]; in fill_elapsedTime()
223 TT.length += 2; in fill_elapsedTime()
229 uint8_t *tmp = &mesg.options[TT.length]; in fill_iaid()
236 TT.length += sizeof(IA_NA); in fill_iaid()
245 if (TT.sock > 0) xclose(TT.sock); in mode_raw()
246 TT.sock = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6)); in mode_raw()
251 sockll.sll_ifindex = if_nametoindex(TT.interface_name); in mode_raw()
252 xbind(TT.sock, (struct sockaddr *) &sockll, sizeof(sockll)); in mode_raw()
253 if (setsockopt(TT.sock, SOL_PACKET, PACKET_HOST,&constone, sizeof(int)) < 0) { in mode_raw()
263 TT.transction_id[i] = r%0xff; in generate_transection_id()
270 TT.tv.tv_sec = seconds; in set_timeout()
271 TT.tv.tv_usec = 100000; in set_timeout()
285 memcpy(mesg.transaction_id, TT.transction_id, 3); in send_msg()
288 TT.length = 0; in send_msg()
293 sendlength = sizeof(dhcp6_msg_t) - 524 + TT.length; in send_msg()
295 sendlength = TT.request_length; in send_msg()
297 sendlength = sendto(TT.sock1, &mesg, sendlength , 0,(struct sockaddr *)&addr6, in send_msg()
339 TT.status - ((char*)&mymsg->dhcp6.options[0] - (char*)mymsg) )) { in validate_ids()
344 TT.status - ((char*)&mymsg->dhcp6.options[0] - (char*)mymsg) )) { in validate_ids()
373 if (TT.state == DHCP6SOLICIT) { in parse_ia_na()
374 if (TT.req_ip) { in parse_ia_na()
377 if(!getaddrinfo(TT.req_ip, NULL, NULL,&res)) { in parse_ia_na()
378 dbg("Requesting IP: %s\n", TT.req_ip); in parse_ia_na()
379 memcpy (&TT.input_socket6, res->ai_addr, res->ai_addrlen); in parse_ia_na()
380 memcpy(t+4, TT.input_socket6.sin6_addr.s6_addr, 16); in parse_ia_na()
381 } else xprintf("Invalid IP: %s\n",TT.req_ip); in parse_ia_na()
421 int ret = setenv("interface", TT.interface_name, 1); in fill_envp()
436 char *script = (toys.optflags & FLAG_s) ? TT.script in run_script()
473 xclose(TT.sock); in lease_fail()
474 xclose(TT.sock1); in lease_fail()
480 if (toys.optflags & FLAG_p) write_pid(TT.pidfile); in lease_fail()
493 if (TT.state == DHCP6RELEASE || TT.state == DHCP6REQUEST ) { in signal_handler()
494 TT.state = DHCP6SOLICIT; in signal_handler()
500 TT.state = DHCP6RENEW; in signal_handler()
501 TT.retries = 0; in signal_handler()
506 if (TT.state == DHCP6RELEASE) return; in signal_handler()
507 if (TT.state != DHCP6CONFIRM ) return; in signal_handler()
510 TT.state = DHCP6RELEASE; in signal_handler()
511 TT.retries = 0; in signal_handler()
517 if ((toys.optflags & FLAG_R) && TT.state == DHCP6CONFIRM) in signal_handler()
544 TT.state = DHCP6SOLICIT; in dhcp6_main()
547 if (!TT.interface_name) TT.interface_name = "eth0"; in dhcp6_main()
548 if (toys.optflags & FLAG_p) write_pid(TT.pidfile); in dhcp6_main()
549 if (!TT.retry) TT.retry = 3; in dhcp6_main()
550 if (!TT.timeout) TT.timeout = 3; in dhcp6_main()
551 if (!TT.errortimeout) TT.errortimeout = 20; in dhcp6_main()
557 dbg("Interface: %s\n", TT.interface_name); in dhcp6_main()
558 dbg("pid file: %s\n", TT.pidfile); in dhcp6_main()
559 dbg("Retry count: %d\n", TT.retry); in dhcp6_main()
560 dbg("Timeout : %d\n", TT.timeout); in dhcp6_main()
561 dbg("Error timeout: %d\n", TT.errortimeout); in dhcp6_main()
566 TT.sock1 = xsocket(PF_INET6, SOCK_DGRAM, 0); in dhcp6_main()
570 sinaddr6.sin6_scope_id = if_nametoindex(TT.interface_name); in dhcp6_main()
573 xsetsockopt(TT.sock1, SOL_SOCKET, SO_REUSEADDR, &constone, sizeof(constone)); in dhcp6_main()
575 xbind(TT.sock1, (struct sockaddr *)&sinaddr6, sizeof(sinaddr6)); in dhcp6_main()
580 int maxfd = TT.sock; in dhcp6_main()
582 if (TT.sock >= 0) FD_SET(TT.sock, &rfds); in dhcp6_main()
583 TT.retval = 0; in dhcp6_main()
584 if ((TT.retval = select(maxfd + 1, &rfds, NULL, NULL, &TT.tv)) < 0) { in dhcp6_main()
588 if (!TT.retval) { in dhcp6_main()
589 if (TT.state == DHCP6SOLICIT || TT.state == DHCP6CONFIRM) { in dhcp6_main()
593 TT.state = DHCP6SOLICIT; in dhcp6_main()
594 TT.retries++; in dhcp6_main()
595 if(TT.retries > TT.retry) set_timeout(TT.errortimeout); in dhcp6_main()
596 else if (TT.retries == TT.retry) { in dhcp6_main()
599 set_timeout(TT.errortimeout); in dhcp6_main()
600 } else set_timeout(TT.timeout); in dhcp6_main()
602 } else if (TT.state == DHCP6REQUEST || TT.state == DHCP6RENEW || in dhcp6_main()
603 TT.state == DHCP6RELEASE) { in dhcp6_main()
604 dbg("State is %d , sending packet\n", TT.state); in dhcp6_main()
605 send_msg(TT.state); in dhcp6_main()
606 TT.retries++; in dhcp6_main()
607 if (TT.retries > TT.retry) set_timeout(TT.errortimeout); in dhcp6_main()
608 else if (TT.retries == TT.retry) { in dhcp6_main()
610 set_timeout(TT.errortimeout); in dhcp6_main()
611 } else set_timeout(TT.timeout); in dhcp6_main()
614 } else if (FD_ISSET(TT.sock, &rfds)) { in dhcp6_main()
615 if ((TT.status = read(TT.sock, toybuf, sizeof(toybuf))) <= 0) continue; in dhcp6_main()
618 !memcmp(mymsg->dhcp6.transaction_id, TT.transction_id, 3)) { in dhcp6_main()
619 if (TT.state == DHCP6SOLICIT) { in dhcp6_main()
623 TT.state = DHCP6SOLICIT; in dhcp6_main()
627 TT.retries = 0; in dhcp6_main()
629 TT.request_length = TT.status - ((char*)&mymsg->dhcp6 - (char*)mymsg); in dhcp6_main()
630 memcpy((uint8_t*)&mesg, &mymsg->dhcp6, TT.request_length); in dhcp6_main()
631 parse_ia_na(mesg.options, TT.request_length); in dhcp6_main()
635 TT.state = DHCP6REQUEST; in dhcp6_main()
640 } else if (TT.state == DHCP6REQUEST || TT.state == DHCP6RENEW ) { in dhcp6_main()
643 dbg("Invalid id received, %d.\n", TT.state); in dhcp6_main()
644 TT.state = DHCP6REQUEST; in dhcp6_main()
648 TT.request_length = TT.status - ((char*)&mymsg->dhcp6 - (char*)mymsg); in dhcp6_main()
649 memcpy((uint8_t*)&mesg, &mymsg->dhcp6, TT.request_length); in dhcp6_main()
650 parse_ia_na(mymsg->dhcp6.options, TT.request_length); in dhcp6_main()
654 TT.retries = 0; in dhcp6_main()
655 run_script(&dhcp_data, (TT.state == DHCP6REQUEST) ? in dhcp6_main()
661 TT.state = DHCP6CONFIRM; in dhcp6_main()
664 if (TT.state == DHCP6REQUEST || !(toys.optflags & FLAG_f)) { in dhcp6_main()
668 if (toys.optflags & FLAG_p) write_pid(TT.pidfile); in dhcp6_main()
676 } else if (TT.state == DHCP6RELEASE) { in dhcp6_main()
684 xclose(TT.sock1); in dhcp6_main()
685 xclose(TT.sock); in dhcp6_main()