Ejemplo n.º 1
0
struct vr_nexthop *
vr_inet_route_lookup(unsigned int vrf_id, struct vr_route_req *rt)
{
    if (!vn_rtable[0] || !vn_rtable[1])
        return NULL;
    return mtrie_lookup(vrf_id, rt);
}
Ejemplo n.º 2
0
/*
 * Exact-match
 * returns the next-hop on exact match. NULL otherwise
 */
static int
mtrie_get(unsigned int vrf_id, struct vr_route_req *rt)
{
    struct vr_nexthop *nh;
    struct vr_route_req breq;
    vr_route_req *req = &rt->rtr_req;

    nh = mtrie_lookup(vrf_id, rt);
    if (nh)
        req->rtr_nh_id = nh->nh_id;
    else
        req->rtr_nh_id = -1;

    if (req->rtr_index != VR_BE_INVALID_INDEX) {
        req->rtr_mac = vr_zalloc(VR_ETHER_ALEN, VR_ROUTE_REQ_MAC_OBJECT);
        req->rtr_mac_size = VR_ETHER_ALEN;

        breq.rtr_req.rtr_mac = req->rtr_mac;
        breq.rtr_req.rtr_index = req->rtr_index;
        breq.rtr_req.rtr_mac_size = VR_ETHER_ALEN;
        vr_bridge_lookup(req->rtr_vrf_id, &breq);

    } else {
        req->rtr_mac_size = 0;
        req->rtr_mac = NULL;
    }

    return 0;
}
Ejemplo n.º 3
0
// Called from data path
void* ipv4_lookup(uint32_t label, uint8_t* ip)
{
    return mtrie_lookup(&ipv4_route_table[label], ip, 32);
}