setting mac address for a host in C (dhcpctl.h)

Johnson koil Raj johnson.raj at wipro.com
Tue Jun 28 13:05:21 UTC 2011


Hi All,

     I am working on dhcpd api by using dhcpctl.h. I am trying to assign 
static IPs for machines when its hostname and mac-address was provided. 
I have tried so far. When I tried to add a new host detail. The 
mac-address alone not assigned properly. Some junk value it is giving. 
The code what I have used is below.

     dhcpctl_data_string macaddrstring = NULL;

     memset (&macaddrstring, 0, sizeof macaddrstring);

     omapi_data_string_new (&macaddrstring, 16, MDL);

     memcpy(macaddrstring->value, "00:0c:26:22:bf:c3", 16);

     status = dhcpctl_set_value (host, macaddrstring, "hardware-address");

I am seeing following value in lease file.

host testomapihost {
   dynamic;
   hardware ethernet 31:30:30:3a:30:63:3a:32:36:3a:32:32:3a:62:66:3a;
   fixed-address 192.168.10.123;
}

Whether like ip address ( example provided in man page)  we need to 
convert mac-address also to any valid format. We can't pass the value 
just like string. What I am doing wrong. Any help will be grateful for me.


Thanks,
Johnson






Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com



More information about the dhcp-users mailing list