]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
OSPF: Fix minor issue in TTL check
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Mon, 9 Oct 2017 19:11:53 +0000 (21:11 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 10 Oct 2017 14:10:02 +0000 (16:10 +0200)
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.

proto/ospf/packet.c

index b84780d340c476e036cc3a54a7c73bc9e0cf370c..7f9f3b39c993c77ed65a1ac0aa5c2520ad4974c9 100644 (file)
@@ -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");