From d8c7d9e8846f025e42227c64e992a3a52ca7dfb4 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sun, 20 Feb 2005 04:27:56 +0000 Subject: [PATCH] Since now I can also use 'dead interval', not just 'dead counter'. --- doc/bird.conf.example | 1 + doc/bird.sgml | 7 +++++++ proto/ospf/config.Y | 4 ++++ proto/ospf/hello.c | 4 ++-- proto/ospf/iface.c | 4 ++-- proto/ospf/neighbor.c | 2 +- proto/ospf/ospf.c | 2 +- proto/ospf/ospf.h | 3 ++- 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/doc/bird.conf.example b/doc/bird.conf.example index 704abef0..8260c028 100644 --- a/doc/bird.conf.example +++ b/doc/bird.conf.example @@ -122,6 +122,7 @@ protocol static { # interface "arc0" { # type nonbroadcast; # poll 14; +# dead 75; # neighbors { # 10.1.1.2 eligible; # 10.1.1.4; diff --git a/doc/bird.sgml b/doc/bird.sgml index 79d7e964..3c233095 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1024,6 +1024,7 @@ protocol ospf <name> { priority <num>; wait <num>; dead count <num>; + dead <num>; type [broadcast|nonbroadcast|pointopoint]; strict nonbroadcast <switch>; authentication [none|simple]; @@ -1048,6 +1049,7 @@ protocol ospf <name> { retransmit <num>; wait <num>; dead count <num>; + dead <num>; authentication [none|simple]; password "<text>"; }; @@ -1126,6 +1128,11 @@ protocol ospf <name> { When the router does not receive any messages from a neighbor in dead num + When the router does not receive any messages from a neighbor in + type broadcast BIRD detects a type of a connected network automatically, but sometimes it's convenient to force use of a different type manually. diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 5f9f12ce..f14f1a4c 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -96,6 +96,7 @@ ospf_vlink_item: | RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if ($2<=0) cf_error("Retransmit int must be greater than zero"); } | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); } | WAIT expr { OSPF_PATT->waitint = $2 ; } + | DEAD expr { OSPF_PATT->dead = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); } | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); } | AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE ; } | AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE ; } @@ -115,6 +116,7 @@ ospf_vlink_start: VIRTUAL LINK idval OSPF_PATT->inftransdelay = INFTRANSDELAY_D; OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D; OSPF_PATT->deadc = DEADC_D; + OSPF_PATT->dead = 0; OSPF_PATT->type = OSPF_IT_VLINK; init_list(&OSPF_PATT->nbma_list); OSPF_PATT->autype = OSPF_AUTH_NONE; @@ -129,6 +131,7 @@ ospf_iface_item: | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); } | PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255"); } | WAIT expr { OSPF_PATT->waitint = $2 ; } + | DEAD expr { OSPF_PATT->dead = $2 ; if ($2<=1) cf_error("Dead interval must be greater than one"); } | DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if ($3<=1) cf_error("Dead count must be greater than one"); } | TYPE BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; } | TYPE NONBROADCAST { OSPF_PATT->type = OSPF_IT_NBMA ; } @@ -210,6 +213,7 @@ ospf_iface_start: OSPF_PATT->priority = PRIORITY_D; OSPF_PATT->waitint = WAIT_DMH*HELLOINT_D; OSPF_PATT->deadc = DEADC_D; + OSPF_PATT->dead = 0; OSPF_PATT->type = OSPF_IT_UNDEF; OSPF_PATT->strictnbma = 0; OSPF_PATT->stub = 0; diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index 5711ac5f..ce87431b 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -38,7 +38,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps, return; } - if (ntohl(ps->deadint) != ifa->helloint * ifa->deadc) + if (ntohl(ps->deadint) != ifa->dead) { log(L_ERR "%s%I%sdead interval mismatch (%d).", beg, faddr, rec, ntohl(ps->deadint)); @@ -209,7 +209,7 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn) pkt->helloint = ntohs(ifa->helloint); pkt->options = ifa->oa->opt.byte; pkt->priority = ifa->priority; - pkt->deadint = htonl(ifa->deadc * ifa->helloint); + pkt->deadint = htonl(ifa->dead); pkt->dr = ifa->drip; ipa_hton(pkt->dr); pkt->bdr = ifa->bdrip; diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 68b6377d..cce7fafe 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -393,7 +393,7 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, ifa->pollint = ip->pollint; ifa->strictnbma = ip->strictnbma; ifa->waitint = ip->waitint; - ifa->deadc = ip->deadc; + ifa->dead = (ip->dead == 0) ? ip->deadc * ifa->helloint : ip->dead; ifa->stub = ip->stub; ifa->autype = ip->autype; ifa->passwords = ip->passwords; @@ -585,7 +585,7 @@ ospf_iface_info(struct ospf_iface *ifa) cli_msg(-1015, "\tPoll timer: %u", ifa->pollint); } cli_msg(-1015, "\tWait timer: %u", ifa->waitint); - cli_msg(-1015, "\tDead timer: %u", ifa->deadc * ifa->helloint); + cli_msg(-1015, "\tDead timer: %u", ifa->dead); cli_msg(-1015, "\tRetransmit timer: %u", ifa->rxmtint); if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA)) { diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index 59a98057..7696d45e 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -309,7 +309,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event) case NEIGHBOR_DOWN: neigh_chstate(n, NEIGHBOR_INIT); default: - tm_start(n->inactim, n->ifa->deadc * n->ifa->helloint); /* Restart inactivity timer */ + tm_start(n->inactim, n->ifa->dead); /* Restart inactivity timer */ break; } break; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index ce01a37b..e43c741b 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -721,7 +721,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) /* DEAD COUNT */ if (ip1->deadc != ip2->deadc) { - ifa->deadc = ip2->deadc; + ifa->dead = ip2->dead; OSPF_TRACE(D_EVENTS, "Changing dead count on interface %s from %d to %d", ifa->iface->name, ip1->deadc, ip2->deadc); diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 44ba10f0..79d1f4f7 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -138,7 +138,7 @@ struct ospf_iface u32 waitint; /* number of sec before changing state from wait */ u32 rxmtint; /* number of seconds between LSA retransmissions */ u32 pollint; /* Poll interval */ - u32 deadc; /* after "deadint" missing hellos is router dead */ + u32 dead; /* after "deadint" missing hellos is router dead */ u32 vid; /* Id of peer of virtual link */ ip_addr vip; /* IP of peer of virtual link */ struct ospf_area *voa; /* Area wich the vlink goes through */ @@ -548,6 +548,7 @@ struct ospf_iface_patt u32 priority; u32 waitint; u32 deadc; + u32 dead; u32 type; u32 autype; u32 strictnbma;