Lines Matching refs:gconfig
324 static server_config_t gconfig; variable
691 {"start" , striptovar , (void*)&gconfig.start_ip , "192.168.0.20"},
692 {"end" , striptovar , (void*)&gconfig.end_ip , "192.168.0.254"},
693 {"interface" , strinvar , (void*)&gconfig.interface , "eth0"},
694 {"port" , strtou32 , (void*)&gconfig.port , "67"},
695 {"min_lease" , strtou32 , (void*)&gconfig.min_lease_sec, "60"},
696 {"max_leases" , strtou32 , (void*)&gconfig.max_leases , "235"},
697 {"auto_time" , strtou32 , (void*)&gconfig.auto_time , "7200"},
698 {"decline_time" , strtou32 , (void*)&gconfig.decline_time , "3600"},
699 {"conflict_time", strtou32 , (void*)&gconfig.conflict_time, "3600"},
700 {"offer_time" , strtou32 , (void*)&gconfig.offer_time , "60"},
701 …{"lease_file" , strinvar , (void*)&gconfig.lease_file , "/var/lib/misc/dhcpd.leases"}, …
702 …{"lease6_file" , strinvar , (void*)&gconfig.lease6_file , "/var/lib/misc/dhcpd6.leases"},…
703 …{"pidfile" , strinvar , (void*)&gconfig.pidfile , "/var/run/dhcpd.pid"}, //DPID_F…
704 {"siaddr" , striptovar , (void*)&gconfig.siaddr_nip , "0.0.0.0"},
705 {"option" , strtoopt , (void*)&gconfig.options , ""},
706 {"opt" , strtoopt , (void*)&gconfig.options , ""},
707 {"notify_file" , strinvar , (void*)&gconfig.notify_file , ""},
708 {"sname" , strinvar , (void*)&gconfig.sname , ""},
709 {"boot_file" , strinvar , (void*)&gconfig.boot_file , ""},
710 {"static_lease" , get_staticlease , (void*)&gconfig.static_leases, ""},
711 {"start6" , striptovar , (void*)&gconfig.start_ip6 , "2001:620:40b:555::100"},
712 {"end6" , striptovar , (void*)&gconfig.end_ip6 , "2001:620:40b:555::200"},
713 {"preferred_lifetime" , strtou32 , (void*)&gconfig.pref_lifetime, "3600"},
714 {"valid_lifetime" , strtou32 , (void*)&gconfig.valid_lifetime, "7200"},
715 {"t1" , strtou32 , (void*)&gconfig.t1 , "3600"},
716 {"t2" , strtou32 , (void*)&gconfig.t2 , "5400"},
780 dbg("Opening listen socket on *:%d %s\n", gconfig.port, gconfig.interface); in open_listensock6()
793 …setsockopt(gstate.listensock, SOL_SOCKET, SO_BINDTODEVICE, gconfig.interface, strlen(gconfig.inter… in open_listensock6()
797 addr6.sin6_port = htons(gconfig.port); //SERVER_PORT in open_listensock6()
798 addr6.sin6_scope_id = if_nametoindex(gconfig.interface); in open_listensock6()
808 mreq.ipv6mr_interface = if_nametoindex(gconfig.interface); in open_listensock6()
829 dbg("Opening listen socket on *:%d %s\n", gconfig.port, gconfig.interface); in open_listensock()
838 xstrncpy(ifr.ifr_name, gconfig.interface, IFNAMSIZ); in open_listensock()
843 addr.sin_port = htons(gconfig.port); //SERVER_PORT in open_listensock()
872 dest_sll.sll_ifindex = gconfig.ifindex; in send_packet6()
881 memcpy(&packet.iph.ip6_src, &gconfig.server_nip6, sizeof(uint32_t)*4); in send_packet6()
884 packet.udph.source = htons(gconfig.port); //SERVER_PORT in send_packet6()
922 dest_sll.sll_ifindex = gconfig.ifindex; in send_packet()
933 packet.iph.saddr = gconfig.server_nip; in send_packet()
936 packet.udph.source = htons(gconfig.port);//SERVER_PORT in send_packet()
1021 gstate.send.send_pkt.nsiaddr = gconfig.server_nip; in prepare_send_pkt()
1202 if ((fd = open(gconfig.lease_file, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) { in write_leasefile()
1203 perror_msg("can't open %s ", gconfig.lease_file); in write_leasefile()
1221 if (gconfig.notify_file) { in write_leasefile()
1223 argv[0] = gconfig.notify_file; in write_leasefile()
1224 argv[1] = gconfig.lease_file; in write_leasefile()
1239 if ((fd = open(gconfig.lease6_file, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) { in write_lease6file()
1240 perror_msg("can't open %s ", gconfig.lease6_file); in write_lease6file()
1258 if (gconfig.notify_file) { in write_lease6file()
1260 argv[0] = gconfig.notify_file; in write_lease6file()
1261 argv[1] = gconfig.lease6_file; in write_lease6file()
1274 gconfig.max_lease_sec = *((uint32_t*)options_list[count].val); in set_maxlease()
1277 if (!gconfig.max_lease_sec) gconfig.max_lease_sec = (60*60*24*10);// DEFAULT_LEASE_TIME; in set_maxlease()
1286 if ((req_exp <= 0) || req_exp > gconfig.pref_lifetime || in get_lease()
1287 req_exp > gconfig.valid_lifetime) { in get_lease()
1288 if ((gconfig.pref_lifetime > gconfig.valid_lifetime)) { in get_lease()
1290 setting to valid lifetime %u", gconfig.valid_lifetime); in get_lease()
1291 return gconfig.valid_lifetime; in get_lease()
1293 return gconfig.pref_lifetime; in get_lease()
1296 if ((req_exp <= 0) || (req_exp > gconfig.max_lease_sec)) in get_lease()
1297 return gconfig.max_lease_sec; in get_lease()
1299 if (req_exp < gconfig.min_lease_sec) in get_lease()
1300 return gconfig.min_lease_sec; in get_lease()
1322 if (memcmp(nip6, gconfig.start_ip6, sizeof(uint32_t)*4) < 0 || in verifyip6_in_lease()
1323 memcmp(nip6, gconfig.end_ip6, sizeof(uint32_t)*4) > 0) in verifyip6_in_lease()
1346 if ((ntohl(nip) < gconfig.start_ip) || (ntohl(nip) > gconfig.end_ip)) in verifyip_in_lease()
1466 for (nip = htonl(gconfig.start_ip); ntohl(nip) <= gconfig.end_ip; ) { in getip_from_pool()
1471 if (ntohl(nip) > gconfig.end_ip) { in getip_from_pool()
1513 memcpy(nip6, gconfig.start_ip6, sizeof(nip6)); in getip6_from_pool()
1514 while(memcmp(nip6, gconfig.end_ip6, sizeof(nip6)) < 0) { in getip6_from_pool()
1527 if (memcmp(nip6, gconfig.end_ip6, sizeof(nip6)) > 0) { in getip6_from_pool()
1548 int fd = open(gconfig.lease_file, O_RDONLY); in read_leasefile()
1561 if (ip >= gconfig.start_ip && ip <= gconfig.end_ip) { in read_leasefile()
1579 int fd = open(gconfig.lease6_file, O_RDONLY); in read_lease6file()
1591 if (memcmp(dls6->lease_nip6, gconfig.start_ip6, sizeof(uint32_t)*4) > 0 && in read_lease6file()
1592 memcmp(dls6->lease_nip6, gconfig.end_ip6, sizeof(uint32_t)*4) < 0) { in read_lease6file()
1633 gconfig.t1 = ntohl(gconfig.t1); in dhcpd_main()
1634 gconfig.t2 = ntohl(gconfig.t2); in dhcpd_main()
1635 gconfig.pref_lifetime = ntohl(gconfig.pref_lifetime); in dhcpd_main()
1636 gconfig.valid_lifetime = ntohl(gconfig.valid_lifetime); in dhcpd_main()
1637 gconfig.port = 547; in dhcpd_main()
1639 ip_pool_size += (gconfig.end_ip6[i]-gconfig.start_ip6[i])<<((3-i)*8); in dhcpd_main()
1641 gconfig.start_ip = ntohl(gconfig.start_ip); in dhcpd_main()
1642 gconfig.end_ip = ntohl(gconfig.end_ip); in dhcpd_main()
1643 ip_pool_size = gconfig.end_ip - gconfig.start_ip + 1; in dhcpd_main()
1646 if (gconfig.max_leases > ip_pool_size) { in dhcpd_main()
1648 (unsigned) gconfig.max_leases, ip_pool_size); in dhcpd_main()
1649 gconfig.max_leases = ip_pool_size; in dhcpd_main()
1651 write_pid(gconfig.pidfile); in dhcpd_main()
1653 if(TT.iface) gconfig.interface = TT.iface; in dhcpd_main()
1654 if(TT.port) gconfig.port = TT.port; in dhcpd_main()
1658 if (get_interface(gconfig.interface, &gconfig.ifindex, in dhcpd_main()
1659 (addr_version==AF_INET6)? (void*)gconfig.server_nip6 : in dhcpd_main()
1660 (void*)&gconfig.server_nip, gconfig.server_mac) < 0) in dhcpd_main()
1661 perror_exit("Failed to get interface %s", gconfig.interface); in dhcpd_main()
1666 gconfig.server_nip = htonl(gconfig.server_nip); in dhcpd_main()
1677 tv.tv_sec = gconfig.auto_time - waited; in dhcpd_main()
1685 retval = select(maxfd + 1, &rfds, NULL, NULL, (gconfig.auto_time?&tv:NULL)); in dhcpd_main()
1698 if (get_interface(gconfig.interface, &gconfig.ifindex, in dhcpd_main()
1699 (addr_version==AF_INET6)? (void*)gconfig.server_nip6 : in dhcpd_main()
1700 (void*)&gconfig.server_nip, gconfig.server_mac)<0) in dhcpd_main()
1701 perror_exit("Failed to get interface %s", gconfig.interface); in dhcpd_main()
1703 gconfig.server_nip = htonl(gconfig.server_nip); in dhcpd_main()
1721 unlink(gconfig.pidfile); in dhcpd_main()
1782 (*ia_addr_p).pref_lifetime = gconfig.pref_lifetime; in dhcpd_main()
1783 (*ia_addr_p).valid_lifetime = gconfig.valid_lifetime; in dhcpd_main()
1824 (*ia_na_p).t1 = gconfig.t1; in dhcpd_main()
1825 (*ia_na_p).t2 = gconfig.t2; in dhcpd_main()
1857 server_duid_len = 8+sizeof(gconfig.server_mac); in dhcpd_main()
1865 memcpy((*server_duid_p).lladdr, gconfig.server_mac, in dhcpd_main()
1866 sizeof(gconfig.server_mac)); in dhcpd_main()
1933 (*ia_na_p).t1 = gconfig.t1; in dhcpd_main()
1934 (*ia_na_p).t2 = gconfig.t2; in dhcpd_main()
1995 if (serverid && (serverid != gconfig.server_nip)) { in dhcpd_main()
2009 reqested_lease = gconfig.offer_time; in dhcpd_main()
2024 optptr = set_optval(optptr, DHCP_OPT_SERVER_ID, &gconfig.server_nip, 4); in dhcpd_main()
2041 if (!serverid) reqested_lease = gconfig.max_lease_sec; in dhcpd_main()
2049 optptr = set_optval(optptr, DHCP_OPT_SERVER_ID, &gconfig.server_nip, 4); in dhcpd_main()
2060 if (serverid != gconfig.server_nip) break; in dhcpd_main()
2064 (gstate.rqcode==DHCPRELEASE)?0:gconfig.decline_time); in dhcpd_main()