ldp hello报文接收的处理流程

(gdb) b ldp_state_machine.c:363


收到的消息是

MPLS_HELLO_MSGTYPE

收到后的处理如下,


        ldp_mesg_hello_get_targeted(&mesg, &targeted);
这时targeted =0 [参考1]

            entity = ldp_if_get_entity(iff);

这时entity=0 FIXME

          /* No entity! No choice but to ignore this packet */

后面这句话说明entity不能为0,但为什么就是0了呢?

这部份程序如下,

          ldp_if *iff = NULL;
          if ((iff = ldp_global_find_if_handle(g, from->if_handle))) {
            entity = ldp_if_get_entity(iff);
            oper_state = iff->oper_state;
          }

此时entity之所以是0,是因为iff为0,其为0,是因为find_if_handle()为0.

find是从g里找到合适的handle,为什么找不到合适的handle?

按照nazi选择卫队的办法,上查到1800年。

#0  ldp_global_find_if_handle (g=0x7ffff06f3dc8, handle=0x7ffff7641520 <ns3::Singleton<ns3::IidManager>::Get()::object>) at ldp_global.c:1064
#1  0x00007ffff07746ed in ldp_buf_process (g=0x7ffff06f3dc8, socket=0x7ffff06f5418, buf=0x7ffff0a1e830, extra=0x0, event=LDP_EVENT_HELLO, from=0x7ffff0a208a0,
    more=0x7ffff0a1e82c) at ldp_state_machine.c:383
#2  0x00007ffff0773384 in ldp_event (handle=0x7ffff06f3dc8, socket=0x7ffff06f5418, extra=0x0, event=LDP_EVENT_UDP_DATA) at ldp_state_machine.c:101

上查以后,发现from来路不明啊。这块代码需要修改。



参考

1 mpls hello报文格式参考

http://wenku.baidu.com/link?url=JYNenx0H870MEs9qjMylc50ffUd7X3N_M3xuxJ-iROlJYFyRRtDOb4GHZgaldP3v4IvYBvjCBVl2NIKLQCOZkBwHKJw5ItLYYUg9zgHqgfu

这里CHP(common hello parameter)下有1位(T bit)叫targeted.

T, Targeted Hello
A value of 1 specifies that this Hello is a Targeted Hello. A
value of 0 specifies that this Hello is a Link Hello.

2 rfc3036 LDP协议规范



你可能感兴趣的:(ldp hello报文接收的处理流程)