isis_receive:收包流程

代码如下

int
isis_receive (struct thread *thread)
{
  struct isis_circuit *circuit;
  u_char ssnpa[ETH_ALEN];
  int retval;

  /*
   * Get the circuit 
   */
  circuit = THREAD_ARG (thread);
  assert (circuit);

  if (!circuit->area)
    return ISIS_OK;

  if (circuit->rcv_stream == NULL)
    circuit->rcv_stream = stream_new (ISO_MTU (circuit));
  else
    stream_reset (circuit->rcv_stream);

  retval = circuit->rx (circuit, ssnpa);
  circuit->t_read = NULL;

  if (retval == ISIS_OK)
    retval = isis_handle_pdu (circuit, ssnpa);

  /* 
   * prepare for next packet. 
   */
  THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
		  circuit->fd);

  return retval;
}

主要流程:

1 收包 rx,调用注册的处理函数, 例如isis*_receive_*_bcast/p2p

2 处理报文 handle

3 处理下一个 READ_ON

处理报文的逻辑如下,

static int
isis_handle_pdu (struct isis_circuit *circuit, u_char * ssnpa)
{
  switch (hdr->pdu_type)
    {
    case L1_LAN_HELLO:
      retval = process_lan_hello (ISIS_LEVEL1, circuit, ssnpa);
      break;
    case L2_LAN_HELLO:
      retval = process_lan_hello (ISIS_LEVEL2, circuit, ssnpa);
      break;
    case P2P_HELLO:
      retval = process_p2p_hello (circuit);
      break;
}

调用关系

(gdb) bt
#0  isis_handle_pdu (circuit=0x7ffff427c8c8, ssnpa=0x7ffff4582b60 "") at isis_pdu.c:1654
#1  0x00007ffff42ce5a2 in isis_receive (thread=0x7ffff4582cc0) at isis_pdu.c:1796
#2  0x00007ffff42f24ef in thread_call (thread=0x7ffff4582cc0) at thread.c:1177
#3  0x00007ffff42bda3d in main (argc=5, argv=0x662700, envp=0x6460b0) at isis_main.c:353
#4  0x00007ffff7a0708f in ns3::DceManager::DoStartProcess (context=0x677f40) at ../model/dce-manager.cc:283
#5  0x00007ffff7a907fc in ns3::TaskManager::Trampoline (context=0x662900) at ../model/task-manager.cc:274
#6  0x00007ffff7a8c7d7 in ns3::PthreadFiberManager::Run (arg=0x678230) at ../model/pthread-fiber-manager.cc:402
#7  0x000000318b2079d1 in start_thread () from /lib64/libpthread.so.0
#8  0x000000318a6e88fd in clone () from /lib64/libc.so.6
(gdb) 


主要结论:

对于PPP网络,并不追究SNPA的值。




你可能感兴趣的:(isis_receive:收包流程)