summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-10-09 21:11:53 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-10-10 16:10:02 +0200
commit2549300b54f262932dd14e6d465926627e6dc8ef (patch)
tree6eba45ba35223c65c728dc134b1d416fec609f4d
parentf097f7659c7ff226a53c51673158e32fb69a6d21 (diff)
OSPF: Fix minor issue in TTL check
The TTL check must be done after instance ID dispatch to avoid warnings when a physical iface is shared by multiple instances and some use TTL security and some not.
-rw-r--r--proto/ospf/packet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index b84780d3..7f9f3b39 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -270,9 +270,6 @@ ospf_rx_hook(sock *sk, uint len)
if (pkt == NULL)
DROP("bad IP header", len);
- if (ifa->check_ttl && (sk->rcv_ttl < 255))
- DROP("wrong TTL", sk->rcv_ttl);
-
if (len < sizeof(struct ospf_packet))
DROP("too short", len);
@@ -379,6 +376,10 @@ found:
if (ipa_equal(sk->laddr, ifa->des_routers) && (ifa->sk_dr == 0))
return 1;
+ /* TTL check must be done after instance dispatch */
+ if (ifa->check_ttl && (sk->rcv_ttl < 255))
+ DROP("wrong TTL", sk->rcv_ttl);
+
if (rid == p->router_id)
DROP1("my own router ID");