• Home
  • Raw
  • Download

Lines Matching refs:gstate

325 static server_state_t gstate;  variable
683 sltmp->next = gstate.leases.sleases; in get_staticlease()
684 gstate.leases.sleases = sltmp; in get_staticlease()
778 if (gstate.listensock > 0) close(gstate.listensock); in open_listensock6()
782 gstate.listensock = xsocket(PF_INET6, SOCK_DGRAM, 0); in open_listensock6()
783 setsockopt(gstate.listensock, SOL_SOCKET, SO_REUSEADDR, &constone, sizeof(constone)); in open_listensock6()
784 setsockopt(gstate.listensock, IPPROTO_IPV6, IPV6_CHECKSUM, &constone, sizeof(constone)); in open_listensock6()
786 if (setsockopt(gstate.listensock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &constone, in open_listensock6()
789 close(gstate.listensock); in open_listensock6()
793 …setsockopt(gstate.listensock, SOL_SOCKET, SO_BINDTODEVICE, gconfig.interface, strlen(gconfig.inter… in open_listensock6()
802 if (bind(gstate.listensock, (struct sockaddr *) &addr6, sizeof(addr6)) == -1) { in open_listensock6()
803 close(gstate.listensock); in open_listensock6()
811 if(setsockopt(gstate.listensock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1) { in open_listensock6()
813 close(gstate.listensock); in open_listensock6()
827 if (gstate.listensock > 0) close(gstate.listensock); in open_listensock()
830 gstate.listensock = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); in open_listensock()
831 setsockopt(gstate.listensock, SOL_SOCKET, SO_REUSEADDR, &constone, sizeof(constone)); in open_listensock()
832 if (setsockopt(gstate.listensock, SOL_SOCKET, SO_BROADCAST, &constone, sizeof(constone)) == -1) { in open_listensock()
834 close(gstate.listensock); in open_listensock()
839 setsockopt(gstate.listensock, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)); in open_listensock()
846 if (bind(gstate.listensock, (struct sockaddr *) &addr, sizeof(addr))) { in open_listensock()
847 close(gstate.listensock); in open_listensock()
862 memcpy(&packet.dhcp6, &gstate.send.send_pkt6, sizeof(dhcp6_msg_t)); in send_packet6()
882 memcpy(&packet.iph.ip6_dst, &gstate.client_nip6, sizeof(uint32_t)*4); in send_packet6()
885 packet.udph.dest = gstate.client_port; //CLIENT_PORT in send_packet6()
913 memcpy(&packet.dhcp, &gstate.send.send_pkt, sizeof(dhcp_msg_t)); in send_packet()
924 memcpy(dest_sll.sll_addr, (broadcast)?bmacaddr:gstate.rcvd.rcvd_pkt.chaddr , 6); in send_packet()
931 padding = 308 - 1 - dhcp_opt_size(gstate.send.send_pkt.options); in send_packet()
934 packet.iph.daddr = (broadcast || (gstate.rcvd.rcvd_pkt.ciaddr == 0))? in send_packet()
935 INADDR_BROADCAST : gstate.rcvd.rcvd_pkt.ciaddr; in send_packet()
937 packet.udph.dest = gstate.client_port; //CLIENT_PORT in send_packet()
962 memset(&gstate.rcvd.rcvd_pkt6, 0, sizeof(dhcp6_msg_t)); in read_packet6()
963 ret = recvfrom(gstate.listensock, &gstate.rcvd.rcvd_pkt6, sizeof(dhcp6_msg_t), in read_packet6()
965 memcpy(gstate.client_nip6, &c_addr.sin6_addr, sizeof(uint32_t)*4); in read_packet6()
966 memcpy(&gstate.client_port, &c_addr.sin6_port, sizeof(uint32_t)); in read_packet6()
971 if (gstate.rcvd.rcvd_pkt6.msgtype < 1) { in read_packet6()
987 memset(&gstate.rcvd.rcvd_pkt, 0, sizeof(dhcp_msg_t)); in read_packet()
988 ret = recvfrom(gstate.listensock, &gstate.rcvd.rcvd_pkt, sizeof(dhcp_msg_t), in read_packet()
990 memcpy(&gstate.client_port, &c_addr.sin_port, sizeof(uint32_t)); in read_packet()
996 if (gstate.rcvd.rcvd_pkt.cookie != htonl(DHCP_MAGIC)) { in read_packet()
1000 if (gstate.rcvd.rcvd_pkt.op != 1) { //BOOTPREQUEST in read_packet()
1004 if (gstate.rcvd.rcvd_pkt.hlen != 6) { in read_packet()
1015 memset((void*)&gstate.send.send_pkt, 0, sizeof(gstate.send.send_pkt)); in prepare_send_pkt()
1016 gstate.send.send_pkt.op = 2; //BOOTPREPLY in prepare_send_pkt()
1017 gstate.send.send_pkt.htype = 1; in prepare_send_pkt()
1018 gstate.send.send_pkt.hlen = 6; in prepare_send_pkt()
1019 gstate.send.send_pkt.xid = gstate.rcvd.rcvd_pkt.xid; in prepare_send_pkt()
1020 gstate.send.send_pkt.cookie = htonl(DHCP_MAGIC); in prepare_send_pkt()
1021 gstate.send.send_pkt.nsiaddr = gconfig.server_nip; in prepare_send_pkt()
1022 memcpy(gstate.send.send_pkt.chaddr, gstate.rcvd.rcvd_pkt.chaddr, 16); in prepare_send_pkt()
1023 gstate.send.send_pkt.options[0] = DHCP_OPT_END; in prepare_send_pkt()
1024 return gstate.send.send_pkt.options; in prepare_send_pkt()
1029 memset((void*)&gstate.send.send_pkt6, 0, sizeof(gstate.send.send_pkt6)); in prepare_send_pkt6()
1030 gstate.send.send_pkt6.msgtype = opt; in prepare_send_pkt6()
1031 memcpy(gstate.send.send_pkt6.transaction_id, gstate.rcvd.rcvd_pkt6.transaction_id, 3); in prepare_send_pkt6()
1032 return gstate.send.send_pkt6.options; in prepare_send_pkt6()
1096 …if ((overloaded == 1) | (overloaded == 3)) get_optval((uint8_t*)&gstate.rcvd.rcvd_pkt.file, opt, v… in get_optval()
1097 …if ((overloaded == 2) | (overloaded == 3)) get_optval((uint8_t*)&gstate.rcvd.rcvd_pkt.sname, opt, … in get_optval()
1133 for (optptr = gstate.rcvd.rcvd_pkt.options; in get_reqparam()
1199 struct arg_list *listdls = gstate.dleases; in write_leasefile()
1236 struct arg_list *listdls = gstate.dleases; in write_lease6file()
1311 for (listdls = gstate.dleases; listdls; listdls = listdls->next) { in verifyip6_in_lease()
1319 for (sls6 = gstate.leases.sleases6; sls6; sls6 = sls6->next) in verifyip6_in_lease()
1335 for (listdls = gstate.dleases; listdls; listdls = listdls->next) { in verifyip_in_lease()
1343 for (sls = gstate.leases.sleases; sls; sls = sls->next) in verifyip_in_lease()
1356 struct arg_list *listdls = gstate.dleases; in addip_to_lease()
1377 listdls->next = gstate.dleases; in addip_to_lease()
1379 gstate.dleases = listdls; in addip_to_lease()
1387 struct arg_list *listdls = gstate.dleases; in addip6_to_lease()
1410 listdls->next = gstate.dleases; in addip6_to_lease()
1412 gstate.dleases = listdls; in addip6_to_lease()
1420 struct arg_list *listdls = gstate.dleases; in delip_from_lease()
1436 static_lease *sls = gstate.leases.sleases; in getip_from_pool()
1437 struct arg_list *listdls = gstate.dleases, *tmp = NULL; in getip_from_pool()
1446 else gstate.dleases = listdls->next; in getip_from_pool()
1483 static_lease6 *sls6 = gstate.leases.sleases6; in getip6_from_pool()
1484 struct arg_list *listdls6 = gstate.dleases, *tmp = NULL; in getip6_from_pool()
1490 else gstate.dleases = listdls6->next; in getip6_from_pool()
1670 fcntl(gstate.listensock, F_SETFD, FD_CLOEXEC); in dhcpd_main()
1675 FD_SET(gstate.listensock, &rfds); in dhcpd_main()
1683 int maxfd = (sigfd.rd > gstate.listensock)? sigfd.rd : gstate.listensock; in dhcpd_main()
1727 if (FD_ISSET(gstate.listensock, &rfds)) { // Some Activity on RDFDs : is socket in dhcpd_main()
1742 memcpy(&gstate.rqcode, &gstate.rcvd.rcvd_pkt6.msgtype, sizeof(uint8_t)); in dhcpd_main()
1743 memcpy(&transactionid, &gstate.rcvd.rcvd_pkt6.transaction_id, in dhcpd_main()
1746 if (!gstate.rqcode || gstate.rqcode < DHCP6SOLICIT || in dhcpd_main()
1747 gstate.rqcode > DHCP6RELAYREPLY) { in dhcpd_main()
1751 if (!gstate.rcvd.rcvd_pkt6.transaction_id || in dhcpd_main()
1752 memcmp(gstate.rcvd.rcvd_pkt6.transaction_id, transactionid, 3)) { in dhcpd_main()
1758 switch (gstate.rqcode) { in dhcpd_main()
1768 get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1772 if(get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1848 else if(get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1891 get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1900 if(get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1957 get_optval6((uint8_t*)&gstate.rcvd.rcvd_pkt6.options, in dhcpd_main()
1976 dbg("Message Type : %u\n", gstate.rqcode); in dhcpd_main()
1987 get_optval((uint8_t*)&gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
1988 DHCP_OPT_MESSAGE_TYPE, &gstate.rqcode); in dhcpd_main()
1989 if (gstate.rqcode == 0 || gstate.rqcode < DHCPDISCOVER in dhcpd_main()
1990 || gstate.rqcode > DHCPINFORM) { in dhcpd_main()
1994 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2002 switch (gstate.rqcode) { in dhcpd_main()
2006 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2008 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2011 get_reqparam(&gstate.rqopt); in dhcpd_main()
2013 gstate.send.send_pkt.yiaddr = getip_from_pool(requested_nip, in dhcpd_main()
2014 gstate.rcvd.rcvd_pkt.chaddr, &reqested_lease, hstname); in dhcpd_main()
2015 if(!gstate.send.send_pkt.yiaddr){ in dhcpd_main()
2021 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2027 optptr = set_reqparam(optptr, gstate.rqopt); in dhcpd_main()
2034 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2036 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2038 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2040 gstate.send.send_pkt.yiaddr = getip_from_pool(requested_nip, in dhcpd_main()
2041 gstate.rcvd.rcvd_pkt.chaddr, &reqested_lease, hstname); in dhcpd_main()
2043 if (!gstate.send.send_pkt.yiaddr) { in dhcpd_main()
2059 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2062 get_optval((uint8_t*) &gstate.rcvd.rcvd_pkt.options, in dhcpd_main()
2064 delip_from_lease(requested_nip, gstate.rcvd.rcvd_pkt.chaddr, in dhcpd_main()
2065 (gstate.rqcode==DHCPRELEASE)?0:gconfig.decline_time); in dhcpd_main()
2068 dbg("Message Type : %u\n", gstate.rqcode); in dhcpd_main()