We did refer to the "api_ip_add_del_route" and test_client.c, but it seems that 
the route result still is not wright.

test_client.c,
add_del_ip4_route (test_main_t * tm, int enable_disable)
{ 
  vl_api_ip_add_del_route_t *mp;
  u32 tmp;

  mp = vl_msg_api_alloc (sizeof (*mp));
  memset (mp, 0, sizeof (*mp));
  mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
  mp->client_index = tm->my_client_index;
  mp->context = 0xdeadbeef;
  mp->table_id = ntohl (0);
  mp->create_vrf_if_needed = 1;
  /* Arp, please, if needed */
  mp->resolve_if_needed = 1;
  mp->resolve_attempts = ntohl (10);

  mp->next_hop_sw_if_index = ntohl (0);
  mp->is_add = enable_disable;
  mp->next_hop_weight = 1;

  /* Next hop: 6.0.0.1 */
  tmp = ntohl (0x06000001);
  clib_memcpy (mp->next_hop_address, &tmp, sizeof (tmp));

  /* Destination: 10.0.0.1/32 */
  tmp = ntohl (0x0a000001);
  clib_memcpy (mp->dst_address, &tmp, sizeof (tmp));
  mp->dst_address_length = 24;

  vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
}


6.0.0.0/24
  unicast-ip4-chain
  [@0]: dpo-load-balance: [index:13 buckets:1 uRPF:12 to:[0:0]]
    [0] [@4]: ipv4-glean: GigabitEthernet2/6/0
6.0.0.3/32
  unicast-ip4-chain
  [@0]: dpo-load-balance: [index:14 buckets:1 uRPF:13 to:[0:0]]
    [0] [@2]: dpo-receive: 6.0.0.3 on GigabitEthernet2/6/0
10.0.0.0/24
  unicast-ip4-chain
  [@0]: dpo-load-balance: [index:12 buckets:1 uRPF:11 to:[0:0]]
    [0] [@0]: dpo-drop ip4



yug...@telincn.com
 
From: Dave Barach (dbarach)
Date: 2016-12-31 21:04
To: yug...@telincn.com; vpp-dev
Subject: RE: [vpp-dev] strange phenomenon of interface
Take a look at vpp_api_test, specifically 
.../vat/api_format.c:api_ip_add_del_route()... 
 
Thanks… Dave
 
From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On 
Behalf Of yug...@telincn.com
Sent: Saturday, December 31, 2016 7:23 AM
To: vpp-dev <vpp-dev@lists.fd.io>
Subject: Re: [vpp-dev] strange phenomenon of interface
 
Hi all,
Thanks for your time.
I would like to use func "ip4_add_del_route_t_handler" to add route, how to 
fill next msg struct,  i just want the same effect with the  cmd "vppctl ip 
route add 10.10.10.0/24 via 80.80.80.1".
It's there any substitude func?
 
typedef VL_API_PACKED(struct _vl_api_ip_add_del_route {
    u16 _vl_msg_id;
    u32 client_index;
    u32 context;
    u32 next_hop_sw_if_index;
    u32 table_id;
    u32 resolve_attempts;
    u32 classify_table_index;
    u32 next_hop_out_label;
    u32 next_hop_table_id;
    u8 create_vrf_if_needed;
    u8 resolve_if_needed;
    u8 is_add;
    u8 is_drop;
    u8 is_unreach;
    u8 is_prohibit;
    u8 is_ipv6;
    u8 is_local;
    u8 is_classify;
    u8 is_multipath;
    u8 is_resolve_host;
    u8 is_resolve_attached;
    u8 not_last;
    u8 next_hop_weight;
    u8 dst_address_length;
    u8 dst_address[16];
    u8 next_hop_address[16];
}) vl_api_ip_add_del_route_t;
 
 
 
Regards,
By Ewan.
 


yug...@telincn.com
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to