📄 labelreq.c
字号:
{
/**************************************/
/* send notification message, NO ROUTE
*/
/**************************************/
MPLS_SEND_NOTIFY(session,NOROUTE,lblReqMsg->baseMsg.msgId, \
lblReqMsg->baseMsg.flags.flags.msgType);
return;
}
/* hyh add for 78.tst */
/* if the msg source is the next hop,send notification */
if(lblReqMsg->pathVecTlvExists == 1)
{
if(lblReqMsg->pathVecTlv.lsrId[0] == downSession->peerLdpId.lsrAddress)
{
MPLS_SEND_NOTIFY(session,LOOPDETECT,lblReqMsg->baseMsg.msgId, \
lblReqMsg->baseMsg.flags.flags.msgType);
return;
}
}
/* hyh add end */
/*************************************************************/
/* continue process label request message
*/
/*************************************************************/
lbl_req_fec_proc(session,downSession,fecEntry,lblReqMsg);
}
}
}
return;
}
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: LDP/CR_LDP
* File Name: ldppdu.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : mplsLdpSession_t *, inbound seesion pointer;
* mplsLdpSession_t *, outbound seesion pointer;
* mplsLdpFecEntry *, fecEntry;
* Output : void
* Function : Label request process function
* Note : first, judge the nodeType == MPLS_NODE_EGRESS?
*/
/****************************************************************************/
void lbl_req_fec_proc(mplsLdpSession_t * upsession, \
mplsLdpSession_t * downsession, \
mplsLdpFecEntry * fecEntry, \
mplsLdpLblReqMsg_t * lblReqMsg)
{
mplsLdpUpCB * upCB = MPLS_NULL;
mplsLdpDownCB * downCB = MPLS_NULL;
mplsLdpLspCB * lspCB = MPLS_NULL;
unsigned short mode = INDEPENDENT;
MPLS_BOOL yes = FALSE;
/*************************************************************************/
/* judge up session Label Distribution mode
*/
/*************************************************************************/
if(upsession->labelAdvertisement == DOWNSTRAMUNSOLICITED)
{
MPLS_UPCB_SEARCH(upsession,upCB,fecEntry);
if(upCB != MPLS_NULL)
{
/******************************************************************/
/* have send to upstream lsr a mapping, just send again
*/
/******************************************************************/
upCB->msgid = lblReqMsg->baseMsg.msgId;
sendtoUpMapping(upsession,upCB,fecEntry,LDP_HOP_LSP);
upCB->msgid = 0;
upCB->state = ESTABLISHED;
return;
}
MPLS_UPCB_CREATE(fecEntry,upsession,upCB)
if(upCB == MPLS_NULL)
return;
/******************************************************************/
/* resource unavailable, just discard it
*/
/******************************************************************/
upCB->upSessionIndex = upsession->index;
if(fecEntry->nodeType == MPLS_NODE_EGRESS || \
fecEntry->nodeType == MPLS_NODE_PROXY_EGRESS)
{
sendtoUpMapping(upsession,upCB,fecEntry,LDP_HOP_LSP);
upCB->msgid = 0;
upCB->state = ESTABLISHED;
if(fecEntry->nodeType == MPLS_NODE_PROXY_EGRESS)
{
/**************************************************************/
/* resource unavailable, just discard it
*/
/**************************************************************/
#if 0 /******************fj*******************/
sendtoLabelXC(fecEntry,MPLS_NULL,MPLS_NULL,LDP_FWD_CREATE);
#endif
/*????? wait_lspfeclbl_append(); */
}
return;
}
MPLS_CONTROL_MODE(mode);
if(mode == INDEPENDENT)
{
sendtoUpMapping(upsession,upCB,fecEntry,LDP_HOP_LSP);
upCB->msgid = 0;
upCB->state = ESTABLISHED;
return;
}
/*********************************************************************/
/* MPLS_NODE_INTERM node Ordered Control
*/
/*********************************************************************/
if(downsession->labelAdvertisement == DOWNSTREAMONDEMAND)
{
/*****************************************************************/
/* downstream DOD mode, depend on the downstream properly process
*/
/*****************************************************************/
return;
}
/*****************************************************************/
/* judge nexthop label ?
*/
/*****************************************************************/
MPLS_NEXTHOP_SESSION_DOWN(downsession,fecEntry,yes);
if(yes == MPLS_TRUE)
{
sendtoUpMapping(upsession,upCB,fecEntry,LDP_HOP_LSP);
upCB->msgid = 0;
upCB->state = ESTABLISHED;
}
else
{
/*****************************************************************/
/* have no nexthop label or downCB
*/
/*****************************************************************/
MPLS_DOWNCB_CREATE(downsession,downCB,fecEntry);
if(downCB == MPLS_NULL)
return;
/* fj */
downCB->downSessionIndex = downsession->index;
/* fj */
sendtoDownRequest(downsession,downCB,fecEntry);
}
}
else
{
/*********************************************************************/
/* atm interface inbound
* search duplicate request
*/
/*********************************************************************/
yes = MPLS_FALSE;
if(fecEntry->nodeType != MPLS_NODE_EGRESS || \
fecEntry->nodeType != MPLS_NODE_PROXY_EGRESS)
{
if(downsession->labelAdvertisement == DOWNSTREAMONDEMAND)
{
/*****************************************************************/
/* atm to atm
*/
/*****************************************************************/
MPLS_LSPCB_CREATE(fecEntry,lspCB)
if(lspCB)
{
lspCB->lspIndex = MPLS_GET_LSP_INDEX;
lspCB->nodeType = MPLS_NODE_INTERM;
lspCB->lspType = LDP_HOP_LSP;
lspCB->upSessionIndex = upsession->index;
lspCB->upifIndex = upsession->ifIndex;
lspCB->upPeerLdpid.lsrAddress = upsession->peerLdpId.lsrAddress;
lspCB->upPeerLdpid.labelSpace = upsession->peerLdpId.labelSpace;
ifindex2mod_req.ifIndex = lspCB->upifIndex;
ifindex2mod_req.mpls_protocol_type = MPLS_LABEL_SWITCH_PROTOCOL_ATM;
ifindex2mod_req.mpls_platform = local_platform;
mpls_ifindex2module(&ifindex2mod_req,&ifindex2mod_ack,MPLS_INTERFACE);
if(ifindex2mod_ack.ack == MPLS_SUCCESS)
{
lspCB->upAtmLabel.module = ifindex2mod_ack.mod;
lspCB->upAtmLabel.port = ifindex2mod_ack.port;
}
else
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest,ERR get UP ATM Module & port\n");
MPLS_ERR_LOG("ERR get UP ATM Module & port");
MPLS_FEC_LSPCB_DELETE(fecEntry,lspCB);
return;
}
lspCB->downSessionIndex = downsession->index;
lspCB->downifIndex = downsession->ifIndex;
lspCB->downPeerLdpid.lsrAddress = downsession->peerLdpId.lsrAddress;
lspCB->downPeerLdpid.labelSpace = downsession->peerLdpId.labelSpace;
ifindex2mod_req.ifIndex = lspCB->downifIndex;
ifindex2mod_req.mpls_protocol_type = MPLS_LABEL_SWITCH_PROTOCOL_ATM;
ifindex2mod_req.mpls_platform = local_platform;
mpls_ifindex2module(&ifindex2mod_req,&ifindex2mod_ack,MPLS_INTERFACE);
if(ifindex2mod_ack.ack == MPLS_SUCCESS)
{
lspCB->downAtmLabel.module = ifindex2mod_ack.mod;
lspCB->downAtmLabel.port = ifindex2mod_ack.port;
}
else
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest,ERR get Down ATM Module & port\n");
MPLS_ERR_LOG("ERR get UP ATM Module & port");
/* should release up atm label */
MPLS_FEC_LSPCB_DELETE(fecEntry,lspCB);
return;
}
MPLS_INSERT_INTO_UP_LSP_LIST(upsession->lsp_up_cb_list,lspCB,lspCB);
MPLS_INSERT_INTO_DOWN_LSP_LIST(downsession->lsp_down_cb_list,lspCB,lspCB);
lspCB->status = IDLE;
lspCB->subStatus = IDLE;
rec_lblreq_tlvpro(upsession,lblReqMsg,fecEntry,lspCB,LDP_HOP_LSP);
if(!(lspCB->waitflag & 0x1))
LspCBFsm(upsession,MPLS_LBLREQ_MSGTYPE, \
lblReqMsg,LDP_HOP_LSP,fecEntry,lspCB);
return;
}
else
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest,creat lspcb fail\n");
}
else
{
/*****************************************************************/
/* atm to FEI
*/
/*****************************************************************/
MPLS_LSPCB_CREATE(fecEntry,lspCB)
if(lspCB)
{
lspCB->lspIndex = MPLS_GET_LSP_INDEX;
lspCB->nodeType = MPLS_NODE_INTERM_EGRESS;
lspCB->lspType = LDP_HOP_LSP;
lspCB->upSessionIndex = upsession->index;
lspCB->upifIndex = upsession->ifIndex;
lspCB->upPeerLdpid.lsrAddress = upsession->peerLdpId.lsrAddress;
lspCB->upPeerLdpid.labelSpace = upsession->peerLdpId.labelSpace;
ifindex2mod_req.ifIndex = lspCB->upifIndex;
ifindex2mod_req.mpls_protocol_type = MPLS_LABEL_SWITCH_PROTOCOL_ATM;
ifindex2mod_req.mpls_platform = local_platform;
mpls_ifindex2module(&ifindex2mod_req,&ifindex2mod_ack,MPLS_INTERFACE);
if(ifindex2mod_ack.ack == MPLS_SUCCESS)
{
lspCB->upAtmLabel.module = ifindex2mod_ack.mod;
lspCB->upAtmLabel.port = ifindex2mod_ack.port;
}
else
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest 2,ERR get UP ATM Module & port\n");
MPLS_ERR_LOG("ERR get UP ATM Module & port");
MPLS_FEC_LSPCB_DELETE(fecEntry,lspCB);
return;
}
lspCB->downSessionIndex = downsession->index;
lspCB->downifIndex = downsession->ifIndex;
lspCB->downPeerLdpid.lsrAddress = downsession->peerLdpId.lsrAddress;
lspCB->downPeerLdpid.labelSpace = downsession->peerLdpId.labelSpace;
ifindex2mod_req.ifIndex = lspCB->downifIndex;
#if 1
ifindex2mod_req.mpls_protocol_type = MPLS_LABEL_SWITCH_PROTOCOL_ATM;
ifindex2mod_req.mpls_platform = local_platform;
mpls_ifindex2module(&ifindex2mod_req,&ifindex2mod_ack,MPLS_INTERFACE);
if(ifindex2mod_ack.ack == MPLS_SUCCESS)
{
lspCB->downAtmLabel.module = ifindex2mod_ack.mod;
lspCB->downAtmLabel.port = ifindex2mod_ack.port;
}
else
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest 2 ERR get Down ATM Module & port\n");
MPLS_ERR_LOG("ERR get UP ATM Module & port");
/* should release up atm label */
MPLS_FEC_LSPCB_DELETE(fecEntry,lspCB);
return;
}
#endif
MPLS_INSERT_INTO_UP_LSP_LIST(upsession->lsp_up_cb_list,lspCB,lspCB);
MPLS_INSERT_INTO_DOWN_LSP_LIST(downsession->lsp_down_cb_list,lspCB,lspCB);
lspCB->status = IDLE;
lspCB->subStatus = IDLE;
rec_lblreq_tlvpro(upsession,lblReqMsg,fecEntry,lspCB,LDP_HOP_LSP);
if(!(lspCB->waitflag & 0x1))
LspCBFsm(upsession,MPLS_LBLREQ_MSGTYPE, \
lblReqMsg,LDP_HOP_LSP,fecEntry,lspCB);
return;
}
else
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest 2,creat lspcb fail\n");
}
}
MPLS_LSPCB_CREATE(fecEntry,lspCB);
if(lspCB)
{
lspCB->lspIndex = MPLS_GET_LSP_INDEX;
lspCB->nodeType = MPLS_NODE_EGRESS;
lspCB->lspType = LDP_HOP_LSP;
lspCB->upSessionIndex = upsession->index;
lspCB->upifIndex = upsession->ifIndex;
lspCB->upPeerLdpid.lsrAddress = upsession->peerLdpId.lsrAddress;
lspCB->upPeerLdpid.labelSpace = upsession->peerLdpId.labelSpace;
ifindex2mod_req.ifIndex = lspCB->upifIndex;
ifindex2mod_req.mpls_protocol_type = MPLS_LABEL_SWITCH_PROTOCOL_ATM;
ifindex2mod_req.mpls_platform = local_platform;
mpls_ifindex2module(&ifindex2mod_req,&ifindex2mod_ack,MPLS_INTERFACE);
if(ifindex2mod_ack.ack == MPLS_SUCCESS)
{
lspCB->upAtmLabel.module = ifindex2mod_ack.mod;
lspCB->upAtmLabel.port = ifindex2mod_ack.port;
}
else
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest 3 ERR get UP ATM Module & port\n");
MPLS_ERR_LOG("ERR get UP ATM Module & port");
MPLS_FEC_LSPCB_DELETE(fecEntry,lspCB);
return;
}
MPLS_INSERT_INTO_UP_LSP_LIST(upsession->lsp_up_cb_list,lspCB,lspCB);
/*
(lspCB)->up_lsp_session_list.next = MPLS_NULL;
(lspCB)->up_lsp_session_list.prev = (upsession->lsp_up_cb_list).last;
if((lspCB)->up_lsp_session_list.prev != NULL)
(lspCB)->up_lsp_session_list.prev->up_lsp_session_list.next = (lspCB);
(upsession->lsp_up_cb_list).last = (lspCB);
if((upsession->lsp_up_cb_list).first == NULL)
(upsession->lsp_up_cb_list).first = (lspCB);
*/
lspCB->status = IDLE;
lspCB->subStatus = IDLE;
rec_lblreq_tlvpro(upsession,lblReqMsg,fecEntry,lspCB,LDP_HOP_LSP);
if(!(lspCB->waitflag & 0x1))
LspCBFsm(upsession,MPLS_LBLREQ_MSGTYPE, \
lblReqMsg,LDP_HOP_LSP,fecEntry,lspCB);
}
else
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"FuncLblRequest 3,creat lspcb fail\n");
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -