summaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorPablo Camarillo <pcamaril@cisco.com>2018-06-19 15:49:02 +0200
committerDamjan Marion <dmarion@me.com>2018-06-19 16:32:11 +0000
commit3337bd22002e9b78459082c34f7b78370b177eb0 (patch)
tree3e0c8d4c5547a57cce74be05236c2c134fe15026 /src/vat
parent2b9838ac60395c8c79cd1010025732aa9d7e9fac (diff)
Fixed bugs in SRv6 API
Jira ticket VPP-1196 Jira ticket VPP-1081 Jira ticket VPP-1078 Jira ticket VPP-1217 Change-Id: Id7e85229cae1017acb0aa4ca63ced334e6dafb8d Signed-off-by: pcamaril <pcamaril@cisco.com> Signed-off-by: Pablo Camarillo <pcamaril@cisco.com> Signed-off-by: pcamaril <pcamaril@cisco.com> Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'src/vat')
-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);