[PATCH phosphor-host-ipmid] Add Set MAC address

Daniel Axtens dja at axtens.net
Thu Feb 4 16:43:04 AEDT 2016


Hi,

>      {
>          sprintf(new_ipaddr, "%d.%d.%d.%d", reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
>      }
> +    else if (reqptr->parameter == 5) // MAC
Instead of a comment, could we #define or 'const' that 5 == MAC?

Regards,
Daniel
> +    {
> +        char                mac[18];
> +        sd_bus_message *reply = NULL, *m = NULL;
> +        sd_bus_error error = SD_BUS_ERROR_NULL;
> +        int r = 0;
> +
> +        sprintf(mac, "%x:%x:%x:%x:%x:%x",
> +                reqptr->data[0],
> +                reqptr->data[1],
> +                reqptr->data[2],
> +                reqptr->data[3],
> +                reqptr->data[4],
> +                reqptr->data[5]);
> +
> +        r = sd_bus_message_new_method_call(bus,&m,app,obj,ifc,"SetHwAddress");
> +        if (r < 0) {
> +            fprintf(stderr, "Failed to add method object: %s\n", strerror(-r));
> +            return -1;
> +        }
> +        r = sd_bus_message_append(m, "s", mac);
> +        if (r < 0) {
> +            fprintf(stderr, "Failed to append message data: %s\n", strerror(-r));
> +            return -1;
> +        }
> +        r = sd_bus_call(bus, m, 0, &error, &reply);
> +        if (r < 0) {
> +            fprintf(stderr, "Failed to call method: %s\n", strerror(-r));
> +            return -1;
> +        }
> +    }
>      else if (reqptr->parameter == 6) // Subnet
>      {
>          sprintf(new_netmask, "%d.%d.%d.%d", reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]);
> -- 
> 2.6.4
>
>
> _______________________________________________
> openbmc mailing list
> openbmc at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160204/b9296955/attachment.sig>


More information about the openbmc mailing list