summaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index f2d10b78de5..14f66c31fa7 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -10758,7 +10758,10 @@ api_sr_localsid_add_del (vat_main_t * vam)
u8 behavior = ~0;
u32 sw_if_index;
u32 fib_table = ~(u32) 0;
- ip6_address_t next_hop;
+ ip6_address_t nh_addr6;
+ ip4_address_t nh_addr4;
+ memset (&nh_addr6, 0, sizeof (ip6_address_t));
+ memset (&nh_addr4, 0, sizeof (ip4_address_t));
bool nexthop_set = 0;
@@ -10769,7 +10772,9 @@ api_sr_localsid_add_del (vat_main_t * vam)
if (unformat (i, "del"))
is_del = 1;
else if (unformat (i, "address %U", unformat_ip6_address, &localsid));
- else if (unformat (i, "next-hop %U", unformat_ip6_address, &next_hop))
+ else if (unformat (i, "next-hop %U", unformat_ip4_address, &nh_addr4))
+ nexthop_set = 1;
+ else if (unformat (i, "next-hop %U", unformat_ip6_address, &nh_addr6))
nexthop_set = 1;
else if (unformat (i, "behavior %u", &behavior));
else if (unformat (i, "sw_if_index %u", &sw_if_index));
@@ -10781,9 +10786,12 @@ api_sr_localsid_add_del (vat_main_t * vam)
M (SR_LOCALSID_ADD_DEL, mp);
- clib_memcpy (mp->localsid_addr, &localsid, sizeof (mp->localsid_addr));
+ clib_memcpy (mp->localsid.addr, &localsid, sizeof (mp->localsid));
if (nexthop_set)
- clib_memcpy (mp->nh_addr, &next_hop, sizeof (mp->nh_addr));
+ {
+ clib_memcpy (mp->nh_addr6, &nh_addr4, sizeof (mp->nh_addr6));
+ clib_memcpy (mp->nh_addr4, &nh_addr6, sizeof (mp->nh_addr4));
+ }
mp->behavior = behavior;
mp->sw_if_index = ntohl (sw_if_index);
mp->fib_table = ntohl (fib_table);