summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-04-17 23:10:40 +0200
committerOndrej Filip <feela@network.cz>2000-04-17 23:10:40 +0200
commit2a0925948de20bd391d2c27a08ffdf2b4350e5c3 (patch)
tree294db6b67d73b03ef8da95ff7dd819e8e9d7cab1 /proto
parent38130b863ffcab6b45484e4e5f1eca1dd933bb1a (diff)
downloadbird-2a0925948de20bd391d2c27a08ffdf2b4350e5c3.tar
bird-2a0925948de20bd391d2c27a08ffdf2b4350e5c3.zip
Listening on AllDRouters for DR and BACKUP added.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/iface.c34
-rw-r--r--proto/ospf/ospf.h1
2 files changed, 34 insertions, 1 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 2d53cf5..8ba198f 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -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)
{
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index e3a42f5..6bcaef3 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -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 */