API for RIB operations

Document created by cdnadmin on Jan 25, 2014
Version 1Show Document
  • View in full screen mode
This document was generated from CDN thread

Created by: Bharathan Tm on 11-12-2012 12:53:21 PM
Hi, I am getting the error "Segmentation fault" while invoking the api "onep_prefix_new" . this is how i am calling the function rc = onep_prefix_new((struct sockaddr *) &ipv4_prefix_addr, 0, 0, &start_prefix); please let me know how to overcome this. Note : i have attached my applicaiton in this thread Thanks, Bharathan.TM

Subject: RE: API for RIB operations
Replied by: Joseph Clarke on 11-12-2012 02:38:40 PM
Hi, I am getting the error "Segmentation fault" while invoking the api "onep_prefix_new" . this is how i am calling the function rc = onep_prefix_new((struct sockaddr *) &ipv4_prefix_addr, 0, 0, &start_prefix); please let me know how to overcome this. Note : i have attached my applicaiton in this thread Thanks, Bharathan.TM

 
In looking at your code, the crash isn't in onep_prefix_new, but in onep_routing_l3_ucast_route_range_new.  It appears to be that onep_prefix_new is broken, and not returning a onep_prefix_t with a proper address member.  Here's what I see in gdb:
 
#0  0x00205db9 in onep_util_pl_clone_prefix (old=0x80623e0, new=0xbffff118)
    at src/onep_util.c:796
#1  0x00211d42 in onep_routing_l3_ucast_route_range_new (
    start_prefix=0x80623e0, range_type=ROUTING_ROUTE_RANGE_EQUAL_OR_LARGER,
    count=100, range=0xbffff170) at src/routing_l3_ucast.c:225
#2  0x08048e01 in test_routing_rib (rtg=0x8062340) at test.c:105
#3  0x08048f2b in test_routing (rtg=0x8062340) at test.c:212
#4  0x08049319 in main (argc=7, argv=0xbffff2f4) at test.c:411

(gdb) frame 2
(gdb) print *start_prefix
$1 = {address = 0xfe66, prefix_len = 0}


If I look at the routing test example, the start_prefix is being created manually:
 
ipv4_prefix_addr.sin_family = AF_INET;
    inet_pton(AF_INET, "0.0.0.0", &ipv4_prefix_addr.sin_addr);

    start_prefix = malloc(sizeof(onep_prefix_t));
    if (!start_prefix) {
        printf("No Memory FAILED\n");
        goto test_routing_rib_failed;
    }
    start_prefix->address = malloc(sizeof(struct sockaddr_in));
    memcpy(start_prefix->address, &ipv4_prefix_addr, sizeof(struct sockaddr_in));
    start_prefix->prefix_len = 0;


That might be a workaround for you until this problem is fixed.

Subject: RE: API for RIB operations
Replied by: Joseph Clarke on 11-12-2012 02:40:36 PM
I found the bug: CSCub48397.  It's fixed, but not available in EFT code.https://cdetsng.cisco.com/webui/#view=CSCub48397

Attachments

    Outcomes