On Mar 12, 2013, at 2:55 PM, Ben Pfaff <[email protected]> wrote:
> On Tue, Mar 12, 2013 at 02:51:17PM -0700, Justin Pettit wrote:
>> @@ -1735,6 +1737,16 @@ iface_refresh_status(struct iface *iface)
>> else {
>> ovsrec_interface_set_mtu(iface->cfg, NULL, 0);
>> }
>> +
>> + error = netdev_get_etheraddr(iface->netdev, mac);
>> + if (!error) {
>> + char *mac_string = xasprintf(ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
>
> Could we please use a local char[] buffer here and snprintf(), instead
> of xasprintf()? We do too many malloc()s on our fast paths anyhow.
Yeah, the thought occurred to me, too. It wasn't exactly on the fastpath, but
I agree statically would be better. How about the following incremental?
@@ -1740,10 +1740,10 @@ iface_refresh_status(struct iface *iface)
error = netdev_get_etheraddr(iface->netdev, mac);
if (!error) {
- char *mac_string = xasprintf(ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
+ char mac_string[32];
+ sprintf(mac_string, ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
ovsrec_interface_set_mac_in_use(iface->cfg, mac_string);
- free(mac_string);
} else {
ovsrec_interface_set_mac_in_use(iface->cfg, NULL);
}
--Justin
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev