Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BIRD Internet Routing Daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
89d6782d
Commit
89d6782d
authored
Jun 03, 2000
by
Ondřej Filip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interface {} added.
parent
b36a0a79
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
21 deletions
+71
-21
proto/ospf/config.Y
proto/ospf/config.Y
+39
-1
proto/ospf/dbdes.c
proto/ospf/dbdes.c
+2
-2
proto/ospf/hello.c
proto/ospf/hello.c
+1
-1
proto/ospf/lsack.c
proto/ospf/lsack.c
+3
-3
proto/ospf/lsreq.c
proto/ospf/lsreq.c
+1
-1
proto/ospf/lsupd.c
proto/ospf/lsupd.c
+3
-3
proto/ospf/ospf.c
proto/ospf/ospf.c
+4
-0
proto/ospf/ospf.h
proto/ospf/ospf.h
+13
-5
proto/ospf/packet.c
proto/ospf/packet.c
+5
-5
No files found.
proto/ospf/config.Y
View file @
89d6782d
...
...
@@ -14,11 +14,14 @@ CF_DEFINES
#define OSPF_CFG ((struct ospf_config *) this_proto)
static struct ospf_area_config *this_area;
static struct iface_patt *this_ipatt;
#define OSPF_PATT ((struct ospf_iface_patt *) this_ipatt)
CF_DECLS
CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG)
CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK)
CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
CF_KEYWORDS(HELLO)
%type <t> opttext
...
...
@@ -46,6 +49,7 @@ ospf_area_start: AREA idval '{' {
this_area->areaid = $2;
this_area->tick = DISPTICK;
this_area->stub = 0;
init_list(&this_area->patt_list);
}
;
...
...
@@ -56,8 +60,42 @@ ospf_area: ospf_area_start
ospf_area_item:
| STUB bool ';' { this_area->stub = $2 ; }
| TICK NUM ';' { this_area->tick = $2 ; }
| ospf_iface_list
;
ospf_iface_item:
| COST NUM { OSPF_PATT->cost = $2 ; }
| HELLO NUM { OSPF_PATT->helloint = $2 ; }
| RETRANSMIT NUM { OSPF_PATT->rxmtint = $2 ; }
;
ospf_iface_opts:
'{'
| ospf_iface_opts ospf_iface_item ';'
;
ospf_iface_opt_list: /* EMPTY */ | ospf_iface_opts '}'
;
ospf_iface_start:
{
this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
add_tail(&this_area->patt_list, NODE this_ipatt);
OSPF_PATT->cost=10;
OSPF_PATT->helloint=10;
OSPF_PATT->rxmtint=5;
}
;
ospf_iface:
ospf_iface_start iface_patt ospf_iface_opt_list
;
ospf_iface_list:
INTERFACE ospf_iface
| ospf_iface_list ',' ospf_iface
;
opttext:
TEXT
| /* empty */ { $$ = NULL; }
...
...
proto/ospf/dbdes.c
View file @
89d6782d
...
...
@@ -27,7 +27,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
n
->
myimms
.
bit
.
i
=
1
;
pkt
=
(
struct
ospf_dbdes_packet
*
)(
ifa
->
ip_sk
->
tbuf
);
op
=
(
struct
ospf_packet
*
)
pkt
;
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
DBDES
);
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
DBDES
_P
);
pkt
->
iface_mtu
=
htons
(
ifa
->
iface
->
mtu
);
/*FIXME NOT for VLINK! */
pkt
->
options
=
ifa
->
options
;
pkt
->
imms
=
n
->
myimms
;
...
...
@@ -52,7 +52,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
pkt
=
n
->
ldbdes
;
op
=
(
struct
ospf_packet
*
)
pkt
;
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
DBDES
);
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
DBDES
_P
);
pkt
->
iface_mtu
=
htons
(
ifa
->
iface
->
mtu
);
pkt
->
options
=
ifa
->
options
;
pkt
->
ddseq
=
htonl
(
n
->
dds
);
...
...
proto/ospf/hello.c
View file @
89d6782d
...
...
@@ -198,7 +198,7 @@ hello_timer_hook(timer *timer)
pkt
=
(
struct
ospf_hello_packet
*
)(
ifa
->
hello_sk
->
tbuf
);
op
=
(
struct
ospf_packet
*
)
pkt
;
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
HELLO
);
fill_ospf_pkt_hdr
(
ifa
,
pkt
,
HELLO
_P
);
pkt
->
netmask
=
ipa_mkmask
(
ifa
->
iface
->
addr
->
pxlen
);
ipa_hton
(
pkt
->
netmask
);
...
...
proto/ospf/lsack.c
View file @
89d6782d
...
...
@@ -24,7 +24,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
pk
=
(
struct
ospf_lsack_packet
*
)
sk
->
tbuf
;
op
=
(
struct
ospf_packet
*
)
sk
->
tbuf
;
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
_P
);
memcpy
(
pk
+
1
,
h
,
sizeof
(
struct
ospf_lsa_header
));
len
=
sizeof
(
struct
ospf_lsack_packet
)
+
sizeof
(
struct
ospf_lsa_header
);
...
...
@@ -79,7 +79,7 @@ ospf_lsack_delay_tx(struct ospf_neighbor *n)
pk
=
(
struct
ospf_lsack_packet
*
)
sk
->
tbuf
;
op
=
(
struct
ospf_packet
*
)
sk
->
tbuf
;
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
_P
);
h
=
(
struct
ospf_lsa_header
*
)(
pk
+
1
);
while
(
!
EMPTY_LIST
(
n
->
ackl
))
...
...
@@ -116,7 +116,7 @@ ospf_lsack_delay_tx(struct ospf_neighbor *n)
sk_send_to_agt
(
sk
,
len
,
ifa
,
NEIGHBOR_EXCHANGE
);
}
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSACK
_P
);
i
=
0
;
}
}
...
...
proto/ospf/lsreq.c
View file @
89d6782d
...
...
@@ -23,7 +23,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
pk
=
(
struct
ospf_lsreq_packet
*
)
n
->
ifa
->
ip_sk
->
tbuf
;
op
=
(
struct
ospf_packet
*
)
n
->
ifa
->
ip_sk
->
tbuf
;
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSREQ
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSREQ
_P
);
sn
=
SHEAD
(
n
->
lsrql
);
if
(
EMPTY_SLIST
(
n
->
lsrql
))
...
...
proto/ospf/lsupd.c
View file @
89d6782d
...
...
@@ -117,7 +117,7 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
pk
=
(
struct
ospf_lsupd_packet
*
)
sk
->
tbuf
;
op
=
(
struct
ospf_packet
*
)
sk
->
tbuf
;
fill_ospf_pkt_hdr
(
ifa
,
pk
,
LSUPD
);
fill_ospf_pkt_hdr
(
ifa
,
pk
,
LSUPD
_P
);
pk
->
lsano
=
htonl
(
1
);
if
(
hn
!=
NULL
)
{
...
...
@@ -183,7 +183,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
DBG
(
"LSupd: 1st packet
\n
"
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSUPD
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSUPD
_P
);
len
=
SIPH
+
sizeof
(
struct
ospf_lsupd_packet
);
lsano
=
0
;
pktpos
=
(
pk
+
1
);
...
...
@@ -205,7 +205,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
debug
(
"%s: LS upd sent to %I (%d LSAs)
\n
"
,
p
->
name
,
n
->
ip
,
lsano
);
DBG
(
"LSupd: next packet
\n
"
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSUPD
);
fill_ospf_pkt_hdr
(
n
->
ifa
,
pk
,
LSUPD
_P
);
len
=
SIPH
+
sizeof
(
struct
ospf_lsupd_packet
);
lsano
=
0
;
pktpos
=
(
pk
+
1
);
...
...
proto/ospf/ospf.c
View file @
89d6782d
...
...
@@ -63,6 +63,7 @@ ospf_init(struct proto_config *c)
struct
proto_ospf
*
po
=
(
struct
proto_ospf
*
)
p
;
struct
ospf_config
*
oc
=
(
struct
ospf_config
*
)
c
;
struct
ospf_area_config
*
ac
;
struct
ospf_iface_patt
*
patt
;
debug
(
"OSPF: Init requested.
\n
"
);
p
->
import_control
=
ospf_import_control
;
...
...
@@ -77,6 +78,9 @@ ospf_init(struct proto_config *c)
WALK_LIST
(
ac
,
oc
->
area_list
)
{
debug
(
"OSPF: area: %I, stub=%u tick=%u
\n
"
,
ac
->
areaid
,
ac
->
stub
,
ac
->
tick
);
WALK_LIST
(
patt
,
ac
->
patt_list
)
debug
(
"Patt cost=%d hello=%d ret=%d
\n
"
,
patt
->
cost
,
patt
->
helloint
,
patt
->
rxmtint
);
}
return
p
;
...
...
proto/ospf/ospf.h
View file @
89d6782d
...
...
@@ -56,6 +56,7 @@ struct ospf_area_config {
u32
areaid
;
int
stub
;
unsigned
tick
;
list
patt_list
;
};
struct
ospf_iface
{
...
...
@@ -117,11 +118,11 @@ struct ospf_iface {
struct
ospf_packet
{
u8
version
;
u8
type
;
#define HELLO 1
/* Hello */
#define DBDES 2
/* Database description */
#define LSREQ 3
/* Link state request */
#define LSUPD 4
/* Link state update */
#define LSACK 5
/* Link state acknowledgement */
#define HELLO
_P
1
/* Hello */
#define DBDES
_P
2
/* Database description */
#define LSREQ
_P
3
/* Link state request */
#define LSUPD
_P
4
/* Link state update */
#define LSACK
_P
5
/* Link state acknowledgement */
u16
length
;
u32
routerid
;
u32
areaid
;
...
...
@@ -356,6 +357,13 @@ struct proto_ospf {
int
rfc1583
;
};
struct
ospf_iface_patt
{
struct
iface_patt
i
;
int
cost
;
int
helloint
;
int
rxmtint
;
};
static
int
ospf_start
(
struct
proto
*
p
);
static
void
ospf_dump
(
struct
proto
*
p
);
static
struct
proto
*
ospf_init
(
struct
proto_config
*
c
);
...
...
proto/ospf/packet.c
View file @
89d6782d
...
...
@@ -127,23 +127,23 @@ ospf_rx_hook(sock *sk, int size)
switch
(
ps
->
type
)
{
case
HELLO
:
case
HELLO
_P
:
DBG
(
"%s: Hello received.
\n
"
,
p
->
name
);
ospf_hello_rx
((
struct
ospf_hello_packet
*
)
ps
,
p
,
ifa
,
size
,
sk
->
faddr
);
break
;
case
DBDES
:
case
DBDES
_P
:
DBG
(
"%s: Database description received.
\n
"
,
p
->
name
);
ospf_dbdes_rx
((
struct
ospf_dbdes_packet
*
)
ps
,
p
,
ifa
,
size
);
break
;
case
LSREQ
:
case
LSREQ
_P
:
DBG
(
"%s: Link state request received.
\n
"
,
p
->
name
);
ospf_lsreq_rx
((
struct
ospf_lsreq_packet
*
)
ps
,
p
,
ifa
,
size
);
break
;
case
LSUPD
:
case
LSUPD
_P
:
DBG
(
"%s: Link state update received.
\n
"
,
p
->
name
);
ospf_lsupd_rx
((
struct
ospf_lsupd_packet
*
)
ps
,
p
,
ifa
,
size
);
break
;
case
LSACK
:
case
LSACK
_P
:
DBG
(
"%s: Link state ack received.
\n
"
,
p
->
name
);
ospf_lsack_rx
((
struct
ospf_lsack_packet
*
)
ps
,
p
,
ifa
,
size
);
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment