diff options
author | Damjan Marion <damarion@cisco.com> | 2016-05-24 23:19:11 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2016-06-13 19:04:12 +0200 |
commit | 86be48773c1833129317a3a0d6fe8165eb69ac3f (patch) | |
tree | ff6ddc2933e9a18aba8e3e841fb6f495bc7efe4a /vnet | |
parent | a38c3df5fd2bf1bf8b3389e882f6dcd5ac533202 (diff) |
Explicity specify IP address type for format_ip46_address function
Change-Id: I3379517535a98a7a5fbd3173503f288a81378821
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/ethernet/arp.c | 4 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_format.c | 18 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_neighbor.c | 4 | ||||
-rw-r--r-- | vnet/vnet/ip/lookup.c | 6 | ||||
-rw-r--r-- | vnet/vnet/vxlan/vxlan.c | 4 |
5 files changed, 27 insertions, 9 deletions
diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c index aa37f25fb2d..d9e4b9b2612 100644 --- a/vnet/vnet/ethernet/arp.c +++ b/vnet/vnet/ethernet/arp.c @@ -1314,7 +1314,7 @@ arp_add_del_adj_cb (struct ip_lookup_main_t * lm, { if (!e) clib_warning("Adjacency contains unknown ARP next hop %U (del)", - format_ip46_address, &adj->arp.next_hop); + format_ip46_address, &adj->arp.next_hop, IP46_TYPE_IP4); else arp_ip4_entry_del_adj(e, adj->heap_handle); } @@ -1322,7 +1322,7 @@ arp_add_del_adj_cb (struct ip_lookup_main_t * lm, { if (!e) clib_warning("Adjacency contains unknown ARP next hop %U (add)", - format_ip46_address, &adj->arp.next_hop); + format_ip46_address, &adj->arp.next_hop, IP46_TYPE_IP4); else arp_ip4_entry_add_adj(e, adj->heap_handle); } diff --git a/vnet/vnet/ip/ip6_format.c b/vnet/vnet/ip/ip6_format.c index ad834f4db8a..5d32189478b 100644 --- a/vnet/vnet/ip/ip6_format.c +++ b/vnet/vnet/ip/ip6_format.c @@ -341,7 +341,23 @@ uword unformat_ip46_address (unformat_input_t * input, va_list * args) u8 * format_ip46_address (u8 * s, va_list * args) { ip46_address_t *ip46 = va_arg (*args, ip46_address_t *); - return ip46_address_is_ip4(ip46)? + ip46_type_t type = va_arg (*args, ip46_type_t); + int is_ip4 = 1; + + switch (type) + { + case IP46_TYPE_ANY: + is_ip4 = ip46_address_is_ip4(ip46); + break; + case IP46_TYPE_IP4: + is_ip4 = 1; + break; + case IP46_TYPE_IP6: + is_ip4 = 0; + break; + } + + return is_ip4 ? format(s, "%U", format_ip4_address, &ip46->ip4): format(s, "%U", format_ip6_address, &ip46->ip6); } diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 19eb5a8d54d..0dad232ce5d 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -3241,7 +3241,7 @@ ip6_neighbor_add_del_adj_cb (struct ip_lookup_main_t * lm, { if (!n) clib_warning("Adjacency contains unknown ND next hop %U (del)", - format_ip46_address, &adj->arp.next_hop); + format_ip46_address, &adj->arp.next_hop, IP46_TYPE_IP6); else ip6_neighbor_entry_del_adj(n, adj->heap_handle); } @@ -3249,7 +3249,7 @@ ip6_neighbor_add_del_adj_cb (struct ip_lookup_main_t * lm, { if (!n) clib_warning("Adjacency contains unknown ND next hop %U (add)", - format_ip46_address, &adj->arp.next_hop); + format_ip46_address, &adj->arp.next_hop, IP46_TYPE_IP6); else ip6_neighbor_entry_add_adj(n, adj->heap_handle); } diff --git a/vnet/vnet/ip/lookup.c b/vnet/vnet/ip/lookup.c index 2f638f7799b..5a56870f9b2 100644 --- a/vnet/vnet/ip/lookup.c +++ b/vnet/vnet/ip/lookup.c @@ -1000,7 +1000,8 @@ u8 * format_ip_adjacency (u8 * s, va_list * args) if (adj->if_address_index != ~0) s = format (s, " %U", format_ip_interface_address, lm, adj->if_address_index); if (adj->arp.next_hop.ip6.as_u64[0] || adj->arp.next_hop.ip6.as_u64[1]) - s = format (s, " via %U", format_ip46_address, &adj->arp.next_hop); + s = format (s, " via %U", format_ip46_address, + &adj->arp.next_hop, IP46_TYPE_ANY); break; case IP_LOOKUP_NEXT_LOCAL: if (adj->if_address_index != ~0) @@ -1011,7 +1012,8 @@ u8 * format_ip_adjacency (u8 * s, va_list * args) s = format (s, " table %d", adj->classify.table_index); case IP_LOOKUP_NEXT_INDIRECT: - s = format (s, " via %U", format_ip46_address, &adj->indirect.next_hop); + s = format (s, " via %U", format_ip46_address, + &adj->indirect.next_hop, IP46_TYPE_ANY); default: break; } diff --git a/vnet/vnet/vxlan/vxlan.c b/vnet/vnet/vxlan/vxlan.c index 133fc6f450c..86d49248e62 100644 --- a/vnet/vnet/vxlan/vxlan.c +++ b/vnet/vnet/vxlan/vxlan.c @@ -45,8 +45,8 @@ u8 * format_vxlan_tunnel (u8 * s, va_list * args) s = format (s, "[%d] %U (src) %U (dst) vni %d encap_fib_index %d", t - ngm->tunnels, - format_ip46_address, &t->src, - format_ip46_address, &t->dst, + format_ip46_address, &t->src, IP46_TYPE_ANY, + format_ip46_address, &t->dst, IP46_TYPE_ANY, t->vni, t->encap_fib_index); s = format (s, " decap_next %U\n", format_decap_next, t->decap_next_index); |