static void bgp_initiate(struct bgp_proto *p) { int rv = bgp_open(p); if (rv < 0) return; if (p->startup_delay) { BGP_TRACE(D_EVENTS, "Startup delayed by %d seconds", p->startup_delay); bgp_start_timer(p->startup_timer, p->startup_delay); } else bgp_startup(p); }
/* BGP massage header */ void bgp_msg(struct pktinfo *pktinfo) { int x; struct pktinfo n_hdr; const u_char *pkt = pktinfo->pkt; bpf_u_int32 len = pktinfo->len; struct bgp_hdr *bgp_hdr = (struct bgp_hdr *)pkt; u_int16_t bgp_len = htons(bgp_hdr->length); n_hdr.len = len; n_hdr.pkt = pkt; if (vflag) { (void)printf("BGP message marker "); for (x = 0;x < 16; x++) (void)printf("%x",bgp_hdr->marker[x]); (void)printf("\n"); (void)printf(" length %d bytes\n", bgp_len); if (bgp_hdr->type > 0 && bgp_hdr->type < 5) (void)printf(" type %d \"%s\"\n", bgp_hdr->type, bgp_types[bgp_hdr->type]); else (void)printf(" type %d \"Invalid type\"\n", bgp_hdr->type); } switch(bgp_hdr->type) { case BGP_OPEN: bgp_open(&n_hdr, bgp_len); break; case BGP_UPDATE: bgp_update(&n_hdr, bgp_len); break; case BGP_NOTIFICATION: bgp_notify(&n_hdr, bgp_len); break; case BGP_KEEPALIVE: bgp_keepalive(&n_hdr, bgp_len); break; default: (void)printf("\"ERROR BGP Invalid Type: %d\"\n",bgp_hdr->type); (void)printf("\n"); break; } } /* end of bgp_msg */
static void bgp_initiate(struct bgp_proto *p) { int rv = bgp_open(p); if (rv < 0) return; if (p->cf->bfd) bgp_update_bfd(p, p->cf->bfd); if (p->startup_delay) { p->start_state = BSS_DELAY; BGP_TRACE(D_EVENTS, "Startup delayed by %d seconds", p->startup_delay); bgp_start_timer(p->startup_timer, p->startup_delay); } else bgp_startup(p); }