summaryrefslogtreecommitdiff
path: root/proto/ospf/iface.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-04-17 21:10:40 +0000
committerOndrej Filip <feela@network.cz>2000-04-17 21:10:40 +0000
commit2a0925948de20bd391d2c27a08ffdf2b4350e5c3 (patch)
tree294db6b67d73b03ef8da95ff7dd819e8e9d7cab1 /proto/ospf/iface.c
parent38130b863ffcab6b45484e4e5f1eca1dd933bb1a (diff)
Listening on AllDRouters for DR and BACKUP added.
Diffstat (limited to 'proto/ospf/iface.c')
-rw-r--r--proto/ospf/iface.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 2d53cf5f..8ba198f1 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)
{