1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00

Merge pull request #133 from ssahani/net

networkd: vxlan improve logging
This commit is contained in:
Lennart Poettering 2015-06-10 15:08:48 +02:00
commit 251811f69b
2 changed files with 34 additions and 102 deletions

View File

@ -35,12 +35,8 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(m); assert(m);
r = sd_rtnl_message_open_container(m, VETH_INFO_PEER); r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append VETH_INFO_PEER attribute: %m");
"Could not append VETH_INFO_PEER attribute: %s",
strerror(-r));
return r;
}
if (v->ifname_peer) { if (v->ifname_peer) {
r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer); r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
@ -50,21 +46,13 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (v->mac_peer) { if (v->mac_peer) {
r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer); r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
"Could not append IFLA_ADDRESS attribute: %s",
strerror(-r));
return r;
}
} }
r = sd_rtnl_message_close_container(m); r = sd_rtnl_message_close_container(m);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
"Could not append IFLA_INFO_DATA attribute: %s",
strerror(-r));
return r;
}
return r; return r;
} }

View File

@ -39,123 +39,67 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if (v->id <= VXLAN_VID_MAX) { if (v->id <= VXLAN_VID_MAX) {
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id); r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
"Could not append IFLA_VXLAN_ID attribute: %s",
strerror(-r));
return r;
}
} }
r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in); r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
"Could not append IFLA_VXLAN_GROUP attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex); r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
"Could not append IFLA_VXLAN_LINK attribute: %s",
strerror(-r));
return r;
}
if(v->ttl) { if(v->ttl) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
"Could not append IFLA_VXLAN_TTL attribute: %s",
strerror(-r));
return r;
}
} }
if(v->tos) { if(v->tos) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
"Could not append IFLA_VXLAN_TOS attribute: %s",
strerror(-r));
return r;
}
} }
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
"Could not append IFLA_VXLAN_LEARNING attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
"Could not append IFLA_VXLAN_RSC attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
"Could not append IFLA_VXLAN_PROXY attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
"Could not append IFLA_VXLAN_L2MISS attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
"Could not append IFLA_VXLAN_L3MISS attribute: %s",
strerror(-r));
return r;
}
if(v->fdb_ageing) { if(v->fdb_ageing) {
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC); r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
"Could not append IFLA_VXLAN_AGEING attribute: %s",
strerror(-r));
return r;
}
} }
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
"Could not append IFLA_VXLAN_UDP_CSUM attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
"Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %s",
strerror(-r));
return r;
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx); r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
if (r < 0) { if (r < 0)
log_netdev_error(netdev, return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
"Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %s",
strerror(-r));
return r;
}
return r; return r;
} }