[Dhcp-agent-commits] dhcp-agent dhcp-agent.h,1.65,1.66 dhcp-client-conf.c,1.16,1.17 dhcp-client-stat
Status: Alpha
Brought to you by:
actmodern
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17346 Modified Files: dhcp-agent.h dhcp-client-conf.c dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-sysconf.c Log Message: temp fix to option checking; added more option constants Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** dhcp-agent.h 4 Jul 2002 14:02:53 -0000 1.65 --- dhcp-agent.h 16 Jul 2002 03:43:30 -0000 1.66 *************** *** 135,146 **** #define SENSIBLE_DESCRIPTOR_MAX 128 - /* type string limits. */ - - # define UINT32_T_STRING_SIZE 11 - # define INT32_T_STRING_SIZE UINT32_T_STRING_SIZE /* the same. */ - # define UINT16_T_STRING_SIZE 6 - # define INT16_T_STRING_SIZE UINT16_T_STRING_SIZE - # define BYTE_STRING_SIZE 5 - /* Reasonable defaults in case services db isn't up to date. */ --- 135,138 ---- *************** *** 163,170 **** #define MAX_VERBOSITY_LEVEL DEBUG_VERBOSITY_LEVEL - /* default configuration */ - - #define DISCOVER_OFFER_RETRIES 3 - /* * * * * * * * * * * * Data structures. * --- 155,158 ---- *************** *** 406,423 **** /* Option tags. */ ! # define TAG_PAD 0 ! # define TAG_END 255 ! # define TAG_DHCP_SUBNET_MASK 1 ! # define TAG_DHCP_HOSTNAME 12 ! # define TAG_DHCP_INTERFACE_MTU 26 ! # define TAG_DHCP_REQUEST_IP_ADDRESS 50 ! # define TAG_DHCP_OPTION_OVERLOAD 52 ! # define TAG_DHCP_MESSAGE_TYPE 53 ! # define TAG_DHCP_SERVER_IDENTIFIER 54 ! # define TAG_PARAMETERS 55 ! # define TAG_MAX_DHCP_SIZE 57 ! # define TAG_DHCP_CLASS_ID 60 ! # define TAG_DHCP_CLIENT_ID 61 /* DHCP overload option values. */ --- 394,477 ---- /* Option tags. */ ! /* (this is me trying to make constant names out of long option ! * names. let the comedy ensue!) ! */ ! # define TAG_DHCP_PAD 0 ! # define TAG_DHCP_SUBNET_MASK 1 ! # define TAG_DHCP_TIME_OFFSET 2 ! # define TAG_DHCP_ROUTER 3 ! # define TAG_DHCP_TIME_SERVER 4 ! # define TAG_DHCP_NAME_SERVER 5 ! # define TAG_DHCP_DOMAIN_NAME_SERVER 6 ! # define TAG_DHCP_LOG_SERVER 7 ! # define TAG_DHCP_COOKIE_SERVER 8 ! # define TAG_DHCP_LPR_SERVER 9 ! # define TAG_DHCP_IMPRESS_SERVER 10 ! # define TAG_DHCP_RESOURCE_LOCATION_SERVER 11 ! # define TAG_DHCP_HOST_NAME 12 ! # define TAG_DHCP_BOOT_FILE_SIZE 13 ! # define TAG_DHCP_MERIT_DUMP_FILE 14 ! # define TAG_DHCP_DOMAIN_NAME 15 ! # define TAG_DHCP_SWAP_SERVER 16 ! # define TAG_DHCP_ROOT_PATH 17 ! # define TAG_DHCP_EXTENSIONS_PATH 18 ! # define TAG_DHCP_IP_FORWARDING 19 ! # define TAG_DHCP_NON_LOCAL_SOURCE_ROUTING 20 ! # define TAG_DHCP_POLICY_FILTER 21 ! # define TAG_DHCP_MAX_DGRAM_REASSUMBLY_SIZE 22 ! # define TAG_DHCP_IP_TIME_TO_LIVE 23 ! # define TAG_DHCP_MTU_AGING_TIMEOUT 24 ! # define TAG_DHCP_MTU_PLATEAU_TABLE 25 ! # define TAG_DHCP_INTERFACE_MTU 26 ! # define TAG_DHCP_SUBNETS_ARE_LOCAL 27 ! # define TAG_DHCP_BROADCAST_ADDRESS 28 ! # define TAG_DHCP_MASK_DISCOVERY 29 ! # define TAG_DHCP_MASK_SUPPLIER 30 ! # define TAG_DHCP_ROUTER_DISCOVERY 31 ! # define TAG_DHCP_ROUTER_SOLICITATION 32 ! # define TAG_DHCP_STATIC_ROUTE 33 ! # define TAG_DHCP_TRAILER_ENCAPSULATION 34 ! # define TAG_DHCP_ARP_CACHE_TIMEOUT 35 ! # define TAG_DHCP_ETHERNET_ENCAPSULATION 36 ! # define TAG_DHCP_TCP_DEFAULT_TTL 37 ! # define TAG_DHCP_TCP_KEEPALIVE_INTERVAL 38 ! # define TAG_DHCP_TCP_KEEPALIVE_GARBAGE 39 ! # define TAG_DHCP_NIS_DOMAIN_NAME 40 ! # define TAG_DHCP_NIS_SERVERS 41 ! # define TAG_DHCP_NTP_SERVERS 42 ! # define TAG_DHCP_VENDOR_SPECIFIC 43 ! # define TAG_DHCP_NETBIOSOTCP_NAME_SERVER 44 ! # define TAG_DHCP_NETBIOSOTCP_DATAGRAM_SERVER 45 ! # define TAG_DHCP_NETBIOSOTCP_NODE_TYPE 46 ! # define TAG_DHCP_NETBIOSOTCP_SCOPE 47 ! # define TAG_DHCP_XWIN_FONT_SERVER 48 ! # define TAG_DHCP_XWIN_DISP_MANAGER_SERVER 49 ! # define TAG_DHCP_REQUESTED_IP_ADDRESS 50 ! # define TAG_DHCP_IP_ADDRESS_LEASE_TIME 51 ! # define TAG_DHCP_OVERLOAD 52 ! # define TAG_DHCP_MESSAGE_TYPE 53 ! # define TAG_DHCP_SERVER_IDENTIFIER 54 ! # define TAG_DHCP_PARAMETERS 55 ! # define TAG_DHCP_MESSAGE 56 ! # define TAG_DHCP_MAX_DHCP_SIZE 57 ! # define TAG_DHCP_RENEWAL_TIME 58 ! # define TAG_DHCP_REBINDING_TIME 59 ! # define TAG_DHCP_VENDOR_CLASS_ID 60 ! # define TAG_DHCP_CLIENT_ID 61 ! # define TAG_DHCP_NISPLUS_DOMAIN 64 ! # define TAG_DHCP_NISPLUS_SERVERS 65 ! # define TAG_DHCP_TFTP_SERVER 66 ! # define TAG_DHCP_BOOT_FILE_NAME 67 ! # define TAG_DHCP_IP_HOME_AGENT 68 ! # define TAG_DHCP_SMTP_SERVER 69 ! # define TAG_DHCP_POP_SERVER 70 ! # define TAG_DHCP_NNTP_SERVER 71 ! # define TAG_DHCP_DEFAULT_WWW_SERVER 72 ! # define TAG_DHCP_DEFAULT_FINGER_SERVER 73 ! # define TAG_DHCP_DEFAULT_IRC_SERVER 74 ! # define TAG_DHCP_DEFAULT_ST_SERVER 75 ! # define TAG_DHCP_DEFAULT_STDA_SERVER 76 ! # define TAG_DHCP_END 255 /* DHCP overload option values. */ Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client-conf.c 4 Jul 2002 14:02:53 -0000 1.16 --- dhcp-client-conf.c 16 Jul 2002 03:43:30 -0000 1.17 *************** *** 35,46 **** static const int default_config_options[] = { ! 1, /* Subnet Mask */ ! 3, /* Routers. */ ! 6, /* Domain Name Servers. */ ! 26, /* Interface MTU */ ! 15, /* Domain Name. */ ! 50, /* IP Address lease time. */ ! 54, /* Server Identifier. */ ! 58, /* Renewal time. */ }; --- 35,48 ---- static const int default_config_options[] = { ! TAG_DHCP_SUBNET_MASK, /* Subnet Mask */ ! TAG_DHCP_ROUTER, /* Routers. */ ! TAG_DHCP_INTERFACE_MTU, /* Interface MTU */ ! TAG_DHCP_DOMAIN_NAME_SERVER, /* Domain Name Servers. */ ! TAG_DHCP_DOMAIN_NAME, /* Domain Name. */ ! TAG_DHCP_REQUESTED_IP_ADDRESS, /* Requested IP Address. */ ! TAG_DHCP_IP_ADDRESS_LEASE_TIME, /* IP Address lease time. */ ! TAG_DHCP_RENEWAL_TIME, /* Renewal time. */ ! TAG_DHCP_REBINDING_TIME, /* Rebinding time. */ ! TAG_DHCP_SERVER_IDENTIFIER, /* Server Identifier. */ }; Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-client-states.c 2 Jul 2002 18:46:21 -0000 1.37 --- dhcp-client-states.c 16 Jul 2002 03:43:30 -0000 1.38 *************** *** 39,42 **** --- 39,43 ---- const char *policy = glob_conf_get_val(CLIENT_OPTION_POLICY); + return 1; if(policy == NULL) policy = "atleast"; *************** *** 122,127 **** dhcp_client_control_t *dc = arg; ! if(client_check_dhcp(dc) || ! dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) || client_check_requested_options(dc)) return 1; --- 123,128 ---- dhcp_client_control_t *dc = arg; ! if(client_check_dhcp(dc) && ! dhcp_is_type(dc->rawnet->dhcp_p, DHCP_OFFER_TM) && client_check_requested_options(dc)) return 1; *************** *** 246,250 **** * The server may have decided to be nice to us. */ ! if(!dhcp_have_option(dc->rawnet->dhcp_p, TAG_DHCP_REQUEST_IP_ADDRESS)) dc->rawnet->dhcp_p->options = add_to_list(dc->rawnet->dhcp_p->options, --- 247,251 ---- * The server may have decided to be nice to us. */ ! if(!dhcp_have_option(dc->rawnet->dhcp_p, TAG_DHCP_REQUESTED_IP_ADDRESS)) dc->rawnet->dhcp_p->options = add_to_list(dc->rawnet->dhcp_p->options, Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-client.c 3 Jul 2002 01:24:20 -0000 1.41 --- dhcp-client.c 16 Jul 2002 03:43:30 -0000 1.42 *************** *** 121,125 **** static void usage(char *s) { ! printf("usage: %s [-cavkw] [-d directory] [-i interface name] [ -m mac address ]\n", s); exit(0); } --- 121,126 ---- static void usage(char *s) { ! // while((c = getopt(argc, argv, "tpcdavkwi:m:h:l:H:")) != -1) { ! printf("usage: %s [-cpavkwt] [-d directory] [-i interface name] [ -m mac address ]\n", s); exit(0); } *************** *** 442,446 **** * semicolons) */ ! setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { --- 443,447 ---- * semicolons) */ ! // setup_interrupt_handlers(); /* setup signal handling */ if((dc = create_dhcp_client_control(interface, promiscuous)) == NULL) { *************** *** 513,517 **** info_message(" "); ! while((c = getopt(argc, argv, "pgcdavi:m:kwh:l:H:")) != -1) { switch(c) { --- 514,518 ---- info_message(" "); ! while((c = getopt(argc, argv, "tpcdavi:m:kwh:l:H:")) != -1) { switch(c) { Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-com.c 30 Jun 2002 21:22:15 -0000 1.11 --- dhcp-com.c 16 Jul 2002 03:43:31 -0000 1.12 *************** *** 153,157 **** /* Always skip pads */ ! if(*dhcp_packet == TAG_PAD) { dhcp_packet++; len--; --- 153,157 ---- /* Always skip pads */ ! if(*dhcp_packet == TAG_DHCP_PAD) { dhcp_packet++; len--; *************** *** 161,165 **** /* Always stop on end. */ ! if(*dhcp_packet == TAG_END) break; --- 161,165 ---- /* Always stop on end. */ ! if(*dhcp_packet == TAG_DHCP_END) break; *************** *** 415,419 **** while((option = dhcp_get_next_option(dhcp)) != NULL) { ! if(option->tag == TAG_DHCP_OPTION_OVERLOAD) { return *(option->data); } --- 415,419 ---- while((option = dhcp_get_next_option(dhcp)) != NULL) { ! if(option->tag == TAG_DHCP_OVERLOAD) { return *(option->data); } *************** *** 472,476 **** if(options[i] && !dhcp_have_option(dhcp, i)) return 1; ! if(!options[i] && dhcp_have_option(dhcp, i)) return 1; } --- 472,476 ---- if(options[i] && !dhcp_have_option(dhcp, i)) return 1; ! if(dhcp_have_option(dhcp, i) && !options[i]) return 1; } *************** *** 526,530 **** option = xmalloc(sizeof(dhcp_option_t)); option->len = len; ! option->tag = TAG_PARAMETERS; option->data = xmalloc(len); --- 526,530 ---- option = xmalloc(sizeof(dhcp_option_t)); option->len = len; ! option->tag = TAG_DHCP_PARAMETERS; option->data = xmalloc(len); *************** *** 543,547 **** { max = htons(max); ! return(create_dhcp_option((unsigned char *)&max, sizeof(uint16_t), TAG_MAX_DHCP_SIZE)); } --- 543,547 ---- { max = htons(max); ! return(create_dhcp_option((unsigned char *)&max, sizeof(uint16_t), TAG_DHCP_MAX_DHCP_SIZE)); } *************** *** 554,558 **** { unsigned char len = strlen(class_id); ! return(create_dhcp_option(class_id, len, TAG_DHCP_CLASS_ID)); } --- 554,558 ---- { unsigned char len = strlen(class_id); ! return(create_dhcp_option(class_id, len, TAG_DHCP_VENDOR_CLASS_ID)); } *************** *** 564,568 **** dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address) { ! return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUEST_IP_ADDRESS)); } --- 564,568 ---- dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address) { ! return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUESTED_IP_ADDRESS)); } *************** *** 574,578 **** dhcp_option_t *dhcp_build_hostname(char *hostname) { ! return(create_dhcp_option((unsigned char *)hostname, (strlen(hostname) + 1), TAG_DHCP_HOSTNAME)); } --- 574,578 ---- dhcp_option_t *dhcp_build_hostname(char *hostname) { ! return(create_dhcp_option((unsigned char *)hostname, (strlen(hostname) + 1), TAG_DHCP_HOST_NAME)); } *************** *** 734,738 **** } ! *packet = TAG_END; packet += 1; len += 1; --- 734,738 ---- } ! *packet = TAG_DHCP_END; packet += 1; len += 1; *************** *** 742,746 **** if((padding = len%4)) { while(padding--) { ! *packet = TAG_PAD; packet++; } --- 742,746 ---- if((padding = len%4)) { while(padding--) { ! *packet = TAG_DHCP_PAD; packet++; } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-sysconf.c 4 Jul 2002 14:02:53 -0000 1.27 --- dhcp-sysconf.c 16 Jul 2002 03:43:31 -0000 1.28 *************** *** 309,316 **** ce = list_ptr->data; ! if(string_matches(dhcp_options_strings[TAG_DHCP_REQUEST_IP_ADDRESS], ce->name)) { ! data = option_convert_handlers[TAG_DHCP_REQUEST_IP_ADDRESS].serialize_to_internal(ce->value); memcpy(&addr, data, IP_ADDR_LEN); xfree(data); --- 309,316 ---- ce = list_ptr->data; ! if(string_matches(dhcp_options_strings[TAG_DHCP_REQUESTED_IP_ADDRESS], ce->name)) { ! data = option_convert_handlers[TAG_DHCP_REQUESTED_IP_ADDRESS].serialize_to_internal(ce->value); memcpy(&addr, data, IP_ADDR_LEN); xfree(data); |