diff options
Diffstat (limited to 'lib/route/link/vxlan.c')
-rw-r--r-- | lib/route/link/vxlan.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/route/link/vxlan.c b/lib/route/link/vxlan.c index a4a4c44c..7b8429c8 100644 --- a/lib/route/link/vxlan.c +++ b/lib/route/link/vxlan.c @@ -316,16 +316,12 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_GROUP) { nl_dump(p, " group "); - if (inet_ntop(AF_INET, &vxi->vxi_group, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ntohs(vxi->vxi_group)); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET, &vxi->vxi_group, addr)); } else if (vxi->ce_mask & VXLAN_ATTR_GROUP6) { nl_dump(p, " group "); - if (inet_ntop(AF_INET6, &vxi->vxi_group6, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", vxi->vxi_group6); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &vxi->vxi_group6, addr)); } if (vxi->ce_mask & VXLAN_ATTR_LINK) { @@ -344,19 +340,14 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_LOCAL) { nl_dump(p, " local "); - if (inet_ntop(AF_INET, &vxi->vxi_local, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ntohs(vxi->vxi_local)); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET, &vxi->vxi_local, addr)); } else if (vxi->ce_mask & VXLAN_ATTR_LOCAL6) { nl_dump(p, " local "); - if (inet_ntop(AF_INET6, &vxi->vxi_local6, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", vxi->vxi_local6); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &vxi->vxi_local6, addr)); } - if (vxi->ce_mask & VXLAN_ATTR_TTL) { nl_dump(p, " ttl "); if(vxi->vxi_ttl) @@ -368,7 +359,7 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_TOS) { nl_dump(p, " tos "); if (vxi->vxi_tos == 1) - nl_dump_line(p, "inherit\n", vxi->vxi_tos); + nl_dump_line(p, "inherit\n"); else nl_dump_line(p, "%#x\n", vxi->vxi_tos); } @@ -695,12 +686,11 @@ static struct rtnl_link_info_ops vxlan_info_ops = { struct rtnl_link *rtnl_link_vxlan_alloc(void) { struct rtnl_link *link; - int err; if (!(link = rtnl_link_alloc())) return NULL; - if ((err = rtnl_link_set_type(link, "vxlan")) < 0) { + if (rtnl_link_set_type(link, "vxlan") < 0) { rtnl_link_put(link); return NULL; } |