Exemple #1
0
mpls_return_enum ldp_inlabel_add_outlabel(ldp_global *g, ldp_inlabel *i,
  ldp_outlabel *o) {
  mpls_return_enum result;

  MPLS_ASSERT(i && o);
  MPLS_ASSERT(i->outlabel == NULL);

#if MPLS_USE_LSR
  {
    lsr_xconnect xcon;
    xcon.insegment_index = i->info.handle;
    xcon.outsegment_index = o->info.handle;
    xcon.info.owner = MPLS_OWNER_LDP;
    result = lsr_cfg_xconnect_set2(g->lsr_handle, &xcon, LSR_CFG_ADD|
      LSR_XCONNECT_CFG_OUTSEGMENT|LSR_XCONNECT_CFG_INSEGMENT|
      LSR_XCONNECT_CFG_LSPID|LSR_XCONNECT_CFG_OWNER);
  }
#else
  result = mpls_mpls_xconnect_add(g->mpls_handle, &i->info, &o->info);
#endif
  if (result == MPLS_SUCCESS) {
    MPLS_REFCNT_HOLD(o);
    i->outlabel = o;
    _ldp_outlabel_add_inlabel(o, i);
  }
  return result;
}
Exemple #2
0
static int ldp_out_segment_read(int cmd, struct zclient *client,
    zebra_size_t size) {
    struct zapi_mpls_out_segment api;
    struct listnode *n;
    struct listnode *nn;
    mpls_outsegment *o;
    struct pending_ftn_data *fn;
    struct pending_xc_data *x;

    mpls_out_segment_stream_read(client->ibuf, &api);

    for (ALL_LIST_ELEMENTS(pending_out_segment, n, nn, o)) {
	if (api.req == o->handle) {
	    zlog_info("found pending NHLFE: %p", o);
	    o->handle = api.index;
	    list_delete_node(pending_out_segment,n);
	    goto ftn;
	}
    }
    zlog_info("requested out segment %d not in list", api.req);
    return 0;

ftn:
    /* if we've gotten this for then the o->handle is not the proper index */
    for (ALL_LIST_ELEMENTS(pending_ftn, n, nn, fn)) {
	if (api.index == fn->o->handle) {
	    mpls_mpls_fec2out_add(fn->h, fn->f, fn->o);
	    list_delete_node(pending_ftn,n);
	    break;
	}
    }
    for (ALL_LIST_ELEMENTS(pending_xc, n, nn, x)) {
	if (api.index == x->o->handle) {
	    mpls_mpls_xconnect_add(x->h, x->i, x->o);
	    list_delete_node(pending_xc,n);
	    break;
	}
    }
    return 0;
}