Passion/Network

Zebra OSPFD 분석

sunshout 2007. 7. 30. 11:51
공개 라우팅 소프트웨어 인 zebra 를 이용하여 여러가지 라우팅 테스트를 할 수 있다.

그 중에서도 OSPF를 분석하여 본다.


OSPF LSDB 구조

struct ospf_lsdb (Language : c)

/* OSPF LSDB structure. */
struct ospf_lsdb
{
  struct
  {
    unsigned long count;
    unsigned long count_self;
    struct route_table *db;
  } type[OSPF_MAX_LSA];
  unsigned long total;
#define MONITOR_LSDB_CHANGE 1 /* XXX */
#ifdef MONITOR_LSDB_CHANGE
  /* Hooks for callback functions to catch every add/del event. */
  int (* new_lsa_hook)(struct ospf_lsa *);
  int (* del_lsa_hook)(struct ospf_lsa *);
#endif /* MONITOR_LSDB_CHANGE */
};

Short Path First 알고리즘 분석
파일명: ospf_spf.h
구성: vertex, vertex_nexthop

struct vertex (Language : c)
struct vertex
{
  u_char flags;
  u_char type;
  struct in_addr id;
  struct lsa_header *lsa;
  u_int32_t distance;
  list child;
  list nexthop;
};


struct vertex_nexthop (Language : c)
struct vertex_nexthop
{
  struct ospf_interface *oi;
  struct in_addr router;
  struct vertex *parent;
};