0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Better checking of configuration.

This commit is contained in:
Ondrej Filip 2004-06-09 12:39:49 +00:00
parent b7e9c74cba
commit 7df86c25fc
2 changed files with 22 additions and 23 deletions

View File

@ -81,14 +81,14 @@ ospf_area_item:
; ;
ospf_iface_item: ospf_iface_item:
COST expr { OSPF_PATT->cost = $2 ; if($2<=0) cf_error("Cost must be greater than zero"); } COST expr { OSPF_PATT->cost = $2 ; if (($2<=0) || ($2>65535)) cf_error("Cost must be in range 1-65535"); }
| HELLO expr { OSPF_PATT->helloint = $2 ; if($2<=0) cf_error("Hello int must be greater than zero"); } | HELLO expr { OSPF_PATT->helloint = $2 ; if (($2<=0) || ($2>65535)) cf_error("Hello interval must be in range 1-65535"); }
| POLL expr { OSPF_PATT->pollint = $2 ; if($2<=0) cf_error("Poll int must be greater than zero"); } | POLL expr { OSPF_PATT->pollint = $2 ; if ($2<=0) cf_error("Poll int must be greater than zero"); }
| RETRANSMIT expr { OSPF_PATT->rxmtint = $2 ; if($2<=0) cf_error("Retransmit int must be greater than zero"); } | 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) cf_error("Transmit delay 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"); }
| PRIORITY expr { OSPF_PATT->priority = $2 ; } | 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 ; } | WAIT expr { OSPF_PATT->waitint = $2 ; }
| DEAD COUNT expr { OSPF_PATT->deadc = $3 ; if($3<=1) cf_error("Dead count 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 BROADCAST { OSPF_PATT->type = OSPF_IT_BCAST ; }
| TYPE NONBROADCAST { OSPF_PATT->type = OSPF_IT_NBMA ; } | TYPE NONBROADCAST { OSPF_PATT->type = OSPF_IT_NBMA ; }
| TYPE POINTOPOINT { OSPF_PATT->type = OSPF_IT_PTP ; } | TYPE POINTOPOINT { OSPF_PATT->type = OSPF_IT_PTP ; }
@ -98,7 +98,6 @@ ospf_iface_item:
| AUTHENTICATION NONE { OSPF_PATT->autype=AU_NONE ; } | AUTHENTICATION NONE { OSPF_PATT->autype=AU_NONE ; }
| AUTHENTICATION SIMPLE { OSPF_PATT->autype=AU_SIMPLE ; } | AUTHENTICATION SIMPLE { OSPF_PATT->autype=AU_SIMPLE ; }
| PASSWORD TEXT { memcpy(OSPF_PATT->password, $2, 8); } | PASSWORD TEXT { memcpy(OSPF_PATT->password, $2, 8); }
|
; ;
pref_list: pref_list:

View File

@ -104,14 +104,14 @@ struct ospf_iface
sock *ip_sk; /* IP socket (for DD ...) */ sock *ip_sk; /* IP socket (for DD ...) */
list neigh_list; /* List of neigbours */ list neigh_list; /* List of neigbours */
u16 cost; /* Cost of iface */ u16 cost; /* Cost of iface */
u16 rxmtint; /* number of seconds between LSA retransmissions */
u16 inftransdelay; /* The estimated number of seconds it takes to u16 inftransdelay; /* The estimated number of seconds it takes to
transmit a Link State Update Packet over this transmit a Link State Update Packet over this
interface. LSAs contained in the update */ interface. LSAs contained in the update */
u8 priority; /* A router priority for DR election */ u8 priority; /* A router priority for DR election */
u16 helloint; /* number of seconds between hello sending */ u16 helloint; /* number of seconds between hello sending */
u16 waitint; /* number of sec before changing state from wait */ u32 waitint; /* number of sec before changing state from wait */
u16 pollint; /* Poll interval */ u32 rxmtint; /* number of seconds between LSA retransmissions */
u32 pollint; /* Poll interval */
u32 deadc; /* after "deadint" missing hellos is router dead */ u32 deadc; /* after "deadint" missing hellos is router dead */
u16 autype; u16 autype;
u8 aukey[8]; u8 aukey[8];
@ -453,18 +453,18 @@ struct proto_ospf
struct ospf_iface_patt struct ospf_iface_patt
{ {
struct iface_patt i; struct iface_patt i;
int cost; u32 cost;
int helloint; u32 helloint;
int rxmtint; u32 rxmtint;
int pollint; u32 pollint;
int inftransdelay; u32 inftransdelay;
int priority; u32 priority;
int waitint; u32 waitint;
int deadc; u32 deadc;
int type; u32 type;
int autype; u32 autype;
int strictnbma; u32 strictnbma;
int stub; u32 stub;
/* must be in network byte order */ /* must be in network byte order */
#define AU_NONE htons(0) #define AU_NONE htons(0)
#define AU_SIMPLE htons(1) #define AU_SIMPLE htons(1)