Hi Experts, I got tired trying several ways to add the IPV6 ACL rules using API. I couldn't successful. The same thing working fine with IPv4 rule. When I tried IPV6 rule, I am getting retval is -58, I am not able to figure out what is this error. Can anyone please help me to understand what could be causing the problem in the following.
vapi_msg_acl_add_replace *acl= vapi_alloc_acl_add_replace(ctx, 1); acl->payload.acl_index=-1; strncpy((char *)acl->payload.tag,"fromthread1",12); acl->payload.count=1; acl->payload.r[0].is_permit=1; char ipv6addrstr[64]="\0"; acl->payload.r[0].src_prefix.address.af=1;//Ipv4 =0 IPv6=1; acl->payload.r[0].dst_prefix.address.af=1; acl->payload.r[0].dst_prefix.len=64;//prefix len int ret=0; //inet_ntop(AF_INET6, &(acl->payload.r[0].src_prefix.address.un.ip6), ipv6addrstr, INET6_ADDRSTRLEN); //printf("1********************ret %d,ipv6addrstr %s\n",ret,ipv6addrstr); ret=inet_pton(AF_INET6,"fd01::1",&(acl->payload.r[0].dst_prefix.address.un.ip6)); //struct in6_addr tmp_v6_addr; //ret=inet_pton(AF_INET6,"fd01::1",&(tmp_v6_addr)); //memcpy(&(acl->payload.r[0].dst_prefix.address.un.ip6),&(tmp_v6_addr.s6_addr[0]),sizeof(struct in6_addr)); //memcpy(&(acl->payload.r[0].dst_prefix.address.un.ip6),&(tmp_v6_addr),sizeof(struct in6_addr)); //for(i=0;i<16;i++) //{ // acl->payload.r[0].dst_prefix.address.un.ip6[i]=tmp_v6_addr.s6_addr[i]; // printf("val %x\n",tmp_v6_addr.s6_addr[i]); //} inet_ntop(AF_INET6, &(acl->payload.r[0].dst_prefix.address.un.ip6), ipv6addrstr, INET6_ADDRSTRLEN); printf("2********************ret %d,ipv6addrstr %s\n",ret,ipv6addrstr); vapi_msg_acl_add_replace_hton(acl); vapi_msg_acl_add_replace_reply *resp; rv=vapi_send_recv(ctx,acl,&resp); vapi_msg_acl_add_replace_reply_ntoh(resp); printf("So the reply receivied ACL Index %d Retval %d\n",resp->payload.acl_index,resp->payload.retval); *All the different ways to convert from ascii to IPV6 I tried, but in any case the payload.retval is -58.* *If I use inet_pton to ipv4, I am getting same error, but I am using inet_aton for ipv4 address to progress.* Any other method to convert the ASCII to IPV6 address may help I am not sure... Let us know if you guys find any problem in my code or... let us know the best way to add IPV6 ACL rules from application.(we don't want to use vppctl) //Ravi
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#20060): https://lists.fd.io/g/vpp-dev/message/20060 Mute This Topic: https://lists.fd.io/mt/85340656/21656 Mute #acl:https://lists.fd.io/g/vpp-dev/mutehashtag/acl Mute #ipv6:https://lists.fd.io/g/vpp-dev/mutehashtag/ipv6 Mute #vapi:https://lists.fd.io/g/vpp-dev/mutehashtag/vapi Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-