]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Listening on AllDRouters for DR and BACKUP added.
authorOndrej Filip <feela@network.cz>
Mon, 17 Apr 2000 21:10:40 +0000 (21:10 +0000)
committerOndrej Filip <feela@network.cz>
Mon, 17 Apr 2000 21:10:40 +0000 (21:10 +0000)
proto/ospf/iface.c
proto/ospf/ospf.h

index 2d53cf5ffe2b348ad57f66f994814744c8ecee48..8ba198f11369346a4623ac6b26ad125dcd19a7ee 100644 (file)
@@ -17,6 +17,37 @@ iface_chstate(struct ospf_iface *ifa, u8 state)
   debug("%s: Changing state of iface: %s from %u into %u.\n",
     p->name, ifa->iface->name, ifa->state, state);
   ifa->state=state;
+  if(ifa->iface->flags & IF_MULTICAST)
+  {
+    if((state==OSPF_IS_BACKUP)||(state==OSPF_IS_DR))
+    {
+      if(ifa->dr_sk==NULL)
+      {
+        ifa->dr_sk=sk_new(p->pool);
+       ifa->dr_sk->type=SK_IP_MC;
+       ifa->dr_sk->saddr=AllDRouters;
+       ifa->dr_sk->daddr=AllDRouters;
+       ifa->dr_sk->tos=IP_PREC_INTERNET_CONTROL;
+       ifa->dr_sk->ttl=1;
+       ifa->dr_sk->rx_hook=ospf_rx_hook;
+       ifa->dr_sk->tx_hook=ospf_tx_hook;
+       ifa->dr_sk->err_hook=ospf_err_hook;
+       ifa->dr_sk->iface=ifa->iface;
+       ifa->dr_sk->rbsize=ifa->iface->mtu;
+       ifa->dr_sk->tbsize=ifa->iface->mtu;
+       ifa->dr_sk->data=(void *)ifa;
+       sk_open(ifa->dr_sk);
+      }
+    }
+    else
+    {
+      if(ifa->dr_sk!=NULL)
+      {
+        sk_close(ifa->dr_sk);
+       rfree(ifa->dr_sk);
+      }
+    }
+  }
 }
 
 void
@@ -101,7 +132,7 @@ ospf_open_mc_socket(struct ospf_iface *ifa)
   p=(struct proto *)(ifa->proto);
 
 
-  /* FIXME: No NBMA networks now */
+  /* FIXME: No NBMA and PTP networks */
 
   if(ifa->iface->flags & IF_MULTICAST)
   {
@@ -287,6 +318,7 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface)
        log("%s: Ignoring this interface\n", p->name);
        return;
       }
+      ifa->dr_sk=NULL;
 
       if((ifa->ip_sk=ospf_open_ip_socket(ifa))==NULL)
       {
index e3a42f5f8be68d58f4c72439a1cf62a85afea0a5..6bcaef3c06b421107c9f8813c254fca96f269530 100644 (file)
@@ -56,6 +56,7 @@ struct ospf_iface {
   struct ospf_area *oa;
   u32 an;              /* Area number */
   sock *hello_sk;      /* Hello socket */
+  sock *dr_sk;         /* For states DR or BACKUP */
   sock *ip_sk;         /* IP socket (for DD ...) */
   list neigh_list;     /* List of neigbours */
   u16 cost;            /* Cost of iface */