Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
8cc598a5
Commit
8cc598a5
authored
May 24, 2009
by
Ondřej Zajíček
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore Hello packets from different IP network (than primary).
parent
050ceb86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
proto/ospf/hello.c
proto/ospf/hello.c
+27
-7
proto/ospf/packet.c
proto/ospf/packet.c
+3
-0
No files found.
proto/ospf/hello.c
View file @
8cc598a5
...
...
@@ -24,16 +24,36 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
mask
=
ps
->
netmask
;
ipa_ntoh
(
mask
);
if
(((
ifa
->
type
!=
OSPF_IT_VLINK
)
&&
(
ifa
->
type
!=
OSPF_IT_PTP
))
&&
((
unsigned
)
ipa_mklen
(
mask
)
!=
ifa
->
iface
->
addr
->
pxlen
))
{
log
(
L_ERR
"%s%I%sbad netmask %I."
,
beg
,
faddr
,
rec
,
mask
);
return
;
}
if
(
ifa
->
type
!=
OSPF_IT_VLINK
)
{
char
*
msg
=
L_WARN
"Received HELLO packet %s (%I) is inconsistent "
"with the primary address of interface %s."
;
if
((
ifa
->
type
!=
OSPF_IT_PTP
)
&&
!
ipa_equal
(
mask
,
ipa_mkmask
(
ifa
->
iface
->
addr
->
pxlen
)))
{
if
(
!
n
)
log
(
msg
,
"netmask"
,
mask
,
ifa
->
iface
->
name
);
return
;
}
/* This check is not specified in RFC 2328, but it is needed
* to handle the case when there is more IP networks on one
* physical network (which is not handled in RFC 2328).
* We allow OSPF on primary IP address only and ignore HELLO packets
* with secondary addresses (which are sent for example by Quagga.
*/
if
((
ifa
->
iface
->
addr
->
flags
&
IA_UNNUMBERED
)
?
!
ipa_equal
(
faddr
,
ifa
->
iface
->
addr
->
opposite
)
:
!
ipa_equal
(
ipa_and
(
faddr
,
mask
),
ifa
->
iface
->
addr
->
prefix
))
{
if
(
!
n
)
log
(
msg
,
"address"
,
faddr
,
ifa
->
iface
->
name
);
return
;
}
}
if
(
ntohs
(
ps
->
helloint
)
!=
ifa
->
helloint
)
{
log
(
L_
WARN
"%s%I%shello interval mismatch (%d)."
,
beg
,
faddr
,
rec
,
log
(
L_
ERR
"%s%I%shello interval mismatch (%d)."
,
beg
,
faddr
,
rec
,
ntohs
(
ps
->
helloint
));
return
;
}
...
...
proto/ospf/packet.c
View file @
8cc598a5
...
...
@@ -323,6 +323,9 @@ ospf_rx_hook(sock * sk, int size)
return
1
;
}
/* This is deviation from RFC 2328 - neighbours should be identified by
* IP address on broadcast and NBMA networks.
*/
n
=
find_neigh
(
ifa
,
ntohl
(((
struct
ospf_packet
*
)
ps
)
->
routerid
));
if
(
!
n
&&
(
ps
->
type
!=
HELLO_P
))
...
...
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