2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

packets: New macro ETH_ADDR_STRLEN.

An upcoming commit will introduce another user.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
This commit is contained in:
Ben Pfaff
2015-12-07 15:00:16 -08:00
parent 1f632fff5e
commit b0d390e5fd
2 changed files with 4 additions and 2 deletions

View File

@@ -330,6 +330,7 @@ ovs_be32 set_mpls_lse_values(uint8_t ttl, uint8_t tc, uint8_t bos,
#define ETH_ADDR_ARGS(EA) ETH_ADDR_BYTES_ARGS((EA).ea)
#define ETH_ADDR_BYTES_ARGS(EAB) \
(EAB)[0], (EAB)[1], (EAB)[2], (EAB)[3], (EAB)[4], (EAB)[5]
#define ETH_ADDR_STRLEN 17
/* Example:
*

View File

@@ -2220,9 +2220,10 @@ iface_refresh_netdev_status(struct iface *iface)
error = netdev_get_etheraddr(iface->netdev, &mac);
if (!error) {
char mac_string[32];
char mac_string[ETH_ADDR_STRLEN + 1];
sprintf(mac_string, ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
snprintf(mac_string, sizeof mac_string,
ETH_ADDR_FMT, ETH_ADDR_ARGS(mac));
ovsrec_interface_set_mac_in_use(iface->cfg, mac_string);
} else {
ovsrec_interface_set_mac_in_use(iface->cfg, NULL);