|  | @@ -101,6 +101,14 @@ struct setting dhcp_server_setting __setting = {
 | 
		
	
		
			
			| 101 | 101 |  	.type = &setting_type_ipv4,
 | 
		
	
		
			
			| 102 | 102 |  };
 | 
		
	
		
			
			| 103 | 103 |  
 | 
		
	
		
			
			|  | 104 | +/** DHCP user class setting */
 | 
		
	
		
			
			|  | 105 | +struct setting user_class_setting __setting = {
 | 
		
	
		
			
			|  | 106 | +	.name = "user-class",
 | 
		
	
		
			
			|  | 107 | +	.description = "User class identifier",
 | 
		
	
		
			
			|  | 108 | +	.tag = DHCP_USER_CLASS_ID,
 | 
		
	
		
			
			|  | 109 | +	.type = &setting_type_string,
 | 
		
	
		
			
			|  | 110 | +};
 | 
		
	
		
			
			|  | 111 | +
 | 
		
	
		
			
			| 104 | 112 |  /**
 | 
		
	
		
			
			| 105 | 113 |   * Name a DHCP packet type
 | 
		
	
		
			
			| 106 | 114 |   *
 | 
		
	
	
		
			
			|  | @@ -834,6 +842,7 @@ int dhcp_create_request ( struct dhcp_packet *dhcppkt,
 | 
		
	
		
			
			| 834 | 842 |  	struct dhcp_client_uuid client_uuid;
 | 
		
	
		
			
			| 835 | 843 |  	size_t dhcp_features_len;
 | 
		
	
		
			
			| 836 | 844 |  	size_t ll_addr_len;
 | 
		
	
		
			
			|  | 845 | +	ssize_t len;
 | 
		
	
		
			
			| 837 | 846 |  	int rc;
 | 
		
	
		
			
			| 838 | 847 |  
 | 
		
	
		
			
			| 839 | 848 |  	/* Create DHCP packet */
 | 
		
	
	
		
			
			|  | @@ -885,8 +894,8 @@ int dhcp_create_request ( struct dhcp_packet *dhcppkt,
 | 
		
	
		
			
			| 885 | 894 |  
 | 
		
	
		
			
			| 886 | 895 |  	/* Add client UUID, if we have one.  Required for PXE. */
 | 
		
	
		
			
			| 887 | 896 |  	client_uuid.type = DHCP_CLIENT_UUID_TYPE;
 | 
		
	
		
			
			| 888 |  | -	if ( ( rc = fetch_uuid_setting ( NULL, &uuid_setting,
 | 
		
	
		
			
			| 889 |  | -					 &client_uuid.uuid ) ) >= 0 ) {
 | 
		
	
		
			
			|  | 897 | +	if ( ( len = fetch_uuid_setting ( NULL, &uuid_setting,
 | 
		
	
		
			
			|  | 898 | +					  &client_uuid.uuid ) ) >= 0 ) {
 | 
		
	
		
			
			| 890 | 899 |  		if ( ( rc = dhcppkt_store ( dhcppkt, DHCP_CLIENT_UUID,
 | 
		
	
		
			
			| 891 | 900 |  					    &client_uuid,
 | 
		
	
		
			
			| 892 | 901 |  					    sizeof ( client_uuid ) ) ) != 0 ) {
 | 
		
	
	
		
			
			|  | @@ -896,6 +905,20 @@ int dhcp_create_request ( struct dhcp_packet *dhcppkt,
 | 
		
	
		
			
			| 896 | 905 |  		}
 | 
		
	
		
			
			| 897 | 906 |  	}
 | 
		
	
		
			
			| 898 | 907 |  
 | 
		
	
		
			
			|  | 908 | +	/* Add user class, if we have one. */
 | 
		
	
		
			
			|  | 909 | +	if ( ( len = fetch_setting_len ( NULL, &user_class_setting ) ) >= 0 ) {
 | 
		
	
		
			
			|  | 910 | +		char user_class[len];
 | 
		
	
		
			
			|  | 911 | +		fetch_setting ( NULL, &user_class_setting, user_class,
 | 
		
	
		
			
			|  | 912 | +				sizeof ( user_class ) );
 | 
		
	
		
			
			|  | 913 | +		if ( ( rc = dhcppkt_store ( dhcppkt, DHCP_USER_CLASS_ID,
 | 
		
	
		
			
			|  | 914 | +					    &user_class,
 | 
		
	
		
			
			|  | 915 | +					    sizeof ( user_class ) ) ) != 0 ) {
 | 
		
	
		
			
			|  | 916 | +			DBG ( "DHCP could not set user class: %s\n",
 | 
		
	
		
			
			|  | 917 | +			      strerror ( rc ) );
 | 
		
	
		
			
			|  | 918 | +			return rc;
 | 
		
	
		
			
			|  | 919 | +		}
 | 
		
	
		
			
			|  | 920 | +	}
 | 
		
	
		
			
			|  | 921 | +
 | 
		
	
		
			
			| 899 | 922 |  	return 0;
 | 
		
	
		
			
			| 900 | 923 |  }
 | 
		
	
		
			
			| 901 | 924 |  
 |