]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Change in ospf_iface. (My bad understanding of lists manipulation.)
authorOndrej Filip <feela@network.cz>
Tue, 13 Apr 1999 19:27:44 +0000 (19:27 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 13 Apr 1999 19:27:44 +0000 (19:27 +0000)
proto/ospf/config.Y
proto/ospf/ospf.c
proto/ospf/ospf.h

index 9840def055fbcfb61e678bb2862bf9434c19e72b..73dcd76eb96008516044ee1250591a7d815c1b4a 100644 (file)
@@ -31,7 +31,7 @@ ospf_proto:
  | ospf_proto ospf_area ';'
  ;
 
-ospf_area: AREA idval ';' {
+ospf_area: AREA idval {
     ((struct ospf_config *)this_proto)->area = $2;
  }
  ;
index fbbc68d7e422730b038967fb13e7f8a8a3177875..683ee66210b9365740f6eab8fc94311ef3d943de 100644 (file)
 int
 ospf_rx_hook(sock *sk, int size)
 {
-  DBG(" RX_Hook_Called.\n");
+  DBG(" OSPF: RX_Hook called on interface ");
+  DBG(sk->iface->name);
+  DBG(".\n");
   return(1);
 }
 
 void
 ospf_tx_hook(sock *sk)
 {
-  DBG(" TX_Hook_Called.\n");
+  DBG(" OSPF: TX_Hook called on interface ");
+  DBG(sk->iface->name);
+  DBG(".\n");
 }
 
 void
 ospf_err_hook(sock *sk, int err)
 {
-  DBG(" Err_Hook_Called.\n");
+  DBG(" OSPF: Err_Hook called on interface ");
+  DBG(sk->iface->name);
+  DBG(".\n");
 }
 
 /* This will change ! */
@@ -48,7 +54,7 @@ ospf_open_socket(struct proto *p, struct ospf_iface *ifa)
 
   /* No NBMA networks now */
 
-  if(ifa->iface->flags & IF_MULTICAST)
+  if(((struct iface *)ifa)->flags & IF_MULTICAST)
   {
     mcsk=sk_new(p->pool);
     mcsk->type=SK_IP_MC;
@@ -59,8 +65,8 @@ ospf_open_socket(struct proto *p, struct ospf_iface *ifa)
     mcsk->rx_hook=ospf_rx_hook;
     mcsk->tx_hook=ospf_tx_hook;
     mcsk->err_hook=ospf_err_hook;
-    mcsk->iface=ifa->iface;
-    mcsk->rbsize=ifa->iface->mtu;
+    mcsk->iface=(struct iface *)ifa;
+    mcsk->rbsize=((struct iface *)ifa)->mtu;
     if(sk_open(mcsk)!=0)
     {
       DBG(" OSPF: SK_OPEN: failed\n");
@@ -87,7 +93,7 @@ is_good_iface(struct proto *p, struct iface *iface)
 }
 
 /* Of course, it's NOT true now */
-byte
+int
 ospf_iface_clasify(struct iface *ifa)
 {
   if((ifa->flags & (IF_MULTIACCESS|IF_MULTICAST))==
@@ -116,13 +122,14 @@ ospf_iface_default(struct ospf_iface *ifa)
   ifa->drid=0;
   ifa->bdrip=ipa_from_u32(0x00000000);
   ifa->bdrid=0;
-  ifa->type=ospf_iface_clasify(ifa->iface);
+  ifa->type=ospf_iface_clasify((struct iface *)ifa);
 }
 
 void
 ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface *old)
 {
-  struct ospf_iface *ospf_iface;
+  struct ospf_iface *ifa;
+  sock *mcsk;
 
   struct ospf_config *c;
   c=(struct ospf_config *)(p->cf);
@@ -133,15 +140,16 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface
 
   if(((flags & IF_CHANGE_UP)==IF_CHANGE_UP) && is_good_iface(p, new))
   {
+    debug(" OSPF: using interface %s.\n", new->name);
     /* Latter I'll use config - this is incorrect */
-    ospf_iface=mb_alloc(p->pool, sizeof(struct ospf_iface));
-    ospf_iface->iface=new;
-    add_tail(&c->iface_list, NODE ospf_iface);
-    ospf_iface_default(ospf_iface);
-    init_list(&(ospf_iface->sk_list));
-    if(ospf_open_socket(p, ospf_iface)!=NULL)
+    ifa=mb_alloc(p->pool, sizeof(struct ospf_iface));
+    bcopy(new, ifa, sizeof(struct ospf_iface));
+    add_tail(&c->iface_list, NODE ifa);
+    ospf_iface_default(ifa);
+    init_list(&(ifa->sk_list));
+    if((mcsk=ospf_open_socket(p, ifa))!=NULL)
     {
-      add_tail(&(ospf_iface->sk_list),NODE ospf_iface);
+      add_tail(&(ifa->sk_list),NODE mcsk);
     }
   }
 }
index 2965d8e77e4be119d3a638e941e20d57cc30628c..b4809b77aeed2ed7f7db7764471255543e274d08 100644 (file)
@@ -26,9 +26,8 @@ struct ospf_config {
 };
 
 struct ospf_iface {
-  node n;
+  struct iface i;      /* Nest's iface */
   list sk_list;                /* List of active sockets */
-  struct iface *iface; /* Nest's iface */
   u32 area;            /* OSPF Area */
   u16 cost;            /* Cost of iface */
   int rxmtint;         /* number of seconds between LSA retransmissions */
@@ -45,7 +44,7 @@ struct ospf_iface {
   u32 drid;
   ip_addr bdrip;       /* Backup DR */
   u32 bdrid;
-  int type;
+  int type;            /* OSPF view of type */
 #define OSPF_IM_BROADCAST 0
 #define OSPF_IM_NBMA 1
 #define OSPF_IM_PTP 2