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

Peter Rathlev peter at rathlev.dk
Wed Jun 29 18:37:43 UTC 2011


On Wed, 2011-06-29 at 19:42 +0530, Johnson koil Raj wrote:
>   I have changed and tried as you suggestion.
> 
>    memset (&macaddrstring, 0, sizeof macaddrstring);
>    omapi_data_string_new (&macaddrstring, 18, MDL);
>    memcpy(macaddrstring->value, "00:0c:26:22:bf:c3", 18);
>    dhcpctl_set_string_value (host, macaddrstring, "hardware-address");
> 
> But still the mac address is not getting set proper.

Technically I didn't suggest that. I even tried saying that correcting
the length would not be a solution.

Look at the "dhcpctl_set_string_value" prototype. It takes "char *" as
the second argument, not "omapi_data_string_t *". The latter is not just
a string, as you can see in includes/omapi/omapi.h.

Again, this is really basic C stuff. Please consider if you're doing the
right thing here. I'm not sure exactly what you want, but you might want
to look at using OMAPI via omshell or Perl (e.g. Net::ISC::DHCPd).

-- 
Peter





More information about the dhcp-users mailing list