diff options
author | Ondrej Filip <feela@network.cz> | 1999-04-13 19:27:44 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 1999-04-13 19:27:44 +0000 |
commit | 55e7732a5a5fe47752eafe6024ba473bd7959e45 (patch) | |
tree | bb944e41c1ea3689ec17038e160833a5cb0e1f8e | |
parent | aec76c6e8e5702144522f0061bc102d26e10b97c (diff) |
Change in ospf_iface. (My bad understanding of lists manipulation.)
-rw-r--r-- | proto/ospf/config.Y | 2 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 40 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 5 |
3 files changed, 27 insertions, 20 deletions
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 9840def0..73dcd76e 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -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; } ; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index fbbc68d7..683ee662 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -24,20 +24,26 @@ 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); } } } diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 2965d8e7..b4809b77 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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 |